/* 
========================
版本号：DFP&HPA2011
文件名：tab.js
作  者：王锦龙
========================
*/
/*
EASY TABS 1.2 Produced and Copyright by Koller Juergen
www.kollermedia.at | www.austria-media.at
Need Help? http:/www.kollermedia.at/archive/2007/07/10/easy-tabs-12-now-with-autochange
You can use this Script for private and commercial Projects, but just leave the two credit lines, thank you.
*/




//EASY TABS 1.2 - tab SETTINGS
//Set the id names of your tabsnss (without a number at the end)
var tabsns_idname = new Array("tabsns","tabgame", "linkthree")
//Set the id names of your tabcontentareas (without a number at the end)
var tabcontent_idname = new Array("tabsnsinfo","tabgameinfo", "tabgroup") 
//Set the number of your tabs in each tab
var tabcount = new Array("3","3","3")
//Set the Tabs wich should load at start (In this Example:tab 1 -> Tab 2 visible on load, tab 2 -> Tab 5 visible on load , tab 3 -> Tab 1 visible on load)
var loadtabs = new Array("1","1","3")  
//Set the Number of the tab which should autochange (if you dont't want to have a change tab set it to 0)
var autochangetab = 1;
//the speed in seconds when the tabs should change
var changespeed = 3;
//should the autochange stop if the user hover over a tab from the autochangetab? 0=no 1=yes
var stoponhover = 1;
//END tab SETTINGS


/*Swich EasyTabs Functions - no need to edit something here*/
function easytabs(tabnr, active) {
	if (tabnr == autochangetab){
		currenttab=active;
	}if ((tabnr == autochangetab)&&(stoponhover==1)) {stop_autochange()}
	else if ((tabnr == autochangetab)&&(stoponhover==0))  {
		counter=0;
	} 
	tabnr = tabnr-1;
	for (j=1; j <= tabcount[tabnr]; j++){
		document.getElementById(tabsns_idname[tabnr]+j).className='tab'+j;
		document.getElementById(tabcontent_idname[tabnr]+j).style.display = 'none';
	}
	document.getElementById(tabsns_idname[tabnr]+active).className='tab'+active+' tabactive';
	document.getElementById(tabcontent_idname[tabnr]+active).style.display = 'block';
}
	var timer; 
	counter=0; 
	var totaltabs=tabcount[autochangetab-1];
	var currenttab=loadtabs[autochangetab-1];
	function start_autochange(){
		counter=counter+1;
		timer=setTimeout("start_autochange()",1000);
		if (counter == changespeed+1) {
			currenttab++;
			if (currenttab>totaltabs) {currenttab=1}
			easytabs(autochangetab,currenttab);
			restart_autochange();
		}
	}
	function restart_autochange(){
		clearTimeout(timer);
		counter=0;start_autochange();
	}
	function stop_autochange(){
		clearTimeout(timer);
		counter=0;
	}

/*    window.onload=function(){
        var tabcount=loadtabs.length; 
		var a = 0; 
		var b = 1; 
		do {easytabs(b, loadtabs[a]);  a++; b++;
		}while (b<=tabcount);
        if (autochangetab!=0){start_autochange();}
    }*/
	
	    function tabRun(){
        var tabcount=loadtabs.length; 
		var a = 0; 
		var b = 1; 
		do {easytabs(b, loadtabs[a]);  a++; b++;
		}while (b<=tabcount);
        if (autochangetab!=0){start_autochange();}
    }
	function ccit_changeTab(tabcount,activeTabID,divID,TabID)
	{
		for(i=1;i<=tabcount;i++)
		{
			document.getElementById(TabID+i).className='tab'+i;
			document.getElementById(divID+i).style.display = 'none';
		}
		document.getElementById(TabID+activeTabID).className='tab'+activeTabID+' tabactive';
		document.getElementById(divID+activeTabID).style.display = 'block';
	}
	

