// JavaScript Document
function validate()
{	
	if ((document.registration.email.value==null)||(document.registration.email.value==""))
		{
			alert("Please Enter your Email ID")
			document.registration.email.focus()
			return false
		}
	if (echeck(document.registration.email.value)==false)
		{
			document.registration.email.value=""
			document.registration.email.focus()
			return false
		}
	if(document.registration.re_email.value=="")
		{
			alert("Please retype your email");
			document.registration.re_email.focus();
			return false;
			}
	if (echeck(document.registration.re_email.value)==false)
		{
			document.registration.re_email.value=""
			document.registration.re_email.focus()
			return false
		}
	if(document.registration.pass.value=="")
		{
			alert("Please enter password");
			document.registration.pass.focus();
			return false;
		}
	if(document.registration.re_pass.value=="")
		{
			alert("Please retype your password");
			document.registration.re_pass.focus();
			return false;
		}
	if(document.registration.first_name.value=="")
		{
			alert("Please enter first name");
			document.registration.first_name.focus();
			return false;
		}
	if(document.registration.last_name.value=="")
		{
			alert("Please enter last name");
			document.registration.last_name.focus();
			return false;
		}
		if(document.registration.company_name.value=="")
		{
			alert("Please enter your company name");
			document.registration.company_name.focus();
			return false;
			}
	if(document.registration.address.value=="")
		{
			alert("Please enter address");
			document.registration.address.focus();
			return false;
		}
if(document.registration.city.value=="")
		{
			alert("Please enter city name");
			document.registration.city.focus();
			return false;
		}
if(document.registration.country.value=="")
		{
			alert("Please enter country name");
			document.registration.country.focus();
			return false;
		}
if(document.registration.phone.value=="")
		{
			alert("Please enter phone number");
			document.registration.phone.focus();
			return false;
		}
if(document.registration.fax.value=="")
		{
			alert("Please enter fax number");
			document.registration.fax.focus();
			return false;
		}
if((document.registration.email.value)!=(document.registration.re_email.value))
{
	alert("Both email Address must be same");
	document.registration.pass.focus();
	return false;
}
if((document.registration.pass.value)!=(document.registration.re_pass.value))
{
	alert("Both the passwords must be same");
	document.registration.pass.focus();
	return false;
}


		return true;
	}
	
function echeck(str) 
	{
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=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 numbersonly(e)
	{
		var unicode=e.charCode?e.charCode:e.keyCode;
		if (unicode!=8)
			{ //if the key isn't the backspace key (which we should allow)
				if (unicode<48||unicode>57) //if not a number
					{
						alert("please insert only number");
			    		return false; //disable key press
					}
			}
	}

function login1()
{
	if(document.login.email.value=="")
		{
			alert("Please enter email address");
			document.login.email.focus();
			return false;
		}
	if(document.login.passwd.value=="")
		{
			alert("Please enter your password");
			document.login.passwd.focus();
			return false;
		}
		   return true;
}
function change_pass1()
{
	if(document.change_pass.old_pass.value=="")
		{
			alert("Enter old password");
			document.change_pass.old_pass.focus();
			return false;
		}
	if(document.change_pass.new_pass.value=="")
		{
			alert("Enter new password");
			document.change_pass.new_pass.focus();
			return false;
		}
	if(document.change_pass.re_pass.value=="")
		{
			alert("Retype new password");
			document.change_pass.re_pass.focus();
			return false;
		}
	
	if((document.change_pass.new_pass.value)!=(document.change_pass.re_pass.value))
		{
			alert("Both new password and re-type password must be same");
		    document.change_pass.new_pass.focus();
		}
		
	return true;
}