function getXMLHTTP() 
	{
		var xmlhttp;	
		var browser = navigator.appName;
		if(browser == "Microsoft Internet Explorer")
		 {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		 }
		else
		 {
			xmlhttp = new XMLHttpRequest();
		 }
		return xmlhttp;	
    }
	
function getState(country_pl) 
 {		
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findState.php?country_pl="+country_pl;
	var req = getXMLHTTP();

	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								document.getElementById('statediv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

/********** New Function Use In Index.php *******************/
function getStateNew(country_pl,func_flag) 
 {		
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findStatemodified.php?country_pl="+country_pl+"&func_flag="+func_flag;
	var req = getXMLHTTP();

	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								document.getElementById('statediv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

/************** Code To Increament Counter For User Fields *******************/
function updateCounter(dbfield,user_id) 
 {
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/increamentCounter.php?user_id="+user_id+"&dbfield="+dbfield;
	var req = getXMLHTTP();
	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								//document.getElementById('statediv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}


function getCity(country_pl,state_pl) 
{
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findCity.php?country_pl="+country_pl+"&state_pl="+state_pl;
	var req = getXMLHTTP();
	
	if (req) 
	{			
		req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{
						if (req.status == 200) 
							{
								document.getElementById('citydiv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL, true);
			req.send(null);
	}
}

/************************* Used In Index.php*******************/
function getCityNew(country_pl,state_pl) 
{
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findCityNew.php?country_pl="+country_pl+"&state_pl="+state_pl;
	var req = getXMLHTTP();
	
	if (req) 
	{			
		req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{
						if (req.status == 200) 
							{
								document.getElementById('citydiv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL, true);
			req.send(null);
	}
}



function getState_sl(country_sl) 
 {		
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findState_sl.php?country_sl="+country_sl;
	var req = getXMLHTTP();

	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								document.getElementById('statediv_sl').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

function getCity_sl(country_sl,state_sl) 
{
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findCity_sl.php?country_sl="+country_sl+"&state_sl="+state_sl;
	var req = getXMLHTTP();
	
	if (req) 
	{			
		req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{
						if (req.status == 200) 
							{
								document.getElementById('citydiv_sl').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL, true);
			req.send(null);
	}
}

function getsubcat(special_id) 
 {		
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findsubcategory.php?special_id="+special_id;
	var req = getXMLHTTP();

	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								document.getElementById('categorydiv_pl').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

function getProcedures(specialtyids) 
 {		
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findProcedures.php?specialty="+specialtyids;
	var req = getXMLHTTP();

	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								document.getElementById('procedurediv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}

//used in index page user side

function getProcedures1(specialtyids) 
 {		
	var strURL="http://www.plasticsurgerysearch.com/includes/modules/findProcedures1.php?specialty="+specialtyids;
	var req = getXMLHTTP();

	if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
					{	
						if (req.status == 200) 
							{
								document.getElementById('procedurediv').innerHTML=req.responseText;						
							} 
						else 
							{
								alert("There was a problem while using XMLHTTP:\n" + req.statusText);
							}
					}
			}
			req.open("GET", strURL);
			req.send(strURL);
		}		
}
