function MM_openBrWindow(theURL,winName,features)
{ 
	  window.open(theURL,winName,features);
}
function checkEmail(emailaddress)
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailaddress.value))
		{
			return (true);
		}
		alert("Please enter your valid email address");
		return (false);
	}
	function checkaddEmail(mf)
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mf.s_email.value))
		{
			return (true);
		}
		alert("Invalid e-mail address! please re-enter");
		return (false);
	}
	function checkaddEmail1(mf)
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mf.email.value))
		{
			return (true);
		}
		alert("Invalid e-mail address! please re-enter");
		return (false);
	}
	function trim(inputString) 
	{
		if (typeof inputString != "string") { return inputString; }
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
		while (ch == " ") 
		{ 
			retValue = retValue.substring(1, retValue.length);
			ch = retValue.substring(0, 1);
		}
		ch = retValue.substring(retValue.length-1, retValue.length);
		while (ch == " ") 
		{
			retValue = retValue.substring(0, retValue.length-1);
			ch = retValue.substring(retValue.length-1, retValue.length);
		}
		while (retValue.indexOf("  ") != -1) 
		{ 
			retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
		}
		return retValue; 
	} 
function NumValidation(strFld)
{
	var valid= "0123456789";
	if (strFld !="")
	{
		var length = strFld.length;
		for(var i=0;i<=length;i++)
		{
			var substring = strFld.substr(i,1);
			if(valid.indexOf(substring)== -1)
			{
				return 0;
			}
		}
	}
	return 1;
}

function updateDay(change,formName,yearName,monthName,dayName)
{	
	
	var form = document.forms[formName];
	var yearSelect = form[yearName];
	var monthSelect = form[monthName];
	var daySelect = form[dayName];
	var year = yearSelect[yearSelect.selectedIndex].value;
	var month = monthSelect[monthSelect.selectedIndex].value;
	var day = daySelect[daySelect.selectedIndex].value;

	if (change == 'month' || (change == 'year' && month == 2))
	{
		var i = 31;
		var flag = true;
		while(flag)
		{
			var date = new Date(year,month-1,i);
			if (date.getMonth() == month - 1)
			{
				flag = false;
			}
			else
			{
				i = i - 1;
			}
		}

		daySelect.length = 0;
		daySelect.length = i;
		var j = 0;
		while(j < i)
		{
			daySelect[j] = new Option(j+1,j+1);
			j = j + 1;
		}
		if (day <= i)
		{
			daySelect.selectedIndex = day - 1;
		}
		else
		{
			daySelect.selectedIndex = daySelect.length - 1;
		}
	}
}

