function chk_regis()
{
	if((document.Form1.txtname.value =="") || (Trim(document.Form1.txtname.value)== "")) 
	{
		alert("Enter Name");
		document.Form1.txtname.focus();
		document.Form1.txtname.value="";
		return false
	}
	if(document.Form1.txtname.value != "")
	{
		if((IsSplChar(document.Form1.txtname.value)) == false)
		{
			alert("Do not use single quotes in any textboxes");
			document.Form1.txtname.focus();
			return false
		}
	}
		
	if((document.Form1.txtemail.value =="") || (Trim(document.Form1.txtemail.value)== ""))
	{
		alert("Enter Email");
		document.Form1.txtemail.focus();
		document.Form1.txtemail.value="";
		return false
	}
	else
	{
		if(isValidEmail(document.Form1.txtemail.value) == false)
		{
			alert("Invalid Email");
			document.Form1.txtemail.focus();
			return false
		}
	}
	
	if((document.Form1.txtpassword.value =="") || (Trim(document.Form1.txtpassword.value)== ""))
	{
		alert("Enter Password");
		document.Form1.txtpassword.focus();
		document.Form1.txtpassword.value="";
		return false
	}
	else
	{
	if (checkpasslength() == false)
	{
		alert('Password Should Contain minimum 6 Characters...');
		document.Form1.txtpassword.focus();
		return false
	}
	else if (checkpasslength() == "sp")
	{
		alert('Special Characters Now Allowed in Password Field...');
		document.Form1.txtpassword.focus();
		return false
	}
	else if (checkpasslength() == "alp")
	{
		alert('Password Should be AlphaNumeric...');
		document.Form1.txtpassword.focus();
		return false
	}
	}
	
	if((document.Form1.txtretype.value =="") || (Trim(document.Form1.txtretype.value)== ""))
	{
		alert("Confirm Password");
		document.Form1.txtretype.focus();
		document.Form1.txtretype.value="";
		return false
	}
	
	if(document.Form1.txtretype.value != document.Form1.txtpassword.value)
	{
		alert("Mismatch Password");
		document.Form1.txtpassword.focus();
		return false
	}
	
	if(document.Form1.txtph1.value == "" && document.Form1.txtph2.value == "" && document.Form1.txtph3.value == "")
	{
		alert("Enter telephone no");
		document.Form1.txtph1.focus();
		return false
	}
	
	if(document.Form1.txtph1.value == "" || document.Form1.txtph2.value == "" || document.Form1.txtph3.value == "")
	{
		alert("Invalid telephone no");
		document.Form1.txtph1.focus();
		return false
	}
	
	if(IsPhone(document.Form1.txtph1.value) == false)
	{
		alert("Invalid telephone no");
		document.Form1.txtph1.focus();
		return false
	}
	
	if(IsPhone(document.Form1.txtph2.value) == false)
	{
		alert("Invalid telephone no");
		document.Form1.txtph2.focus();
		return false
	}
	
	if(IsPhone(document.Form1.txtph3.value) == false)
	{
		alert("Invalid telephone no");
		document.Form1.txtph3.focus();
		return false
	}
	
	var phon1 = document.Form1.txtph1.value;
	var phon2 = document.Form1.txtph2.value;
	var phon3 = document.Form1.txtph3.value;
	
	if(phon1.length != 3)
	{
		alert("Invalid telephone no");
		document.Form1.txtph1.focus();
		return false
	}
	if(phon2.length != 3)
	{
		alert("Invalid telephone no");
		document.Form1.txtph2.focus();
		return false
	}
	if(phon3.length != 4)
	{
		alert("Invalid telephone no");
		document.Form1.txtph3.focus();
		return false
	}

	if(document.Form1.txtzipcode.value == "")
	{
		alert("Enter Zipcode");
		document.Form1.txtzipcode.focus();
		return false
	}
	
	if(document.Form1.txtzipcode.value != "")
	{
		if(IsPostal(document.Form1.txtzipcode.value) == false)
		{
			alert("Invalid Zipcode");
			document.Form1.txtzipcode.focus();
			return false
		}
	}
	
	return true
}

 function IsPostal(strString)
   //  check for valid numeric strings
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;
   
   if (strString.length > 5)
   {
	 blnResult = false;
	 return blnResult;
   }

//  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function IsPhone(strString)
   //  check for valid numeric strings
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

//  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function checkusername()
{
	 Evalue	=	document.Form1.txtuname.value;
	 Elength=Evalue.length;
	 var chars =0;
	 var ints=0;
	 var strChar;
	 if (Elength  < 6)
		{
			return false
		}
	  else if (Elength  > 14)
		{
			return false
		}
	 var strValidnumbers = "0123456789";
	 var strValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
	 for (i =0; i < Elength ;i++)
		{
		strChar = Evalue.charAt(i);
		if (strValidChars.indexOf(strChar) != -1)
         {
			chars = "c";
         }
		 else if (strValidnumbers.indexOf(strChar) != -1)
         {
			ints = "i";
         }
         else
         {
            return "sp";
         }
        
        }
        if (chars == 0)
         {
			return "alp";
         }
         else if (ints == 0)
         {
			return "alp";
         }
         else
         {
			return true
         }
}

function checkpasslength()
   {
	 Evalue	=	document.Form1.txtpassword.value;
	 Elength=Evalue.length;
	 var chars =0;
	 var ints=0;
	 var strValidnumbers = "0123456789";
	 var strValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	 var strChar;
	 
	 if (Elength  < 6)
		{
			return false
		}
	 for (i =0; i < Elength ;i++)
		{
		strChar = Evalue.charAt(i);
		if (strValidChars.indexOf(strChar) != -1)
         {
			chars = "c";
         }
		 else if (strValidnumbers.indexOf(strChar) != -1)
         {
			ints = "i";
         }
         else
         {
            return "sp";
         }
        
        }
         
       	 if (chars == 0)
         {
			return "alp";
         }
         else if (ints == 0)
         {
			return "alp";
         }
         else
         {
			return true
         }
   }
   
   function isValidEmail(val)
	{
		 var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
		 if (!val.match(re))
			{
		    return false;
			} 
		else 
			{
        return true;
			}
	}
	
	function chk_txt1()
	{
		var phon1 = document.Form1.txtph1.value;
		if (phon1.length == 3)
		{
			document.Form1.txtph2.focus();
		}
		
		if(IsPhone(document.Form1.txtph1.value) == false)
		{
			alert("Invalid telephone no");
			document.Form1.txtph1.focus();
			return false
		}
	}
	
	function chk_txt2()
	{
		var phon2 = document.Form1.txtph2.value;
		if (phon2.length == 3)
		{
			document.Form1.txtph3.focus();
		}
		
		if(IsPhone(document.Form1.txtph2.value) == false)
		{
			alert("Invalid telephone no");
			document.Form1.txtph2.focus();
			return false
		}
	}
	
	function chk_txt3()
	{
		var phon3 = document.Form1.txtph3.value;
		if (phon3.length == 4)
		{
			//document.Form1.txtrequest.focus();
		}
		
		if(IsPhone(document.Form1.txtph3.value) == false)
		{
			alert("Invalid telephone no");
			document.Form1.txtph3.focus();
			return false
		}
	}
