// JavaScript Document
function AllTrim(sStr)
{ 
	while (sStr.substring(0,1) == ' ')
	{
		sStr = sStr.substring(1, sStr.length);
	}
	while (sStr.substring(sStr.length-1, sStr.length) == ' ')
	{
		sStr = sStr.substring(0,sStr.length-1);
	}
	return sStr;
}
function login_page()
{
	var email;
		email=document.getElementById("login_name").value;
	if(email=="")
	{
	alert("Please enter your login name");
	document.getElementById("login_name").focus();
	return false;
	}
	if (emailcheck(email)==false)
	{
		document.getElementById("login_name").focus();
		return false;
	}
	if(document.getElementById("pwd").value=="")
	{
	alert("Please enter your password");
	document.getElementById("pwd").focus();
	return false;
	}
	return true;
}

function forgotpassword_page()
{
	
    var email;
		email=document.getElementById("login_name").value;
	if(email=="")
	{
	alert("Please enter your login name");
	document.getElementById("login_name").focus();
	return false;
	}
	if (emailcheck(email)==false)
	{
		document.getElementById("login_name").focus();
		return false;
	}
	if(document.getElementById("SecQ").value=="")
	{
	alert("Please select security question");
	document.getElementById("SecQ").focus();
	return false;
	}
	if(document.getElementById("ans").value=="")
	{
	alert("Please enter your answer");
	document.getElementById("ans").focus();
	return false;
	}
	return true;
}