function HaveChildnp()
	{
//		var MARST = document.MatriForm.MARITAL_STATUS.options[document.MatriForm.MARITAL_STATUS.selectedIndex].value;

 

		var CHILDLW = document.MatriForm.NOOFCHILDREN.options[document.MatriForm.NOOFCHILDREN.selectedIndex].value;

		
		if(document.MatriForm.MARITAL_STATUS[0].checked)
		{
		document.MatriForm.NOOFCHILDREN.disabled=true;	
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;									
	    }
		 else if ( document.MatriForm.MARITAL_STATUS[1].checked || document.MatriForm.MARITAL_STATUS[2].checked  || document.MatriForm.MARITAL_STATUS[3].checked  || document.MatriForm.MARITAL_STATUS[4].checked)
		{
		document.MatriForm.NOOFCHILDREN.disabled=false;			
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=false;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=false;											
		}
		
		
		if(document.MatriForm.MARITAL_STATUS[0].checked && document.MatriForm.CHILDLIVINGWITHME[0].checked || document.MatriForm.CHILDLIVINGWITHME[1].checked)
		{
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;											
		}
		

		if(CHILDLW > 0)
		{
			if ( document.MatriForm.MARITAL_STATUS[0].checked)
			{
					if ( (document.MatriForm.CHILDLIVINGWITHME[0].checked || document.MatriForm.CHILDLIVINGWITHME[1].checked) && (!document.MatriForm.CHILDLIVINGWITHME[0].checked || !document.MatriForm.CHILDLIVINGWITHME[1].checked) )
					{
							document.MatriForm.CHILDLIVINGWITHME[0].checked=false;
							document.MatriForm.CHILDLIVINGWITHME[1].checked=false;
							document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
							document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;	
					}
					
		
					
			}
		}

		if(CHILDLW == 0)
		{
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;							
	    }
			 
		else if ( CHILDLW > 1)
		{
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=false;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=false;							
		}
		
		
	}

	function ValidateNo( NumStr, String ) 
	{
 		for( var Idx = 0; Idx < NumStr.length; Idx ++ )
 		{
			 var Char = NumStr.charAt( Idx );
			 var Match = false;

				for( var Idx1 = 0; Idx1 < String.length; Idx1 ++) 
				{
					 if( Char == String.charAt( Idx1 ) ) 
					 Match = true;
				}
				
				if ( !Match ) 
					return false;
 		}

        	return true;
	}


	function ValidateEmail( Email )
	{
		var atCharPresent = false;
		var dotPresent = false;

		for ( var Idx = 0; Idx < Email.length; Idx++ )
		{
			if ( Email.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( Email.charAt ( Idx ) == '.' )
				dotPresent = true;
		}

		if ( !atCharPresent || !dotPresent )
			return false;

		return true;
	}

	function ResetValues( )
	{
		var MatriForm = this.document.MatriFormReg;


		MatriForm.EMAIL.value = "";
		MatriForm.EMAILconfirm.value = "";
		MatriForm.txtp.value = "";
		MatriForm.txtcp.value = "";
		MatriForm.txtname.value = "";
		MatriForm.txtgender.value = "";
		MatriForm.txtmaritalstatus.value = "";
		
		return true;
	}

	
	
	
	// Function to validate all the inputs
	function Validate()
	{
		
		var MatriForm = this.document.MatriForm;	
		// Check E-mail field
		if ( MatriForm.EMAIL.value == "" )
		{
			alert( "Please enter a valid E-mail ID." );
			MatriForm.EMAIL.focus( );
			return false;
		}
		else
		{
			if( !ValidateEmail( MatriForm.EMAIL.value ) )
			{
				alert( "Invalid E-mail " + MatriForm.EMAIL.value );
				MatriForm.EMAIL.focus( );
				return false;
			}
			for ( var Idx = 0; Idx < MatriForm.EMAIL.value.length; Idx++ )
			{
				if ( MatriForm.EMAIL.value.charAt(Idx) == '	' 
					|| MatriForm.EMAIL.value.charAt(Idx) == ' ' 
					|| MatriForm.EMAIL.value.charAt(Idx) == ',' 
					|| MatriForm.EMAIL.value.charAt(Idx) == '/' 
					|| MatriForm.EMAIL.value.charAt(Idx) == '\\' 
					|| MatriForm.EMAIL.value.charAt(Idx) == ';' )
				{
					alert( "Blanks or other invalid characters are not allowed in the e-mail ID / User Name.\n Please enter only one E-mail ID. / User Name" );
					MatriForm.EMAIL.focus( );
					return false;
				}
			}
		}

		if ( MatriForm.EMAILconfirm.value != "" && MatriForm.EMAILconfirm.value == "" )
		{
			alert( "Please confirm E-mail address" );
			MatriForm.EMAILconfirm.focus( );
			return false;
		}

		if ( MatriForm.EMAIL.value != MatriForm.EMAILconfirm.value )
		{
			alert( "E-mail address did not match, please enter a  confirm E-mail" );
			MatriForm.EMAILconfirm.focus( );
			return false;
		}


	// Check Password 
		if ( MatriForm.txtp.value == "" )
		{
			alert( "Please enter a password." );
			MatriForm.txtp.focus( );
			return false;
		}

		if ( MatriForm.txtp.value.length < 4 )
		{
			alert( "Password must be atleast 4 characters." );	
			MatriForm.txtp.focus( );
			return false;
		}

		if ( MatriForm.txtcp.value == "" )
		{
			alert( "Please enter a confirm password." );
			MatriForm.txtcp.focus( );
			return false;
		}

		if ( MatriForm. txtp.value != MatriForm. txtcp.value )
		{
			alert( "Password did not match." );
			MatriForm.txtp.value = "";
			MatriForm.txtcp.value = "";

			MatriForm.txtp.focus( );

			return false;
		}

		tmpPass = MatriForm.txtp.value;

		goodPasswd = 1;

		for( var idx=0; idx< tmpPass.length; idx++ )
		{
			ch = tmpPass.charAt(idx);

			if( !((ch>='a') && (ch<='z')) && !((ch>='A') && (ch<='Z')) && !((ch>=0) && (ch <=9)) )
			{
				goodPasswd = 0;
				break;
			}
		}

		if( goodPasswd ==0 )
		{
			alert( "Password must contains only letters and digits." );
			MatriForm. txtp.value="";
			MatriForm. txtcp.value="";
			MatriForm. txtp.focus();
			return false;
		}
		// Check the Name field
		if ( MatriForm.txt_mobile.value == "" )
		{
			alert( "Please enter mobile no." );
			MatriForm.txt_mobile.focus( );
			return false;
		}
		if(MatriForm.txt_mobile.value!="")
		{
			if(NumValidation(MatriForm.txt_mobile.value)==0)
			{
				alert("Invalid mobile number, Please enter valid mobile number\nValid entries are 0123456789");
				MatriForm.txt_mobile.focus()
				return false;
			}
		}

		// Check the Name field
		if ( MatriForm.txtName.value == "" )
		{
			alert( "Please Enter your name." );
			MatriForm.txtName.focus( );
			return false;
		}

		// Check gender field
		if ( !MatriForm.txtGender[0].checked && !MatriForm.txtGender[1].checked)
		{
			alert("Please Select the gender.");
			MatriForm.txtGender[0].focus( );
			return false;
		}
		if (document.MatriForm.dobMonth.options[document.MatriForm.dobMonth.selectedIndex].text=="-Month-")	
			  	{
				  	alert("Select Month");
					MatriForm.dobMonth.focus();
					return false;
			  	}
			  if (document.MatriForm.dobDay.options[document.MatriForm.dobDay.selectedIndex].text=="-DATE-")	
			  	{
				  	alert("Select Day");
					MatriForm.dobDay.focus();
					return false;
			  	}
			  if (document.MatriForm.dobYear.value=="0")		
			  	{
				  	alert("Select Year");
					MatriForm.dobYear.focus();
					return false;
			  	}
		
		
		
		// Check Marital Status
		if (!MatriForm.MARITAL_STATUS[0].checked && !MatriForm.MARITAL_STATUS[1].checked && !MatriForm.MARITAL_STATUS[2].checked && !MatriForm.MARITAL_STATUS[3].checked)
		{
			alert( "Please Select the Marital Status." );
			MatriForm.MARITAL_STATUS[0].focus( );
			return false;
		}
		
		// Check Language
		if ( MatriForm.Language.selectedIndex == 0 )
		{
			alert( "Please Select your Mother Tongue." );	
			MatriForm.Language.focus( );
			return false;
		}
		
		// Check Religion
		if ( MatriForm.religion.selectedIndex == 0 )
		{
			alert( "Please Select your Religion." );	
			MatriForm.religion.focus( );
			return false;
		}
		
		// Check Religion
		if ( MatriForm.country.selectedIndex == 0 )
		{
			alert( "Please select your Country of Residence." );	
			MatriForm.religion.focus( );
			return false;
		}
		if ( MatriForm.security_code.value == "" )
		{
			alert( "Please enter a security code shown above." );
			MatriForm.security_code.focus( );
			return false;
		}
	
	if( !(MatriForm.txtAccept.checked) )
		{
			alert("Please read and accept the terms and conditions.");
			return false;
		}
	
		return true;
	}

	function caste_disable(obj){		
	if(obj.options[obj.selectedIndex].text != 'Hindu' &&
		obj.options[obj.selectedIndex].text != 'Muslim' &&
		obj.options[obj.selectedIndex].text != 'Christian' &&
		obj.options[obj.selectedIndex].text != 'Jain' &&
		obj.options[obj.selectedIndex].text != 'Sikh'){
	document.MatriFormReg.caste.disabled = true;
	}
	else {
		document.MatriFormReg.caste.disabled = false;
		get_caste(obj.form.religion,0);
	}
}

function caste_disablesearch(obj){		
	if(obj.options[obj.selectedIndex].text != 'Hindu' &&
		obj.options[obj.selectedIndex].text != 'Muslim' &&
		obj.options[obj.selectedIndex].text != 'Christian' &&
		obj.options[obj.selectedIndex].text != 'Jain' &&
		obj.options[obj.selectedIndex].text != 'Sikh'){
	document.MatriFormSearch.caste.disabled = true;
	}
	else {
		document.MatriFormSearch.caste.disabled = false;
		get_caste(obj.form.religion,0);
	}
}
function caste_disablesearchheader(obj){		
	if(obj.options[obj.selectedIndex].text != 'Hindu' &&
		obj.options[obj.selectedIndex].text != 'Muslim' &&
		obj.options[obj.selectedIndex].text != 'Christian' &&
		obj.options[obj.selectedIndex].text != 'Jain' &&
		obj.options[obj.selectedIndex].text != 'Sikh'){
	document.MatriForm.caste.disabled = true;
	}
	else {
		document.MatriForm.caste.disabled = false;
		get_caste(obj.form.religion,0);
	}
}


var caste=new Array();
caste["Hindu"] = ["6000 Niyogi","96K Kokanastha","24 Manai Chettier","Adi Dravida","Agarwal","Anavil Brahmin","Arora","Arya Vysya","Aryasamaj","Audichya Brahmin","Ad Dharmi","Ad Andhra","Adi Karnataka","Agnikula Kshatriya","Agri","Ahom","Ambalavasi","Andipandaram", "Ariyavaisiyar","Arekatica","Araya","Arunthathiyar","Arya Vysya","Ayyaraka","Bahi","Balija Naidu","Bengali","Bengali Brahmin","Bhandari","Billava","Brahmin","Brahmin Bhumihar","Brahmin Goswami","Brahmin Kanada Madhva","Brahmin Kanyakubja","Brahmin Niyogi Nandavariki","Brahmin Saryuparin","Brahmin Tyagi","Bunt","Baduga","Baghel","Gaderiya","Baishnab","Baishya","Baru","Barujibi","Besta Bengali","Bhavsar Kshyatriya","Bhavi","Billava","Bishnoi","Boyer","Brahmbatt Brahmin","Brahmin Anavil","Brahmin Audichya","Brahmin Barendra","Brahmin Bhatt","Brahmin Bengali","Brahmin Bhumihar","Brahmin Brahmbhatt","Brahmin Danua","Brahmin Davadnya","Brahmin Deshastha","Brahmin Dhiman","Brahmin Dravida","Brahmin Goochwali","Brahmin Goswami","Brahmin Gowr","Brahmin Gowd Saraswat","Brahmin Gurukkal","Brahmin Halua","Brahmin Havyaka","Brahmin Iyengar","Brahmin Iyer","Brahmin Jangid","Brahmin Jhadua","Brahmin Jhijhotiya","Brahmin Kannada Madhva","Brahmin Kanyakubja","Brahmin Karhade","Brahmin Kashmiri Pandit","Brahmin Kokanastha","Brahmin Kota","Brahmin Kulin","Brahmin Kumaoni","Brahmin Madhawa","Brahmin Maharashtrian","Brahmin Maithili","Brahmin Modh","Brahmin Mohyal","Brahmin Nagar","Brahmin Namoodiri","Brahmin Narmadiya","Brahmin Niyogi Nandavarki","Brahmin Palwal","Brahmin Panda","Brahmin Pundit","Brahmin Pareek","Brahmin Punjabi","Brahmin Pushkarma","Brahmin Rarhi","Brahmin Rigvedi","Brahmin Rudraj","Brahmin Sakaldwipiya","Brahmin Sanadya","Brahmin Sanketi","Brahmin Saraswat","Brahmin Saryuparin","Brahmin Shivhalli","Brahmin Shrimali","Brahmin Smartha","Brahmin Srivishnava","Brahmin Stanika","Brahmin Tamil","Brahmin Telugu","Brahmin Tyagi","Brahmin Daidiki","Brahmin Vaikhanasa","Brahmin Velanadu","Brahmin Viswa","Brahmin Vyas","Brahmin Other","Buddar","Bunt-Shetty","CKP","Chamber","Chanravanshi Kahar","Chandraseniya Kayastha Pral","Chasa","Chattada Dri Vaishnava","Chaudhary","Chettiar","Chhetri","Chippolu","Coorgi","Chaurasia","Chettiar","Coorgi","Davadnya Brahmin","Dawoodi Bhora","Dawoodi Bhora","Davadiga","Devenga","Deventra Kula Vetlalar","Dhaneshawat Vaish","Dhangar","Dheevara","Dhiman","Dhoba","Dhobi","Digamber","Dumal","Dusadha - Paswan","Deshastha Brahmin","Devanga chettier","Devanga","Dhaneshawat Vaish","Dhiman Brahmin","Digambar","Ediga","Ezhava","Ezhuthachan","Garhwali Brahmins","Garhwali Rajput","Gomantak Maratha","Goswami","Gounder","Gour Brahmin","Gowd Saraswat Brahmin","Gowda","Gujarati","Gupta","Gurjar","Havyaka Brahmin","Iyengar","Iyer","Iyer Brahmin","Jaiswal","Jat","Jangumar","Kalar","Kalinga Vysya","Kamboj","Kamma","Kannada Mogaveera","Kapu","Kapu Naidu","Karhade Brahmin","Karuneekar","Kashmiri Pandit (Brahmin)","Kashyap","Kayastha","Khatri","Kokanastha Brahmin","Kongu Vellala Gounder","Kori","Koshti","Kshatriya","Kumaoni Brahmins","Kumaoni Rajput","Kumawat","Kumbara","Kunbi","Kurmi","Kuruba","Leva Patil","Lingayat","Lohana","Maithil Brahmin","Malayalee Namboodiri","Malayalee Variar","Mali","Maharashtrian","Maharashtrian Brahmin","Maheshwari","Maratha","Maruthuvar","Marvar","Marwari","Maurya","Menon","Meena","Mahajan","Mudaliar","Mudaliar Arcot","Mudaliar Saiva","Mudaliar Senguntha","Mukulathur","Nadar","Nagar Brahmin","Naidu","Nair","Nair Vaniya","Nambiar","Nepali","OBC (Barber-Naayee)","Padmashali","Patel Desai","Patel Kadva","Patel Leva","Perika","Pillai","Prajapati","Punjabi","Punjabi Brahmin","Rajput","Reddy","Saraswat Brahmins","Sahu","Scheduled Caste","Saini","Sepahia","Setti Balija","Sindhi","Somvanshi","Sonar","Sood","Sowrashtra","Sozhiya Vellalar","Sutar","Swarnakar","Tamil Yadava","Teli","Telugu","Telugu Brahmin","Thevar","Thiyya","Udayar","Vaidiki Brahmin","Vaishnav","Vaish","Vaishnav Bhatia","Vaishnav Vania","Varshney","Vanniyakullak Shatriya","Vanniyar","Veerashaiva","Velethadathu Nair","Vellalar","Vellama","Vishwakarma","Viswabrahmin","Vokaliga","Vysya","Yadav", "Vaniya chettier","Vannar","Others"];
caste["Muslim"] = ["Bengali","Dawoodi Bohra","Ehle-Hadith","Memon","Rajput","Shia","Shia Imami Ismaili","Sunni","Others"];
caste["Christian"] = ["Catholic","CMS","CSI","Evangelical","Jacobite","Marthoma","Nadar","Protestant","Syrian","Others"];
caste["Jain"] = ["Digambar","Shewetamber","Vania","Others"];
caste["Sikh"] = ["Clean Shaven","Gursikh","Jat","Kamboj","Kesadhari","Khatri","Ramgharia","Ramdasia","Others"];


	function get_caste(obj,show_default){

		var sel_caste = '';

		var sel_religion	= obj.options[obj.selectedIndex].text;
		var caste_obj		= obj.form.elements["caste"];
		//CLEAN CASTE SELECT BOX
		while ( caste_obj.options.length ) caste_obj.options[0] = null;

		//ADD FIRST SELECT OPTION
		caste_obj.options[0]=new Option("Does not matter","Does not matter",true);


		//ADD CASTE OPTIONS FOR SELECTED RELIGION
		//if(obj.selectedIndex>0){
			for(j=0;j<caste[sel_religion].length;j++){
				//NOT TO INCLUDE OPTIONS HAVING NULL VALUES
				if(caste[sel_religion][j]!=""){
					var caste_val = caste[sel_religion][j]=="Does not matter"?"Does not matter":caste[sel_religion][j];
					var def_sel   = (sel_caste == caste_val) ? true : false;
                    caste_obj.options[j+1] = new Option(caste[sel_religion][j], caste_val, true, def_sel);

				}
			}
		//}

	}

	function updateDay(change,formName,yearName,monthName,dayName) 
{
	var form = document.forms[formName];
	var yearSelect = form[yearName];
	var monthSelect = form[monthName];
	var daySelect = form[dayName];
	var year = yearSelect[yearSelect.selectedIndex].value;
	var month = monthSelect[monthSelect.selectedIndex].value;
	var day = daySelect[daySelect.selectedIndex].value;

	if (change == 'month' || (change == 'year' && month == 2))
	{
		var i = 31;
		var flag = true;
		while(flag)
		{
			var date = new Date(year,month-1,i);
			if (date.getMonth() == month - 1)
			{
				flag = false;
			}
			else
			{
				i = i - 1;
			}
		}

		daySelect.length = 0;
		daySelect.length = i;
		var j = 0;
		while(j < i)
		{
			daySelect[j] = new Option(j+1,j+1);
			j = j + 1;
		}
		if (day <= i)
		{
			daySelect.selectedIndex = day - 1;
		}
		else
		{
			daySelect.selectedIndex = daySelect.length - 1;
		}
	}
}

function clearform()
	{
	MatriForm.txtName.value=""
//	MatriForm.txtDay.value="1"
//	MatriForm.txtMonth.value="1"
//	MatriForm.txtYear.value="1"
	MatriForm.txtGender[0].Checked
	MatriForm.MARITAL_STATUS.value="0"
	MatriForm.NOOFCHILDREN.value="0"

	MatriForm.EMAIL.value=""
	MatriForm.EMAILconfirm.value=""
	MatriForm.txtp.value=""
	MatriForm.txtcp.value=""
	//MatriForm.Accept.unChecked
	}

/* Validation for login form */

function validate_login(mf)
{
	if(trim(mf.email.value)=="")
	{
		alert("Please Enter Either Your Email Address Or Your MATID");
		mf.email.focus();
		return false;
	}
	if(mf.userpassword.value=="")
	{
		alert("Please Enter Your Password");
		mf.userpassword.focus();
		return false;
	}
	return true;
}

function setVisibility(varId,varAction)
{
	document.getElementById(varId).style.display = varAction;
}

function validate_search(MatriForm)
  {
  		 if (MatriForm.txtSAge.value == "" )
		 {
			alert( "Please enter minimum age." );
			MatriForm.txtSAge.focus( );
			return false;
		}
		
		 if ( MatriForm.txtSAge.value < 18 )
		 {
			alert( "Minimum age should be above 18" );
			MatriForm.txtSAge.focus( );
			return false;
		}
		
		
		if ( MatriForm.txtSAge.value > 60 )
		 {
			alert( "Minimum age should not be above 60" );
			MatriForm.txtSAge.focus( );
			return false;
		}
		
		 if ( MatriForm.txtEAge.value == "" )
		 {
			alert( "Please enter maximum Age" );
			MatriForm.ta.focus( );
			return false;
		}
		
		if ( MatriForm.txtEAge.value > 60 )
		 {
			alert( "Maximum Age should be below 60" );
			MatriForm.txtEAge.focus( );
			return false;
		}
		
		if ( MatriForm.txtEAge.value < 18 )
		 {
			alert( "Maximum Age should not be below 18" );
			MatriForm.txtEAge.focus( );
			return false;
		}
	
		if ( MatriForm.religion.selectedIndex == 0 )
		{
			alert( "Please select Religion." );	
			MatriForm.religion.focus( );
			return false;
		}
		
			
}


function check_Age(field_name)
{
	var i, max, field_info
	max = document.MatriFormSearch.field_info.value.length;	
	for (i = 0; i < max; i++)
	{
		if(isNaN(field_info.value.charAt(i)))
		{
			alert("Age must be numeric.");
			field_info.value = "";
			field_info.focus();
			return false;
		}
	}
return true;
}

function Validateprofile(  )
	{
		var MatriForm = this.document.MatriForm;
			
		// Check Education
		if ( MatriForm.txtEdu.selectedIndex == 0 )
		{
			alert( "Please Select your Education." );	
			MatriForm.txtEdu.focus( );
			return false;
		}
		
		// Check Edu details
		if ( MatriForm.txtEdudetails.selectedIndex == 0 )
		{
			alert( "Please Select your Education Details" );	
			MatriForm.txtEdudetails.focus( );
			return false;
		}
		
		
		// Check Occupation
		if ( MatriForm.txtOccu.value == "" )
		{
			alert( "Please Select your Occupation." );	
			MatriForm.txtOccu.focus( );
			return false;
		}
		
		// Check Employed in
		if ( MatriForm.txtEmp.selectedIndex == 0 )
		{
			alert( "Please Select your Employed in status." );	
			MatriForm.txtEmp.focus( );
			return false;
		}
		
		// Check Height
		if ( MatriForm.txtHeight.selectedIndex == 0 )
		{
			alert( "Please Select your Height." );	
			MatriForm.txtHeight.focus( );
			return false;
		}
		
		
		// Check Weight
		if ( MatriForm.txtWeight.selectedIndex == 0 )
		{
			alert( "Please Select your Weight." );	
			MatriForm.txtWeight.focus( );
			return false;
		}
		
		
		// Check Blood Group
		/*if ( MatriForm.txtBlood.selectedIndex == 0 )
		{
			alert( "Please Select your Blood Group." );	
			MatriForm.txtBlood.focus( );
			return false;
		}*/
	
	
		// Check BodyType
		if ( MatriForm.txtBody.selectedIndex == 0 )
		{
			alert( "Please Select your Body type." );	
			MatriForm.txtBody.focus( );
			return false;
		}
		
		
		// Check Complexion
		if ( MatriForm.txtComplexion.selectedIndex == 0 )
		{
			alert( "Please Select your Complexion." );	
			MatriForm.txtComplexion.focus( );
			return false;
		}
		
		
		// Check Address 
		if ( MatriForm.txtAddress.value == "" )
		{
			alert( "Please enter your Address." );
			MatriForm.txtAddress.focus( );
			return false;
		}
		
				// Check City 
		if ( MatriForm.txtCity.value == "" )
		{
			alert( "Please enter your City." );
			MatriForm.txtCity.focus( );
			return false;
		}
			// Check State 
		if ( MatriForm.txtState.value == "" )
		{
			alert( "Please enter your State." );
			MatriForm.txtState.focus( );
			return false;
		}
	// Check any Phone number
		
		return true;
	}


	// Final Step

	function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

	function Validatefinal(  )
	{
		var MatriForm = this.document.MatriForm;
		
	
	
	// Check Looking Field
		
	
		// Check Profile
		if ( MatriForm.txtmsg.value == "" )
		{
			alert( "Please Enter your Profile" );	
			MatriForm.txtmsg.focus( );
			return false;
		}
		
		// Profile Min Chars 
		if ( MatriForm.txtmsg.value.length < 50 )
		{
			alert( "Profile must be atleast 50 chars." );	
			MatriForm.txtmsg.focus( );
			return false;
		}
		
		// Profile Max Chars
		if ( MatriForm.txtmsg.value.length > 1000 )
		{
			alert( "Please do not enter more than 1000 chars. Please shorten your Profile and submit again." );	
			MatriForm.txtmsg.focus( );
			return false;
		}
		




		
		// Check Family Details
		if ( MatriForm.txtFD.value.length > 300 )
		{
			alert( "Please do not enter more than 300 chars. Please shorten your Family Details and submit again." );	
			MatriForm.txtFD.focus( );
			return false;
		}

//Check Father and mother name/////






		
if ( !MatriForm.txtLooking[0].checked && !MatriForm.txtLooking[1].checked && !MatriForm.txtLooking[2].checked && !MatriForm.txtLooking[3].checked)
		{
			alert( "Please Select the Looking for." );
			MatriForm.txtLooking[0].focus( );
			return false;
		}
	

if ( MatriForm.Fromage.value == "" )
		{
			alert( "Please Enter your Expected From Age." );
			MatriForm.Fromage.focus( );
			return false;
		}



if(isNaN(document.MatriForm.Fromage.value)) 
		{ 
		 alert("Age should be only numbers."); 
		document.MatriForm.Fromage.focus();
		 return false; 
		}
		

if(document.MatriForm.Fromage.value < 18 )
		{ 
		 alert("Age should be 18 And Above."); 
		 document.MatriForm.Fromage.focus();
		 return false; 
		}

if ( MatriForm.Toage.value == "" )
		{
			alert( "Please Enter your Expected To Age." );
			MatriForm.Toage.focus( );
			return false;
		}

		
		if(document.MatriForm.Toage.value < 18 )
		{ 
		 alert("Age should be 18 And Above."); 
		 document.MatriForm.Toage.focus();
		 return false; 
		}
if ( MatriForm.religion.selectedIndex == 0 )
		{
			alert( "Please Select your Expected Religion." );	
			MatriForm.religion.focus( );
			return false;
		}


if ( MatriForm.caste.selectedIndex == 0 )
		{
			alert( "Please Select your Expected Caste." );	
			MatriForm.caste.focus( );
			return false;
		}
		
		// Check Partner Expectation details
		if ( MatriForm.txtPPE.value.length > 300 )
		{
			alert( "Please do not enter more than 300 chars. Please shorten your Partner Expectation and submit again." );	
			MatriForm.txtPPE.focus( );
			return false;
		}	
	return true;
	}

/* basic modification */

function caste_disableed(obj){
	if(obj.options[obj.selectedIndex].text != 'Hindu' &&
		obj.options[obj.selectedIndex].text != 'Muslim' &&
		obj.options[obj.selectedIndex].text != 'Christian' &&
		obj.options[obj.selectedIndex].text != 'Jain' &&
		obj.options[obj.selectedIndex].text != 'Sikh'){
	document.MatriForm.caste.disabled = true;
	}
	else {
		document.MatriForm.caste.disabled = false;
		get_caste(obj.form.religion,0);
	}
}

function Validateabou()
	{
		var MatriForm = this.document.MatriForm;
		
	// Check Profile
		if ( MatriForm.txtmsg.value == "" )
		{
			alert( "Please Enter your Profile" );	
			MatriForm.txtmsg.focus( );
			return false;
		}
		
		// Profile Min Chars 
		if ( MatriForm.txtmsg.value.length < 50 )
		{
			alert( "Profile must be atleast 50 chars." );	
			MatriForm.txtmsg.focus( );
			return false;
		}
		
		// Profile Max Chars
		if ( MatriForm.txtmsg.value.length > 1000 )
		{
			alert( "Please do not enter more than 1000 chars. Please shorten your Profile and submit again." );	
			MatriForm.txtmsg.focus( );
			return false;
		}
		return true;
	}

function Check_form() {

var MatriForm = this.document.MatriForm;
// Check Password 
		if ( signupForm.txtp.value == "" )
		{
			alert( "Kindly enter a new password." );
			signupForm.txtp.focus( );
			return false;
		}

		if ( signupForm.txtp.value.length < 4 )
		{
			alert( "Password must be atleast 4 characters." );	
			signupForm.txtp.focus( );
			return false;
		}


		if ( signupForm.txtp.value.length > 20 )
		{
		alert( "Password must be Max 20 characters." );	
		signupForm.txtp.focus( );
		return false;
		}

		if ( signupForm.txtcp.value == "" )
		{
			alert( "Kindly enter a confirm password." );
			signupForm.txtcp.focus( );
			return false;
		}

		if ( signupForm. txtp.value != signupForm. txtcp.value )
		{
			alert( "Password and Confirm password must be same." );
			signupForm.txtp.value = "";
			signupForm.txtcp.value = "";

			signupForm.txtp.focus( );

			return false;
		}

		tmpPass = signupForm.txtp.value;

		goodPasswd = 1;

		for( var idx=0; idx< tmpPass.length; idx++ )
		{
			ch = tmpPass.charAt(idx);

			if( !((ch>='a') && (ch<='z')) && !((ch>='A') && (ch<='Z')) && !((ch>=0) && (ch <=9)) )
			{
				goodPasswd = 0;
				break;
			}
		}

		if( goodPasswd ==0 )
		{
			alert( "Password must contains only letters and digits." );
			signupForm. txtp.value="";
			signupForm. txtcp.value="";
			signupForm. txtp.focus();
			return false;
		}

return true;
}

function validate_message()
  {
 
		if ( form.txtmsg.value == "" )
		 {
			alert( "Please enter Your Message." );
			form.txtmsg.focus( );
			return false;
		}
		
}

function goDel() 
{ 
    var recslen =  document.forms[0].length; 
    var checkboxes="" 
    for(i=1;i<recslen;i++) 
    { 
        if(document.forms[0].elements[i].checked==true) 
        checkboxes+= " " + document.forms[0].elements[i].name 
    } 
    
    if(checkboxes.length>0) 
    { 
        var con=confirm("Are you sure you want to delete"); 
        if(con) 
        { 
            document.forms[0].action="receivemessage_del_submit.php?recsno="+checkboxes 
            document.forms[0].submit() 
        } 
    } 
    else 
    { 
        alert("No message is selected.") 
    } 
} 

function selectall() 
{ 
//        var formname=document.getElementById(formname); 

        var recslen = document.forms[0].length; 
        
        if(document.forms[0].topcheckbox.checked==true) 
            { 
                for(i=1;i<recslen;i++) { 
                document.forms[0].elements[i].checked=true; 
                } 
    } 
    else 
    { 
        for(i=1;i<recslen;i++) 
        document.forms[0].elements[i].checked=false; 
    } 
} 

// Secton for sent message

function goDel_sent() 
{ 
    var recslen =  document.forms[0].length; 
    var checkboxes="" 
    for(i=1;i<recslen;i++) 
    { 
        if(document.forms[0].elements[i].checked==true) 
        checkboxes+= " " + document.forms[0].elements[i].name 
    } 
    
    if(checkboxes.length>0) 
    { 
        var con=confirm("Are you sure you want to delete"); 
        if(con) 
        { 
            document.forms[0].action="sentmessage_del_submit.php?recsno="+checkboxes 
            document.forms[0].submit() 
        } 
    } 
    else 
    { 
        alert("No message is selected.") 
    } 
} 

function selectall_sent() 
{ 
//        var formname=document.getElementById(formname); 

        var recslen = document.forms[0].length; 
        
        if(document.forms[0].topcheckbox.checked==true) 
            { 
                for(i=1;i<recslen;i++) { 
                document.forms[0].elements[i].checked=true; 
                } 
    } 
    else 
    { 
        for(i=1;i<recslen;i++) 
        document.forms[0].elements[i].checked=false; 
    } 
} 

function validate_educational()
  {
  		 if ( MatriForm.txtSAge.value == "" )
		 {
			alert( "Please enter minimum age." );
			MatriForm.txtSAge.focus( );
			return false;
		}
		
		 if ( MatriForm.txtSAge.value < 18 )
		 {
			alert( "Minimum age should be above 18" );
			MatriForm.txtSAge.focus( );
			return false;
		}
		
		
		if ( MatriForm.txtSAge.value > 40 )
		 {
			alert( "Minimum age should not be above 40" );
			MatriForm.txtSAge.focus( );
			return false;
		}
		
		 if ( MatriForm.txtEAge.value == "" )
		 {
			alert( "Please enter maximum Age" );
			MatriForm.ta.focus( );
			return false;
		}
		
		if ( MatriForm.txtEAge.value > 40 )
		 {
			alert( "Maximum Age should be below 40" );
			MatriForm.txtEAge.focus( );
			return false;
		}
		
		if ( MatriForm.txtEAge.value < 18 )
		 {
			alert( "Maximum Age should not be below 18" );
			MatriForm.txtEAge.focus( );
			return false;
		}
	
		if ( MatriForm.religion.selectedIndex == 0 )
		{
			alert( "Please select Religion." );	
			MatriForm.religion.focus( );
			return false;
		}
		
			
}
function validatematri()
  {
		if (form.txtID.value == "" )
		 {
			alert( "Matri Id Required." );
			form.txtID.focus( );
			return false;
		}
}
function validate_img(mf)
{
	if(mf.image_upload.value=="")
	{
		alert("Please select image for modification");
		mf.image_upload.focus();
		return false;
	}
	return true;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function Check_form_share() {


 if(document.form1.name.value == "") {
alert("Kindly enter your Name.");
document.form1.name.focus();
return false;
}


if(document.form1.email.value == "" ) {
alert("Kindly enter your E-mail ID.");
document.form1.email.focus();
return false;
}


else if (document.form1.email.value.length != 0)
{
	var e_check  = document.form1.email.value;

	if(document.form1.email.value.indexOf(" ") != -1)	{
	alert("Kindly enter correct E-Mail ID without any spaces in it.");
	document.form1.email.focus();
	return false;
	}

	if(document.form1.email.value.indexOf("@") == -1)	{
	alert("Invalid E-Mail ID! Kindly enter correct E-Mail ID.");
	document.form1.email.focus();
	return false;
	}
   	validarr = document.form1.email.value.split("@");

   	if(validarr[0].length==0)   	{
   	alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
   	document.form1.email.focus();
   	return false;
   	}
  	if(validarr[1].indexOf("@") >=0)   	{
   	alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
   	document.form1.email.focus();
   	return false;
   	}
   	if(validarr[1].length==0)   	{
   	alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
   	document.form1.email.focus();
   	return false;
   	}
   	if(validarr[1].length != 0)   	{

		if(validarr[1].indexOf(".") == -1)     	{
		alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
		document.form1.email.focus();
		return false;
		}
		validemail = validarr[1].split(".");
		 if(validemail[0].length==0)   		{
		 alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
		 document.form1.email.focus();
		 return false;
		}
		if(validemail[1].length==0)  		{
		alert("Invalid E-Mail ID! Kindly enter the correct E-mail ID.");
		document.form1.email.focus();
		return false;
		}
	}   // end of of validemail
} // end of valid email-id check

if(document.form1.phone.value == "") {
alert("Kindly enter your Phone no.");
document.form1.phone.focus();
return false;
}




if(document.form1.comments.value == "" ) {
alert("Kindly enter your Comments.");
document.form1.comments.focus();
return false;
}

if ( !form1.rating[0].checked && !form1.rating[1].checked && !form1.rating[2].checked && !form1.rating[3].checked && !form1.rating[4].checked)
		{
			alert( "Kindly select your rating" );
		form1.rating[4].focus( );
		return false;
		}

return true;
}

function validate_searchform(mf)
{
	if(mf.username.value=="")
	{
		alert("Please enter Either User Name or Email Address");
		mf.username.focus();
		return false;
	}
	return true;
}


function MM_findObj_1(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_validateForm_contact() { //v4.0

  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm_contact.arguments;

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj_1(args[i]);

    if (val) { nm=val.name; if ((val=val.value)!="") {

      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

      } else if (test!='R') { num = parseFloat(val);

        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

          min=test.substring(8,p); max=test.substring(p+1);

          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

  } if (errors) alert('The following error(s) occurred:\n'+errors);

  document.MM_returnValue = (errors == '');

}

function valid_MAT(mf)
{
	if(mf.matid.value=="")
	{
		alert("Please enter MATID");
		mf.matid.focus();
		return false;
	}
	return true;
}

/* Step2 */

function check_phone(field_name)
{
	var i, max, field_info
	field_info = eval("document.MatriForm." + field_name);
	max = field_info.value.length;
	
	for (i = 0; i < max; i++)
	{
		if(isNaN(field_info.value.charAt(i)))
		{
			alert("You Must Enter A Number.");
			field_info.value = "";
			field_info.focus();
			return false;
		}
	}
			return true;
}

function Validate_step2()
	{
		var MatriForm = this.document.MatriForm;
			
		// Check Education
		if ( MatriForm.txtEdu.selectedIndex == 0 )
		{
			alert( "Please Select your Education." );	
			MatriForm.txtEdu.focus( );
			return false;
		}
		
		// Check Edu details
		if ( MatriForm.txtEdudetails.selectedIndex == 0 )
		{
			alert( "Please Select your Education Details" );	
			MatriForm.txtEdudetails.focus( );
			return false;
		}
		
		
		// Check Occupation
		if ( MatriForm.txtOccu.value == "" )
		{
			alert( "Please Select your Occupation." );	
			MatriForm.txtOccu.focus( );
			return false;
		}
		
		// Check Employed in
		if ( MatriForm.txtEmp.selectedIndex == 0 )
		{
			alert( "Please Select your Employed in status." );	
			MatriForm.txtEmp.focus( );
			return false;
		}
		
		// Check Height
		if ( MatriForm.txtHeight1.selectedIndex == 0 )
		{
			alert( "Please Select your Height." );	
			MatriForm.txtHeight1.focus( );
			return false;
		}
		
		
		// Check Weight
		if ( MatriForm.txtWeight.selectedIndex == 0 )
		{
			alert( "Please Select your Weight." );	
			MatriForm.txtWeight.focus( );
			return false;
		}
		
		
		// Check Blood Group
		/*if ( MatriForm.txtBlood.selectedIndex == 0 )
		{
			alert( "Please Select your Blood Group." );	
			MatriForm.txtBlood.focus( );
			return false;
		}
	
	
		// Check BodyType
		if ( MatriForm.txtBody.selectedIndex == 0 )
		{
			alert( "Please Select your Body type." );	
			MatriForm.txtBody.focus( );
			return false;
		}*/
		
		// Check Address 
		if ( MatriForm.txtAddress.value == "" )
		{
			alert( "Please enter your Address." );
			MatriForm.txtAddress.focus( );
			return false;
		}

		if ( MatriForm.ResidingState.value == "0" )
		{
			alert( "Please select state." );
			MatriForm.ResidingState.focus( );
			return false;
		}		
				// Check City 
		if ( MatriForm.City.value == "0" )
		{
			alert( "Please select your City." );
			MatriForm.City.focus( );
			return false;
		}
		
		if (MatriForm.txtMobile.value == "" )
		{
			alert( "Please enter mobile no." );
			MatriForm.txtMobile.focus( );
			return false;
		}
		if(MatriForm.txtMobile.value!="")
		{
			if(NumValidation(MatriForm.txtMobile.value)==0)
			{
				alert("Invalid mobile number, Please enter valid mobile number\nValid entries are 0123456789");
				MatriForm.txtMobile.focus()
				return false;
			}
		}
		return true;
}

/* New Validation */

function validate_step1()
{
	var MatriForm = this.document.MatriForm_step1;
	var flag = 1;	
	if(document.getElementById('EMAIL').value.search(/\S/)==-1)
	{
		document.getElementById('errEmail').innerHTML='Required.';
		document.getElementById('EMAIL').focus();
		flag=0;
	}
	else
	{
		document.getElementById('errEmail').innerHTML='';	
	}

   if(document.getElementById('EMAIL').value.search(/\S/)!=-1)
	{
		var x =document.getElementById('EMAIL').value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)==false)
		{	
			document.getElementById('errEmail').innerHTML='Invalid Email.';
			document.getElementById('EMAIL').focus();
			flag=0;
		}
		else
		{
		 document.getElementById('errEmail').innerHTML='';	
		}
	}
	 if(document.getElementById('EMAILconfirm').value.search(/\S/)==-1)
	{
		document.getElementById('errCEmail').innerHTML='Required.';
		document.getElementById('EMAILconfirm').focus();
		flag=0;
	}
	else
	{
		document.getElementById('errCEmail').innerHTML='';	
	}

   if(document.getElementById('EMAILconfirm').value.search(/\S/)!=-1)
	{
		var x =document.getElementById('EMAILconfirm').value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)==false)
		{	
			document.getElementById('errCEmail').innerHTML='Invalid Email.';
			document.getElementById('EMAILconfirm').focus();
			flag=0;
		}
		else
		{
		 document.getElementById('errCEmail').innerHTML='';	
		}
	}
	if(document.getElementById('EMAILconfirm').value.search(/\S/)!=-1)
	 {
		 if(document.getElementById('EMAILconfirm').value != document.getElementById('EMAIL').value)
		 {
			document.getElementById('errCEmail').innerHTML='Email does not match.';
			document.getElementById('EMAILconfirm').focus();
			flag=0;	 
		 }
		 else
		 {
			document.getElementById('errCEmail').innerHTML='';
			
		 }	
	 }
	 if(document.getElementById('txtp').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errPwd').innerHTML='Required';
		document.getElementById('txtp').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errPwd').innerHTML='';
		
	 }
	 if(document.getElementById('txtcp').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errcPwd').innerHTML='Required';
		document.getElementById('txtcp').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errcPwd').innerHTML='';
		
	 }
	 if(document.getElementById('txtcp').value.search(/\S/)!=-1)
	 {
		 if(document.getElementById('txtcp').value != document.getElementById('txtp').value)
		 {
			document.getElementById('errCPwd').innerHTML='Password does not match.';
			document.getElementById('txtcp').focus();
			flag=0;	 
		 }
		 else
		 {
			document.getElementById('errcPwd').innerHTML='';
			
		 }	
	 }
	 if(document.getElementById('txt_mobile').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errMobile').innerHTML='Required.';
		document.getElementById('txt_mobile').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errMobile').innerHTML='';
		
	 }
	 if(document.getElementById('txtAddress').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errAddress').innerHTML='Required.';
		document.getElementById('txtAddress').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errAddress').innerHTML='';
		
	 }
	 if(document.getElementById('txtCountry').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errtxtCountry').innerHTML='Required.';
		document.getElementById('txtCountry').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errtxtCountry').innerHTML='';
		
	 }
	  if(document.getElementById('ResidingState').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errState').innerHTML='Required.';
		document.getElementById('ResidingState').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errState').innerHTML='';
		
	 }
	  if(document.getElementById('City').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errcCity').innerHTML='Required.';
		document.getElementById('City').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errcCity').innerHTML='';
		
	 }

	  if(document.getElementById('country').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errCResidence').innerHTML='Required.';
		document.getElementById('country').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errCResidence').innerHTML='';
		
	 }

	 if(document.getElementById('txtName').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errName').innerHTML='Required.';
		document.getElementById('txtName').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errName').innerHTML='';		
	 }
	 if (MatriForm.txtGender[0].checked==false && MatriForm.txtGender[1].checked==false)
	{
		document.getElementById('errGender').innerHTML='Required.';		
		flag=0;	
	}
	else
	{
		document.getElementById('errGender').innerHTML='';
	}
	if (MatriForm.dobMonth.value=="0")	
	{
		document.getElementById('errDOB').innerHTML='Required.';
		MatriForm.dobMonth.focus();
		flag=0;	
	}
	else
	{
		document.getElementById('errDOB').innerHTML='';
	}
	if (MatriForm.dobDay.value=="0")	
	{
		document.getElementById('errDOB').innerHTML='Required.';
		MatriForm.dobDay.focus();
		flag=0;	
	}
	else
	{
		document.getElementById('errDOB').innerHTML='';
	}
	if (MatriForm.dobYear.value=="0")	
	{
		document.getElementById('errDOB').innerHTML='Required.';
		MatriForm.dobYear.focus();
		flag=0;	
	}
	else
	{
		document.getElementById('errDOB').innerHTML='';
	}
	
	if (MatriForm.MARITAL_STATUS[0].checked==false && MatriForm.MARITAL_STATUS[1].checked==false && MatriForm.MARITAL_STATUS[2].checked==false && MatriForm.MARITAL_STATUS[3].checked==false)
	{
		document.getElementById('errCMarital').innerHTML='Required.';
		MatriForm.MARITAL_STATUS[0].focus( );
		flag=0;	
	}
	else
	{
		document.getElementById('errCMarital').innerHTML='.';
	}
	if(document.getElementById('Language').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errMT').innerHTML='Required.';
		document.getElementById('Language').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errMT').innerHTML='';
		
	 }
	 if(document.getElementById('religion').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errReligion').innerHTML='Required.';
		document.getElementById('religion').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errReligion').innerHTML='';
		
	 }
	 if(document.getElementById('caste').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errCast').innerHTML='Required.';
		document.getElementById('caste').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errCast').innerHTML='';
		
	 }
	 
	  if(document.getElementById('txtGothra').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errGotra').innerHTML='Required.';
		document.getElementById('txtGothra').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errGotra').innerHTML='';
		
	 }
	 if(document.getElementById('txtPb').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errBirthPlace').innerHTML='Required.';
		document.getElementById('txtPb').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errBirthPlace').innerHTML='';
		
	 }
	 if (MatriForm.txtTb.value=="")	
	{
		document.getElementById('errBirthTime').innerHTML='Required.';
		MatriForm.txtTb.focus();
		flag=0;	
	}
	else
	{
		document.getElementById('errBirthTime').innerHTML='';
	}
	 if(document.getElementById('security_code').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errSecurity').innerHTML='Required.';
		document.getElementById('security_code').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errSecurity').innerHTML='';
		
	 }
	
	if(flag==0)
    {
	 	return false;
	}
	else
	{
		return true;
	}
}

