function validate_login_form(frm) {
	
	var pb=frm;
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {	
		alert("Please enter your email id");
		pb.email.value = "";
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value == 0 || pb.pwd.value == "Enter Your Password") {
		alert("Please enter your password");
		pb.pwd.value = "";
		pb.pwd.focus();
		return false;
	}	
}


function validate_forgot_password() {
	var pb=document.forgot_password;
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if((pb.email_f.value.length >= 0) && (!email_check.test(pb.email_f.value))) {	
		alert("Please enter your Email ID");
		pb.email_f.value = "";
		pb.email_f.focus();
		return false;
	}
}


function newsletter_validate() {
	var pb=document.newsletter;
	
	if (pb.name.value == 0 || pb.name.value == "Enter Your Name") {
		alert("Please enter your name");
		pb.name.focus();
		return false;
	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
}


function validate_change_password_form() {
	var pb=document.change_password_form;
	
	if (pb.opwd.value==0) {
		alert("Please enter your old password");
		pb.opwd.focus();
		return false;
	}
	
	if (pb.npwd.value == 0) {
		alert("Please enter your new password");
		pb.npwd.focus();
		return false;
	}
	
	if (pb.npwd.value.length < 6) {
		alert("Please enter a valid password [Minimum 6 characters]");
		pb.npwd.focus();
		return false;
	}
	
	if (pb.cpwd.value == 0) {
		alert("Please confirm your new password");
		pb.cpwd.focus();
		return false;
	}
	
	if (pb.npwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}	
}


function validate_manage_members(checkpass) {

	var pb=document.manage_members;
	var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
	var num_check = /^([0-9\s])+([\s])*([0-9\s])*$/;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	if(checkpass=="")
	{
		
	if (pb.pwd.value.length < 6) {
		alert("Please enter a valid password [Minimum 6 characters]");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.pwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}
	
	}
	
	if (pb.title.value==0) {
		alert("Please select your title");
		pb.title.focus();
		return false;
	}
	
	if (pb.firstName.value==0) {
		alert("Please enter your first name");
		pb.firstName.focus();
		return false;
	}
	if(!name_check.test(pb.firstName.value)) {
		alert("First name should be in alphabets only");
		pb.firstName.focus();
		return false;
	}
	
	if (pb.phone.value==0) {
		alert("Please enter phone no.");
		pb.phone.focus();
		return false;
	}
	/*if(!num_check.test(pb.phone.value)) {
		alert("Phone no. should be in numeric only");
		pb.phone.focus();
		return false;
	}*/
	
	if (pb.mobile.value==0) {
		alert("Please enter mobile no.");
		pb.mobile.focus();
		return false;
	}
	/*if(!num_check.test(pb.mobile.value)) {
		alert("Mobile no. should be in numeric only");
		pb.mobile.focus();
		return false;
	}*/
	
	/*if (pb.lastName.value==0) {
		alert("Please enter your last name");
		pb.lastName.focus();
		return false;
	}
	if(!name_check.test(pb.lastName.value)) {
		alert("Last name should be in alphabets only");
		pb.lastName.focus();
		return false;
	}*/
	
	if (pb.city.value==0) {
		alert("Please enter your billing city");
		pb.city.focus();
		return false;
	}
	
	if(!name_check.test(pb.city.value)) {
		alert("City name should be in alphabets only");
		pb.city.focus();
		return false;
	}
	
	if (pb.state.value==0) {
		alert("Please enter your billing state");
		pb.state.focus();
		return false;
	}
	if(!name_check.test(pb.state.value)) {
		alert("State name should be in alphabets only");
		pb.state.focus();
		return false;
	}
	
	if (pb.country.value==0) {
		alert("Please select your billing country");
		pb.country.focus();
		return false;
	}
	
	if (pb.zipcode.value==0) {
		alert("Please enter your billing zip code");
		pb.zipcode.focus();
		return false;
	}
	
	if (pb.address.value==0) {
		alert("Please enter your billing address");
		pb.address.focus();
		return false;
	}
	
	if (pb.cityShip.value==0) {
		alert("Please enter your shipping city");
		pb.cityShip.focus();
		return false;
	}
	
	if(!name_check.test(pb.cityShip.value)) {
		alert("Shipping City name should be in alphabets only");
		pb.cityShip.focus();
		return false;
	}
	
	if (pb.stateShip.value==0) {
		alert("Please enter your shipping state");
		pb.stateShip.focus();
		return false;
	}
	
	if(!name_check.test(pb.stateShip.value)) {
		alert("Shipping State name should be in alphabets only");
		pb.stateShip.focus();
		return false;
	}
	
	if (pb.countryShip.value==0) {
		alert("Please select your shipping country");
		pb.countryShip.focus();
		return false;
	}
	
	if (pb.zipcodeShip.value==0) {
		alert("Please enter your shipping zip code");
		pb.zipcodeShip.focus();
		return false;
	}
	
	if (pb.addressShip.value==0) {
		alert("Please enter your shipping address");
		pb.addressShip.focus();
		return false;
	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value.length < 6) {
		alert("Please enter a valid password [Minimum 6 characters]");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.pwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}
}


function validate_send_email_form() {
	var pb=document.send_email_form;
	
	var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;	
	if((pb.your_name.value.length >= 0) && (!name_check.test(pb.your_name.value))) {
		alert("Please enter your name, should be in alphabets only");
		pb.your_name.focus();
		return false;
	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.your_email.value.length >= 0) && (!email_check.test(pb.your_email.value))) {
		alert("Please enter a valid email id");
		pb.your_email.focus();
		return false;
	}
	
	if((pb.friend_name.value.length >= 0) && (!name_check.test(pb.friend_name.value))) {
		alert("Please enter your friend's name, should be in alphabets only");
		pb.friend_name.focus();
		return false;
	}
	
	if((pb.friend_email.value.length >= 0) && (!email_check.test(pb.friend_email.value))) {
		alert("Please enter a valid email id of your friend");
		pb.friend_email.focus();
		return false;
	}
}


