var onairList =
{	
	realTimeIssueHTML : new Array(),
	nowCnt : 0,
	maxCnt : 10,
	listId : null ,
	movingCnt : 0,
	listObj : null,
	init : function (tg)
	{
		this.listId = tg;
		var t = setTimeout("onairList.seting()", 2000);
	},
	seting : function ()
	{
		var liObj = this.listId.getElementsByTagName("LI");
		this.maxCnt = liObj.length;
		this.listId.innerHTML = this.listId.innerHTML + "<li>" + liObj[0].innerHTML + "<li>";
		if(this.maxCnt>0)
		{
			this.show();
		}
	},
	show : function ()
	{
		if (this.maxCnt == this.nowCnt )
		{
			this.nowCnt = 0;
			this.movingCnt = 0;
			this.listId.style.top = "0px";
		}
		this.nowCnt++;
		var t = setTimeout("onairList.motion()", 4000);
	},
	motion : function ()
	{
		this.movingCnt = this.movingCnt + 4;
		if (this.movingCnt > (16 * this.nowCnt))
		{
			this.movingCnt = 16 * this.nowCnt;
			this.show();
		}else
		{
			this.listId.style.top= "-" + this.movingCnt + "px";
			var t = setTimeout("onairList.motion()", 100);
		}			
	}	
};

var rollingList = {
	visibleListCnt:null,
	totalSetCnt:null,
	selectedSetIndex:null,
	seriesList:null,
	centralObj:null,
	list:null,
	init : function(params) {
		this.centralObj = params.centralObj;
		this.list = params.list;
		this.visibleListCnt = params.visibleListCnt;
		this.nextBtnObj = params.nextBtnObj;
		this.prevBtnObj = params.prevBtnObj;
		this.selectedSetIndex=0;
		this.totalSetCnt = parseInt(((this.list.length -1) / this.visibleListCnt)+1, 10);		
				
		var childs = this.centralObj.childNodes;
		var childLength = childs.length;
	
		for(i=0; i<childLength; i++) {
			if(childs[i].nodeType === 1) {
				if(childs[i].className === this.prevBtnObj || childs[i].id === this.prevBtnObj) {
					childs[i].onclick = function() {
						rollingList.show(1);			
					};
				} else if(childs[i].className === this.nextBtnObj || childs[i].id === this.nextBtnObj) {
					childs[i].onclick = function() {
						rollingList.show(-1);
					};					
				}
			}				
		}			
	},
	show : function() {
		var direction = arguments[0] || 1;
		this.selectedSetIndex = (this.selectedSetIndex + this.totalSetCnt + direction) % this.totalSetCnt;
		var first = this.selectedSetIndex * this.visibleListCnt;
		var last = first + this.visibleListCnt ;
	
		for(i=0; i<this.list.length; i++){
			if (i >= first && i < last) {
				domHelper.cssjs('remove', this.list[i], 'hidden');
			}
			else {
				domHelper.cssjs('add', this.list[i], 'hidden');
			}			
		}
	}
};

