// JavaScript Document
function validation()
{
  if(document.mailform.name.value=='')
 {
  alert("Name is Mandetory");
  document.mailform.name.focus();
	return false;
  }
   
  if((document.mailform.email.value.indexOf("@")==-1)&&(document.mailform.email.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.mailform.email.focus();
  return false;
  }
   if(document.mailform.street.value=='')
 {
  alert("Street is mandetory");
  document.mailform.street.focus();
  return false;
  } 
  
  if(document.mailform.city.value=='')
 {
  alert("City is Mandetory");
  document.mailform.city.focus();
	return false;
  }
  if(document.mailform.state.value=='')
 {
  alert("State is Mandetory");
  document.mailform.state.focus();
	return false;
  }
  if(document.mailform.zip.value=='')
 {
  alert("Zipcode is Mandetory");
  document.mailform.zip.focus();
	return false;
  }
  if(document.mailform.country.value=='')
 {
  alert("Country is Mandetory");
  document.mailform.country.focus();
	return false;
  }
  return true;
}


function checkOther()
{
	if(document.mailform.submittedby.value=="Others")
	{
		document.getElementById('othre1').style.display="";
		document.getElementById('othre2').style.display="";
		
	}
	else
	{
		document.getElementById('othre1').style.display="none";
		document.getElementById('othre2').style.display="none";
		
	}
}

function loginvalidate()
{
	if(document.loginform.reg_email.value=='')
 {
  alert("Email Address is Mandetory");
  document.loginform.reg_email.focus();
	return false;
  }
  if((document.loginform.reg_email.value.indexOf("@")==-1)&&(document.loginform.reg_email.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.loginform.reg_email.focus();
  return false;
  }
  if(document.loginform.reg_password.value=='')
 {
  alert("Password is Mandetory");
  document.loginform.reg_password.focus();
	return false;
  }
    
 return true;
}

function regvalidation()
{
/*	
  if(document.regform.reg_username.value=='')
 {
  alert("username is mandetory");
  document.regform.reg_username.focus();
  return false;
  } 
   if(document.regform.reg_username.value.length<6 || document.regform.reg_username.value.length>=25)
  {
	alert("Username should be between 6 to 25 characters");
	document.regform.reg_username.focus();
	return false;
}
if(document.regform.reg_password.value=='')
 {
  alert("password is mandetory");
  document.regform.reg_password.focus();
 return false;
  } 
   if(document.regform.reg_password.value.length<6 ||  document.regform.reg_password.value.length>=25)
		{
				alert("Password should be between 6 to 25 characters");
				document.regform.reg_password.focus();
				return false;
		}
   if(document.regform.reg_conpassword.value=='')
 {
  alert("please enter the password again");
  document.regform.reg_conpassword.focus();
  return false;
  }
   if(document.regform.reg_password.value!=document.regform.reg_conpassword.value)
  {
     alert("Both the Passwords you typed do not match. Please use identical Passwords in both the form fields.");
	 document.regform.reg_conpassword.focus();
    return false;
  }
   if(document.regform.reg_username.value==document.regform.reg_password.value)		
      {
		  alert("Username and Password can't be same");
		  document.regform.reg_username.focus();
		  return false;
	}
	*/
	if(document.regform.reg_fname.value=='')
 {
  alert("First Name is mandetory");
  document.regform.reg_fname.focus();
	return false;
  }
   if(document.regform.reg_sname.value=='')
 {
  alert("Surname is mandetory");
  document.regform.reg_sname.focus();
	return false;
  }
  
  if((document.regform.reg_email.value.indexOf("@")==-1)&&(document.regform.reg_email.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.regform.reg_email.focus();
  return false;
  }
   if(document.regform.date.value=="")
 {
	alert("Day is mandatory.");
	document.regform.date.focus();
	return false;
 }
  if(document.regform.month.value=="")
 {
 alert("Month is mandatory.");
 document.regform.month.focus();
 return false;
 }
 if(document.regform.year.value=="")
 {
 alert("Year is mandatory.");
 document.regform.year.focus();
 return false;
 }
 if(document.regform.reg_sex.value=="")
 {
  alert("Please select your sex");
  document.regform.reg_sex.focus();
	return false;
  }
    if(document.regform.country.value=='')
 {
  alert("Country is mandetory");
  document.regform.country.focus();
	return false;
  }

  return true;
}


function billingvalidate()
{
 if(document.f1.name.value=='')
 {
  alert("Name is mandetory");
  document.f1.name.focus();
  return false;
  } 
 if(document.f1.address.value=='')
 {
  alert("Address is mandetory");
  document.f1.address.focus();
  return false;
  } 
  
  if(document.f1.city.value=='')
 {
  alert("City is mandetory");
  document.f1.city.focus();
  return false;
  } 
  
  if(document.f1.state.value=='')
 {
  alert("State is mandetory");
  document.f1.state.focus();
  return false;
  } 
   
  if(document.f1.zip.value=='')
 {
  alert("Zipcode is mandetory");
  document.f1.zip.focus();
  return false;
  }
  if(document.f1.phone.value=='')
 {
  alert("Phone Number is mandetory");
  document.f1.phone.focus();
  return false;
  }
  if(document.f1.phone.value.length < 6 || document.f1.phone.value.length >13 )
	{
			alert("The length of Telephone Number should be appropriate");
			document.f1.phone.focus();
			return false;
	}
	if(isNaN(parseInt(document.f1.phone.value)))
	{
			alert("Please specify a valid Telephone Number");
			document.f1.phone.value='';
			document.f1.phone.focus();
			return false;
	}
  if(document.f1.mobile.value=='')
 {
  alert("Mobile Number is mandetory");
  document.f1.mobile.focus();
  return false;
  } 
  if(document.f1.mobile.value!="")
	{
			if(document.f1.mobile.value.length < 10 || document.f1.mobile.value.length >12)
			{
					alert("The length of Mobile number should be appropriate");
					document.f1.mobile.focus();
					return false;
			}
			if(isNaN(parseInt(document.f1.mobile.value)))
			{
					alert("Please specify a valid Mobile number");
					document.f1.mobile.value='';
					document.f1.mobile.focus();
					return false;
			}
	}
   return true;
}

function forgotvalidate()
{
if(document.f1.reg_email.value=='')
 {
  alert("Email Address is mandetory");
  document.f1.reg_email.focus();
  return false;
  } 
   return true;
}

function invitevalidate()
{
	if(document.f1.firstname.value=='')
 {
  alert("First Name is mandetory");
  document.f1.firstname.focus();
  return false;
  } 
  if(document.f1.lastname.value=='')
 {
  alert("Last Name is mandetory");
  document.f1.lastname.focus();
  return false;
  } 
  if(document.f1.email.value=='')
 {
  alert("Email is mandetory");
  document.f1.email.focus();
  return false;
  } 
  if((document.f1.email.value.indexOf("@")==-1)&&(document.f1.email.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.f1.email.focus();
  return false;
  }
  if(document.f1.myname.value=='')
 {
  alert("Name is mandetory");
  document.f1.myname.focus();
  return false;
  } 
  if(document.f1.myemail.value=='')
 {
  alert("Email is mandetory");
  document.f1.myemail.focus();
  return false;
  } 
  if((document.f1.myemai.value.indexOf("@")==-1)&&(document.f1.myemai.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.f1.myemai.focus();
  return false;
  }
   return true;
}
	
	

function validation1()
{
if((document.mailform.email.value.indexOf("@")==-1)&&(document.mailform.email.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.mailform.email.focus();
  return false;
  }	

 if(document.mailform.zip.value=='')
 {
  alert("Zipcode is Mandetory");
  document.mailform.zip.focus();
	return false;
  }

}

function billvalidate()
{
	if(document.frm.address1.value=='')
 {
  alert("Billing Address is Mandetory");
  document.frm.address1.focus();
  return false;
  }
  if(document.frm.email.value=='')
 {
  alert("Email Address is Mandetory");
  document.frm.email.focus();
  return false;
  }
  if((document.frm.email.value.indexOf("@")==-1)&&(document.frm.email.value.indexOf(".")==-1))
 {
  alert("Enter a valid email address");
  document.frm.email.focus();
  return false;
  }	
  return true;
}