function filldata() {
	
	var f1=document.register;
  if(f1.chk.checked==1) {
	  
	  f1.shipp_company.value=f1.bill_company.value;
	  f1.shipp_firstName.value=f1.bill_firstName.value;
	  f1.shipp_lastName.value=f1.bill_lastName.value;
	  f1.shipp_phone.value=f1.bill_phone.value;
	  f1.shipp_address.value=f1.bill_address.value;
	  f1.shipp_city.value=f1.bill_city.value;
	  f1.shipp_state.value=f1.bill_state.value;
	  f1.shipp_country.value=f1.bill_country.value;
	  f1.shipp_zipcode.value=f1.bill_zipcode.value;	
	   
  }
  else{
	  f1.shipp_company.value="";
	  f1.shipp_firstName.value="";
	  f1.shipp_lastName.value="";
	  f1.shipp_phone.value="";
	  f1.shipp_address.value="";
	  f1.shipp_city.value="";
	  f1.shipp_state.value="";
	  f1.shipp_country.value="";
	  f1.shipp_zipcode.value="";
	  
	  
  }
}


function submit_form(formName, url, hiddenAttribute1, useId1, hiddenAttribute2, useId2) {
	var useId=document.getElementById(useId2).value;
	document.getElementById(hiddenAttribute1).value=useId1;
	document.getElementById(hiddenAttribute2).value=useId;
	document.getElementById(formName).action =url;
	document.getElementById(formName).submit();
	return true;	
}


function validate_keyword_search() {
	var pb=document.keyword_search;
	if (pb.keyword.value==0 || pb.keyword.value=="Enter Keyword") {
		alert("Please enter search keyword");
		pb.keyword.focus();
		return false;
	}
}

function validate_newsletter()
{
var frm=document.newsletter;
	
		if(frm.name.value==0)
		{
		alert("Please Enter Your Name");
		frm.name.focus();
		return false;
		}
		
		if(frm.name.value=='Enter your name')
		{
		alert("Please Enter Your Name");
		frm.name.focus();
		return false;
		}
	
		if(document.getElementById("name").value)
		{
		var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
		if(!name_check.test(document.getElementById("name").value)) 
			{
			alert("Please Enter Valid Name.");
			document.getElementById("name").focus();
			return false;
			
			} 

		}
		
		var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
		if((document.newsletter.email.value.length >= 0) && (!email_check.test(document.newsletter.email.value))) {
		alert("Please enter a valid Email ID");
		document.newsletter.email.focus();
		return false;
	}
		
		}
		
function validate_contactus()
{
	frm=document.contact;
	if(frm.firstName.value==0)
	{
	alert("Please enter your name.");
	frm.firstName.focus();
	return false;
	}
	
	if(document.getElementById("firstName").value)
	{
			var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
			if(!name_check.test(document.getElementById("firstName").value)) 
			{
			alert("Please Enter Valid Name.");
			document.getElementById("firstName").focus();
			return false;
			
			} 

	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((frm.email.value.length >= 0) && (!email_check.test(frm.email.value))) {
		alert("Please enter a valid Email ID");
		frm.email.focus();
		return false;
	}
	
	if(frm.city.value==0)
	{
	alert("Please enter city.");
	frm.city.focus();
	return false;
	}
	
	if(document.getElementById("city").value)
	{
			var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
			if(!name_check.test(document.getElementById("city").value)) 
			{
			alert("Please Enter Valid City Name.");
			document.getElementById("city").focus();
			return false;
			
			} 

	}
	
	if(frm.state.value==0)
	{
	alert("Please enter state.");
	frm.state.focus();
	return false;
	}
	
	if(document.getElementById("state").value)
	{
			var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
			if(!name_check.test(document.getElementById("state").value)) 
			{
			alert("Please Enter Valid State Name.");
			document.getElementById("state").focus();
			return false;
			
			} 

	}
	
	if(frm.country.value==0)
	{
	alert("Please select country.");
	frm.country.focus();
	return false;
	}
	
	if(frm.comments.value==0)
	{
	alert("Please enter message.");
	frm.comments.focus();
	return false;
	}
	
}


function checkNewsLetter()
{
	var comvarable=document.newsLetter

		if(comvarable.name.value=='Enter name')
		{
		alert ( "Enter name ." );
		comvarable.name.focus();  
		return false;	
		}
		
		if (comvarable.name.value=="" )
		{
		alert ( "Enter name ." );
		comvarable.name.focus();  
		return false;
		}
		
	
		var emailID=document.newsLetter.email
				
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID");
		emailID.focus();
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.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 validate_newsletter_left() {
	var pb=document.newsletter_left;
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	
	if((pb.email_news.value.length >= 0) && (!email_check.test(pb.email_news.value))) {
		alert("Please enter a valid Email ID");
		pb.email_news.focus();
		return false;
	}
}
