var SITE_URL="http://www.nrigujarati.co.in/";
var CLS_SITE_URL="http://www.nrigujarati.co.in/Classified/";
var MAT_SITE_URL="http://www.nrigujarati.co.in/matrimonial/";

function Trim(myval)
{
	return myval.split(" ").join("");
}

function CheckUncheckAll(frm,chk)
{
	if(chk.name.substr(0,8)!="CheckAll")
	{
		CheckName = chk.name;
		MyChecked = true;

		for(i=0;i<frm.elements.length;i++)
		{
			if(frm.elements[i].name==CheckName && frm.elements[i].checked==false)
			{
				MyChecked=false;
				break;
			}
		}

		CheckAll = eval("frm.CheckAll_"+CheckName.substr(0,CheckName.length-2));
		CheckAll.checked=MyChecked;
	}		
	else
	{
		CheckName = chk.name.substr(9,chk.name.length)+"[]";
		
		if(chk.checked==true)
			AllChecked = true;
		else
			AllChecked = false;

		for(i=0;i<frm.elements.length;i++)
		{
			if(frm.elements[i].name==CheckName)
				frm.elements[i].checked=AllChecked;		
		}
	}
}

function validateEmail(fld)
{
	var my=fld.value;
	var attherate=my.indexOf("@");
	var lastattherate = my.lastIndexOf("@")
	var dotpos=my.lastIndexOf(".");
	var posspace = my.indexOf(" ");
	var totallen = my.length;
	
	if (attherate<=0 || dotpos<=0 || attherate > dotpos || (dotpos-attherate)<=1 || (dotpos == totallen-1) || posspace > -1 || attherate!=lastattherate)
		return false;
	else
		return true;
}

function gotoPage(a,l,frm)
{
	frm = eval("document."+frm);
	frm.action=l;
	frm.cpage.value=a;
	frm.submit();
}

function Create_Object()
{
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	return ajaxRequest;
}
function FillState()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split(":");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById("StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById("CountryId").value;
	var queryString = "?CountryId=" + CountryId;
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}

