// JavaScript Document
function getNewHTTPObject1()
{
        var xmlhttp;

        /** Special IE only code ... */
        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xmlhttp = false;
                  }
             }
          @else
             xmlhttp = false;
        @end @*/

        /** Every other browser on the planet */
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xmlhttp = new XMLHttpRequest();
            }
            catch (e)
            {
                xmlhttp = false;
            }
        }

        return xmlhttp;
}
function checkuname(uname)
{
   var strURL="includes/finduname.php?u="+uname;
	var xmlhttp1 = getNewHTTPObject1();
   if (xmlhttp1)
   {
     xmlhttp1.onreadystatechange = function()
     {
      if (xmlhttp1.readyState == 4)
      {
	 // only if “OK”
	 if (xmlhttp1.status == 200)
         {
			 if(xmlhttp1.responseText=='found')
			 {
				document.getElementById("a").innerHTML="This username already exists.";	
				document.getElementById("flg").value='1';
			 }
			 else
			 {
				document.getElementById("a").innerHTML="This username is available.";	
				document.getElementById("flg").value='0';
			 }
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
	 }
       }
      }
   xmlhttp1.open("GET", strURL, true);
   xmlhttp1.send(null);
   }
}
function showcities(country)
{
	document.getElementById('other_city').innerHTML=" ";
   var strURL="includes/findcities.php?country="+country;
	var xmlhttp1 = getNewHTTPObject1();
   if (xmlhttp1)
   {
     xmlhttp1.onreadystatechange = function()
     {
      if (xmlhttp1.readyState == 4)
      {
	 // only if “OK”
	 if (xmlhttp1.status == 200)
         {
	    document.getElementById("cities_div").innerHTML=xmlhttp1.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
	 }
       }
      }
   xmlhttp1.open("GET", strURL, true);
   xmlhttp1.send(null);
   }
}
function showotherloc(loc)
{
	if(loc==0)
	{
		document.getElementById("loc").innerHTML="<input type=text name=nSettingLocationID id=nSettingLocationID class=box1>";	
	}
}
function findloc(city)
{
	if(city==0)
	{
		document.getElementById("cities_div1").innerHTML="<input type=text name=nSettingCityID id=nSettingCityID class=box1>";
		document.getElementById("loc").innerHTML="<input type=text name=nSettingLocationID id=nSettingLocationID class=box1>";
	}
	else
	{
	   var strURL="includes/showlocs.php?city="+city;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("loc").innerHTML=xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }
	}
}
function delpic(pic,action,lid)
{
	if(confirm("Are you sure you want to delete this picture?")){
		var strURL="includes/delpic.php?pic="+pic+"&action="+action+"&lid="+lid;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("pics").innerHTML = xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }	
	}
	  else
	  {return false;}
}
function mainpicc(pic,action,lid)
{
		var strURL="includes/main.php?pic="+pic+"&action="+action+"&lid="+lid;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("pics").innerHTML = xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }	
}
function showcities1(cid)
{
		var strURL="includes/showcities.php?cid="+cid;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("cities").innerHTML = xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }	
}
function findcities(country)
{
   if(country==0)
   {
		document.getElementById("cities_div1").innerHTML="<input type=text name=nSettingCityID id=nSettingCityID class=box1>";
		document.getElementById("loc").innerHTML="<input type=text name=nSettingLocationID id=nSettingLocationID class=box1>";
   }
   else
   {
	   var strURL="includes/findcities_listings.php?country="+country;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("cities_div1").innerHTML=xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }
   }
}
function showlistings(p)
{
	   var strURL="featuredlistings.php?p="+p;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("featured").innerHTML=xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }
}
function showglossary(p,letter)
{
	var strURL="glossarywords.php?p_g="+p+"&letter="+letter;
		var xmlhttp1 = getNewHTTPObject1();
	   if (xmlhttp1)
	   {
		 xmlhttp1.onreadystatechange = function()
		 {
		  if (xmlhttp1.readyState == 4)
		  {
		 // only if “OK”
		 if (xmlhttp1.status == 200)
			 {
			document.getElementById("glossary").innerHTML=xmlhttp1.responseText;
		 } else {
		   alert("There was a problem while using XMLHTTP:\n" + xmlhttp1.statusText);
		 }
		   }
		  }
	   xmlhttp1.open("GET", strURL, true);
	   xmlhttp1.send(null);
	   }
}