
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode >=48 && charCode <=57 )|| (charCode == 46 )||(charCode == 10 )||(charCode == 13 )|| (charCode == 8)||(charCode == 32)||(charCode == 45))
        {
	       return true; 
        }
         else
          {
	         alert("Please Enter Only Numbers");
            return false;
        }
        
    }

function IsEmpty(obj, obj_type)
{
 if (obj_type == "text" || obj_type == "password" || obj_type == "textarea" || obj_type == "file") {
  var objValue;
  
  objValue = obj.value.replace(/\s+$/,"");
  
  if (objValue.length == 0) {
   //obj.focus();
   return true;
  } else {
   return false;
  }
 } else if (obj_type == "select") {
  for (i=0; i < obj.length; i++) {
   if (obj.options[i].selected) {
    if(obj.options[i].value == "0") {
     //obj.focus();
     return true;
    } else {
     return false;
    }
   }
   
  }
  return true; 
 } else if (obj_type == "radio" || obj_type == "checkbox") {
  if (!obj[0] && obj) {
   if (obj.checked) {
    return false;
   } else {
    //obj.focus();
    return true; 
   }
  } else {
   for (i=0; i < obj.length-1; i++) {
    if (obj[i].checked) {
     return false;
    }
   }
   //obj[0].focus();
   return true;
  }
 } else {
  return false;
 }
}





