var xmlHttp;

function orgin(O)
{
  O = O.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+O+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
	return "";
  else
    return results[1];
}

function showSpecial1(str)
{ 
var spinWheel = '<div style="position:relative; padding:50px 0 0 197px;"><img src="/images/spinwheel-waiting.gif" border="0" width="30" height="30"/></div>';
document.getElementById("price-frame1").innerHTML = spinWheel; 

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="data/scrollpost.asp";
url=url+"?q="+str+"&data="+data;
xmlHttp.onreadystatechange=stateChanged1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged1() 
{
	if (xmlHttp.readyState==4)
	{	
	document.getElementById("price-frame1").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
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 showUniqueCities()
{
		var selectObject = document.getElementById("_fareSaleCityList");
		var uniqueList = "";
		for (var i = 0; i < selectObject.options.length; i++) 
		{
			var curOption = selectObject.options[i].value;
			if(uniqueList.indexOf(curOption) < 0)
			{
				uniqueList = uniqueList + "|" + curOption + "|";
			}
			else{				
				selectObject.remove(i);
				i--;
			}	
		}			
}

function CheckCityExists(cityName)
{
		cityName = cityName.replace("%20", " ");
		var selectObject = document.getElementById("_fareSaleCityList");
		var uniqueList = "";
		for (var i = 0; i < selectObject.options.length; i++) 
		{
			var curOption = selectObject.options[i].value;			
			if(curOption == cityName)
			{				
				return true;				
			}			
		}		
		return false;
}

function showEm()
{	
	showUniqueCities();		
	var O_city = orgin('q');
	if (O_city !="" && CheckCityExists(O_city))
	{ 	
		showSpecial1(O_city);
	}		
}