function FillCity()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	var StateId = document.getElementById("StateId").value;
	var queryString = "?StateId=" + StateId;
	
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function userFillState()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split(":");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById("StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById("CountryId").value;
	var queryString = "?CountryId=" + CountryId;
	ajaxRequest1.open("GET", SITE_URL+"includes/user_fill_state_city.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}
function userFillCity()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	var StateId = document.getElementById("StateId").value;
	var queryString = "?StateId=" + StateId;
	
	ajaxRequest1.open("GET", SITE_URL+"includes/user_fill_state_city.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function dohideComment(th)
{
	if(document.getElementById("cr1"+th).style.display=="none")
	 {
		document.getElementById("cr1"+th).style.display="";		
	 }
	else
	 {
		document.getElementById("cr1"+th).style.display="none";		
	 }
	
}

function IsNumeric(strString)
 //  check for valid numeric strings	
 {
 var strValidChars = "0123456789.-";
 var strChar;
 var blnResult = true;

 if (strString.length == 0) return false;

 //  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 checkURL(value) 
 {
 		/*var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");*/
//		var urlregex = new RegExp("^(http:\/\/|https:\/\/|ftp:\/\/){1}([0-9A-Za-z]+\.)");
		//var urlregex= new RegExp("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
		/*if(urlregex.test(value))
		{
			return(true);
		}
		return(false);*/
}

function chkURL(URL)
{
	var a=URL.substr(0,4);
	if(a != "http")
		document.frm1.Banner_URL.value = "http://"+a;
	
}

function ShowImage(URL)
{
	window.open(URL,'mywindow','width=400,height=400,scrollbars=yes,resizable=yes');		
}


function newwindow(url)
{
	var URL = SITE_URL + url;
	window.open(URL,'mywindow','status=yes, scrollbars=yes, resizable=yes, fullscreen=yes');
		
}
function newwindowclassified(url)
{
	var URL = CLS_SITE_URL + url;
	window.open(URL,'mywindow','width=400, height=300, status=yes, scrollbars=yes, resizable=yes');
		
}

function FillCast()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
			
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("CastId1");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}

	var StateId = document.getElementById("ReligionId").value;
	var queryString = "?ReligionId=" + StateId;

	ajaxRequest1.open("GET",SITE_URL+"includes/fill_marital_status.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function FillCasts()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
			
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.frm1.CastId1;
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}

	var StateId = document.getElementById("ReligionId").value;
	var queryString = "?ReligionId=" + StateId;

	ajaxRequest1.open("GET",SITE_URL+"includes/fill_marital_status.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function FillCastuser()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				
				var ajaxDisplay = document.getElementById("CastId1");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}

	var StateId = document.getElementById("ReligionId").value;
	var queryString = "?ReligionId=" + StateId;
	ajaxRequest1.open("GET",SITE_URL+"includes/fill_marital_statususer.php" + queryString, true);
	ajaxRequest1.send(null); 
}


function ShowContent(a)
{
	for(i=0; i<4; i++)
	{
		 
		 var showid = eval("document.getElementById('show"+i+"')");
		  var hideid = eval("document.getElementById('hide"+i+"')");
				 
			if(i == a)
			{
				showid.style.display="block";
				hideid.style.display="none";				
			}
			else
			{
				showid.style.display="none";
				hideid.style.display="block";
			}
	}
		
	
	var ajaxRequest2 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest2.onreadystatechange = function(){
		
		if(ajaxRequest2.readyState == 4){
				
			var ajaxDisplay = document.getElementById("displaycontent");
			ajaxDisplay.innerHTML = ajaxRequest2.responseText;
		}
	}
		
	var queryString = "?contentid=" + a;
	ajaxRequest2.open("GET", "includes/newscontent.php" + queryString, true);
	
	ajaxRequest2.send(null); 
}


function FillStatewithClass(clsname)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split(":");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById("StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById("CountryId").value;
	var queryString = "?CountryId=" + CountryId+"&clsname="+clsname;
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_citywithclass.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}

function FillCitywithClass(clsname)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	var StateId = document.getElementById("StateId").value;
	var queryString = "?StateId=" + StateId+"&clsname="+clsname;
	
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_citywithclass.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function DispPlanDetail(planid)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("dispplandetail");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	//var StateId = document.getElementById("StateId").value;
	var queryString = "?Planid=" + planid;
	ajaxRequest1.open("GET", SITE_URL +"includes/display_plan_detail.php" + queryString, true);
	ajaxRequest1.send(null); 
}
function FillStatemarital()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split(":");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById("StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById("CountryId").value;
	var queryString = "?CountryId=" + CountryId;
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city_marital.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}

function FillCitymarital()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	var StateId = document.getElementById("StateId").value;
	var queryString = "?StateId=" + StateId;
	
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city_marital.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function CheckCity()
{
	var CityId = document.getElementById("CityId").value;
	if(CityId == 0)
	{
		document.getElementById("addcityval").style.display="block";	
		document.getElementById("OtherCity").focus();
	}
	else
		document.getElementById("addcityval").style.display="none";	
	
}



function FillStateOther()
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split("@");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById("StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById("CountryId").value;
	var queryString = "?CountryId=" + CountryId;
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city_other.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}

function FillCityOther()
{
	var StateId = document.getElementById("StateId").value;
	if(StateId == 0)
	{
		document.getElementById("addstateval").style.display="block";	
		document.getElementById("OtherState").focus();
	}
	else
	{

		var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
		
		// Create a function that will receive data sent from the server
		ajaxRequest1.onreadystatechange = function(){
			if(ajaxRequest1.readyState == 4){
					
				//alert(ajaxRequest1.responseText);
				if(ajaxRequest1.responseText != "notfound")
				{
					var ajaxDisplay = document.getElementById("CityOpt");
					ajaxDisplay.innerHTML = ajaxRequest1.responseText;
					document.getElementById("addstateval").style.display="none";	
				}
			}
		}
		
		var queryString = "?StateId=" + StateId;
		
		ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city_other.php" + queryString, true);
		ajaxRequest1.send(null); 
	}
}

function FillStateOtherwithClass(clsname)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split("@");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById("StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				var ajaxDisplay = document.getElementById("CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById("CountryId").value;
	var queryString = "?CountryId=" + CountryId+"&clsname="+clsname;
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city_otherwithclass.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}

function FillCityOtherwithClass(clsname)
{
	var StateId = document.getElementById("StateId").value;
	if(StateId == 0)
	{
		document.getElementById("addstateval").style.display="block";	
		document.getElementById("OtherState").focus();
	}
	else
	{

		var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
		
		// Create a function that will receive data sent from the server
		ajaxRequest1.onreadystatechange = function(){
			if(ajaxRequest1.readyState == 4){
					
				//alert(ajaxRequest1.responseText);
				if(ajaxRequest1.responseText != "notfound")
				{
					var ajaxDisplay = document.getElementById("CityOpt");
					ajaxDisplay.innerHTML = ajaxRequest1.responseText;
					document.getElementById("addstateval").style.display="none";	
				}
			}
		}
		
		var queryString = "?StateId=" + StateId+"&clsname="+clsname;
		
		ajaxRequest1.open("GET", SITE_URL+"includes/fill_state_city_otherwithclass.php" + queryString, true);
		ajaxRequest1.send(null); 
	}
}



function FillOtherStateClassPrefix(clsname,prefix)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			var longstring=ajaxRequest1.responseText;
			var brokenstring=longstring.split("@");
				
			if(brokenstring[0] != "notfound")
			{
				var ajaxDisplay = document.getElementById(prefix+"StateOpt");
				ajaxDisplay.innerHTML = brokenstring[0];
			}
			if(brokenstring[1] != "notfound")
			{
				//alert(brokenstring[1]);
				var ajaxDisplay = document.getElementById(prefix+"CityOpt");
				ajaxDisplay.innerHTML = brokenstring[1];
			}
		}
	}
	var CountryId = document.getElementById(prefix+"CountryId").value;
	var queryString = "?CountryId=" + CountryId+"&clsname="+clsname+"&prefix="+prefix;
	ajaxRequest1.open("GET", SITE_URL+"includes/fill_otherstate_city_classprefix.php" + queryString, true);
	
	ajaxRequest1.send(null); 
}