function regform()
{
	

	var titlee=document.getElementById("titlee").value;
	var firstname=document.getElementById("firstname").value; 
	var lastname=document.getElementById("lastname").value;
	//var gender=document.getElementById("gender").value;
	var address=document.getElementById("address").value; 
	var city=document.getElementById("city").value;	
	var country=document.getElementById("country").value;
	var zipcode=document.getElementById("zipcode").value;
	var phoneno=document.getElementById("phoneno").value; 
	var faxno=document.getElementById("faxno").value; 
	var handphoneno=document.getElementById("handphoneno").value;
	var emailid=document.getElementById("emailid").value;	
	var password=document.getElementById("password").value; 
	var cpassword=document.getElementById("cpassword").value; 
 var s=document.frm; 
	//var terms_condition=document.getElementById("terms_condition").value;


if(titlee==0)
		{
		alert("Please select title");
		document.frm.titlee.focus();
		return false;
		}


if(firstname=="")
	 {
		alert("Please enter the First name");
		document.frm.firstname.focus();
		document.frm.firstname.select();
		return false;
	}



	if(firstname!="")
	{
		var invalids = "!#$%^&*()-=[]{}`~,'<>/?;:\|0123456789@._";
		for(i=0; i<invalids.length; i++) 
		{
			if(firstname.indexOf(invalids.charAt(i)) >= 0 )
			{
				alert("First Name should be contains Alphabets");
				document.frm.firstname.value="";
				document.frm.firstname.focus();
				document.frm.firstname.select();
				return false;
			}
		}
	}

if (IsEmpty(document.frm.firstname,'text'))
 {
  alert("Please enter the First name");
  document.frm.firstname.focus();
  return false;
 }


if(lastname=="")
	 {
		alert("Please enter the Last name");
		document.frm.lastname.focus();
		document.frm.lastname.select();
		return false;
	}



	if(lastname!="")
	{
		var invalids = "!#$%^&*()-=[]{}`~,'<>/?;:\|0123456789@._";
		for(i=0; i<invalids.length; i++) 
		{
			if(lastname.indexOf(invalids.charAt(i)) >= 0 )
			{
				alert("Last Name should be contains Alphabets");
				document.frm.lastname.value="";
				document.frm.lastname.focus();
				document.frm.lastname.select();
				return false;
			}
		}
	}

if (IsEmpty(document.frm.lastname,'text'))
 {
  alert("Please enter the Last name");
  document.frm.lastname.focus();
  return false;
 }

//
//wlen=frm.gender.length;
// choose12="";
//
//
// //alert(wlen);
// for(ei=0;ei<wlen;ei++)
// {
//	if(frm.gender[ei].checked)
//	{
//		choose12=frm.gender[ei].value;
//	}
// }
// if(choose12=="")
// {
//	alert("Please select Gender");
//	return false;
//	
// }


if(address=="")
	{
		alert("Please enter the Address");
		document.frm.address.focus();
		document.frm.address.select();
		return false;
	}

if (IsEmpty(document.frm.address,'textarea'))
 {
  alert("Please enter the Address");
  document.frm.address.focus();
  return false;
 }

if(city=="")
	 {
		alert("Please enter the City");
		document.frm.city.focus();
		document.frm.city.select();
		return false;
	}

if (IsEmpty(document.frm.city,'text'))
 {
  alert("Please enter the City");
  document.frm.city.focus();
  return false;
 }

if(country=="")
	 {
		alert("Please enter the Country");
		document.frm.country.focus();
		document.frm.country.select();
		return false;
	}

if (IsEmpty(document.frm.country,'text'))
 {
  alert("Please enter the Country");
  document.frm.country.focus();
  return false;
 }

//////////////////
// if(zipcode=="")
// 	 {
// 		alert("Please enter the Zip code");
// 		document.frm.zipcode.focus();
// 		document.frm.zipcode.select();
// 		return false;
// 	}

// if (IsEmpty(document.frm.zipcode,'text'))
//  {
//   alert("Please enter the Zipcode");
//   document.frm.zipcode.focus();
//   return false;
//  }
 
if(zipcode!="")
 {
	var invalids = "!#$%^&*()-=[]{}`~'<>/?;:\|@._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(i=0; i<invalids.length; i++) 
	{
		if(zipcode.indexOf(invalids.charAt(i)) >= 0 )
		{
			alert("Zip code should contain only numbers");
			document.frm.zipcode.focus();
			document.frm.zipcode.select();
			return false;
		}
	} 
	 
 }

if(phoneno=="")
	 {
		alert("Please enter the Phone No");
		document.frm.phoneno.focus();
		document.frm.phoneno.select();
		return false;
	}
	
	if(phoneno!="")
 {
	var invalids = "!#$%^&*()-=[]{}`~'<>/?;:\|@._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(i=0; i<invalids.length; i++) 
	{
		if(phoneno.indexOf(invalids.charAt(i)) >= 0 )
		{
			alert("Phone number should contain only numbers");
			document.frm.phoneno.focus();
			document.frm.phoneno.select();
			return false;
		}
	} 
	 
 }

// if (IsEmpty(document.frm.zipcode,'text'))
//  {
//   alert("Please enter the Zipcode");
//   document.frm.zipcode.focus();
//   return false;
//  }
// if(faxno=="")
// 	 {
// 		alert("Please enter the Fax no");
// 		document.frm.faxno.focus();
// 		document.frm.faxno.select();
// 		return false;
// 	}
	
	if(faxno!="")
 {
	var invalids = "!#$%^&*()-=[]{}`~'<>/?;:\|@._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(i=0; i<invalids.length; i++) 
	{
		if(faxno.indexOf(invalids.charAt(i)) >= 0 )
		{
			alert("Fax number should contain only numbers");
			document.frm.faxno.focus();
			document.frm.faxno.select();
			return false;
		}
	} 
	 
 }
// if (IsEmpty(document.frm.faxno,'text'))
//  {
//   alert("Please enter the Fax no");
//   document.frm.faxno.focus();
//   return false;
//  }

// if(handphoneno=="")
// 	 {
// 		alert("Please enter the Cell Phone No");
// 		document.frm.handphoneno.focus();
// 		document.frm.handphoneno.select();
// 		return false;
// 	}

if(handphoneno!="")
 {
	var invalids = "!#$%^&*()-=[]{}`~'<>/?;:\|@._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(i=0; i<invalids.length; i++) 
	{
		if(handphoneno.indexOf(invalids.charAt(i)) >= 0 )
		{
			alert("Cell phone number should contain only numbers");
			document.frm.handphoneno.focus();
			document.frm.handphoneno.select();
			return false;
		}
	} 
	 
 }
// if (IsEmpty(document.frm.handphoneno,'text'))
//  {
//   alert("Please enter the cell phone no");
//   document.frm.handphoneno.focus();
//   return false;
//  }

//validation for cprimary_email


if(emailid=="")
	{
	alert("Please enter the Email address!");
	document.frm.emailid.focus();
	document.frm.emailid.select();
	return false;
	}
	else if(emailid!=""){
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.emailid.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.frm.emailid.value="";
		document.frm.emailid.focus();
		document.frm.emailid.select();
		return false;
		}
	}




