// JavaScript Document
//Function to change tab and div text of top tabs//
var toptabtime;
var bottomtabtime;
function stopswap()
{
	clearTimeout(toptabtime);
}
function stopbottomswap()
{
	clearTimeout(bottomtabtime);
}
function changeBG(selectedObj)
{
	
	var tablist = document.getElementById("top_tabs").getElementsByTagName("li");
	var tabcontainerlist = document.getElementById("tab_text_container").getElementsByTagName("div");
	for(i=0;i<tablist.length;i++)
	{
				tablist[i].className="";
				tabcontainerlist[i].className="hide"
	}
	selectedObj.className="selected";
	for(i=0;i<tablist.length;i++)
	{
		if(tablist[i].className=="selected")
		{
			
	       tabcontainerlist[i].className="sty_div_topm show"
		}
	}
}


//Function to change tab and div text of bottom tabs//
function changebottomBG(selectedObj)
{
	
	var tablist = document.getElementById("bottom_tabs").getElementsByTagName("li");
	var tabcontainerlist = document.getElementById("bottomtab_text_container").getElementsByTagName("div");
	for(i=0;i<tablist.length;i++)
	{
				tablist[i].className="";
				tabcontainerlist[i].className="hide"
	}
	selectedObj.className="selected";
	for(i=0;i<tablist.length;i++)
	{
		if(tablist[i].className=="selected")
		{
			
	       tabcontainerlist[i].className="sty_div_bottomm show"
		}
	}
}

//Function to auto change tab and div text of top tabs//
var count=-1;
function swapdivs()
{
	var tablist = document.getElementById("top_tabs").getElementsByTagName("li");
	if(count<5)
	count=count+1;
	else
	count=0;
	changeBG(tablist[count]);
	toptabtime=setTimeout("swapdivs()",5000);
}

//Function to auto change tab and div text of bottom tabs//
var countbottom=-1;
function swapbottomdivs()
{
	var tablist = document.getElementById("bottom_tabs").getElementsByTagName("li");
	if(countbottom<2)
	countbottom=countbottom+1;
	else
	countbottom=0;
	changebottomBG(tablist[countbottom]);
	bottomtabtime=setTimeout("swapbottomdivs()",5000);
}
//function to swich between drop down websites

function switchsite()
{
	
	var sitelist = document.getElementById("selectsite").options;
	
	
		if (sitelist[0].selected)
		  { var url ="http://www.rsystems.com";
			window.open=(url,"_blank")
		  }
			
			else 
			{
			var url ="http://corporate.india.rsystems.com";
			window.open=(url,"_blank");
			}
}