function register_page()
{
	var email;
		email=document.getElementById("email").value;
	var cemail;
	cemail=document.getElementById("confemail").value;
	
	if(document.getElementById("firstname").value=="")
	{
	alert("Please enter your name");
	document.getElementById("firstname").focus();
	return false;
	}
	
	if(document.getElementById("city").value=="")
	{
	alert("Please enter your city");
	document.getElementById("city").focus();
	return false;
	}
	if(document.getElementById("state").value=="")
	{
	alert("Please enter your province/state");
	document.getElementById("state").focus();
	return false;
	}
	if(document.getElementById("country").value=="")
	{
	alert("Please select your country");
	document.getElementById("country").focus();
	return false;
	}
	if(email=="")
	{
	alert("Please enter your email");
	document.getElementById("email").focus();
	return false;
	}
	if (emailcheck(email)==false)
		{
			document.getElementById("email").focus();
			return false;
		}
		if(cemail=="")
	{
	alert("Please enter your confirm email");
	document.getElementById("confemail").focus();
	return false;
	}
		if(cemail!=email)
	{
	alert("Confirm email should be same as email");
	document.getElementById("confemail").focus();
	return false;
	}
	
		if(document.getElementById("pass").value=="")
	{
	alert("Please enter your password");
	document.getElementById("pass").focus();
	return false;
	}
	
		if(document.getElementById("cpass").value!=document.getElementById("pass").value)
	{
	alert("Confirm password should be same as password");
	document.getElementById("cpass").focus();
	return false;
	}
	
	if(document.getElementById("SecQ").value=="")
	{
	alert("Please select security question");
	document.getElementById("SecQ").focus();
	return false;
	}
	
	if(document.getElementById("ans").value=="")
	{
	alert("Please enter answer for the question");
	document.getElementById("ans").focus();
	return false;
	}
	
	if(document.getElementById("check1").checked==false)
	{
	alert("Please read and accept the terms and condition first");
	document.getElementById("check1").focus();
	return false;
	}

	return true;
}
function emailcheck(str) 
{

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ext=str.substr(str.indexOf(".")+1,str.length);
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
	
		return true;

}
function changepassword_page()
{
		
	if(document.getElementById("pass").value=="")
	{
	alert("Please enter your password");
	document.getElementById("pass").focus();
	return false;
	}
	
		if(document.getElementById("cpass").value!=document.getElementById("pass").value)
	{
	alert("Confirm password should be same as password");
	document.getElementById("cpass").focus();
	return false;
	}
	return true;
}
function changeprofile_page()
{
		
	if(document.getElementById("firstname").value=="")
	{
	alert("Please enter your name");
	document.getElementById("firstname").focus();
	return false;
	}
	
	if(document.getElementById("city").value=="")
	{
	alert("Please enter your city");
	document.getElementById("city").focus();
	return false;
	}
	if(document.getElementById("state").value=="")
	{
	alert("Please enter your province/state");
	document.getElementById("state").focus();
	return false;
	}
	
	
	if(document.getElementById("zipcode").value=="")
	{
	alert("Please select your Postal/Zip");
	document.getElementById("zipcode").focus();
	return false;
	}
	
	if(document.getElementById("country").value=="")
	{
	alert("Please select your country");
	document.getElementById("country").focus();
	return false;
	}
	
	
	if(document.getElementById("SecQ").value=="")
	{
	alert("Please select security question");
	document.getElementById("SecQ").focus();
	return false;
	}
	
	if(document.getElementById("ans").value=="")
	{
	alert("Please enter answer for the question");
	document.getElementById("ans").focus();
	return false;
	}
	
	
	return true;
}
function hor_image_h1()
{
str=document.getElementById("image_arrow_h1").alt;
if (str=="open")
{
document.getElementById("image_arrow_h1").src="style/images/arrow2.gif";
document.getElementById("div_h1").style.display="block";
document.getElementById("image_arrow_h1").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("h_session").value=="sessionin")
{
document.getElementById("image_arrow_h1").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_h1").src="style/images/arrow.jpg";
}
document.getElementById("div_h1").style.display="none";
document.getElementById("image_arrow_h1").alt="open";
return false;

}
}
function hor_image_h2()
{
str=document.getElementById("image_arrow_h2").alt;
if (str=="open")
{
document.getElementById("image_arrow_h2").src="style/images/arrow2.gif";
document.getElementById("div_h2").style.display="block";
document.getElementById("image_arrow_h2").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("c_session").value=="sessionin")
{
alert(str2);
document.getElementById("image_arrow_h2").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_h2").src="style/images/arrow.jpg";
}
document.getElementById("div_h2").style.display="none";
document.getElementById("image_arrow_h2").alt="open";
return false;

}
}
function hor_image_h3()
{
str=document.getElementById("image_arrow_h3").alt;
if (str=="open")
{
document.getElementById("image_arrow_h3").src="style/images/arrow2.gif";
document.getElementById("div_h3").style.display="block";
document.getElementById("image_arrow_h3").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("s_session").value=="sessionin")
{
document.getElementById("image_arrow_h3").src="style/images/arrowjpg";
}
else
{
document.getElementById("image_arrow_h3").src="style/images/arrow.jpg";
}
document.getElementById("div_h3").style.display="none";
document.getElementById("image_arrow_h3").alt="open";
return false;

}
}
function hor_image_h4()
{
str=document.getElementById("image_arrow_h4").alt;
if (str=="open")
{
document.getElementById("image_arrow_h4").src="style/images/arrow2.gif";
document.getElementById("div_h4").style.display="block";
document.getElementById("image_arrow_h4").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("p_session").value=="sessionin")
{
document.getElementById("image_arrow_h4").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_h4").src="style/images/arrow.jpg";
}
document.getElementById("div_h4").style.display="none";
document.getElementById("image_arrow_h4").alt="open";
return false;

}
}
function hor_image_h5()
{
str=document.getElementById("image_arrow_h5").alt;
if (str=="open")
{
document.getElementById("image_arrow_h5").src="style/images/arrow2.gif";
document.getElementById("div_h5").style.display="block";
document.getElementById("image_arrow_h5").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("r_session").value=="sessionin")
{
document.getElementById("image_arrow_h5").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_h5").src="style/images/arrow.jpg";
}
document.getElementById("div_h5").style.display="none";
document.getElementById("image_arrow_h5").alt="open";
return false;
}
}
function ver_image_v1()
{
str=document.getElementById("image_arrow_v1").alt;
if (str=="open")
{
document.getElementById("image_arrow_v1").src="style/images/arrow2.gif";
document.getElementById("div_v1").style.display="block";
document.getElementById("image_arrow_v1").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("h_session1").value=="sessionin")
{
document.getElementById("image_arrow_v1").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_v1").src="style/images/arrow.jpg";
}
document.getElementById("div_v1").style.display="none";
document.getElementById("image_arrow_v1").alt="open";
return false;
}
}
function ver_image_v2()
{
str=document.getElementById("image_arrow_v2").alt;
if (str=="open")
{
document.getElementById("image_arrow_v2").src="style/images/arrow2.gif";
document.getElementById("div_v2").style.display="block";
document.getElementById("image_arrow_v2").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("c_session1").value=="sessionin")
{
document.getElementById("image_arrow_v2").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_v2").src="style/images/arrow.jpg";
}
document.getElementById("div_v2").style.display="none";
document.getElementById("image_arrow_v2").alt="open";
return false;
}
}
function ver_image_v3()
{
str=document.getElementById("image_arrow_v3").alt;
if (str=="open")
{
document.getElementById("image_arrow_v3").src="style/images/arrow2.gif";
document.getElementById("div_v3").style.display="block";
document.getElementById("image_arrow_v3").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("s_session1").value=="sessionin")
{
document.getElementById("image_arrow_v3").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_v3").src="style/images/arrow.jpg";
}
document.getElementById("div_v3").style.display="none";
document.getElementById("image_arrow_v3").alt="open";
return false;
}
}
function ver_image_v4()
{
str=document.getElementById("image_arrow_v4").alt;
if (str=="open")
{
document.getElementById("image_arrow_v4").src="style/images/arrow2.gif";
document.getElementById("div_v4").style.display="block";
document.getElementById("image_arrow_v4").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("p_session1").value=="sessionin")
{
document.getElementById("image_arrow_v4").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_v4").src="style/images/arrow.jpg";
}
document.getElementById("div_v4").style.display="none";
document.getElementById("image_arrow_v4").alt="open";
return false;
}
}
function ver_image_v5()
{
str=document.getElementById("image_arrow_v5").alt;
if (str=="open")
{
document.getElementById("image_arrow_v5").src="style/images/arrow2.gif";
document.getElementById("div_v5").style.display="block";
document.getElementById("image_arrow_v5").alt="close";
return false;
}
if (str=="close")
{
if (document.getElementById("r_session1").value=="sessionin")
{
document.getElementById("image_arrow_v5").src="style/images/arrow1.jpg";
}
else
{
document.getElementById("image_arrow_v5").src="style/images/arrow.jpg";
}
document.getElementById("div_v5").style.display="none";
document.getElementById("image_arrow_v5").alt="open";
return false;
}
}