/******************************************
Function name : validMember
Return type : None
Date created :16 Jan 2009
Date last modified : 16 Jan 2009
Author : bharat bhushan
Last modified by : bharat bhushan
Comments : Function will check the policy details entry
User instruction : validform()
******************************************/

function validMember()
{  

      var regEmail = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;

     nm=document.MemberForm.name.value;
     if(nm==0)
			{
			 alert("please enter Name");
			 document.MemberForm.name.value="";
			 document.MemberForm.name.focus();
			 
			 return false;
			 }
     
     nm1=document.MemberForm.c_o_name.value;
     if(nm1==0)
			{
			 alert("please enter Parent/Husband Name");
			 document.MemberForm.c_o_name.value="";
			 document.MemberForm.c_o_name.focus();
			 
			 return false;
			 }   

      nm2=document.MemberForm.address.value;
      if(nm2==0)
			{
			 alert("please enter Complete Postal Address");
			 document.MemberForm.address.value="";
			 document.MemberForm.address.focus();
			 
			 return false;
			 }     

      nm3=document.MemberForm.statename.value;
      if(nm3==0)
			{
			 alert("please enter State");
			 document.MemberForm.statename.value="";
			 document.MemberForm.statename.focus();
			 
			 return false;
			 }   
      nm31=document.MemberForm.city.value;
      if(nm31==0)
			{
			 alert("please Select City");
			 document.MemberForm.city.value="";
			 document.MemberForm.city.focus();
			 
			 return false;
			 }       
     nm4=document.MemberForm.pincode.value;
      if(nm4==0)
			{
			 alert("please enter Pincode");
			 document.MemberForm.pincode.value="";
			 document.MemberForm.pincode.focus();
			 
			 return false;
			 }    

     nm5=document.MemberForm.date.value;
      if(nm5==0)
			{
			 alert("please enter Date of Date of Birth");
			 document.MemberForm.date.value="";
			 document.MemberForm.date.focus();
			 
			 return false;
			 }     

     nm6=document.MemberForm.month.value;
      if(nm6==0)
			{
			 alert("please enter Month of Date of Birth");
			 document.MemberForm.month.value="";
			 document.MemberForm.month.focus();
			 
			 return false;
			 }     

    nm7=document.MemberForm.year.value;
      if(nm7==0)
			{
			 alert("please enter Year of Date of Birth");
			 document.MemberForm.year.value="";
			 document.MemberForm.year.focus();
			 
			 return false;
			 }  
   nm76=document.MemberForm.stdcode.value;
      if(nm76==0)
			{
			 alert("please enter STD Code");
			 document.MemberForm.stdcode.value="";
			 document.MemberForm.stdcode.focus();
			 
			 return false;
			 }      
  nm67=document.MemberForm.phonenumberno.value;
      if(nm67==0)
			{
			 alert("please enter Phone Number");
			 document.MemberForm.phonenumberno.value="";
			 document.MemberForm.phonenumberno.focus();
			 
			 return false;
			 }      
    nm8=document.MemberForm.email.value;
      if(nm8==0)
			{
			 alert("please enter Email-id");
			 document.MemberForm.email.value="";
			 document.MemberForm.email.focus();
			 
			 return false;
			 }  
      else

        {
		var email = document.MemberForm.email.value;	
		var mflag =  email.match(regEmail);	
		if(mflag=='' || mflag==null)
		{
		     alert("please enter your valid Email-id");
			 document.MemberForm.email.value="";
			 document.MemberForm.email.focus();	
                         return false;	
			
		}	
	}
    nm9=document.MemberForm.introducername.value;
    nm10=document.MemberForm.internateuser.checked;
      if(nm9==0 && nm10 == false)
			{
			 alert("please enter Introduced By");
			 document.MemberForm.introducername.value="";
			 document.MemberForm.introducername.focus();
			 
			 return false;
			 }            
}

/******************************************
Function name : getXMLHTTP
Return type : None
Date created : 16 jan 2009
Date last modified : 16 jan 2009
Author : bharat bhushan
Last modified by : bharat bhushan
Comments : Function will populate the drop down menu
User instruction : getXMLHTTP()
******************************************/
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(stateId)
           {		
		//alert(stateId);die;
		var strURL="findState.php?state="+stateId;
//alert("strURL");die;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"

					if (req.status == 200) {				//alert("bharat");die;		
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