//validation for password

if(password==""){
		alert("Please enter the Password");
		document.frm.password.focus();
		document.frm.password.select();
		return false;
		
	}

if (IsEmpty(document.frm.password,'text'))
 {
  alert("Please enter the password");
  document.frm.password.focus();
  return false;
 }

	if(password.length<5){
		alert("The password should be enter 5 or more characters");
		document.frm.password.value="";
		document.frm.password.focus();
		document.frm.password.select();
		return false;
	}
	
	if(cpassword==""){
		alert("Please enter the Confirm Password");
		document.frm.cpassword.focus();
		document.frm.cpassword.select();
		return false;
	}

if (IsEmpty(document.frm.cpassword,'text'))
 {
  alert("Please enter the Confirm password");
  document.frm.cpassword.focus();
  return false;
 }

	if(password!=cpassword){
		alert("Passwords are not same, Please Re-enter");
		document.frm.password.value="";
		document.frm.cpassword.value="";
		document.frm.password.focus();
		document.frm.password.select();
		return false;
		
	}
if(s.terms_condition.checked)
{
	var move="true";
}
if(move!="true")
{
	alert("Please click the check box to accept the terms and conditions");
	s.terms_condition.focus();
	return false;
}
return true;

}


//enable the my country
function submitenable()
{
	//alert("df");
	if(document.getElementById("terms_condition").checked)
	{
		document.frm.btnSubmit.disabled="";		
	}
	else 
	{
		document.frm.btnSubmit.disabled="disabled";		
	}
}





function fmlog()
{

var emaillh=document.getElementById("emaillh").value;
var pwordh=document.getElementById("pwordh").value; 

if (IsEmpty(document.fm.emaillh,'text'))
 {
  alert("Please enter the Email address!");
  document.fm.emaillh.focus();
  return false;
 }


if(emaillh=="")
	{
	alert("Please enter the Email address!");
	document.fm.emaillh.focus();
	//document.frmLogin.emaill.select();
	return false;
	}
	else if(emaillh!="")
		{
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.fm.emaillh.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.fm.emaillh.value="";
		document.fm.emaillh.focus();
		//document.frmLogin.emaill.select();
		return false;
		}
	}


if (IsEmpty(document.fm.pwordh,'text'))
 {
  alert("Please enter the password");
  document.fm.pwordh.focus();
  return false;
 }

if(pwordh=="")
	{
		alert("Please enter the Password");
		document.fm.pwordh.focus();
		//document.frmLogin.pword.select();
		return false;		
	}

return true;
}




function forgetpas()
{

var femail=document.getElementById("femail").value;


if(femail=="")
	{
	alert("Please enter the Email address!");
	document.frm.femail.focus();
	//document.frmLogin.emaill.select();
	return false;
	}
	else if(femail!="")
		{
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.femail.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail Address! Please Re-enter.");
		document.frm.femail.value="";
		document.frm.femail.focus();
		//document.frmLogin.emaill.select();
		return false;
		}
	}

if (IsEmpty(document.frm.femail,'text'))
 {
  alert("Please enter the password");
  document.frm.femail.focus();
  return false;
 }
return true;
}







