var tabcounter = 0;

function CaptureEnter(SubmitID) 
{
	if (event.keyCode == 13) 
	{
		document.getElementById(SubmitID).focus();
	}
}




  



//Homepage Tab Switcher
function switch1(div) 
{
	var option= new Array(3);
	var placeholders = new Array(3);
	option[0] = 'one';
	option[1] = 'two';
	option[2] = 'three';
	
	
	for(var i=0; i<option.length; i++) 
	{
		if (document.getElementById(option[i])) 
		{
			obj=document.getElementById(option[i]);
			obj.style.display=(option[i]==div)? "block" : "none";
		}
	}
	clearTimeout(thetimer);
}

//Homepage Tab Switcher
//We created a separate function because when we click the button we have to stop the auto load.
function Autoswitch1(div) 
{
	var option= new Array(3);
	var image;
	option[0] = 'one';
	option[1] = 'two';
	option[2] = 'three';
	
	for(var i=0; i<option.length; i++) 
	{
		if (document.getElementById(option[i])) 
		{
			obj=document.getElementById(option[i]);
			if (option[i]==div)
			{
				obj.style.display = "block"; 
				image = (i + 1);
				switchTabImg('img' + image.toString());
			}
			else
				obj.style.display = "none";
			
		}
	}
}

//Determines which object to display
function AutoSwitchDiv()
{

	var obj;
	tabcounter = tabcounter + 1;
	if (tabcounter > 2)
		tabcounter = 0;
	
	switch(tabcounter)
	{
		case 0:
			obj = 'one';
			break;
		case 1:
			obj = 'two';
			break;
		case 2:
			obj = 'three';
			break;
		default:
			obj = 'one';
	}
	Autoswitch1(obj);
	thetimer = setTimeout("AutoSwitchDiv()", 5000);
}

//Set the time and the function to control the object change
window.onload=function () 
{

	thetimer = setTimeout("AutoSwitchDiv()", 5000);
}


function switchTabImg(i){

var i;
var imgURL1="/sbd/imagesnet/publicsite/tabs/home_tab_";
var imgURL2="_off.jpg";
var web="web";
var com="com";
var book="book";
var img1="/sbd/imagesnet/publicsite/tabs/home_tab_web_on.jpg";
var img2="/sbd/imagesnet/publicsite/tabs/home_tab_com_on.jpg";
var img3="/sbd/imagesnet/publicsite/tabs/home_tab_book_on.jpg";





switch(i){
case "img1":
document.getElementById("tab_web1").src=img1;
document.getElementById("tab_web2").src=imgURL1+com+imgURL2;
document.getElementById("tab_web3").src=imgURL1+book+imgURL2;
break;
case "img2":
document.getElementById("tab_web2").src=img2;
document.getElementById("tab_web1").src=imgURL1+web+imgURL2;
document.getElementById("tab_web3").src=imgURL1+book+imgURL2;break;
case "img3":
document.getElementById("tab_web1").src=imgURL1+web+imgURL2;
document.getElementById("tab_web2").src=imgURL1+com+imgURL2;
document.getElementById("tab_web3").src=img3;break;


}
}