function caste_disable_register_step1(obj){		
	if(obj.options[obj.selectedIndex].text != 'Hindu' &&
		obj.options[obj.selectedIndex].text != 'Muslim' &&
		obj.options[obj.selectedIndex].text != 'Christian' &&
		obj.options[obj.selectedIndex].text != 'Jain' &&
		obj.options[obj.selectedIndex].text != 'Sikh'){
	document.MatriForm_step1.caste.disabled = true;
	}
	else {
		document.MatriForm_step1.caste.disabled = false;
		get_caste(obj.form.religion,0);
	}
}

function updateDay_reg_step1(change,formName,yearName,monthName,dayName)
{	
	
	var form = document.forms[formName];
	var yearSelect = form[yearName];
	var monthSelect = form[monthName];
	var daySelect = form[dayName];
	var year = yearSelect[yearSelect.selectedIndex].value;
	var month = monthSelect[monthSelect.selectedIndex].value;
	var day = daySelect[daySelect.selectedIndex].value;

	if (change == 'month' || (change == 'year' && month == 2))
	{
		var i = 31;
		var flag = true;
		while(flag)
		{
			var date = new Date(year,month-1,i);
			if (date.getMonth() == month - 1)
			{
				flag = false;
			}
			else
			{
				i = i - 1;
			}
		}

		daySelect.length = 0;
		daySelect.length = i;
		var j = 0;
		while(j < i)
		{
			daySelect[j] = new Option(j+1,j+1);
			j = j + 1;
		}
		if (day <= i)
		{
			daySelect.selectedIndex = day - 1;
		}
		else
		{
			daySelect.selectedIndex = daySelect.length - 1;
		}
	}
}

