
				function check_india_usa(country_val,state_val,city_val, flag_val)
				{
					if(!state_val) var state_val = "";
					if(!city_val)  var city_val  = "";
					if(!flag_val)  var flag_val  = "";

						display_state_dropdown(country_val,state_val,city_val,document.newuser.stateofresidence,'+ urlname + ','city_search',flag_val,'state_selected');
						display_dropdown(country_val,state_val,city_val,document.newuser.elements['residence'], '+ urlname +', 'city_search',flag_val,'state_selected');
				}

				function check_religion(religion_val,caste_val, flag_val)
				{
					if(!caste_val) var caste_val = "";
					if(!flag_val)  var flag_val  = "";
					display_caste_dropdown(religion_val,caste_val, document.newuser.caste,'+ urlname + ','city_search',flag_val,'caste_selected');
				}


// To get the HTTP object to call a method..
function getHTTPObject()
{
	var xmlhttp;

	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlhttp = new XMLHttpRequest();
			}
			catch (e)
			{
				xmlhttp = false;
			}
		}
	}

	return xmlhttp;

} 
// EO function getHTTPObject()

//Instatiate another object to call method..
var http_state = new getHTTPObject();
var check_selected_state;
var check_state_obj;
var check_state_from_page;

function display_state_dropdown(selected_country, selected_state, selected_city, state_obj, img_url, from_page, flag)
{

		check_state_obj = state_obj;
		check_state_from_page = from_page;
		var myurl = urlname + "/include/state.asp?country=" + escape(selected_country) + "&state=" + escape(selected_state) + "&city=" + escape(selected_city);

		
		if(selected_country == "")
		{
			state_obj.options.length = 0;
			state_obj[0] = new Option("Select state", "");
			return false;
		}

		document.getElementById("show_hide_state").style.display = "none";
		document.getElementById("loading_state").innerHTML = "<img src=\"" + urlname + "/images/loading.gif\" hspace=\"16\" vspace=\"3\" align=\"absmiddle\">";
		check_selected_state = selected_state;

		http_state.open("GET", myurl, true);
		http_state.onreadystatechange = useHttpResponse_state;
		http_state.send(null);

} // EO function


// To populate the drop down with state values..
function useHttpResponse_state()
{


	if (http_state.readyState == 4 && http_state.status == 200)
	{
		var textout = http_state.responseText;
		
		myString    = new String(textout);
		splitString = myString.split("|");

		check_state_obj.options.length = 0;
		check_state_obj[0] = new Option("Select state", "");

		for(var i=0; i<splitString.length; i++)
		{
			var curr_state = splitString[i];
			var curr_state_val;
			curr_state_val = curr_state;

			check_selected_state_spilt_string = check_selected_state.split('|');
			
			if(InArray(check_selected_state_spilt_string, curr_state) >= 0)
			{
				check_state_obj[i+1] = new Option(curr_state, curr_state_val, false, true);
				check_state_obj[i+1].selected = true;
			}
			else
			{
				check_state_obj[i+1] = new Option(curr_state, curr_state_val);
			}
		}

		document.getElementById("loading_state").innerHTML = "";
		document.getElementById("show_hide_state").style.display = "";
	}
}

//END


var http = new getHTTPObject();
var check_selected_city;
var check_city_obj;
var check_city_from_page;

function display_dropdown(selected_country, selected_state, selected_city, city_obj, img_url, from_page, flag, state_option)
{
	var myurl = urlname+'/include/city.asp?country='+ escape(selected_country)+'&state='+escape(selected_state)+'&city='+escape(selected_city)+'&state_option='+escape(state_option)+'&from_page='+escape(from_page);

	check_city_obj = city_obj;
	check_city_from_page = from_page;

	if((selected_state == "" && state_option != "no_state_selected") || selected_country == "")
	{
		city_obj.options.length = 0;
		city_obj.options.size = 1;
		city_obj[0] = new Option("---------Select city---------", "");
		return false;
	}

	document.getElementById("show_hide_city").style.display = "none";
	document.getElementById("loading_city").innerHTML = "<img src=\"" + urlname + "/images/loading.gif\" hspace=\"16\" align=\"absmiddle\">";

	if(selected_city == "-")
		check_selected_city = "Other";
	else
		check_selected_city = selected_city;

	http.open("GET", myurl, true);
	http.onreadystatechange = useHttpResponse;
	http.send(null);

} // EO function display_dropdown()


