var xmlHttp


function checkcs()
{
        var conpaslen = document.regform1.conpass.value;
	   if(document.regform1.rname.value == '' || (document.regform1.rname.value.search('[ ]') == 0))
			  {
				  alert("Enter Name");
				  document.regform1.rname.value = '';
				  document.regform1.rname.focus();
				  return false;
				  
			  }
	     else if(document.regform1.rda.value == 'DD')
			  {
				  alert("Select Valid Date");
				  document.regform1.rda.focus();
				  return false;
				  
			  }		
	      else if(document.regform1.rmon.value == 'MM')
			  {
				  alert("Select Valid Month");
				  document.regform1.rmon.focus();
				  return false;
				  
			  }		
		   else if(document.regform1.rye.value == 'YY')
			  {
				  alert("Select Valid Year");
				  document.regform1.rye.focus();
				  return false;
				  
			  }		
			else if(document.regform1.mtongue.value == '-1')
			  {
				  alert("Select Valid Mother Tongue");
				  document.regform1.mtongue.focus();
				  return false;
				  
			  }		  
			else if(document.regform1.rel.value == '-1')
			  {
				  alert("Select Valid Religion");
				  document.regform1.rel.focus();
				  return false;
				  
			  }		
			else if(document.regform1.cas.value == '-1')
			  {
				  alert("Select Valid Caste");
				  document.regform1.cas.focus();
				  return false;
				  
			  }	
			 else if(document.regform1.country.value == '-1')
			  {
				  alert("Select Valid Country Livinig In");
				  document.regform1.country.focus();
				  return false;
				  
			  }		    
			else if(document.regform1.cmobile.value == '' || (document.regform1.cmobile.value.search('[ ]') == 0))
			  {
				  alert("Enter Mobile Number");
				  document.regform1.cmobile.value = '';
				  document.regform1.cmobile.focus();
				  return false;
			  }
			  else if(document.regform1.conemail.value == '' || (document.regform1.conemail.value.search('[ ]') == 0))
			  {
				  alert("Enter Valid Email Id");
				  document.regform1.conemail.focus();
				  return false;
				  
			  }	
			 
			  else if(
	(document.regform1.conpass.value == '' || (document.regform1.conpass.value.search('[ ]') == 0)) || ((conpaslen.length)<6))
			  {
				  alert("Enter Valid Password & Password Must Minimum 6 Characters");
				  document.regform1.conpass.focus();
				  return false;
				  
			  }		    
			else
			  {
				  xmlHttp=GetXmlHttpObject()
				  if (xmlHttp==null)
				   {
					    alert ("Browser does not support HTTP Request")
						 return
				   }
				   str = document.regform1.rname.value;
				  // alert("came"+str);
				   str1 = document.regform1.rye.value +"-"+document.regform1.rmon.value+"-"+document.regform1.rda.value;
				    //alert("came"+str1);
				   str2 = document.regform1.cmobile.value;
				   //alert("came"+str2);
				    url = "including_files/tempregiexcheck.php?nam="+str+"&dobdt="+str1+"&mobi="+str2
					
					url=url+"&sid="+Math.random()
					xmlHttp.onreadystatechange=regiexcheck
					xmlHttp.open("GET",url,true)
					xmlHttp.send(null)
			  }
			  

		  
        /*
		else if(document.regform1.scas.value == -1)
           {
             alert("Select Valid Sub Caste/Gothram");
             document.regform1.scas.focus();
             return false;
           }
		   */
}

function regiexcheck()
{
	if (xmlHttp.readyState==4 )
 {
//document.myForm.cas.value=xmlHttp.responseText;
//alert(xmlHttp.responseText)
var a = Number(xmlHttp.responseText)


    if(a == 0)
	{
		document.regform1.submit();
	}
	else
	{
		alert ("Given Details are Already Registerd As : NET "+ a + " Signin to Proceed with your Registration");
		document.regform1.rname.value = "";
		document.regform1.rda.value = "DD";
		document.regform1.rmon.value ="MM";
		document.regform1.rye.value = "YY";
		document.regform1.cmobile.value = "";
		document.regform1.rname.focus();
		return false
	}
	

 }
}

function agecal()
{
if(document.regform1.rda.value == "DD")
{
//alert("Select the Valid Date")
document.regform1.rda.focus();
}
else if(document.regform1.rmon.value == "MM")
{
//alert("Select the Valid Month")
document.regform1.rmon.focus();
}
else if(document.regform1.rye.value == "YY")
{
//alert("Select the Valid Year")
document.regform1.rye.focus();
}
else
{
var cdb;
cdb = document.regform1.rye.value+-+document.regform1.rmon.value+-+document.regform1.rda.value;
//alert(cdb)
//showage(cdb)
//document.regform1.roob.focus();
}
}



