function emailval(Label,Control)
{
	var checkEmail=Control.value;
	if ((checkEmail.indexOf('@') <= 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
	{
		alert("Enter a Valid Email ID.");
		Control.focus();
		return false;
	}
	return true;
}
function validate(MyForm)
{	
	if(!IsValid(MyForm.UserName.value,"UserName"))
	{
		MyForm.UserName.focus();
		return false;
	}
	
	
	if(!IsPassword(MyForm.Password.value,"Password"))
	{
		MyForm.Password.focus();
		return false;
	}
	if(!IsPassword(MyForm.ConfirmPassword.value,"Confirm Password"))
	{
		MyForm.ConfirmPassword.focus();
		return false;
	}
	if((MyForm.Password.value != MyForm.ConfirmPassword.value))
	{
		alert("Confirm Password Does not Match");
		MyForm.ConfirmPassword.focus();
		return false;
	}
	if(!emailval('Email',MyForm.Email))
	              return false;
				  
	if(!IsValid(MyForm.FirstName.value,"First Name"))
	{
		MyForm.FirstName.focus();
		return false;
	}
	
	if(!IsValid(MyForm.LastName.value,"Last Name"))
	{
		MyForm.LastName.focus();
		return false;
	}
	
	if(document.getElementById("birthday_month").selectedIndex=="")
	{
		alert("Select the Month");
		return false;
	}
	
	if(document.getElementById("birthday_month").selectedIndex!="")
	{
		if(!document.getElementById("birthday_day").selectedIndex)
	{
		alert("Select the Day");
		return false;
	}
	if(!document.getElementById("birthday_year").selectedIndex)
	{
		alert("Select the Year");
		return false;
	}
	}
	if(document.getElementById("birthday_day").selectedIndex!="")
	{
		if(!document.getElementById("birthday_month").selectedIndex)
	{
		alert("Select the Month");
		return false;
	}
	if(!document.getElementById("birthday_year").selectedIndex)
	{
		alert("Select the Year");
		return false;
	}
	}
	if(document.getElementById("birthday_year").selectedIndex!="")
	{
		if(!document.getElementById("birthday_day").selectedIndex)
	{
		alert("Select the Day");
		return false;
	}
	if(!document.getElementById("birthday_month").selectedIndex)
	{
		alert("Select the Month");
		return false;
	}
	}
	
	if(!IsValid(MyForm.Address.value,"Address"))
	{
		MyForm.Address.focus();
		return false;
	}
	 if(!document.getElementById("Country").selectedIndex)
	{
		alert("Select the Country");
		return false;
	}
	if(!IsValid(MyForm.State.value,"State "))
	{
		MyForm.State.focus();
		return false;
	}
	if(!IsValid(MyForm.City.value,"City "))
	{
		MyForm.City.focus();
		return false;
	}
		
	if(!IsZipCode(MyForm.Zip.value,"Zipcode"))
	{
		MyForm.Zip.focus();
		return false;
	}
	
	if(!IsNumber(MyForm.Phone.value,"Phone Number"))
	{
		MyForm.Phone.select();
		return false;
	}
	
	MyForm.hdAction.value = 1;

}

function LoginValidate(MyForm)
{	

	
	if(!IsValid(MyForm.UserName.value,"User Name "))
	{
		MyForm.UserName.focus();
		return false;
	}
	if(!IsValid(MyForm.Password.value,"Password "))
	{
		
		
		
		MyForm.Password.focus();
		return false;
	}
	
	MyForm.hdAction.value = 1;
	return true;
}