function check_availability()
{
	httpOb=null;
	var uemail;
	uemail=document.getElementById('EMAIL').value;		
	if(uemail !="")
	 {
		var flag=1;
		if(document.getElementById('EMAIL').value.search(/\S/)==-1)
		{
			document.getElementById('errEmail').innerHTML='Required.';
			document.getElementById('EMAIL').focus();
			flag=0;
		}
		else
		{
			document.getElementById('errEmail').innerHTML='';	
		}

	   if(document.getElementById('EMAIL').value.search(/\S/)!=-1)
		{
			var x =document.getElementById('EMAIL').value;
			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if (filter.test(x)==false)
			{	
				document.getElementById('errEmail').innerHTML='Invalid Email.';
				document.getElementById('EMAIL').focus();
				flag=0;
			}
			else
			{
			 document.getElementById('errEmail').innerHTML='';	
			}
		}
		if(flag==1)
		{	
			httpOb=null;
			var PagePath;
			PagePath='getuserstatus.php?email='+uemail;	 
			// code for IE
			 if (window.ActiveXObject)
			 {
				var httpOb=new ActiveXObject("Microsoft.XMLHTTP");
				httpOb.onreadystatechange=function()
				  {
					if (httpOb.readyState==4 && httpOb.status==200)
					{
						document.getElementById('usertid_status').innerHTML = httpOb.responseText;					
					}
					else
					{
						document.getElementById('usertid_status').innerHTML = "<img src='../images/ajax-loader.gif' style='padding-right:40px;' width='32' height='32' border='0' />";
						
					}
				  }
				 httpOb.Open("GET",PagePath,true);
				 httpOb.send();
				 document.getElementById(msg2Show).innerHTML=httpOb.responseText;
			 }

			 // code for Mozilla, etc.
			 else if (window.XMLHttpRequest)
			 {
				 httpOb=new XMLHttpRequest()
				 // Mozilla, Safari, ...
			
				 httpOb.overrideMimeType('text/xml');
				 httpOb.onreadystatechange=function()
				  {
					if (httpOb.readyState==4 && httpOb.status==200)
					{
						document.getElementById('usertid_status').innerHTML = httpOb.responseText;					
					}
					else
					{
						document.getElementById('usertid_status').innerHTML = "<img src='../images/ajax-loader.gif' style='padding-right:40px;' width='32' height='32' border='0' />";
										
					}
				  }
				 httpOb.open('GET', PagePath, true);
				 httpOb.send(null);
				
			 }
			 else
			 {
				alert("Your browser does not support XMLHTTP.")
			 }
		}
		else
		 {
			return false;
		 }
	 }
}