function changepass()
{
var oldpass=document.getElementById("oldpass").value;
var pass=document.getElementById("pass").value;
var newpass=document.getElementById("newpass").value; 
var conpass=document.getElementById("conpass").value;


//validation for password

	if(pass==""){
		alert("Please enter the Password");
		document.frm.pass.focus();
		document.frm.pass.select();
		return false;		
	}



	if(pass!=oldpass){
		alert("Old Password are not right, Please Re-enter");
		document.frm.pass.value="";		
		document.frm.pass.focus();
		document.frm.pass.select();
		return false;
		
	}
	
	if(newpass==""){
		alert("Please enter the New Password");
		document.frm.newpass.focus();
		document.frm.newpass.select();
		return false;		
	}
		if (IsEmpty(document.frm.newpass,'text'))
		{
		alert("Please enter the New password");
		document.frm.newpass.focus();
		document.frm.newpass.value="";	
		return false;
		}
	if(newpass.length<5){
		alert("The new password should be enter 5 or more characters");
		document.frm.newpass.value="";
		document.frm.newpass.focus();
		document.frm.newpass.select();
		return false;
	}


	
	if(conpass==""){
		alert("Please enter the Confirm Password");
		document.frm.conpass.focus();
		document.frm.conpass.select();
		return false;
	}
		if (IsEmpty(document.frm.conpass,'text'))
		{
		alert("Please enter the Confirm password");
		document.frm.conpass.focus();
		document.frm.conpass.value="";	
		return false;
		}
	if(newpass!=conpass){
		alert("Passwords are not same, Please Re-enter");
		document.frm.newpass.value="";
		document.frm.conpass.value="";
		document.frm.newpass.focus();
		document.frm.newpass.select();
		return false;
		
	}


	if(newpass==oldpass){
		alert("Old password and new password are same, Please Re-enter");
		document.frm.newpass.value="";
		document.frm.conpass.value="";
		document.frm.newpass.focus();
		document.frm.newpass.select();
		return false;
		
	}




	//alert("fcdfsdfds");
return true;
}




function editdetail()
{
	

	var etit=document.getElementById("etit").value;
	var efirstname=document.getElementById("efirstname").value; 
	var elastname=document.getElementById("elastname").value;
	//var gender=document.getElementById("gender").value;
	var eaddress=document.getElementById("eaddress").value; 
	var ecity=document.getElementById("ecity").value;	
	var ecountry=document.getElementById("ecountry").value;
	var ezip=document.getElementById("ezip").value;
	var ephone=document.getElementById("ephone").value; 
	var efax=document.getElementById("efax").value; 
	var ehandphone=document.getElementById("ehandphone").value;
	
if(etit==0)
		{
		alert("Please select title");
		document.frm.etit.focus();
		return false;
		}


if(efirstname=="")
	 {
		alert("Please enter the First name");
		document.frm.efirstname.focus();
		document.frm.efirstname.select();
		return false;
	}

		if (IsEmpty(document.frm.efirstname,'text'))
		{
		alert("Please enter the First name");
		document.frm.efirstname.focus();
		return false;
		}

	if(efirstname!="")
	{
		var invalids = "!#$%^&*()-=[]{}`~,'<>/?;:\|0123456789@._";
		for(i=0; i<invalids.length; i++) 
		{
			if(efirstname.indexOf(invalids.charAt(i)) >= 0 )
			{
				alert("First Name should be contains Alphabets");
				document.frm.efirstname.value="";
				document.frm.efirstname.focus();
				document.frm.efirstname.select();
				return false;
			}
		}
	}


if(elastname=="")
	 {
		alert("Please enter the Last name");
		document.frm.elastname.focus();
		document.frm.elastname.select();
		return false;
	}

		if (IsEmpty(document.frm.elastname,'text'))
		{
		alert("Please enter the Last name");
		document.frm.elastname.focus();
		return false;
		}

	if(elastname!="")
	{
		var invalids = "!#$%^&*()-=[]{}`~,'<>/?;:\|0123456789@._";
		for(i=0; i<invalids.length; i++) 
		{
			if(elastname.indexOf(invalids.charAt(i)) >= 0 )
			{
				alert("Last Name should be contains Alphabets");
				document.frm.elastname.value="";
				document.frm.elastname.focus();
				document.frm.elastname.select();
				return false;
			}
		}
	}


if(eaddress=="")
	 {
		alert("Please enter the Address");
		document.frm.eaddress.focus();
		document.frm.eaddress.select();
		return false;
	}

		if (IsEmpty(document.frm.eaddress,'text'))
		{
		alert("Please enter the Address");
		document.frm.eaddress.focus();
		return false;
		}

if(ecity=="")
	 {
		alert("Please enter the City");
		document.frm.ecity.focus();
		document.frm.ecity.select();
		return false;
	}
		if (IsEmpty(document.frm.ecity,'text'))
		{
		alert("Please enter the City");
		document.frm.ecity.focus();
		return false;
		}

if(ecountry=="")
	 {
		alert("Please enter the Country");
		document.frm.ecountry.focus();
		document.frm.ecountry.select();
		return false;
	}
		if (IsEmpty(document.frm.ecountry,'text'))
		{
		alert("Please enter the Country");
		document.frm.ecountry.focus();
		return false;
		}
//////////////////
// if(ezip=="")
// 	 {
// 		alert("Please enter the Zip code");
// 		document.frm.ezip.focus();
// 		document.frm.ezip.select();
// 		return false;
// 	}
// 		if (IsEmpty(document.frm.ezip,'text'))
// 		{
// 		alert("Please enter the Zip code");
// 		document.frm.ezip.focus();
// 		return false;
// 		}
if(ephone=="")
	 {
		alert("Please enter the Phone No");
		document.frm.ephone.focus();
		document.frm.ephone.select();
		return false;
	}
		if (IsEmpty(document.frm.ephone,'text'))
		{
		alert("Please enter the Phone No");
		document.frm.ephone.focus();
		return false;
		}

// if(efax=="")
// 	 {
// 		alert("Please enter the Fax no");
// 		document.frm.efax.focus();
// 		document.frm.efax.select();
// 		return false;
// 	}

// 		if (IsEmpty(document.frm.efax,'text'))
// 		{
// 		alert("Please enter the Fax no");
// 		document.frm.efax.focus();
// 		return false;
// 		}
// if(ehandphone=="")
// 	 {
// 		alert("Please enter the Cell Phone No");
// 		document.frm.ehandphone.focus();
// 		document.frm.ehandphone.select();
// 		return false;
// 	}

// 		if (IsEmpty(document.frm.ehandphone,'text'))
// 		{
// 		alert("Please enter the Cell Phone No");
// 		document.frm.ehandphone.focus();
// 		return false;
// 		}
	//alert("fcdfsdfds");
return true;
}


