window.onload=function()
{
	var fadeOut = {type: 'opacity', from: 100, to: 0, step: -10};
	var fadeIn = {type: 'opacity', from: 0, to: 100, step: 10};
	
	// start the banner animations
    document.getElementById("tab1").className = "tab current"
    document.getElementById("tab2").className = "tab next"
    document.getElementById("tab3").className = "tab other"
	tab2();
	
	// used to see when a tab button is pressed
	var pause = 0;
	
	// used to see which tab button was pressed
	var tab;
	
	function tabbutton1()
	{
		tabb2 = document.getElementById("tabbutton2");
		tabb2.className = tabb2.className.replace(" active", "");
		
		tabb3 = document.getElementById("tabbutton3");
		tabb3.className = tabb3.className.replace(" active", "");

		document.getElementById("tabbutton1").className += " active";
	}
	
	function tabbutton2()
	{
		tabb1 = document.getElementById("tabbutton1");
		tabb1.className = tabb1.className.replace(" active", "");
		
		tabb3 = document.getElementById("tabbutton3");
		tabb3.className = tabb3.className.replace(" active", "");
		
		document.getElementById("tabbutton2").className += " active";		
	}
	
	function tabbutton3()
	{
		tabb2 = document.getElementById("tabbutton2");
		tabb2.className = tabb2.className.replace(" active", "");
		
		tabb1 = document.getElementById("tabbutton1");
		tabb1.className = tabb1.className.replace(" active", "");
		
		document.getElementById("tabbutton3").className += " active";	
	}
	
	function tab1end()
	{
		/*
        document.getElementById("tab1").style.zIndex = 19000;
		document.getElementById("tab2").style.zIndex = 20000;
		document.getElementById("tab3").style.zIndex = 1;
        */
        document.getElementById("tab1").className = "tab current"
        document.getElementById("tab2").className = "tab next"
        document.getElementById("tab3").className = "tab other"
	}
	
	function tab2end()
	{
		/*
		document.getElementById("tab1").style.zIndex = 1;
		document.getElementById("tab2").style.zIndex = 19000;
		document.getElementById("tab3").style.zIndex = 20000;
        */
        document.getElementById("tab1").className = "tab other"
        document.getElementById("tab2").className = "tab current"
        document.getElementById("tab3").className = "tab next"
	}
	
	function tab3end()
	{
		/*
		document.getElementById("tab1").style.zIndex = 20000;
		document.getElementById("tab2").style.zIndex = 1;
		document.getElementById("tab3").style.zIndex = 19000;
        */
        document.getElementById("tab1").className = "tab next"
        document.getElementById("tab2").className = "tab other"
        document.getElementById("tab3").className = "tab current"
	}
	
	function tab1()
	{
		$fx("#tab1").fxHold(4000).fxAdd({type: 'opacity', from: 0, to: 100, step: 10, onstart: tabbutton1, onfinish: tab1end}).fxRun(tab2, 1);
		$fx("#tab3").fxHold(4000).fxAdd(fadeOut).fxRun(null, 1);
	}
	
	function tab2()
	{		
		$fx("#tab2").fxHold(4000).fxAdd({type: 'opacity', from: 0, to: 100, step: 10, onstart: tabbutton2, onfinish: tab2end}).fxRun(tab3, 1);
		$fx("#tab1").fxHold(4000).fxAdd(fadeOut).fxRun(null, 1);
	}
	
	function tab3()
	{
		$fx("#tab3").fxHold(4000).fxAdd({type: 'opacity', from: 0, to: 100, step: 10, onstart: tabbutton3, onfinish: tab3end}).fxRun(tab1, 1);	
		$fx("#tab2").fxHold(4000).fxAdd(fadeOut).fxRun(null, 1);
	}
}

function RefreshHomepage(docroot)
{
	var show_ctrl = document.getElementById("RefreshHomepage").value;
	location.href = docroot + "home/" + show_ctrl;		
}