function chmt()
{
var mton1;

mton1 = document.regform1.mtongue.value;

      if (mton1 == 20)

      {

      document.regform1.mtother.readOnly = false;

      document.regform1.mtother.value = "";

      document.regform1.mtother.focus();

      }

      else

      {

      document.regform1.mtother.readOnly = true;

      document.regform1.mtother.value = "Nil";

      }
}

function showage(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 url = "including_files/agedisp.php?r="+str
 url=url+"&sid="+Math.random()

xmlHttp.onreadystatechange=aged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function aged()
{
if (xmlHttp.readyState==4 )
 {
//document.myForm.cas.value=xmlHttp.responseText;

document.regform1.rage.value=xmlHttp.responseText
 }
}



function chscas()
{
var sca1
sca1 = document.regform1.scas.value;
//alert(sca1)
             if ((sca1 == -2))
               {
               document.regform1.rscother.readOnly = false;
               document.regform1.rscother.value = "";
               document.regform1.rscother.focus();
               }
               else
               {
               document.regform1.rscother.readOnly = true;
               document.regform1.rscother.value ="Nil";
               }
}






function shcas()
{

var re1
var b
b = document.regform1.rel.value
//alert("came here"+b)
//alert(document.regform1.rel.value)
//document.getElementById("scastd").innetHTML = "" ;
              /* if (re1 == 4)
               {
               document.regform1.rrother.readOnly = false;
               document.regform1.rrother.value = "";
               document.regform1.rrother.focus();
               }
               else
               {
               document.regform1.rrother.readOnly = true;
               document.regform1.rrother.value = "Nil";
               }*/
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
   alert ("Browser does not support HTTP Request")
   return
   }
url = "including_files/rcastedisp.php?r="+b+"&nreg=1"
 url=url+"&sid="+Math.random()
document.getElementById("regcaste").innerHTML = '<img src="images/ajloader.gif" border="0"> Please Wait Loading';
xmlHttp.onreadystatechange=castdisp
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
               
}

function castdisp()
{
if (xmlHttp.readyState==4 )
 {
//document.myForm.cas.value=xmlHttp.responseText;

document.getElementById("regcaste").innerHTML=xmlHttp.responseText
//document.getElementById("scastd").innerHTML="<select name=scas class=textfeild><option value=-1>Select Subcaste / Gothram</option></select>"
 }
}

function shscas()
{
var ca1
ca1 = document.regform1.cas.value ;
//alert(ca1);
/*
               if ((ca1 == 507)||(ca1 == 508) || (ca1 == 509))
                {
                document.regform1.rcother.readOnly = false;
                document.regform1.rcother.value = "";
                document.regform1.rcother.focus();
                }
                else
                {
                document.regform1.rcother.readOnly = true;
                document.regform1.rcother.value = "Nil";
                }
                
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 url = "including_files/rsubcastedisp.php?r="+ca1
 url=url+"&sid="+Math.random()

xmlHttp.onreadystatechange=sucas
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
*/
}

function sucas()
{
if (xmlHttp.readyState==4 )
 {
//document.myForm.cas.value=xmlHttp.responseText;
document.getElementById("scastd").innerHTML=xmlHttp.responseText
 }
}


function chscas()
{
var sca1
sca1 = document.regform1.scas.value;
//alert(sca1)
             if ((sca1 == -2))
               {
               document.regform1.rscother.readOnly = false;
               document.regform1.rscother.value = "";
               document.regform1.rscother.focus();
               }
               else
               {
               document.regform1.rscother.readOnly = true;
               document.regform1.rscother.value ="Nil";
               }
}

function chedu()
{
var edu1
edu1 = document.regform2.education.value;
//alert (edu1);
        if (edu1 == 6)
        {
        document.regform2.eduother.readOnly = false;
        document.regform2.eduother.value = "";
        document.regform2.eduother.focus();
        }
        else
        {
        document.regform2.eduother.readOnly = true;
        document.regform2.eduother.value = "Nil";
        }
}

function edudetcheck()
{
  if(document.regform2.edudetail.value == "(Eg., M.Sc., PGDCA)")
    {
    document.regform2.edudetail.value = "";
    }
}

