function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "1234567890";
   var strChar;
   var blnResult = true;

  
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
 function ChkReg()
 {
	var gofocus;
	var foc;
	var counter=0;
	var frm =document.create_account;
	var x = document.create_account.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var check=/^[0-9\s]+$/;
 	var m = document.getElementById("mothertongue_id").selectedIndex;
   	var mothertongue = document.getElementById("mothertongue_id").options[m].text;
	var o = document.getElementById("occupation_id").selectedIndex;
   	var occupation = document.getElementById("occupation_id").options[o].text;
	var t = document.getElementById("tribe_id").selectedIndex;
   	var tribe = document.getElementById("tribe_id").options[t].text;
	var c = document.getElementById("country_id").selectedIndex;
   	var country = document.getElementById("country_id").options[c].text;
	
		if(frm.user_id.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox1").style.display = "";	
		 $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter user id").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.user_id.focus();
		}				
		}
		else if(frm.user_id.value.length<6)
		{
		counter=counter+1;
		document.getElementById("msgbox1").style.display = "";	
		 $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* User ID must be 6 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.user_id.focus();
		}
		}
		else
		{
		document.getElementById("msgbox1").innerHTML="";
		document.getElementById("msgbox1").style.display = 'none';	
		}
		
		if(frm.password.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox0").style.display = "";	
		 $("#msgbox0").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter password").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.password.focus();
		}				
		}
		else if(frm.password.value.length<4)
		{
		counter=counter+1;
		document.getElementById("msgbox0").style.display = "";	
		 $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Password must be 4 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.password.focus();
		}
		}
		else
		{
		document.getElementById("msgbox0").innerHTML="";
		document.getElementById("msgbox0").style.display = 'none';	
		}
		if(frm.confirmation.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox").style.display = "";
		$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Password Confirmation field cannot be blank.").fadeTo(900,1);	
			});		
		if(counter=='1')
		{
		frm.confirmation.focus();
		}
		}		
		else if(frm.password.value!="" && frm.confirmation.value!="" && frm.password.value != frm.confirmation.value)		
		{
		counter=counter+1;
		document.getElementById("msgbox").style.display = "";
		$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Password and Confirm Password do not match.").fadeTo(900,1);	
			});		
		if(counter=='1')
		{
		frm.confirmation.focus();
		}
		}
		else
		{
		document.getElementById("msgbox").innerHTML="";
		document.getElementById("msgbox").style.display = 'none';	
		}
		
		if(frm.name.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox2").style.display = "";	
		 $("#msgbox2").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter name</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.name.focus();
		}				
		}
		else if(frm.name.value.length<5)
		{
		counter=counter+1;
		document.getElementById("msgbox2").style.display = "";	
		 $("#msgbox2").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Name must be 5 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.name.focus();
		}
		}
		else
		{
		document.getElementById("msgbox2").innerHTML="";
		document.getElementById("msgbox2").style.display = 'none';	
		}
		
		if(frm.mothertongue_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox3").style.display = '';	
		 $("#msgbox3").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select mother tongue.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.mothertongue_id.focus();
		}					
		}
		else if(mothertongue=='Other' && frm.othermothertongue.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox3").style.display = '';	
		 $("#msgbox3").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other mother tongue.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.othermothertongue.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox3").innerHTML="";
		document.getElementById("msgbox3").style.display = 'none';	
		}
		
		if(frm.mobile.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox4").style.display = "";	
		 $("#msgbox4").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter mobile no.</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.mobile.focus();
		}				
		}		
		else
		{
		document.getElementById("msgbox4").innerHTML="";
		document.getElementById("msgbox4").style.display = 'none';	
		}
		
		if(frm.email.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox5").style.display = '';	
		 $("#msgbox5").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Email field cannot be blank.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.email.focus();
		}					
		}
		else if(frm.email.value!="")
			{
			if (filter.test(x))
			{
				document.getElementById("msgbox5").style.display='none';
			}
			else
			{
				counter=counter+1;
			document.getElementById("msgbox5").style.display='';
			$("#msgbox5").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Invalid email address.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.email.focus();
		}
		}
		}
		else
		{
		document.getElementById("msgbox5").innerHTML="";
		document.getElementById("msgbox5").style.display = 'none';	
		}
		
		if(frm.occupation_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox6").style.display = '';	
		 $("#msgbox6").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select occupation.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.occupation_id.focus();
		}					
		}
		else if(occupation=='Other' && frm.otheroccupation.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox6").style.display = '';	
		 $("#msgbox6").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other occupation.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.otheroccupation.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox6").innerHTML="";
		document.getElementById("msgbox6").style.display = 'none';	
		}
		
		if(frm.tribe_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox7").style.display = '';	
		 $("#msgbox7").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select tribe.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.tribe_id.focus();
		}					
		}
		else if(tribe=='Other' && frm.othertribe.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox7").style.display = '';	
		 $("#msgbox7").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other tribe.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.othertribe.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox7").innerHTML="";
		document.getElementById("msgbox7").style.display = 'none';	
		}
		
		if(frm.postal_address.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox8").style.display = "";	
		 $("#msgbox8").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter postal address</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.postal_address.focus();
		}				
		}		
		else
		{
		document.getElementById("msgbox8").innerHTML="";
		document.getElementById("msgbox8").style.display = 'none';	
		}
		
		if(frm.country_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox9").style.display = '';	
		 $("#msgbox9").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select country.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.country_id.focus();
		}					
		}
		else if(country=='Other' && frm.othercountry.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox9").style.display = '';	
		 $("#msgbox9").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other country.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.othercountry.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox9").innerHTML="";
		document.getElementById("msgbox9").style.display = 'none';	
		}
		
		if(frm.security_code.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox10").style.display = '';	
		 $("#msgbox10").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Security code field cannot be blank.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.security_code.focus();
		}
		}
		else
		{
		document.getElementById("msgbox10").innerHTML="";
		document.getElementById("msgbox10").style.display = 'none';	
		}
		
		if(counter>0)
		{
		document.getElementById('TableContainer').scrollTop = 0;
		alert("* Please check the fields highlighted in red !");
		
		return false;
		}		
		
}


