// Check for a blank field.
function isBlank(data)
{
	// Remove all cases of "<br>" and "&nbsp;"
	data = data.replace(/\r|\n|\<br>|\&nbsp;/g, "");
	// Remove all spaces
	data = data.replace(/\s/g, "");	

	if (data == '')
		return true;
	else
		return false;	
}

function replaceDoubleQuotes(data)
{
	// Remove all cases of "<br>" and "&nbsp;"
	data = data.replace(/\"/g, '\"');

	return data;	
}


function getXMLHttpObject()
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();		
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
		
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	return xmlHttp;
}

function changeCityDropDown(stateID,elementToChange)
{
//	alert(stateID);

	xmlHttp = getXMLHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="/ajax_php/changeCityDropDown.php";
	url=url+"?id="+stateID;
	//url=url+"&country="+country;
	url=url+"&sid="+Math.random();

	xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState==4)
		{
			document.getElementById(elementToChange).innerHTML=xmlHttp.responseText;
			//window.open("document.writeln('" + xmlHttp.responseText + "');", 'OFFSCREEN','scrollbars=no,resizable=no,width=1024,height=768');
		}
    }

   xmlHttp.open("POST",url,true);
   xmlHttp.send(null);   
}

function changeStateDropDown(countryID,elementToChange)
{
//	alert(countryID);

	xmlHttp = getXMLHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="/ajax_php/changeStateDropDown.php";
	url=url+"?id="+countryID;
	url=url+"&sid="+Math.random();

	xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState==4)
		{
			document.getElementById(elementToChange).innerHTML=xmlHttp.responseText;
			document.getElementById('cityDropDown').innerHTML="";
			//window.open("document.writeln('" + xmlHttp.responseText + "');", 'OFFSCREEN','scrollbars=no,resizable=no,width=1024,height=768');
		}
    }

   xmlHttp.open("POST",url,true);
   xmlHttp.send(null);   
}

function changeIndexMembers(pageID)
{

	xmlHttp = getXMLHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="/ajax_php/changeIndexFeatured.php";
	url=url+"?id="+pageID;

	xmlHttp.onreadystatechange=function()
    {
		if(xmlHttp.readyState==4)
		{
			document.getElementById('indexMem').innerHTML=xmlHttp.responseText;
			//document.getElementById('indexMem').innerHTML="";
			//window.open("document.writeln('" + xmlHttp.responseText + "');", 'OFFSCREEN','scrollbars=no,resizable=no,width=1024,height=768');
		}
    }

   xmlHttp.open("POST",url,true);
   xmlHttp.send(null);   
}