function choccu()
{
var occu1
occu1 = document.regform2.occupation.value;
//alert(occu1)
   if (occu1 == 6 || occu1 == 0)
   {
	   
	   if (occu1 == 6)
	   {
         document.regform2.occuother.readOnly = false;
         document.regform2.occuother.value = "";
         document.regform2.occuother.focus();
	   }
	 else
	   {
		 document.regform2.occuother.readOnly = true;
         document.regform2.occuother.value = "Nil";
	   }
   document.regform2.designation.value ="Nil";
   document.regform2.income.value = "0";
   document.regform2.aincome.value = "0";
   document.regform2.company.value = "Nil";
   document.regform2.caddress.value = "Nil";
   document.regform2.ccity.value = "Nil";
   document.regform2.cdist.value = 0;
   document.regform2.cdistother.value = "Nil";
   document.regform2.cstate.value = 0;
   document.regform2.cstateother.value = "Nil";
   document.regform2.ccountry.value = 0;
   document.regform2.ccountryother.value = "Nil";
   document.regform2.cpincode.value = 0;
   document.regform2.cisd.value = 0;
   document.regform2.cstd.value =0;
   document.regform2.cphone.value = "Nil";
   document.regform2.cmobile.value = "Nil";
   document.regform2.oemail.value = "Nil";
   }
    
    else
   {
   document.regform2.occuother.readOnly = true;
   document.regform2.occuother.value = "Nil";
   document.regform2.designation.value ="";
   document.regform2.income.value = "";
   document.regform2.aincome.value = "";
   document.regform2.company.value = "";
   document.regform2.caddress.value = "";
   document.regform2.ccity.value = "";
   document.regform2.cdist.value = -1;
   document.regform2.cdistother.value = "";
   document.regform2.cstate.value = -1;
   document.regform2.cstateother.value = "";
   document.regform2.ccountry.value = -1;
   document.regform2.ccountryother.value = "";
   document.regform2.cpincode.value = "";
   document.regform2.cisd.value = "";
   document.regform2.cstd.value = "";
   document.regform2.cphone.value = "";
   document.regform2.cmobile.value = "";
   document.regform2.oemail.value = "";

   }
}


function chcdist()
{
var cdis1
cdis1 = document.regform2.cdist.value;
//alert(cdis1);
   if (cdis1 == 120)
    {
    document.regform2.cdistother.readOnly = false;
    document.regform2.cdistother.value = "";
    document.regform2.cdistother.focus();
    }
    else
    {
    document.regform2.cdistother.readOnly = true;
    document.regform2.cdistother.value = "Nil";
    }
}

function chcstat()
{
var csta1
csta1 = document.regform2.cstate.value;
//alert(csta1);
       if (csta1 == 32)
       {
       document.regform2.cstateother.readOnly = false;
       document.regform2.cstateother.value = "";
       document.regform2.cstateother.focus();
       }
       else
       {
       document.regform2.cstateother.readOnly = true;
       document.regform2.cstateother.value = "Nil";
       }
}

function chccountry()
{
var ccou1
ccou1 = document.regform2.ccountry.value;
      if (ccou1 == 261)
      {
      document.regform2.ccountryother.readOnly = false;
      document.regform2.ccountryother.value = "";
      document.regform2.ccountryother.focus();
      }
      else
      {
      document.regform2.ccountryother.readOnly = true;
      document.regform2.ccountryother.value = "Nil";
      }
}

function marsel1()
{
if (document.regform4.marany.checked)
{
var j=0;
var cmar = "";
for(j=0;j<document.regform4.mar.length;j++)
{
 document.regform4.mar[j].checked = false
 if (cmar == "")
   {
  cmar += document.regform4.mar[j].value
  }
  else
  {
  cmar += "," + document.regform4.mar[j].value
  }
}
}
else
{
cmar = "";
}
document.regform4.mari.value = cmar;
}

function marsel()
{
document.regform4.marany.checked = false;
//alert(document.edusear.mar.length);
var j=0;
var cmar = "";
for(j=0;j<document.regform4.mar.length;j++)
{
 if(document.regform4.mar[j].checked)
 {
   if (cmar == "")
   {
  cmar += document.regform4.mar[j].value
  }
  else
  {
  cmar += "," + document.regform4.mar[j].value
  }
  }
}
document.regform4.mari.value = cmar;
}