function contactVali()
{
//alert("hi");

	var know_about=document.getElementById("know_about").value;
	var my_name=document.getElementById("my_name").value; 
	var my_email=document.getElementById("my_email").value;
	var comments=document.getElementById("comments").value;
	
if(know_about=="0")
	 {
		alert("Please Select what you want to know");
		document.frm.know_about.focus();
		
		return false;
	}
		
if(my_name=="")
	 {
		alert("Please enter your name");
		document.frm.my_name.focus();
		
		return false;
	}
		if (IsEmpty(document.frm.my_name,'text'))
		{
		alert("Please enter your name");
		document.frm.my_name.focus();
		return false;
		}
if(my_email=="")
	{
	alert("Please enter the Email ID!");
	document.frm.my_email.focus();
	//document.frmLogin.emaill.select();
	return false;
	}
	else if(my_email!="")
		{
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm.my_email.value)) 
	{
		}
		else
		{
		alert("Invalid E-mail ID! Please Re-enter.");
		document.frm.my_email.value="";
		document.frm.my_email.focus();
		//document.frmLogin.emaill.select();
		return false;
		}
	}

if(comments=="")
	 {
		alert("Please enter your comments");
		document.frm.comments.focus();
		
		return false;
	}
		if (IsEmpty(document.frm.comments,'textarea'))
		{
		alert("Please enter your comments");
		document.frm.comments.focus();
		return false;
		}
//alert("hi");

	return true;
}




//enable the my country
function subscribeee()
{
	//alert("df");
	if((document.getElementById("new_products").checked) || (document.getElementById("special_offers").checked) || (document.getElementById("latest_design").checked))
	{
		//alert("checked");	
	}
	else 
	{
		alert("Please select atleast one option for Subscribe");
		return false;
		//document.frm.btnSubmit.disabled="disabled";		
	}
	return true;
}


//Limiting Character validation   
function limitlength(obj, length)
{
	var maxlength=length
	if (obj.value.length>maxlength)
	{
	obj.value=obj.value.substring(0, maxlength)
     }
}      