// JavaScript Document
function fill_caste(religion)
{
	var xmlHttp;
	xmlHttp = ajaxHandler();
	if(xmlHttp==null)
	{
		alert("Your browser not support Ajax");
	}
	xmlHttp.onreadystatechange=function()
    {
	  if(xmlHttp.readyState==4)
      {
	    document.getElementById("caste_part").innerHTML = xmlHttp.responseText
	  }	
    }
  xmlHttp.open("GET","Ajax/CasteAjax.php?religion="+religion.value,true);
  xmlHttp.send(null); 
}
function CheckOption(case_val)
{
	document.getElementById("more_cases").style.display='none';
	if(case_val=="2")
		document.getElementById("more_cases").style.display='block';
}
function SelectState(country_val)
{
	document.getElementById("residing_state").disabled=true;
	if(country_val==88)
		document.getElementById("residing_state").disabled=false;
}
function register_validate(form)
{
	if(form.email_id.value=='')
	{
		alert("Email id must be provided");
		form.email_id.focus();
		return false;
	}
	else if(!emailCheck(form.email_id.value))
	{
		form.email_id.select();
		return false;
	}
	if(form.password.value=='')
	{
		alert("Password must be provided");
		form.password.focus();
		return false;
	}
	else if(form.password.value != form.c_password.value)
	{
		alert("Passwords did not match");
		form.password.select();
		return false;
	}
	if(form.form_filled_by.value=='')
	{
		alert("Form filled by must be choosen");
		form.form_filled_by.focus();
		return false;
	}
	if(form.firstname.value=='')
	{
		alert("Firstname must be provided");
		form.firstname.focus();
		return false;
	}
	else if(form.firstname.value.match(/[^a-zA-Z. ]/))
	{
		alert("Invalid Firstname");
		form.firstname.select();
		return false;
	}
	if(form.lastname.value=='')
	{
		alert("Lastname must be provided");
		form.lastname.focus();
		return false;
	}
	else if(form.lastname.value.match(/[^a-zA-Z. ]/))
	{
		alert("Invalid Lastname");
		form.lastname.select();
		return false;
	}
	if(form.birth_of_day.value=='')
	{
		alert("Day of birth provided");
		form.birth_of_day.focus();
		return false;
	}
	else if(form.birth_of_month.value=='')
	{
		alert("Month of birth provided");
		form.birth_of_month.focus();
		return false;
	}
	else if(form.birth_of_year.value=='')
	{
		alert("Year of birth provided");
		form.birth_of_year.focus();
		return false;
	}
	else if(checkday(form.birth_of_day.value,form.birth_of_month.value,form.birth_of_year.value))
	{
		alert("Check your birth date");
		form.birth_of_day.focus();
		return false;
	}
	if(form.marital_status.value=='')
	{
		alert("Marital status must choosen");
		form.marital_status.focus();
		return false;
	}
	if(form.height.value=='')
	{
		alert("Height must choosen");
		form.height.focus();
		return false;
	}
	if(form.body_type.value=='')
	{
		alert("Body type must choosen");
		form.body_type.focus();
		return false;
	}
	if(form.complextion.value=='')
	{
		alert("Complexion must choosen");
		form.complextion.focus();
		return false;
	}
	if(form.drinking.value=='')
	{
		alert("Drinking style must choosen");
		form.drinking.focus();
		return false;
	}
	if(form.smoking.value=='')
	{
		alert("Smoking style must choosen");
		form.smoking.focus();
		return false;
	}
	if(form.education.value=='')
	{
		alert("Education must choosen");
		form.education.focus();
		return false;
	}
	if(form.occupation.value=='')
	{
		alert("Occupation must choosen");
		form.occupation.focus();
		return false;
	}
	if(form.annual_income.value=='')
	{
		alert("Annual income must choosen");
		form.annual_income.focus();
		return false;
	}
	if(form.country_origin.value=='')
	{
		alert("Country origin must choosen");
		form.country_origin.focus();
		return false;
	}
	if(form.country_citizen.value=='')
	{
		alert("Country citizenship must choosen");
		form.country_citizen.focus();
		return false;
	}
	if(form.country_reside.value=='')
	{
		alert("Residing country must choosen");
		form.country_reside.focus();
		return false;
	}
	if( !(form.residing_state.disabled) && form.residing_state.value=='')
	{
		alert("Residing state must choosen");
		form.residing_state.focus();
		return false;
	}
	if(form.residence_status.value=='')
	{
		alert("Residence status must choosen");
		form.residence_status.focus();
		return false;
	}
	if(form.community.value=='')
	{
		alert("Community must choosen");
		form.community.focus();
		return false;
	}
	if(form.mother_tongue.value=='')
	{
		alert("Mother tongue must choosen");
		form.mother_tongue.focus();
		return false;
	}
	if(form.family_values.value=='')
	{
		alert("Family values must choosen");
		form.family_values.focus();
		return false;
	}
	if(form.contact_no.value=='')
	{
		alert("Contact number must choosen");
		form.contact_no.focus();
		return false;
	}
	if(form.yourself.value.trim()=='')
	{
		alert("Describe yourself");
		form.yourself.focus();
		return false;
	}
}

