// JavaScript Document

var xmlHttp=null;
function Trim(str)
{
	//trim leding spaces
	while(true)
	{
		if(str.charAt(0) == ' ')
			str = str.substr(1);
		else
			break;
	}
	
	//trim trailing spaces
	while(true)
	{
		if(str.charAt(str.length-1) == ' ')
			str = str.substr(0,str.length-1);
		else
			break;
	}
	return(str);	
}

function GetXmlHttpObject()
{
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}

function begin()
{
//	fun_showimgbg();
//	fun_lang(1);
//	fn_load();
	//for (k=1;k<=5;k++)
	//{
	//	doallhidden(k);
	//}
	init();
}
function fun_lang(val)
{
	
	var i,lang,path,pathar,patheng,ceng,carb;
	path=window.location.pathname;
	if (path.substr(1,8)=="beta/ar/")
	{
		//patheng=path.replace("/ar/","/");
		window.location.href="http://www.himalayaherbals.com/";
	}
	else
	{
		//pathar=path.replace("beta/","beta/ar/");
		window.location.href="http://www.himalayaherbals.com/ar";
	}
	i=1;
	while(i<3)
	{
		lang="lang"+i;
		if (val==1 && i==1)
		{
			document.getElementById(lang).style.backgroundColor="#006666";
			document.getElementById(lang).style.color="#ffffff";
		}
		else if (val==2 && i==2)
		{
			document.getElementById(lang).style.backgroundColor="#ff6600";
			document.getElementById(lang).style.color="#ffffff";
		}
		else if (i!=val)
		{
			document.getElementById(lang).style.backgroundColor="#ffffff";
			document.getElementById(lang).style.color="#006666";
		}
		i++;
	}
}
function init()
{
	var path = window.location.pathname.split("/");
	var imgname=path[parseInt(path.length)-1].replace(".htm",".jpg");	
	document.getElementById("region").style.backgroundImage="url('../../images/bgimg/"+Trim(imgname)+"')";
	document.getElementById("region").style.backgroundPosition="bottom center";
	document.getElementById("region").style.backgroundRepeat="no-repeat";
}

function fun_ahdivshow(v,l)
{
	for (k=1;k<=l;k++)
	{
		var div="#div"+k;
		if (v==k)
		{$(div).fadeIn(1500);}
		else
		{$(div).fadeOut(1000);}	
	}	
}