function FillOtherCityClassPrefix(clsname,prefix)
{
	var StateId = document.getElementById(prefix+"StateId").value;
	if(StateId == 0)
	{
		document.getElementById(prefix+"addstateval").style.display="block";	
		document.getElementById(prefix+"OtherState").focus();
	}
	else
	{

		var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
		
		// Create a function that will receive data sent from the server
		ajaxRequest1.onreadystatechange = function(){
			if(ajaxRequest1.readyState == 4){
					
				//alert(ajaxRequest1.responseText);
				if(ajaxRequest1.responseText != "notfound")
				{
					var ajaxDisplay = document.getElementById(prefix+"CityOpt");
					ajaxDisplay.innerHTML = ajaxRequest1.responseText;
					document.getElementById(prefix+"addstateval").style.display="none";	
				}
			}
		}
		
		var queryString = "?StateId=" + StateId+"&clsname="+clsname+"&prefix="+prefix;
		
		ajaxRequest1.open("GET", SITE_URL+"includes/fill_otherstate_city_classprefix.php" + queryString, true);
		ajaxRequest1.send(null); 
	}
}

function CheckCityPrefix(prefix)
{
	
	var CityId = document.getElementById(prefix+"CityId").value;
	if(CityId == 0)
	{
		document.getElementById(prefix+"addcityval").style.display="block";	
		document.getElementById(prefix+"OtherCity").focus();
	}
	else
		document.getElementById(prefix+"addcityval").style.display="none";	
	
}

function DispMatPlanDetail(planid)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("dispplandetail");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	//var StateId = document.getElementById("StateId").value;
	var queryString = "?Planid=" + planid;
	
	ajaxRequest1.open("GET", MAT_SITE_URL+"includes/matrimonial_plan_detail.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function DispMatPlanDetails(planid)
{

	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				var ajaxDisplay = document.getElementById("dispplandetails");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}
	//var StateId = document.getElementById("StateId").value;
	var queryString = "?Planid=" + planid;
	
	ajaxRequest1.open("GET", MAT_SITE_URL+"includes/matrimonial_plan_details.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function FillCastClass(clsname)
{
	var ajaxRequest1 = Create_Object();  // The variable that makes Ajax possible!		
	
	// Create a function that will receive data sent from the server
	ajaxRequest1.onreadystatechange = function(){
		if(ajaxRequest1.readyState == 4){
				
			//alert(ajaxRequest1.responseText);
			if(ajaxRequest1.responseText != "notfound")
			{
				
				var ajaxDisplay = document.getElementById("CastId1");
				ajaxDisplay.innerHTML = ajaxRequest1.responseText;
			}
		}
	}

	var StateId = document.getElementById("ReligionId").value;
	var queryString = "?ReligionId=" + StateId+"&clsname="+clsname;
	ajaxRequest1.open("GET",SITE_URL+"includes/fill_marital_statusclass.php" + queryString, true);
	ajaxRequest1.send(null); 
}

function checkInternationalPhone(strPhone)
{
	// Declaring required variables
	var digits = "0123456789";
	// non-digit characters which are allowed in phone numbers
	var phoneNumberDelimiters = "()- ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
	var validWorldPhoneChars = phoneNumberDelimiters + "+";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 10;
	//alert(strPhone);
	var bracket=3
	strPhone=Trim(strPhone)
	if(strPhone.indexOf("+")>1) return false
	if(strPhone.indexOf("-")!=-1)bracket=bracket+1
	if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
	var brchr=strPhone.indexOf("(")
	if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
	if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(s));
	//return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}




