function showhome(type)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Your browser does not support AJAX..")
		return;
	}
	if(type==1)
	{
		var url="welcome_v.html"
		removevactive();		
	}
	else
	{
		var url="welcome_f.html"
		removefactive();
	}
	url=url+"?sid="+Math.random()
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4)
		{			
			document.getElementById("maincontent").innerHTML=xmlHttp.responseText
		}	
	}
	xmlHttp.open("get",url,true)
	xmlHttp.send(null)
}
function showlink(linkUrl,obj,type)
{

	if(type==1)
	{		
		removevactive();		
	}
	else
	{		
		removefactive();		
	}
	document.getElementById("submenu1").style.display="none";	
	document.getElementById("submenu2").style.display="none";
	obj.className=obj.className+"_active";
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Your browser does not support AJAX..")
		return;
	}

	var url=linkUrl	
	url=url+"?sid="+Math.random()
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4)
		{			
			document.getElementById("maincontent").innerHTML=xmlHttp.responseText
		}	
	}
	xmlHttp.open("get",url,true)
	xmlHttp.send(null)
}
function showSublink(linkUrl,obj,type)
{

	if(type==1)
	{		
		removevactive();		
	}
	else
	{		
		removefactive();		
	}	
	obj.className=obj.className+"_active";
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Your browser does not support AJAX..")
		return;
	}

	var url=linkUrl	
	url=url+"?sid="+Math.random()
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4)
		{			
			document.getElementById("maincontent").innerHTML=xmlHttp.responseText
		}	
	}
	xmlHttp.open("get",url,true)
	xmlHttp.send(null)
}
function removefactive()
{
	for(i=1;i<=13;i++)
	{
		if(i!=15)
		{
			changeobj=document.getElementById("link"+i)			
			if(changeobj.className.indexOf("_")>-1)
			{			
				changeobj.className=changeobj.className.substring(0,changeobj.className.indexOf("_"));						
			}
		}
	}
	
}
function removevactive()
{	
	for(i=1;i<=16;i++)
	{
		if(i!=3 && i!=5 && i!=6  && i!=8 && i!=9 && i!=11 && i!=12)
		{			
			changeobj=document.getElementById("link"+i)				
			if(changeobj.className.indexOf("_")>-1)
			{			
				changeobj.className=changeobj.className.substring(0,changeobj.className.indexOf("_"));						
			}
		}
	}
}
function GetXmlHttpObject()
{
	 var xmlhttp=false;
	/* running locally on IE5.5, IE6, IE7 */                                              ; /*@cc_on
	if(location.protocol=="file:"){
	if(!xmlhttp)try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); }catch(e){xmlhttp=false;}
	if(!xmlhttp)try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){xmlhttp=false;}
	}                                                                                ; @cc_off @*/
	/* IE7, Firefox, Safari, Opera...  */
	if(!xmlhttp)try{ xmlhttp=new XMLHttpRequest(); }catch(e){xmlhttp=false;}
	/* IE6 */
	if(typeof ActiveXObject != "undefined"){
	if(!xmlhttp)try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); }catch(e){xmlhttp=false;}
	if(!xmlhttp)try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){xmlhttp=false;}
	}
	/* IceBrowser */
	if(!xmlhttp)try{ xmlhttp=createRequest(); }catch(e){xmlhttp=false;}
	return xmlhttp;
}
function ChangeRev(aId)
{
		document.getElementById("Div_Rv_Art").style.display="none";
		document.getElementById("Div_Rv_Cus").style.display="none";
		document.getElementById("Rv_Art").className="heading3";
		document.getElementById("Rv_Cus").className="heading3";		
		document.getElementById(aId).className="heading3_active";		
		document.getElementById("Div_"+aId).style.display="block";
}
function OpenSubMenu(submenuID)
{
	if(submenuID==1)
	{
		document.getElementById("submenu2").style.display="none";
	}
	else
	{
		document.getElementById("submenu1").style.display="none";
	}
	if(document.getElementById("submenu"+submenuID).style.display=="none")
	{
		document.getElementById("submenu"+submenuID).style.display="block";
	}
	else
	{
		document.getElementById("submenu"+submenuID).style.display="none";
	}
}
function URLParameter(name)
{ 
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
	var regexS = "[\\?&]"+name+"=([^&#]*)";  
	var regex = new RegExp( regexS );  
	var results = regex.exec( window.location.href );  
	if( results == null )    
	return "";  
	else    
	return results[1];
}
function login()
{
	var errMsg="";	
	if(document.getElementById("TxtLogin").value.replace(/ /g,"")=="")
	{
		errMsg=errMsg+" - Login ID \n";
	}
	if(document.getElementById("TxtPwd").value.replace(/ /g,"")=="")
	{
		errMsg=errMsg+" - Password \n";
	}
	if(errMsg!="")
	{
		alert("Please enter the following fields \n"+errMsg);
		return;
	}
	else
	{
		xmlHttp=GetXmlHttpObject();
		if(xmlHttp==null)
		{
			alert("Your browser does not support AJAX..")
			return;
		}			
		url="authenticate.php?param="+document.getElementById("TxtLogin").value+"&param1="+document.getElementById("TxtPwd").value+"&sid="+Math.random()
		xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4)
			{					
				if(xmlHttp.responseText==0)
				{
					alert("Sorry login failed");
				}
				else if(xmlHttp.responseText==1)
				{
					window.location="myhome.php";					
				}
			}	
		}
		xmlHttp.open("get",url,true);
		xmlHttp.send(null);		
	}
}
function OpenChangePwd()
{	
	document.getElementById("passwordchange").style.display="block";	
}
function resetPwd()
{
	var oldPwd;
	var newPwd;
	var confnewPwd;
	oldPwd=document.FrmChangePwd.TxtOldPwd;
	newPwd=document.FrmChangePwd.TxtNewPwd;
	confnewPwd=document.FrmChangePwd.TxtConfNewPwd;
	if(oldPwd.value.replace(/ /g,"")=="")
	{
		alert("Sorry please enter your old password");
		oldPwd.focus();
		return;
	}
	else if(newPwd.value.replace(/ /g,"")=="")
	{
		alert("Sorry please enter new password");
		newPwd.focus();
		return;
	}
	else if(confnewPwd.value.replace(/ /g,"")=="")
	{
		alert("Sorry please enter new password");
		confnewPwd.focus();
		return;
	}
	else if(newPwd.value!=confnewPwd.value)
	{
		alert("Sorry Confirm Password does not match");
		confnewPwd.focus();
		return;
	}
	else
	{
		xmlHttp=GetXmlHttpObject();
		if(xmlHttp==null)
		{
			alert("Your browser does not support AJAX..")
			return;
		}			
		url="getoldpwd.php?sid="+Math.random()
		xmlHttp.onreadystatechange=function()
		{
			if (xmlHttp.readyState==4)
			{			
				if(oldPwd.value!=xmlHttp.responseText)
				{
					alert("Sorry your password could not be changed");
					oldPwd.focus();
					return;
				}
				else
				{
					document.FrmChangePwd.action="editpwd.php";
					document.FrmChangePwd.submit();				
				}
			}	
		}
		xmlHttp.open("get",url,true);
		xmlHttp.send(null);	
	}
}
function logOut()
{
	window.location="logout.php";
}