function loginCheck()
	{
	if(document.frm.user_id.value=="")
		{
			alert("Please enter user name or email ex. abc@cititribe.com");
			document.frm.user_id.focus();
			return false;
		}
		
		if(document.frm.password.value=="")
		{
			alert("Please enter your password.");
			document.frm.password.focus();
			return false;
		}
	}
	
	function ChkCountry()	{
	var c = document.getElementById("country_id").selectedIndex;
   	var c = document.getElementById("country_id").options[c].text;
	if(c=='Other')
	{
	document.getElementById("othercountry1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("othercountry1").style.display='none';
	}
	}
	
	function ChkState()
	{
	var s = document.getElementById("state_id").selectedIndex;
   	var s = document.getElementById("state_id").options[c].text;
	if(s=='Other')
	{
	document.getElementById("otherstate1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otherstate1").style.display='none';
	}
	}
	
	function ChkCity()
	{		
		var c = document.getElementById("city_id").selectedIndex;
		var c = document.getElementById("city_id").options[c].text;
	
	if(c=='Other')
	{
	document.getElementById("othercity1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("othercity1").style.display='none';
	}
	}
	
	function ChkTribe()
	{
	var w = document.getElementById("tribe_id").selectedIndex;
   	var selected_text = document.getElementById("tribe_id").options[w].text;	
	if(selected_text=='Other')
	{
	document.getElementById("othertribe1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("othertribe1").style.display='none';
	}
	}
	
	function ChkMotherTongue()
	{	
	var w = document.getElementById("mothertongue_id").selectedIndex;
   	var selected_text = document.getElementById("mothertongue_id").options[w].text;	
	if(selected_text=='Other')
	{
	document.getElementById("othermothertongue1").style.display='';
	return false;
	}	
	else
	{
	document.getElementById("othermothertongue1").style.display='none';
	}
	}
	
	function ChkReligion()
	{
	var r = document.getElementById("religion_id").selectedIndex;
   	var r = document.getElementById("religion_id").options[r].text;	
	if(r=='Other')
	{
	document.getElementById("otherreligion1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otherreligion1").style.display='none';
	}
	}
	
	function ChkEducation()
	{
	var q = document.getElementById("qualification_id").selectedIndex;
   	var q = document.getElementById("qualification_id").options[q].text;	
	if(q=='Other')
	{
	document.getElementById("otherqualification1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otherqualification1").style.display='none';
	}
	}
	
	function ChkLanguage()
	{
	var l = document.getElementById("language_id").selectedIndex;
   	var l = document.getElementById("language_id").options[l].text;	
	if(l=='Other')
	{
	document.getElementById("otherlanguage1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otherlanguage1").style.display='none';
	}
	}
	
	function ChkOccupation()
	{
	var o = document.getElementById("occupation_id").selectedIndex;
   	var o = document.getElementById("occupation_id").options[o].text;	
	if(o=='Other')
	{
	document.getElementById("otheroccupation1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otheroccupation1").style.display='none';
	}
	}
	
	function ChkHobbies()
	{
	var h = document.getElementById("hobbies_id").selectedIndex;
   	var h = document.getElementById("hobbies_id").options[h].text;
	if(h=='Other')
	{
	document.getElementById("otherhobbies1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otherhobbies1").style.display='none';
	}
	}
	
	function ChkCategory()
	{	
	var cat = document.getElementById("category_id").selectedIndex;
   	var cat = document.getElementById("category_id").options[cat].text;	
	if(cat=='Other')
	{
	document.getElementById("othercategory1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("othercategory1").style.display='none';
	}
	}
	
	function ChkProfession(str)
	{	
	if(str=='3')
	{
	document.getElementById("otherprofession1").style.display='';
	return false;
	}
	else
	{
	document.getElementById("otherprofession1").style.display='none';
	}
	}
	
	function ChkMatrimonial()
 {
	var gofocus;
	var foc;
	var counter=0;
	var frm =document.matrimonial_post;
	var x = frm.email.value;
	var x2 = frm.cpemail.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var check=/^[0-9\s]+$/;		
		
		if(frm.name.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_name").style.display = "";	
		 $("#msg_name").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter name</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.name.focus();
		}				
		}
		else if(frm.name.value.length<5)
		{
		counter=counter+1;
		document.getElementById("msg_name").style.display = "";	
		 $("#msg_name").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Name must be 5 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.name.focus();
		}
		}
		else
		{
		document.getElementById("msg_name").innerHTML="";
		document.getElementById("msg_name").style.display = 'none';	
		}
		if(frm.religion_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msg_religion").style.display = '';	
		 $("#msg_religion").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select religion tongue.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.religion_id.focus();
		}					
		}
		else
		{
		document.getElementById("msg_religion").innerHTML="";
		document.getElementById("msg_religion").style.display = 'none';	
		}
		if(frm.month.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msg_month").style.display = '';	
		 $("#msg_month").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select month").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.month.focus();
		}					
		}
		else
		{
		document.getElementById("msg_month").innerHTML="";
		document.getElementById("msg_month").style.display = 'none';	
		}
		if(frm.day.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msg_day").style.display = '';	
		 $("#msg_day").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select month").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.day.focus();
		}					
		}
		else
		{
		document.getElementById("msg_day").innerHTML="";
		document.getElementById("msg_day").style.display = 'none';	
		}
		if(frm.year.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msg_year").style.display = '';	
		 $("#msg_year").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select year").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.year.focus();
		}					
		}
		else
		{
		document.getElementById("msg_year").innerHTML="";
		document.getElementById("msg_year").style.display = 'none';	
		}
		if(frm.qualification_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msg_qualification").style.display = '';	
		 $("#msg_qualification").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select education").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.qualification_id.focus();
		}					
		}
		else
		{
		document.getElementById("msg_qualification").innerHTML="";
		document.getElementById("msg_qualification").style.display = 'none';	
		}
		
		if(frm.feet.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_feet").style.display = "";	
		 $("#msg_feet").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter feet</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.feet.focus();
		}				
		}
		else if(!(IsNumeric(frm.feet.value)))
		{
		counter=counter+1;
		document.getElementById("msg_feet").style.display = "";	
		 $("#msg_feet").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter valid feet.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.feet.focus();
		}
		}
		else
		{
		document.getElementById("msg_feet").innerHTML="";
		document.getElementById("msg_feet").style.display = 'none';	
		}
		
		if(!(IsNumeric(frm.inch.value)))
		{
		counter=counter+1;
		document.getElementById("msg_inch").style.display = "";	
		 $("#msg_inch").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter valid inch.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.inch.focus();
		}
		}
		else
		{
		document.getElementById("msg_inch").innerHTML="";
		document.getElementById("msg_inch").style.display = 'none';	
		}
		if(frm.phone.value=="" && frm.mobile.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_phone").style.display = "";	
		 $("#msg_phone").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter atleast one contact number</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.phone.focus();
		}				
		}
		else
		{
		document.getElementById("msg_phone").innerHTML="";
		document.getElementById("msg_phone").style.display = 'none';	
		}
		if(frm.postaladdress.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_postaladdress").style.display = "";	
		 $("#msg_postaladdress").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter postal address </LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.postaladdress.focus();
		}				
		}
		else
		{
		document.getElementById("msg_postaladdress").innerHTML="";
		document.getElementById("msg_postaladdress").style.display = 'none';	
		}
		
		if(frm.country_id.value=="-1" && document.getElementById("othercountry1").style.display=='none')
		{
		counter=counter+1;
		document.getElementById("msg_country").style.display = '';	
		 $("#msg_country").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select country").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.country_id.focus();
		}					
		}
		else if(document.getElementById("othercountry1").style.display=='' && frm.othercountry.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_country").style.display = '';	
		 $("#msg_country").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter country name").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.country_id.focus();
		}				
		}
		else
		{
		document.getElementById("msg_country").innerHTML="";
		document.getElementById("msg_country").style.display = 'none';	
		}		
		if(document.getElementById("txtHint0").style.display=='' && frm.state_id.value!="0" && frm.state_id.value=="-1" && document.getElementById("otherstate1").style.display=='none')
		{
		counter=counter+1;
		document.getElementById("msg_state").style.display = '';	
		 $("#msg_state").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select state").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.state_id.focus();
		}					
		}
 
		else if(document.getElementById("otherstate1").style.display=='' && frm.otherstate.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_state").style.display = '';	
		 $("#msg_state").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter state name").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.state_id.focus();
		}				
		}
		else
		{
		document.getElementById("msg_state").innerHTML="";
		document.getElementById("msg_state").style.display = 'none';	
		}		
		
		if(document.getElementById("txtHint1").style.display=='' && frm.city_id.value!="0" && frm.city_id.value=="-1" && document.getElementById("othercity1").style.display=='none')
		{
		counter=counter+1;
		document.getElementById("msg_city").style.display = '';	
		 $("#msg_city").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select city").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.city_id.focus();
		}					
		}
 
		else if(document.getElementById("othercity1").style.display=='' && frm.othercity.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_city").style.display = '';	
		 $("#msg_city").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter city name").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.city_id.focus();
		}				
		}
		else
		{
		document.getElementById("msg_city").innerHTML="";
		document.getElementById("msg_city").style.display = 'none';	
		}
		if(frm.email.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_email").style.display = '';	
		 $("#msg_email").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Email field cannot be blank.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.email.focus();
		}					
		}
		else if(frm.email.value!="")
			{
			if (filter.test(x))
			{
				document.getElementById("msg_email").style.display='none';
			}
			else
			{
				counter=counter+1;
			document.getElementById("msg_email").style.display='';
			$("#msg_email").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Invalid email address.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.email.focus();
		}
		}
		}
		else
		{
		document.getElementById("msg_email").innerHTML="";
		document.getElementById("msg_email").style.display = 'none';	
		}
		
		if(frm.aboutme.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_aboutme").style.display = "";	
		 $("#msg_aboutme").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter about me </LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.aboutme.focus();
		}				
		}
		else
		{
		document.getElementById("msg_aboutme").innerHTML="";
		document.getElementById("msg_aboutme").style.display = 'none';	
		}
		
		if(frm.cpname.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cpname").style.display = "";	
		 $("#msg_cpname").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter Contact Person Name</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.cpname.focus();
		}				
		}
		else if(frm.cpname.value.length<5)
		{
		counter=counter+1;
		document.getElementById("msg_cpname").style.display = "";	
		 $("#msg_cpname").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Contact Person Name must be 5 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.cpname.focus();
		}
		}
		else
		{
		document.getElementById("msg_cpname").innerHTML="";
		document.getElementById("msg_cpname").style.display = 'none';	
		}
		if(frm.cpphone.value=="" && frm.cpmobile.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cpphone").style.display = "";	
		 $("#msg_cpphone").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter atleast one contact number</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.cpphone.focus();
		}				
		}
		else
		{
		document.getElementById("msg_cpphone").innerHTML="";
		document.getElementById("msg_cpphone").style.display = 'none';	
		}
		if(frm.cppostaladdress.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cppostaladdress").style.display = "";	
		 $("#msg_cppostaladdress").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter postal address </LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.cppostaladdress.focus();
		}				
		}
		else
		{
		document.getElementById("msg_cppostaladdress").innerHTML="";
		document.getElementById("msg_cppostaladdress").style.display = 'none';	
		}
		if(frm.country_id2.value=="-1" && document.getElementById("othercountry3").style.display=='none')
		{
		counter=counter+1;
		document.getElementById("msg_cpcountry").style.display = '';	
		 $("#msg_cpcountry").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select country").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.country_id2.focus();
		}					
		}
		else if(document.getElementById("othercountry3").style.display=='' && frm.othercountry4.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cpcountry").style.display = '';	
		 $("#msg_cpcountry").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter country name").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.country_id2.focus();
		}				
		}
		else
		{
		document.getElementById("msg_cpcountry").innerHTML="";
		document.getElementById("msg_cpcountry").style.display = 'none';	
		}
		
		if(document.getElementById("txtHint2").style.display=='' && frm.state_id2.value!="0" && frm.state_id2.value=="-1" && document.getElementById("otherstate3").style.display=='none')
		{
		counter=counter+1;
		document.getElementById("msg_cpstate").style.display = '';	
		 $("#msg_cpstate").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select state").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.state_id2.focus();
		}					
		}
 
		else if(document.getElementById("otherstate3").style.display=='' && frm.otherstate4.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cpstate").style.display = '';	
		 $("#msg_cpstate").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter state name").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.state_id2.focus();
		}				
		}
		else
		{
		document.getElementById("msg_cpstate").innerHTML="";
		document.getElementById("msg_cpstate").style.display = 'none';	
		}
		
		if(document.getElementById("txtHint3").style.display=='' && frm.city_id2.value!="0" && frm.city_id2.value=="-1" && document.getElementById("othercity3").style.display=='none')
		{
		counter=counter+1;
		document.getElementById("msg_cpcity").style.display = '';	
		 $("#msg_cpcity").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select city").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.city_id2.focus();
		}					
		}
 
		else if(document.getElementById("othercity3").style.display=='' && frm.othercity4.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cpcity").style.display = '';	
		 $("#msg_cpcity").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter city name").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.city_id2.focus();
		}				
		}
		else
		{
		document.getElementById("msg_cpcity").innerHTML="";
		document.getElementById("msg_cpcity").style.display = 'none';	
		}
		if(frm.cpemail.value=="")
		{
		counter=counter+1;
		document.getElementById("msg_cpemail").style.display = '';	
		 $("#msg_cpemail").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Email field cannot be blank.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.cpemail.focus();
		}					
		}
		else if(frm.cpemail.value!="")
			{
			if (filter.test(x2))
			{
				document.getElementById("msg_cpemail").style.display='none';
			}
			else
			{
				counter=counter+1;
			document.getElementById("msg_cpemail").style.display='';
			$("#msg_cpemail").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Invalid email address.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.cpemail.focus();
		}
		}
		}
		else
		{
		document.getElementById("msg_cpemail").innerHTML="";
		document.getElementById("msg_cpemail").style.display = 'none';	
		}
		if(counter>0)
		{
		document.getElementById('TableContainer').scrollTop = 0;
		alert("* Please check the fields highlighted in red !");
		
		return false;
		}		
		
}

 function ChkAccount()
 {
	var gofocus;
	var foc;
	var counter=0;
	var frm =document.create_account;
	var x = document.create_account.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var check=/^[0-9\s]+$/; 
	var m = document.getElementById("mothertongue_id").selectedIndex;
   	var mothertongue = document.getElementById("mothertongue_id").options[m].text;
	var o = document.getElementById("occupation_id").selectedIndex;
   	var occupation = document.getElementById("occupation_id").options[o].text;
	var t = document.getElementById("tribe_id").selectedIndex;
   	var tribe = document.getElementById("tribe_id").options[t].text;
	var c = document.getElementById("country_id").selectedIndex;
   	var country = document.getElementById("country_id").options[c].text;	
		
		if(frm.password.value!="" && frm.password.value.length<4)
		{
		counter=counter+1;
		document.getElementById("msgbox0").style.display = "";	
		 $("#msgbox1").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Password must be 4 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.password.focus();
		}
		}
		else
		{
		document.getElementById("msgbox0").innerHTML="";
		document.getElementById("msgbox0").style.display = 'none';	
		}			
		if((frm.password.value!="" || frm.confirmation.value!="")&& frm.password.value != frm.confirmation.value)		
		{
		counter=counter+1;
		document.getElementById("msgbox").style.display = "";
		$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Password and Confirm Password do not match.").fadeTo(900,1);	
			});		
		if(counter=='1')
		{
		frm.confirmation.focus();
		}
		}
		else
		{
		document.getElementById("msgbox").innerHTML="";
		document.getElementById("msgbox").style.display = 'none';	
		}
		
		if(frm.name.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox2").style.display = "";	
		 $("#msgbox2").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter name</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.name.focus();
		}				
		}
		else if(frm.name.value.length<5)
		{
		counter=counter+1;
		document.getElementById("msgbox2").style.display = "";	
		 $("#msgbox2").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Name must be 5 character long.").fadeTo(900,1);	
			});
		 if(counter=='1')
		{
		frm.name.focus();
		}
		}
		else
		{
		document.getElementById("msgbox2").innerHTML="";
		document.getElementById("msgbox2").style.display = 'none';	
		}
		
		if(frm.mothertongue_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox3").style.display = '';	
		 $("#msgbox3").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select mother tongue.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.mothertongue_id.focus();
		}					
		}	
		
		else if(mothertongue=='Other' && frm.othermothertongue.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox3").style.display = '';	
		 $("#msgbox3").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other mother tongue.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.othermothertongue.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox3").innerHTML="";
		document.getElementById("msgbox3").style.display = 'none';	
		}
		
		if(frm.mobile.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox4").style.display = "";	
		 $("#msgbox4").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter mobile no.</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.mobile.focus();
		}				
		}		
		else
		{
		document.getElementById("msgbox4").innerHTML="";
		document.getElementById("msgbox4").style.display = 'none';	
		}
		
		if(frm.email.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox5").style.display = '';	
		 $("#msgbox5").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Email field cannot be blank.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.email.focus();
		}					
		}
		else if(frm.email.value!="")
			{
			if (filter.test(x))
			{
				document.getElementById("msgbox5").style.display='none';
			}
			else
			{
				counter=counter+1;
			document.getElementById("msgbox5").style.display='';
			$("#msgbox5").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Invalid email address.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.email.focus();
		}
		}
		}
		else
		{
		document.getElementById("msgbox5").innerHTML="";
		document.getElementById("msgbox5").style.display = 'none';	
		}
		
		if(frm.occupation_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox6").style.display = '';	
		 $("#msgbox6").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select occupation.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.occupation_id.focus();
		}					
		}
		else if(occupation=='Other' && frm.otheroccupation.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox6").style.display = '';	
		 $("#msgbox6").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other occupation.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.otheroccupation.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox6").innerHTML="";
		document.getElementById("msgbox6").style.display = 'none';	
		}
		
		if(frm.tribe_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox7").style.display = '';	
		 $("#msgbox7").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select tribe.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.tribe_id.focus();
		}					
		}
		else if(tribe=='Other' && frm.othertribe.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox7").style.display = '';	
		 $("#msgbox7").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other tribe.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.othertribe.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox7").innerHTML="";
		document.getElementById("msgbox7").style.display = 'none';	
		}
		
		if(frm.postal_address.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox8").style.display = "";	
		 $("#msgbox8").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter postal address</LI>").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.postal_address.focus();
		}				
		}		
		else
		{
		document.getElementById("msgbox8").innerHTML="";
		document.getElementById("msgbox8").style.display = 'none';	
		}
		
		if(frm.country_id.value=="-1")
		{
		counter=counter+1;
		document.getElementById("msgbox9").style.display = '';	
		 $("#msgbox9").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please select country.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.country_id.focus();
		}					
		}
		else if(country=='Other' && frm.othercountry.value=="")
		{
		counter=counter+1;
		document.getElementById("msgbox9").style.display = '';	
		 $("#msgbox9").fadeTo(200,0.1,function() //start fading the messagebox
			{ 			
			  //add message and change the class of the box and start fading
			 $(this).html("* Please enter other country.").fadeTo(900,1);	
			});	
		if(counter=='1')
		{
		frm.othercountry.focus();
		}					
		}
		else
		{
		document.getElementById("msgbox9").innerHTML="";
		document.getElementById("msgbox9").style.display = 'none';	
		}
		
		if(counter>0)
		{
		document.getElementById('TableContainer').scrollTop = 0;
		alert("* Please check the fields highlighted in red !");
		
		return false;
		}		
		
}

function OpenWin(str1,str2)
{
window.location.href="browse-matrimonial.php?gender="+str1+"&tribe_id="+str2;	
}