function form_validate_step2()
{
	var MatriForm = this.document.matriform_step2;
	var flag = 1;	
	if(document.getElementById('txtmsg').value.search(/\S/)==-1)
	{
		document.getElementById('errAbout').innerHTML='Required.';
		document.getElementById('txtmsg').focus();
		flag=0;
	}
	else
	{
		document.getElementById('errAbout').innerHTML='';	
	}

    if(document.getElementById('txtEdu').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errEdu').innerHTML='Required.';
		document.getElementById('txtEdu').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errEdu').innerHTML='';
		
	 }
	 if(document.getElementById('txtEdudetails').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errEduDetail').innerHTML='Required.';
		document.getElementById('txtEdudetails').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errEduDetail').innerHTML='';		
	 }
	 if(document.getElementById('txtIncome').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errIncome').innerHTML='Required.';
		document.getElementById('txtIncome').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errIncome').innerHTML='';		
	 }
	 if(document.getElementById('txtEmp').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errEmployed').innerHTML='Required.';
		document.getElementById('txtEmp').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errEmployed').innerHTML='';		
	 }
	 if(document.getElementById('txtHeight1').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errHeight').innerHTML='Required.';
		document.getElementById('txtHeight1').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errHeight').innerHTML='';		
	 }
	 if(document.getElementById('txtWeight').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errtxtWeight').innerHTML='Required.';
		document.getElementById('txtWeight').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errtxtWeight').innerHTML='';		
	 }
	 if(document.getElementById('txtComplexion').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errComplexion').innerHTML='Required.';
		document.getElementById('txtComplexion').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errComplexion').innerHTML='';		
	 }
	 if (MatriForm.txtBody[0].checked==false && MatriForm.txtBody[1].checked==false && MatriForm.txtBody[2].checked==false && MatriForm.txtBody[3].checked==false)
	{
		document.getElementById('errBody').innerHTML='Required.';
		MatriForm.txtBody[0].focus( );
		flag=0;	
	}
	else
	{
		document.getElementById('errBody').innerHTML='';
	}
	 if(document.getElementById('txtFD').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errFDetail').innerHTML='Required.';
		document.getElementById('txtFD').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errFDetail').innerHTML='';		
	 }
	 if(document.getElementById('txtFANAME').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errFname').innerHTML='Required.';
		document.getElementById('txtFANAME').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errFname').innerHTML='';		
	 }
	 if(document.getElementById('txtMONAME').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errMname').innerHTML='Required.';
		document.getElementById('txtMONAME').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errMname').innerHTML='';		
	 }
	if(flag==0)
    {
	 	return false;
	}
	else
	{
		return true;
	}
}
function caste_disable_partpreferences(obj){		
	if(obj.options[obj.selectedIndex].text != 'Hindu' &&
		obj.options[obj.selectedIndex].text != 'Muslim' &&
		obj.options[obj.selectedIndex].text != 'Christian' &&
		obj.options[obj.selectedIndex].text != 'Jain' &&
		obj.options[obj.selectedIndex].text != 'Sikh'){
		document.matriform_step3.caste.disabled = true;
	}
	else {
		document.matriform_step3.caste.disabled = false;
		get_caste(obj.form.religion,0);
	}
}
function form_validate_step3()
{
	var MatriForm = this.document.matriform_step3;
	var flag = 1;	
	if (MatriForm.txtLooking[0].checked==false && MatriForm.txtLooking[1].checked==false && MatriForm.txtLooking[2].checked==false && MatriForm.txtLooking)
	{
		document.getElementById('errPPre').innerHTML='Required.';
		MatriForm.txtLooking[0].focus( );
		flag=0;	
	}
	else
	{
		document.getElementById('errPPre').innerHTML='';
	}
	if(document.getElementById('Fromage').value.search(/\S/)==-1 || document.getElementById('Toage').value.search(/\S/)==-1)
	 {
	 	document.getElementById('Errage').innerHTML='Required.';
		document.getElementById('Fromage').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('Errage').innerHTML='';
		
	 }
	 if(document.getElementById('txtPPE').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errExpection').innerHTML='Required.';
		document.getElementById('txtPPE').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errExpection').innerHTML='';
		
	 }
	 if(document.getElementById('religion').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errReligion').innerHTML='Required.';
		document.getElementById('religion').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errReligion').innerHTML='';
		
	 }
	 if(document.getElementById('caste').value.search(/\S/)==-1)
	 {
	 	document.getElementById('errCaste').innerHTML='Required.';
		document.getElementById('caste').focus();
		flag=0;	 
	 }
	 else
	 {
	    document.getElementById('errCaste').innerHTML='';
		
	 } 
	
	if(flag==0)
    {
	 	return false;
	}
	else
	{
		return true;
	}
}

