// JavaScript Document
	
	function validateFields()
	{
	
	
	
	  //document.frm.state.disabled=false;
	
	if (trim(document.frm.name.value)=="")
			{
			alert("Name is Required");
			document.frm.name.focus();
			return false;	
			}
			
		if (trim(document.frm.address.value) == "")
			{
			alert("Address is Required");
			document.frm.address.focus();
			return false;	
			}
		
		if (document.frm.city.value == "")
			{
			alert("City is Required");
			document.frm.city.focus();
			return false;	
			}
		if (document.frm.state.value == "")
			{
			alert("State is Required");
			document.frm.state.focus();
			return false;	
			}
		 if (document.frm.zip.value == "")
			{
			alert("Zip /Post Code is Required");
			document.frm.zip.focus();
			return false;	
			}
		if (trim(document.frm.country.value) == "")
			{
			alert("Country is Required");
			document.frm.country.focus();
			return false;	
			}		
			
		 if (trim(document.frm.email.value) == "")
			{
				alert("Email is Required");
				document.frm.email.focus();
				return false;
			}
		else if (echeck(document.frm.email.value) == false){
				document.frm.email.value="";
				document.frm.email.focus();
				return false;
			}
	if (trim(document.frm.ship_add.value)=="")
			{
			alert("Shipping Information is Required");
			document.frm.ship_add.focus();
			return false;	
			}		
		if (trim(document.frm.username.value)=="")
			{
			alert("Username is Required");
			document.frm.username.focus();
			return false;	
			}	
		
		if (trim(document.frm.upassword.value)== "")
		{
			alert("Password missing.");
			document.frm.upassword.focus();
			return false;	
		}
		if (document.frm.upassword.value != document.frm.repass.value)
		{
			alert("Password doesn't match. Please enter again.!");
			document.frm.upassword.focus();
			return false;	
		}	
		if ((document.frm.upassword.value.length<=5) || (document.frm.upassword.value.length>=19))
		{
			alert("Password should be greater than 6 and less than 20 digit!");
			return false;	
		}
		
}
  function trim(str)
  {
  	return str.replace(/^\s+|\s+$/g,'');
  }
  function echeck(str) {

		//alert(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")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail")
		    return false
		 }

 		 return true					
	}

//fn to check Date in mm/dd/yyyy
