﻿// JScript File

function Register()
{


 


if (document.frmreg.txtcustname.value=='')
{
alert('Enter Name');
document.frmreg.txtcustname.focus();
return false;
}



if (document.frmreg.txtstreet.value=='')
{
alert('Enter Street Details');
document.frmreg.txtstreet.focus();
return false;
}
if (document.frmreg.txtarea.value=='')
{
alert('Enter Area');
document.frmreg.txtarea.focus();
return false;
}



if (document.frmreg.txtcity.value=='')
{
alert('Enter City ');
document.frmreg.txtcity.focus();
return false;
}

if(document.frmreg.ddlstate.value=='-1')
 {
   alert("Select State");		
   return false;
 }
 
if(document.frmreg.ddlQues.value=='-1')
 {
    alert("Select Question");		
     return false;
 }

if (document.frmreg.txtanswer.value=='')
{
alert('Enter Answer');
document.frmreg.txtanswer.focus();
return false;
}

if(document.frmreg.ddlstate.value=='-1')
 {
   alert("Select State");		
   return false;
 }
if (document.frmreg.txtemail.value!='') 
 {  
    var emailStr=document.getElementById("txtemail").value;
       // checks if the e-mail address is valid
    var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
    var matchArray = emailStr.match(emailPat);
    if (matchArray == null) 
     {
       alert("Your email address incorrect");
       return false;
     }
    
      
   

}




}