function edusel1()
{
if(document.regform4.eduany.checked)
{
var i=0;
var cedu = "";
for(i=0;i<document.regform4.educ.length;i++)
{
document.regform4.educ[i].checked = false;
   if (cedu == "")
   {
  cedu += document.regform4.educ[i].value
  }
  else
  {
  cedu += "," + document.regform4.educ[i].value
  }
}
}
else
{
cedu = "";
}
document.regform4.edu.value= cedu;
}

function edusel()
{
document.regform4.eduany.checked = false;
//alert(document.edusear.edu.length);
var i=0;
var cedu = "";
for(i=0;i<document.regform4.educ.length;i++)
{
 if(document.regform4.educ[i].checked)
 {
   if (cedu == "")
   {
  cedu += document.regform4.educ[i].value
  }
  else
  {
  cedu += "," + document.regform4.educ[i].value
  }
  }
}
document.regform4.edu.value = cedu;
}



function jobsel1()
{
if (document.regform4.jobany.checked)
{
var k=0;
var cjob = "";
for(k=0;k<document.regform4.jobc.length;k++)
{
document.regform4.jobc[k].checked = false;
   if (cjob == "")
   {
  cjob += document.regform4.jobc[k].value
  }
  else
  {
  cjob += "," + document.regform4.jobc[k].value
  }
}
}
else
{
cjob = "";
}
document.regform4.job.value = cjob;
}



function jobsel()
{
//alert(document.edusear.edu.length);
var k=0;
var cjob = "";
document.regform4.jobany.checked = false;
for(k=0;k<document.regform4.jobc.length;k++)
{
 if(document.regform4.jobc[k].checked)
 {
   if (cjob == "")
   {
  cjob += document.regform4.jobc[k].value
  }
  else
  {
  cjob += "," + document.regform4.jobc[k].value
  }
  }
}
document.regform4.job.value = cjob;
}

function checkpack()
{
if(document.regform4.mari.value == "")
{
alert ("Select Marital Expectation")
document.regform4.marany.focus();
return false;
}
if(document.regform4.edu.value == "")
{
alert ("Select Educational Expectation")
document.regform4.eduany.focus();
return false;
}
if(document.regform4.job.value == "")
{
alert ("Select Occupational Expectation")
document.regform4.jobany.focus();
return false;
}
if(document.regform4.otherexp.value == "")
{
document.regform4.otherexp.value = "Nil";
}
if(document.regform4.mempackage.value == "")
  {
  alert ("Select Any One Membership Package");
  document.regform4.msid[0].focus();
  return false;
  }
}

function packcheck()
{
var i=0;

    for(i=0;i<document.regform4.msid.length;i++)
    {
       if (document.regform4.msid[i].checked)
         {
          document.regform4.mempackage.value = document.regform4.msid[i].value;
         }
    }
}

function chcondist()
{
var cdis1
cdis1 = document.regform5.condist.value;
//alert(cdis1);
   if (cdis1 == 120)
    {
    document.regform5.condistother.readOnly = false;
    document.regform5.condistother.value = "";
    document.regform5.condistother.focus();
    }
    else
    {
    document.regform5.condistother.readOnly = true;
    document.regform5.condistother.value = "Nil";
    }
}

function chconstat()
{
var csta1
csta1 = document.regform5.constate.value;
//alert(csta1);
       if (csta1 == 32)
       {
       document.regform5.constateother.readOnly = false;
       document.regform5.constateother.value = "";
       document.regform5.constateother.focus();
       }
       else
       {
       document.regform5.constateother.readOnly = true;
       document.regform5.constateother.value = "Nil";
       }
}

function chconcountry()
{
var ccou1
ccou1 = document.regform5.concountry.value;
      if (ccou1 == 261)
      {
      document.regform5.concountryother.readOnly = false;
      document.regform5.concountryother.value = "";
      document.regform5.concountryother.focus();
      }
      else
      {
      document.regform5.concountryother.readOnly = true;
      document.regform5.concountryother.value = "Nil";
      }
}

function fsub()
{
if (document.regform5.paymode[0].checked == true)
{
//alert (document.regform5.paymode[0].value);
document.regform5.action = "regpaycc.php3";
}
if (document.regform5.paymode[1].checked == true)
{
//alert (document.regform5.paymode[1].value);
document.regform5.action = "registration.php";
}
if (document.regform5.paymode[2].checked == true)
{
//alert (document.regform5.paymode[2].value);
document.regform5.action = "registration.php";
}
if (document.regform5.paymode[3].checked == true)
{
//alert (document.regform5.paymode[3].value);
document.regform5.action = "registration.php";
}

}




function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

