



function getf() {
                        var theform;
                        if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
                                theform = document.Form1;
                        }
                        else {
                                theform = document.forms["Form1"];
                        }
                        return theform;
}

function GetCookie(sName)
{
        //cookies are separated by semicolons
        var aCookie = document.cookie.split("; ");
        CookieLength = aCookie.length;
        for (var i=0; i < CookieLength; i++)
        {
                // a name/value pair (a crumb) is separated by an equal sign
                var aCrumb = aCookie[i].split("=");
                if (sName == aCrumb[0]) return unescape(aCrumb[1]);
        }
        // a cookie with the requested name does not exist
        return null;
}


  function SetCookie(sName, sValue)
  {
    var date = new Date();
    date.setDate(date.getDate() + 190);
    //document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString() + "; path=/; domain=RentalEarth.com";
    document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString() + "; path=/;";
  }
  
  function cityclick() {
   var f = getf();
   var val = f.lstCities.options[f.lstCities.selectedIndex].value;
   SetCookie('cityselect',val);
   window.location = "propsearch.aspx?simple=y&cityid=" + val;
  }
  
  function setlist() {
    var val = GetCookie("cityselect");
    try {
        SetCookie("w",screen.width);
        SetCookie("h",screen.height);
        } catch (e) {}; 
        
        
    if (val != null) {
      var f = getf();
      var i = 0;
      for (i=0;i<f.lstCities.options.length;i++) {
         if (f.lstCities.options[i].value == val)
            f.lstCities.selectedIndex = i;
      }
    }
  }