// To populate the drop down with city values..
function useHttpResponse()
{
	// readyState = 0 being unintialised, 1 being loading, 2 being loaded, 3 being interactive and 4 being finished
	if (http.readyState == 4 && http.status == 200)
	{
		var textout = http.responseText;

		myString    = new String(textout);
		splitString = myString.split("|");

		check_city_obj.options.length = 0;
		check_city_obj.options.size = 1;
		check_city_obj[0] = new Option("---------Select city---------", "");
		
		for(var i=0; i<splitString.length; i++)
		{
			var curr_city = splitString[i].trim();
			var curr_city_val;

			if(curr_city == "Other")
			{
				curr_city_val = "Other";
			}
			else
			{
				curr_city_val = curr_city;
			}

			if(curr_city)
			{
				//Creating new options of city ..
				check_selected_city_spilt_string = check_selected_city.split('|');
					
				if (InArray(check_selected_city_spilt_string, curr_city) >= 0)
				{
					check_city_obj[i+1] = new Option(curr_city, curr_city_val, false, true);
					check_city_obj[i+1].selected = true;
				}
				else
				{
					check_city_obj[i+1] = new Option(curr_city, curr_city_val);
				}
			}
		}

		document.getElementById("loading_city").innerHTML = "";
		document.getElementById("show_hide_city").style.display = "";
	}
}

//END



var http_caste = new getHTTPObject();
var check_selected_caste;
var check_caste_obj;
var check_caste_from_page;

function display_caste_dropdown(selected_religion, selected_caste, caste_obj, img_url, from_page, flag)
{
	check_caste_obj = caste_obj;
	check_caste_from_page = from_page;

		var myurl = urlname + "/include/caste.asp?religion=" + escape(selected_religion);
	
		if(selected_religion == "")
		{
			caste_obj.options.length = 0;
			caste_obj[0] = new Option("Select caste", "");
			return false;
		}

		document.getElementById("loading_caste").innerHTML = "<img src=\"" + urlname + "/images/loading.gif\" hspace=\"16\" vspace=\"3\" align=\"absmiddle\">";

	if(selected_caste == "-")
	{
		check_selected_caste = "Other";
	}
	else
	{
		check_selected_caste = selected_caste;
	}
	
		caste_obj.options.length = 0;
		document.getElementById("show_hide_caste").style.display = "none";

		http_caste.open("GET", myurl, true);
		http_caste.onreadystatechange = useHttpResponse_caste;
		http_caste.send(null);

} // EO function


function useHttpResponse_caste()
{
	if (http_caste.readyState == 4 && http_caste.status == 200)
	{
		var textout = http_caste.responseText;
		myString    = new String(textout);
		splitString = myString.split("|");

		check_caste_obj.options.length = 0;
		check_caste_obj[0] = new Option("Select caste", "");

		for(var i=0; i<splitString.length; i++)
		{
			var curr_caste = splitString[i].trim();
			var curr_caste_val;

			if(curr_caste == "Other")
			{
				curr_caste_val = "Other";
			}
			else
			{
				curr_caste_val = curr_caste;
			}

			//Creating new options of caste ..
			check_selected_caste_spilt_string = check_selected_caste.split('|');
			
			if(InArray(check_selected_caste_spilt_string, curr_caste) >= 0)
			{
				check_caste_obj[i+1] = new Option(curr_caste, curr_caste_val, false, true);
				check_caste_obj[i+1].selected = true;
			}
			else
			{
				check_caste_obj[i+1] = new Option(curr_caste, curr_caste_val);
			}
		}

		document.getElementById("loading_caste").innerHTML = "";
		document.getElementById("show_hide_caste").style.display = "";
	}
}


String.prototype.trim = function()
{
	var x=this;
	x=x.replace(/^\s*(.*)/, "$1");
	x=x.replace(/(.*?)\s*$/, "$1");
	return x;
}

function InArray(arr, key) 
{
	for (var i=0; i<arr.length; i++)
	{
		if (arr[i] == key)	return i;
	}
	return -1;
}



//Open Email
function checkuemail(str)
{ 
	var str;
xmlHttpemail = new getHTTPObject();
if (xmlHttpemail==null)
  {
  	alert ("Your browser does not support AJAX!");
	  return;
  } 

var url= urlname+'/include/checkmember.asp?pemail='+str;
xmlHttpemail.onreadystatechange = uemailchange;
xmlHttpemail.open("GET",url,true);
xmlHttpemail.send(null);
}

function uemailchange() 
{
	if (xmlHttpemail.readyState == 4 && xmlHttpemail.status == 200 && xmlHttpemail.responseText != "")
	{ 
		document.getElementById("show_hide_email").innerHTML=xmlHttpemail.responseText;
	}
}
//Close Email

//Open Profile
function checkuprofile(str)
{ 
	var str;
xmlHttpprofile = new getHTTPObject();
if (xmlHttpprofile==null)
  {
  	alert ("Your browser does not support AJAX!");
	  return;
  } 

var url= urlname+'/include/checkmember.asp?pid='+str;
xmlHttpprofile.onreadystatechange = upidchange;
xmlHttpprofile.open("GET",url,true);
xmlHttpprofile.send(null);
}

function upidchange() 
{
	if (xmlHttpprofile.readyState == 4 && xmlHttpprofile.status == 200 && xmlHttpprofile.responseText != "")
	{ 
		document.getElementById("show_hide_pid").innerHTML=xmlHttpprofile.responseText;
	}
}
//Close Profile

