var searchWin = null;
var searchString = "";
var query = "";
var uCountry = null;
var collection = null;

//FUNCTION PROTOTYPES

//This prototype is provided by the Mozilla foundation and//is distributed under the MIT license.//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
if (!Array.prototype.indexOf)
{
    Array.prototype.indexOf = function(elt /*, from*/)
      {
          var len = this.length;
          var from = Number(arguments[1]) || 0;
          from = (from < 0)
              ? Math.ceil(from)
              : Math.floor(from);
          if (from < 0)
              from += len;
          for (; from < len; from++)
          {
              if (from in this && this[from] === elt)
                  return from;
          }
          return -1;
      };
}
//END PROTOTYPES

function translate (str)
{
   var i=0;
   var tempStr;
   str = str.replace (/ /g, "");
   str = str.replace (/,/g, "");
   str = str.replace (/&/g, "");
   i++;
   return str;
}

function disableEnterKey(e)
{
     var key;


     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}

function disableEnterKeyFromHome(e,textboxObj)
{
     var key;


     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

    
     if(key == 13)
     {
          doSearchOnHome();
     }
     else
          return true;
}

function doSearchonSubmit(textValue)
{
   
    if (textValue != '' && textValue != 'Enter city/state/Country/hotel to search')
    {       
        doSearchOnHome();        
    }
    
    return false;
}

function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g, "");
}

function uniqueEntry(entry) {
    //if (entry == null) return;
    var arrNewEntry = [];
    var seenEntry = {};
    for (var i = 0; i < entry.length; i++) {
        if (!seenEntry[entry[i]]) {
            seenEntry[entry[i]] = true;
            arrNewEntry.push(entry[i]);
        }
    }
    collection = arrNewEntry;
}

function uniqueCountry(entry) {
    var arrNewEntry = [];
    var seenEntry = {};
    for (var i = 0; i < entry.length; i++) {
        if (!seenEntry[entry[i]]) {
            seenEntry[entry[i]] = true;
            arrNewEntry.push(entry[i]);
        }
    }
    uCountry = arrNewEntry;
}

function uniqueCity(entry) {
    var arrNewEntry = [];
    var seenEntry = {};
    for (var i = 0; i < entry.length; i++) {
        if (!seenEntry[entry[i]]) {
            seenEntry[entry[i]] = true;
            arrNewEntry.push(entry[i]);
        }
    }
    uCity = arrNewEntry;
}

function uniqueState(entry) {
    var arrNewEntry = [];
    var seenEntry = {};
    for (var i = 0; i < entry.length; i++) {
        if (!seenEntry[entry[i]]) {
            seenEntry[entry[i]] = true;
            arrNewEntry.push(entry[i]);
        }
    }
    uState = arrNewEntry;
}

function buildStyles() {
    var sStyles = "<style>\r";
    totalElements = featureCollectionState.length;
    currentElement = 0;
    while (currentElement < totalElements) {
        sStyles += "#expand_state_" + featureCollectionState[currentElement].id + " { display:none };\r";
        currentElement++;
    }
    sStyles += "</style>";
    document.write(sStyles);

    sStyles = "<style>\r";
    totalElements = featureCollectionCity.length;
    currentElement = 0;
    while (currentElement < totalElements) {
        sStyles += "#expand_city_" + featureCollectionCity[currentElement].id + " { display:none };\r";
        currentElement++;
    }
    sStyles += "</style>";
    document.write(sStyles);    
}

function sortProp(a, b) {
    var x = a.prop.toLowerCase();
    var y = b.prop.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortCityProp(a, b) {
    var x = a.prop.toLowerCase();
    var y = b.prop.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : sortProp(a, b)));
}

function sortStateCityProp(a, b) {
    var x = a.state.toLowerCase();
    var y = b.state.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : sortCityProp(a, b)));
}

function sortCityStateProp(a, b) {
    var x = a.city.toLowerCase();
    var y = b.city.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : sortProp(a, b)));
}

function sortRate(a, b) {
    var x = a;
    var y = b;
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function genLastMinuteSpecials() {

    var sHTML = "";
    for (i = 0; i < lastMinuteSpecials.length; i++) {
        sHTML += "<span class='searchHead'>" + lastMinuteSpecials[i][1] + "</span><br/>";
        sHTML += URLDecode(lastMinuteSpecials[i][2]) + "<br/><br/>";    
    }
    sTab = document.getElementById("specTab");
    sTab.rows[1].cells[0].innerHTML = sHTML;
}

function editLastMinuteSpecials(eID) {

    for (i = 0; i < lastMinuteSpecials.length; i++) {
        if (lastMinuteSpecials[i][0] == eID) {
            eForm.iID.value = lastMinuteSpecials[i][0];
            eForm.title.value = lastMinuteSpecials[i][1];
            eForm.desc.value = URLDecode(lastMinuteSpecials[i][2]);
        }
    }
}

function ADMINLastMinuteSpecials() {

    var sHTML = "<table align='left' style='border:solid 2px #05182d' cellpadding='4'><tr><td align='center' class='adminHead'>Action</td><td align='center' class='adminHead'>ID</td><td align='center' class='adminHead'>Title</td><td align='center' class='adminHead'>Description</td></tr>";
    for (i = 0; i < lastMinuteSpecials.length; i++) {
        sHTML += "<tr><td align='left' class='seachHeadLight' style='background-color:#eef2f3'><a class='propList' href='/ADMIN_EDIT_last-minute-specials.aspx?ID=" + lastMinuteSpecials[i][0] + "'>EDIT</a>&nbsp;&nbsp;<a class='propList' href='/ADMIN_DO_DELETE.aspx?ID=" + lastMinuteSpecials[i][0] + "'>DELETE</a></td>";
        sHTML += "<td align='left' class='seachHeadLight' style='background-color:#eef2f3'>" + lastMinuteSpecials[i][0] + "</td>";
        sHTML += "<td align='left' class='seachHeadLight' style='background-color:#eef2f3'>" + lastMinuteSpecials[i][1] + "</td>";
        sHTML += "<td align='left' class='seachHeadLight' style='background-color:#eef2f3'>" + URLDecode(lastMinuteSpecials[i][2]) + "</td></tr>";
    }
    sHTML += "</table>"
    sTab = document.getElementById("specTab");
    sTab.rows[2].cells[0].innerHTML = sHTML;
}

function genAttractionTickets() {

    var sHTML = "";
    for (i = 0; i < attractionTickets.length; i++) {
        sHTML += "<span class='searchHead'>" + attractionTickets[i][1] + "</span><br/>";
        sHTML += URLDecode(attractionTickets[i][2]) + "<br/><br/>";
    }
    sTab = document.getElementById("tktTab");
    sTab.rows[1].cells[0].innerHTML = sHTML;
}

function editAttractionTickets(eID) {

    for (i = 0; i < attractionTickets.length; i++) {
        if (attractionTickets[i][0] == eID) {
            eForm.iID.value = attractionTickets[i][0];
            eForm.title.value = attractionTickets[i][1];
            eForm.desc.value = URLDecode(attractionTickets[i][2]);
        }
    }
}

function ADMINAttractionTickets() {

    var sHTML = "<table align='left' style='border:solid 2px #05182d' cellpadding='4'><tr><td align='center' class='adminHead'>Action</td><td align='center' class='adminHead'>ID</td><td align='center' class='adminHead'>Title</td><td align='center' class='adminHead'>Description</td></tr>";
    for (i = 0; i < attractionTickets.length; i++) {
        sHTML += "<tr><td align='left' class='seachHeadLight' style='background-color:#eef2f3'><a class='propList' href='ADMIN_EDIT_attraction-tickets.aspx?ID=" + attractionTickets[i][0] + "'>EDIT</a>&nbsp;&nbsp;<a class='propList' href='ADMIN_DO_tickets_DELETE.aspx?ID=" + attractionTickets[i][0] + "'>DELETE</a></td>";
        sHTML += "<td align='left' class='seachHeadLight' style='background-color:#eef2f3'>" + attractionTickets[i][0] + "</td>";
        sHTML += "<td align='left' class='seachHeadLight' style='background-color:#eef2f3'>" + attractionTickets[i][1] + "</td>";
        sHTML += "<td align='left' class='seachHeadLight' style='background-color:#eef2f3'>" + URLDecode(attractionTickets[i][2]) + "</td></tr>";
    }
    sHTML += "</table>"
    sTab = document.getElementById("tktTab");
    sTab.rows[2].cells[0].innerHTML = sHTML;
}



function show(id) {
    el = document.getElementById(id);
    if (el.style.display == 'none') {
        el.style.display = '';
        el = document.getElementById('more' + id);
        el.innerHTML = 'Touch to Hide This Offer';
    } else {
        el.style.display = 'none';
        el = document.getElementById('more' + id);
        el.innerHTML = 'Book Now, Pay Later!';
    }
}

function URLDecode(url) //function decode URL
{
    // Replace + with ' '
    // Replace %xx with equivalent character
    // Put [ERROR] in output if %xx is invalid.
    var HEXCHARS = "0123456789ABCDEFabcdef";
    var encoded = url;
    var plaintext = "";
    var i = 0;
    while (i < encoded.length) {
        var ch = encoded.charAt(i);
        if (ch == "+") {
            plaintext += " ";
            i++;
        } else if (ch == "%") {
            if (i < (encoded.length - 2)
&& HEXCHARS.indexOf(encoded.charAt(i + 1)) != -1
&& HEXCHARS.indexOf(encoded.charAt(i + 2)) != -1) {
                plaintext += unescape(encoded.substr(i, 3));
                i += 3;
            } else {
                alert('Bad escape combination near ...' + encoded.substr(i));
                plaintext += "%[ERROR]";
                i++;
            }
        } else {
            plaintext += ch;
            i++;
        }
    } // while 

    return plaintext;
}; 


function buildFeaturesSTATE() 
{
    var sHTML = "<table border=0 width=\"440px\">";
    var expandId = "";
    var foundRate = false;
    stateHasChanged = false;
    expandIdSet = false;
    totalElements = featureCollectionState.length;
    currentElement = 0;
    var previousState = "";    
    var stateCount = 0;
    uniqueCountry(collectionCountry);
    uCountry.sort();
    uCountry.reverse();
    for (lCountry = 0; lCountry < uCountry.length; lCountry++ ) {
        sHTML += "<tr>";
        currentCountry = uCountry[lCountry];
        if (currentCountry != "Mexico") {
            currentCountry = uCountry[lCountry] + " (Click on State name to see/hide City Destinations)";
        }
        else {
            currentCountry = uCountry[lCountry] + " (Click on Mexico below to see all Mexican destinations)";
        }
        sHTML += "<td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"4\" class=\"searchHeadLight\" valign=\"top\" align=\"left\">" + currentCountry + "</td></tr>";
        currentElement = 0;
        while (currentElement < totalElements) {
            if (featureCollectionState[currentElement].country == uCountry[lCountry]) {
              
                
                comparator = featureCollectionState[currentElement];
                sHTML += "<tr>";
                sHTML += "<td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"3\" class=\"searchHead\" valign=\"top\" align=\"left\">" + "<a id=\"pLink\" class=\"featureLink\" href=\"#\" onclick=\"return hide_show('expand_state_" + comparator.id + "','search_arrow_" + comparator.id + "','Collapse List','Expand " + comparator.state + " Property List');\">" + comparator.state;
                sHTML += "&nbsp;<img width=\"10\" src=\"images/arrow_down.gif\" alt=\"Expand " + comparator.state + " Property List\" border=\"0\" id=\"search_arrow_" + comparator.id + "\" /></a>";
                sHTML += "</td></tr>";
                sHTML += "<tr style=\"display:none;\" id=\"expand_state_" + comparator.id + "\"><td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"440px\" colspan=\"3\"><table border=\"0\" width=\"100%\" cellpadding=0 cellspacing=0 border=0>";
                currentState = comparator.state;
                while (!stateHasChanged && currentElement < totalElements) {
                    comparator = featureCollectionState[currentElement];
                    if (currentState == comparator.state) {
                        currentCity = comparator.city;
                        cityHasChanged = false;
                        firstRow = true;
                        if (currentState == "Florida" && !expandIdSet) {
                            //expandId = comparator.id;
                            //expandIdSet = true;
                        }
                        sHTML += "<tr bgcolor=\"#05182d\"><td colspan=\"2\" bgcolor=\"#05182d\" valign=\"middle\" align=\"left\" style=\"color:white\">&nbsp;" + comparator.city + "</td></tr>";
                        while (!stateHasChanged && !cityHasChanged && currentElement < totalElements) {
                            comparator = featureCollectionState[currentElement];
                            if (currentCity == comparator.city) {
                                if (currentElement >= totalElements) {
                                    stateHasChanged = true;
                                }
                                else {
                                    comparator = featureCollectionState[currentElement];
                                    if (firstRow == true) {
                                        sHTML += "<tr><td colspan=\"2\" valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #aaaaaa dotted\">";
                                        firstRow = false;
                                    }
                                    else {
                                        sHTML += "<tr><td colspan=\"2\" valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #aaaaaa dotted\">";
                                    }
                                    //sHTML += "<a href=\"/property-detail.aspx?pID=" + comparator.id + "\" class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                                    sHTML += "<a href=/property/" + translate (comparator.prop) + "/" + comparator.id + " class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                                    foundRate = false;
                                    for (i = 0; i < collectionLowestRates.length; i++) {
                                        if (collectionLowestRates[i][1] == comparator.id) {
                                            sHTML += "&nbsp;&nbsp;from&nbsp;&nbsp;";
                                            sHTML += "<span class=\"featuredPropPrice\">$&nbsp;" + collectionLowestRates[i][0] + "</span>";
                                            foundRate = true;
                                        }
                                    }
                                    if (!foundRate) {
                                        sHTML += "&nbsp;&nbsp;&nbsp;<span class=\"featureLight\">Call for Rate</span>";
                                        foundRate = false;
                                    }
                                    sHTML += "</td></tr>"
                                    currentElement++;
                                }
                            }
                            else {
                                cityHasChanged = true;
                            }
                        }
                    }
                    else {
                        stateHasChanged = true;
                        currentElement = currentElement - 1;
                    }                   
                }
                sHTML += "</table></td>";
                sHTML += "</tr>";
                
                stateHasChanged = false;             
            }
            currentElement++;
        }
    }
    sHTML += "</table>";
    otab = document.getElementById("ptab");
    otab.rows[0].cells[0].innerHTML = sHTML;
    
    hide_show("expand_state_" + expandId, "search_arrow_" + expandId, "Collapse List", "");   
}

function state_city_search( explore_type,  explore_name) 
{

//    var sHTML = "<table border=0 width=\"440px\">";
    var sHTML = "";
    var expandId = "";
    var foundRate = false;
    stateHasChanged = false;
    expandIdSet = false;
    totalElements = featureCollectionState.length;
    currentElement = 0;
    
    
    if (explore_type.toLowerCase() == "city" ) {
        sHTML += "<tr bgcolor=\"#05182d\"><td colspan=\"2\" bgcolor=\"#05182d\" valign=\"middle\" align=\"left\" style=\"color:white\">&nbsp;" + explore_name + "</td></tr>";    
        while (currentElement < totalElements) {
            comparator = featureCollectionState[currentElement];
            
            if (comparator.city.toLowerCase() == explore_name.toLowerCase()) {
                sHTML += "<tr><td colspan=\"2\" valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #aaaaaa dotted\">";
                sHTML += "<a href=/property/" + translate (comparator.prop) + "/" + comparator.id + " class=\"featureProp\">&nbsp;" + comparator.prop + "</a><br>";
                sHTML += "</td></tr>"
            }
            currentElement++;
        }
    }
    else if (explore_type.toLowerCase() == "state" ) {      
        sHTML += "<tr><td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"4\" class=\"searchHeadLight\" valign=\"top\" align=\"left\">" + explore_name + "</td></tr>";
        while (currentElement < totalElements) {
            comparator = featureCollectionState[currentElement];
            if (comparator.state.toLowerCase() == explore_name.toLowerCase()) {
                sHTML += "<tr><td colspan=\"2\" valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #aaaaaa dotted\">";
                sHTML += "<a href=/property/" + translate (comparator.prop) + "/" + comparator.id + " class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                sHTML += "</td></tr>"
            }
            currentElement++;
        }    
        
    
    }
    

    
    
    /*
    
    
    uniqueCountry(collectionCountry);
    uCountry.sort();
    uCountry.reverse();
    for (lCountry = 0; lCountry < uCountry.length; lCountry++ ) {
        sHTML += "<tr>";
        currentCountry = uCountry[lCountry];
        if (currentCountry != "Mexico") {
            currentCountry = uCountry[lCountry] + " (Click on State name to see/hide City Destinations)";
        }
        else {
            currentCountry = uCountry[lCountry] + " (Click on Mexico below to see all Mexican destinations)";
        }
        sHTML += "<td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"4\" class=\"searchHeadLight\" valign=\"top\" align=\"left\">" + currentCountry + "</td></tr>";
        currentElement = 0;
        while (currentElement < totalElements) {
            if (featureCollectionState[currentElement].country == uCountry[lCountry]) {

                comparator = featureCollectionState[currentElement];
                sHTML += "<tr>";
                sHTML += "<td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"3\" class=\"searchHead\" valign=\"top\" align=\"left\">" + "<a id=\"pLink\" class=\"featureLink\" href=\"#\" onclick=\"return hide_show('expand_state_" + comparator.id + "','search_arrow_" + comparator.id + "','Collapse List','Expand " + comparator.state + " Property List');\">" + comparator.state;
                sHTML += "&nbsp;<img width=\"10\" src=\"images/arrow_down.gif\" alt=\"Expand " + comparator.state + " Property List\" border=\"0\" id=\"search_arrow_" + comparator.id + "\" /></a>";
                sHTML += "</td></tr>";
                sHTML += "<tr style=\"display:none;\" id=\"expand_state_" + comparator.id + "\"><td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"440px\" colspan=\"3\"><table border=\"0\" width=\"100%\" cellpadding=0 cellspacing=0 border=0>";
                currentState = comparator.state;
                while (!stateHasChanged && currentElement < totalElements) {
                    comparator = featureCollectionState[currentElement];
                    if (currentState == comparator.state) {
                        currentCity = comparator.city;
                        cityHasChanged = false;
                        firstRow = true;
                        if (currentState == "Florida" && !expandIdSet) {
                            //expandId = comparator.id;
                            //expandIdSet = true;
                        }
                        sHTML += "<tr bgcolor=\"#05182d\"><td colspan=\"2\" bgcolor=\"#05182d\" valign=\"middle\" align=\"left\" style=\"color:white\">&nbsp;" + comparator.city + "</td></tr>";
                        while (!stateHasChanged && !cityHasChanged && currentElement < totalElements) {
                            comparator = featureCollectionState[currentElement];
                            if (currentCity == comparator.city) {
                                if (currentElement >= totalElements) {
                                    stateHasChanged = true;
                                }
                                else {
                                    comparator = featureCollectionState[currentElement];
                                    if (firstRow == true) {
                                        sHTML += "<tr><td colspan=\"2\" valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #aaaaaa dotted\">";
                                        firstRow = false;
                                    }
                                    else {
                                        sHTML += "<tr><td colspan=\"2\" valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #aaaaaa dotted\">";
                                    }
                                    //sHTML += "<a href=\"/property-detail.aspx?pID=" + comparator.id + "\" class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                                    sHTML += "<a href=/property/" + translate (comparator.prop) + "/" + comparator.id + " class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                                    foundRate = false;

                                    if (!foundRate) {
                                        sHTML += "&nbsp;&nbsp;&nbsp;<span class=\"featureLight\">Call for Rate</span>";
                                        foundRate = false;
                                    }
                                    sHTML += "</td></tr>"
                                    currentElement++;
                                }
                            }
                            else {
                                cityHasChanged = true;
                            }
                        }
                    }
                    else {
                        stateHasChanged = true;
                        currentElement = currentElement - 1;
                    }
                }
                sHTML += "</table></td>";
                sHTML += "</tr>";
                stateHasChanged = false;
            }
            currentElement++;
        }
    }
    
    */
    
    
 //   sHTML += "</table>";
    otab = document.getElementById("ptab");
    otab.rows[0].cells[0].innerHTML = sHTML;
    
    hide_show("expand_state_" + expandId, "search_arrow_" + expandId, "Collapse List", "");   

}


function buildFeaturesCITY()
{
    var sHTML = "<table border=0 width=\"440px\">";
    var expandId = "";
    var foundRate = false;
    cityHasChanged = false;
    totalElements = featureCollectionCity.length;
    currentElement = 0;
    uniqueCountry(collectionCountry);
    uCountry.sort();
    uCountry.reverse();
    //featureCollectionCity.sort(sortCityStateProp);
    for (lCountry = 0; lCountry < uCountry.length; lCountry++) {
        sHTML += "<tr>";
        sHTML += "<td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"4\" class=\"searchHeadLight\" valign=\"top\" align=\"left\">" + uCountry[lCountry] + "</td></tr>";
        currentElement = 0;
        while (currentElement < totalElements) {
            if (featureCollectionCity[currentElement].country == uCountry[lCountry]) {

                comparator = featureCollectionCity[currentElement];
                sHTML += "<tr>";
                sHTML += "<td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"10\"><img src=\"images/10.gif\"></td><td colspan=\"3\" class=\"searchHead\" valign=\"top\" align=\"left\">" + "<a id=\"pLink\" class=\"featureLink\" href='#' onclick=\"return hide_show('expand_city_" + comparator.id + "','search_arrow_" + comparator.id + "','Collapse List','Expand " + comparator.city + " Property List');\">" + comparator.city + ", <span class=\"searchHeadLight\">" + comparator.state + "</span>";
                sHTML += "&nbsp;<img width=\"10\" src='images/arrow_down.gif' alt='Expand " + comparator.city + " Property List' border='0' id='search_arrow_" + comparator.id + "' /></a>";
                sHTML += "</td></tr>";
                sHTML += "<tr style=\"display:none;\" id=\"expand_city_" + comparator.id + "\"><td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"10\"><img src=\"images/10.gif\"></td><td width=\"440px\" colspan=\"3\"><table border=0 width=\"100%\" cellpadding=0 cellspacing=0 border=0>";
                currentCity = comparator.city;
                firstRow = true;
                while (!cityHasChanged) {
                    if (currentElement >= totalElements) {
                        cityHasChanged = true;
                    }
                    else {
                        comparator = featureCollectionCity[currentElement];
                        if (currentCity == comparator.city) {
                            if (firstRow == true) {
                                if (comparator.city == "Orlando" || comparator.city == "Florida") {
                                    expandId = comparator.id
                                }
                                sHTML += "<tr><td width=\"10\"><img src=\"images/10.gif\"></td><td valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #cccccc dotted;border-top:1px #cccccc dotted;border-left:1px #cccccc dotted\">";
                                firstRow = false;
                            }
                            else {
                                sHTML += "<tr><td width=\"10\"><img src=\"images/10.gif\"></td><td valign=\"middle\" align=\"left\" style=\"background-color:#eef2f3;border-bottom:1px #cccccc dotted;border-left:1px #cccccc dotted\">";
                            }
                            //sHTML += "<a href=\"/property-detail.aspx?pID=" + comparator.id + "\" class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                             sHTML += "<a href=/property/" + translate (comparator.prop) + "/" + comparator.id + " class=\"featureProp\">&nbsp;" + comparator.prop + "</a>";
                            foundRate = false;
                            for (i = 0; i < collectionLowestRates.length; i++) {
                                if (collectionLowestRates[i][1] == comparator.id) {
                                    sHTML += "&nbsp;&nbsp;from&nbsp;&nbsp;";
                                    sHTML += "<span class=\"featuredPropPrice\">$&nbsp;" + collectionLowestRates[i][0] + "</span>";
                                    foundRate = true;
                                }
                            }
                            if (!foundRate) {
                                sHTML += "&nbsp;&nbsp;&nbsp;<span class=\"featureLight\">Call for Rate</span>";
                                foundRate = false;
                            }
                            sHTML += "</td></tr>"
                        }
                        else {
                            cityHasChanged = true;
                            currentElement = currentElement - 2;
                        }
                    }
                    currentElement++;
                }
                sHTML += "</table></td>";
                sHTML += "</tr>";
                cityHasChanged = false;
            }
            currentElement++;
        }
    }
    sHTML += "</table>";
    otab = document.getElementById('ptab');
    otab.rows[0].cells[0].innerHTML = sHTML;
    hide_show("expand_city_" + expandId, "search_arrow_" + expandId, "Collapse List", "Expand Orlando Property List");
}

function loadDate()
{	
      				
	var now = new Date();
	var mm = now.getMonth() + 1;
	var dd = now.getDate();
	var yyyy = now.getFullYear();
	
	var year = new String(yyyy);
	var month  = new String(mm);
	var day = new String(dd);
	
	dateStr =  month + '-' + day + '-' + year;
	
	document.RRsearch.checkin.value = dateStr;
	
	if (document.Form2.property.value == "")
	{
	    document.Form2.property.value = "Begin Typing Property, City, State or Country Name Here";
	}
	//var oCell = document.getElementById('soundCell');
	//var isMSie = /*@cc_on!@*/false;
	//if(isMSie)
	//{
	//	oCell.innerHTML = '<EMBED MASTERSOUND id="waves" name="waves" volume="40" src="surf.mp3" autostart=true hidden=true loop="true" height="0" width="0">';
	//}
	//else
	//{
	//	oCell.innerHTML = '<object type="audio/mpeg" data="surf.mp3" width="0" height="0"><param name="src" value="surf.mp3"><param name="autoplay" value="true"><param name="autoStart" value="1"><param name="volume" value="40"></object>';
    //}
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    objQuery = new Querystring();
    query = window.location.search.substring(1);
   
    if (query != "") {
        if (sPage == "search.aspx") {
            loadIFrame();
        }
    }
    
 }

function loadBlank()
{
	rrContainer.location.href = "blank.html";
}

function Select_Value_Set(SelectName, Value) {
  eval('SelectObject = document.' + SelectName + ';');
  for(index = 0; 
    index < SelectObject.length; 
    index++) {
   if(SelectObject[index].value == Value)
     SelectObject.selectedIndex = index;
   }
}

function loadIFrame()
{
//    alert('hi');
    document.Form2.property.value = objQuery.get("searchword");
//    alert(document.Form2.property.value);
    //document.RRsearch.rooms.value = objQuery.get("rooms");
    //document.RRsearch.adults.value = objQuery.get("adults");
    //document.RRsearch.children.value = objQuery.get("children");
    if (objQuery.get("rooms") == null)
        document.RRsearch.rooms.value = 1;
    else
        document.RRsearch.rooms.value = objQuery.get("rooms");
    if (objQuery.get("adults") == null)
        document.RRsearch.adults.value = 2;
    else
        document.RRsearch.adults.value = objQuery.get("adults");
    if (objQuery.get("children") == null)
        v = 0;
    else
        document.RRsearch.children.value = objQuery.get("children");
    if (objQuery.get("pageconfig") == null)
        pageConfig = "2312E52E-23BC-4FB3-97AD-D3D776";
    else
        pageConfig = objQuery.get("pageconfig");

    if (objQuery.get("checkin") == null)
        tmpDate = new Date();
    else {
        properDate = objQuery.get("checkin").replace(/-/g, '/');
        tmpDate = new Date(properDate);
    }
    /* This condition is for orlando*/
    if(objQuery.get("checkin") == "2010-02-11")
    { 
       tmpDate = new Date();
    }
    
    searchQuery = "pageconfig=" + pageConfig;
    searchQuery += "&rooms=" + document.RRsearch.rooms.value + "&adults=" + document.RRsearch.adults.value;
    searchQuery += "&children=" + document.RRsearch.children.value + "&checkin=" + tmpDate.format("yyyy-mm-dd") + "&searchword=" + document.Form2.property.value;
    document.RRsearch.checkin.value = tmpDate.format("mm-dd-yyyy");
    rrContainer.location.href = "http://hotels.roomrez.com/Booking/QuerySearch.aspx?" + searchQuery;
}

function doSearch()
{
	if(document.Form2.property.value.search(/http/) != -1)
	{
		rrContainer.location.href = document.Form2.property.value;
	}
	else
	{
		document.RRsearch.property.blur();
		properDate=document.RRsearch.checkin.value.replace(/-/g,'/');
		var tmpDate = new Date(properDate);
		searchString = "http://hotels.roomrez.com/Booking/QuerySearch.aspx?pageconfig=";
		searchString += document.Form2.property.value;
		searchString += "&rooms=" + document.RRsearch.rooms.value;
		searchString += "&adults=" + document.RRsearch.adults.value;
		searchString += "&children=" + document.RRsearch.children.value;
		searchString += "&checkin=" + tmpDate.format("yyyy-mm-dd");
		rrContainer.location.href = searchString;
	}
}

function checkEnter(e){ //e is event object passed from function invocation
	var characterCode; //literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	}
	else{
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		doHomeSearchNew(); //submit the form
		return false;
	}
	else{
		return true;
	}

}

function doHomeSearchNew() {
    if (document.Form2.property.value != "Begin Typing Property, City, State or Country Name Here") {
        PropName = trim(document.Form2.property.value);
        if (collectionOnly.indexOf(PropName) != -1) {
            //sURL = "property-detail.aspx?pID=" + collectionID[collectionOnly.indexOf(PropName)];
            index = collectionOnly.indexOf(PropName);
            sURL = "/property/" + translate (PropName) + "/" + collectionID [index]; 
            self.location.href = sURL;
        }
        else {
            self.location.href = "search.aspx?searchword=" + PropName;
        }
    }    
}

function doSearchOnHome() {
    if (document.RRsearch.property.value != "Begin Typing Property, City, State or Country Name Here") {
        PropName = trim(document.RRsearch.property.value);
        if (collectionOnly.indexOf(PropName) != -1) {
            //sURL = "property-detail.aspx?pID=" + collectionID[collectionOnly.indexOf(PropName)];
            index = collectionOnly.indexOf(PropName);
            sURL = "/property/" + translate (PropName) + "/" + collectionID [index]; 
            self.location.href = sURL;
        }
        else {
            self.location.href = "search.aspx?searchword=" + PropName;
        }
    }    
}

function doHomeSearch() {
    if (document.Form2.property.value != "Begin Typing Property, City, State or Country Name Here") {
        PropName = trim(document.RRsearch.Form2.value);
        if (collectionOnly.indexOf(PropName) != -1) {
            //sURL = "property-detail.aspx?pID=" + collectionID[collectionOnly.indexOf(PropName)];
            index = collectionOnly.indexOf(PropName);
            sURL = "/property/" + translate (PropName) + "/" + collectionID [index]; 
            self.location.href = sURL;
        }
        else if (collectionCity.indexOf(PropName) != -1) {
            var idList = "";
            var nameList = "";
            for (i = 0; i < collectionCity.length; i++) {
                if (collectionCity[i] == PropName) {
                    if (idList == "") {
                        idList += collectionID[i];
                        nameList += escape(collectionOnly[i]);
                    }
                    else {
                        idList += "-" + collectionID[i];
                        nameList += "-" + escape(collectionOnly[i]);
                    }
                }
            }
            sURL = "/property-results.aspx?loc=" + PropName + "&pIDs=" + idList + "&pNames=" + nameList;
            self.location.href = sURL;
        }
        else if (collectionState.indexOf(PropName) != -1) {
            var idList = "";
            var nameList = "";
            for (i = 0; i < collectionState.length; i++) {
                if (collectionState[i] == PropName) {
                    if (idList == "") {
                        idList += collectionID[i];
                        nameList += escape(collectionOnly[i]);
                    }
                    else {
                        idList += "-" + collectionID[i];
                        nameList += "-" + escape(collectionOnly[i]);
                    }
                }
            }
            sURL = "/property-results.aspx?loc=" + PropName + "&pIDs=" + idList + "&pNames=" + nameList;
            self.location.href = sURL;
        }
        else if (collectionCountry.indexOf(PropName) != -1) {
            var idList = "";
            var nameList = "";
            for (i = 0; i < collectionCountry.length; i++) {
                if (collectionCountry[i] == PropName) {
                    if (idList == "") {
                        idList += collectionID[i];
                        nameList += escape(collectionOnly[i]);
                    }
                    else {
                        idList += "-" + collectionID[i];
                        nameList += "-" + escape(collectionOnly[i]);
                    }
                }
            }
            sURL = "/property-results.aspx?loc=" + PropName + "&pIDs=" + idList + "&pNames=" + nameList;
            self.location.href = sURL;
        }
        else {
            alert("You must select a property, city or region before clicking 'View Property Details'");
        }
    }
}

function doHomeSearchTMP()
{
    if (document.RRsearch.property.value.search(/Sheraton/) != -1 || document.RRsearch.property.value.search(/Westin/) != -1 || document.RRsearch.property.value.search(/Vistana/) != -1) {
        var rpn = "";
        if (document.RRsearch.housekeeping) {
            if (document.RRsearch.housekeeping.value == "yes") {
                rpn = "BESTVO";
            }
            else {
                rpn = "BTSNH";
            }
        }
        else {
            rpn = "BESTVO";
        }                
        var cid = document.RRsearch.checkin.value.split('-');
        var nor = "0" + document.RRsearch.rooms.value;
        var noa = "0" + document.RRsearch.adults.value;
        var noc = "0" + document.RRsearch.children.value;
        var rot = (noa * 1) + (noc *1);  //ensure a number
        if (rot < 10)
        {
            rot = "0" + rot;
        }
        var dd = cid[2] + "-" + cid[0] + "-" + ((cid[1] * 1) + 1);
        var cid_esc = cid[0] + "%2F" + cid[1] + "%2F" + cid[2];
        var ad = cid[2] + "-" + cid[0] + "-" + cid[1];
        var cod = cid[0] + "%2F" + ((cid[1] * 1) + 1) + "%2F" + cid[2];
        var sheraton_URL = "";
        if (document.RRsearch.property.value.search(/Mountain Vista/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5624&";
            sheraton_URL += "stateProvince=CO&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Avon&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Broadway Plantation/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5601&";
            sheraton_URL += "stateProvince=SC&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Myrtle+Beach&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Desert Oasis/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5611&";
            sheraton_URL += "stateProvince=AZ&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Scottsdale&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/PGA Vacation/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5604&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Port+St.+Lucie&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Vistana Resort/) != -1) {
            rpn = "BTNSPK";
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5608&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Orlando&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Vistana Villages/) != -1) {
            rpn = "BTNSPK";
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5607&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Orlando&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Vistana|Beach Club/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5619&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Jensen+Beach&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Westin Mission Hills/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=1369&";
            sheraton_URL += "stateProvince=CA&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Rancho+Mirage&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.RRsearch.property.value.search(/Westin Kierland Villas/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5639&";
            sheraton_URL += "stateProvince=AZ&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";https://p3nlsccweb.secureserver.net/css/images/scc/icon_close_window.gif
            sheraton_URL += "city=Scottsdale&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/reservations/index.html";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
    }
    else {
        properDate = document.RRsearch.checkin.value.replace(/-/g, '/');
        var tmpDate = new Date(properDate);
        searchString = "pageconfig=2312E52E-23BC-4FB3-97AD-D3D776"
        searchString += "&rooms=" + document.RRsearch.rooms.value;
        searchString += "&adults=" + document.RRsearch.adults.value;
        searchString += "&children=" + document.RRsearch.children.value;
        searchString += "&checkin=" + tmpDate.format("yyyy-mm-dd");
        searchString += "&searchword=" + escape(document.RRsearch.property.value);
        self.location.href = "/search.aspx?" + searchString;
   }
}



function doHomeSearchTMP1()
{
    
    if (document.Form2.property.value.search(/Sheraton/) != -1 || document.Form2.property.value.search(/Westin/) != -1 || document.Form2.property.value.search(/Vistana/) != -1) {
        var rpn = "";
        if (document.RRsearch.housekeeping) {
            if (document.RRsearch.housekeeping.value == "yes") {
                rpn = "BESTVO";
            }
            else {
                rpn = "BTSNH";
            }
        }
        else {
            rpn = "BESTVO";
        }                
        var cid = document.RRsearch.checkin.value.split('-');
        var nor = "0" + document.RRsearch.rooms.value;
        var noa = "0" + document.RRsearch.adults.value;
        var noc = "0" + document.RRsearch.children.value;
        var rot = (noa * 1) + (noc *1);  //ensure a number
        if (rot < 10)
        {
            rot = "0" + rot;
        }
        var dd = cid[2] + "-" + cid[0] + "-" + ((cid[1] * 1) + 1);
        var cid_esc = cid[0] + "%2F" + cid[1] + "%2F" + cid[2];
        var ad = cid[2] + "-" + cid[0] + "-" + cid[1];
        var cod = cid[0] + "%2F" + ((cid[1] * 1) + 1) + "%2F" + cid[2];
        var sheraton_URL = "";
        if (document.Form2.property.value.search(/Mountain Vista/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5624&";
            sheraton_URL += "stateProvince=CO&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Avon&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Broadway Plantation/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5601&";
            sheraton_URL += "stateProvince=SC&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Myrtle+Beach&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Desert Oasis/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5611&";
            sheraton_URL += "stateProvince=AZ&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Scottsdale&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/PGA Vacation/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5604&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Port+St.+Lucie&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Vistana Resort/) != -1) {
            rpn = "BTNSPK";
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5608&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Orlando&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Vistana Villages/) != -1) {
            rpn = "BTNSPK";
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5607&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Orlando&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Vistana|Beach Club/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5619&";
            sheraton_URL += "stateProvince=FL&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Jensen+Beach&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Westin Mission Hills/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=1369&";
            sheraton_URL += "stateProvince=CA&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";
            sheraton_URL += "city=Rancho+Mirage&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else if (document.Form2.property.value.search(/Westin Kierland Villas/) != -1) {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/search/ratelist.html?";
            sheraton_URL += "departureDate=" + dd + "&";
            sheraton_URL += "requestedChainCode=SI&";
            sheraton_URL += "roomOccupancyTotal=" + rot + "&";
            sheraton_URL += "numberOfRooms=" + nor + "&";
            sheraton_URL += "numberOfAdults=" + noa + "&";
            sheraton_URL += "requestedAffiliationCode=VO&";
            sheraton_URL += "propertyID=5639&";
            sheraton_URL += "stateProvince=AZ&";
            sheraton_URL += "ratePlanName=" + rpn + "&";
            sheraton_URL += "roomBedCode=&";
            sheraton_URL += "corporateAccountNumber=&";
            sheraton_URL += "iATANumber=&";
            sheraton_URL += "country=US&";
            sheraton_URL += "ciDate=" + cid_esc + "&";
            sheraton_URL += "arrivalDate=" + ad + "&";
            sheraton_URL += "coDate=" + cod + "&";
            sheraton_URL += "smokingPreference=&";
            sheraton_URL += "lengthOfStay=1&";https://p3nlsccweb.secureserver.net/css/images/scc/icon_close_window.gif
            sheraton_URL += "city=Scottsdale&";
            sheraton_URL += "wheelchairPreference=0&";
            sheraton_URL += "promotionCode=";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
        else {
            sheraton_URL = "http://www.starwoodhotels.com/sheraton/reservations/index.html";
            ypos = ((screen.height - 600) / 2);
            xpos = ((screen.width - 870) / 2);
            winHnd = window.open(sheraton_URL, "searchWin", "height=600, width=870, menubar = yes, resizable = yes, scrollbars = yes, status = yes, titlebar = yes, toolbar = yes");
            //winHnd.moveTo(xpos, ypos);
        }
    }
    else {
        properDate = document.RRsearch.checkin.value.replace(/-/g, '/');
        var tmpDate = new Date(properDate);
        searchString = "pageconfig=2312E52E-23BC-4FB3-97AD-D3D776"
        searchString += "&rooms=" + document.RRsearch.rooms.value;
        searchString += "&adults=" + document.RRsearch.adults.value;
        searchString += "&children=" + document.RRsearch.children.value;
        searchString += "&checkin=" + tmpDate.format("yyyy-mm-dd");
        searchString += "&searchword=" + escape(document.Form2.property.value);
        self.location.href = "/search.aspx?" + searchString;
   }
}

function setSrc()
{
	//searchWin.document.getElementById('data').src = searchString;
	document.getElementById('data').src = searchString;
}

function hide_show(e_table, e_img, alt_less, alt_more) {
    if (document.getElementById) {
        var id_table = document.getElementById(e_table);
        var id_img = document.getElementById(e_img);
        if (id_table == null) return false;
        if (id_img == null) return false;
        //Set the object to table-cell if the browser is
        //anything other than IE and block if it is.
        if (!(/MSIE (\d+\.\d+);/.test(navigator.userAgent))) { 
            if (id_table.style.display == "table-row") {
                id_table.setAttribute('style', 'display:none');
                id_img.src = "images/arrow_down.gif";
                id_img.alt = alt_more;
            }
            else {
                id_table.setAttribute('style', 'display:table-row');
                id_img.src = "images/arrow_up.gif";
                id_img.alt = alt_less;
            }
        }
        else {
            if (id_table.style.display == "block") {
                id_table.style.display = "none";
                id_img.src = "images/arrow_down.gif";
                id_img.alt = alt_more;
            }
            else {
                id_table.style.display = "block";
                id_img.src = "images/arrow_up.gif";
                id_img.alt = alt_less;
            }
        }
        return false;
    }
    else {
        return true;
    }
}

function genCitySelect(type, value, dis_flag) {
    var sHTML = "";
    //Static Special box pointing to the Last Minute Specials Page
    sHTML += "<select id=\"citysel\" style=\"width:220px\" onchange=\"cityChange(" + dis_flag + ");\" >";
	
	if (type == "country" && value != "all") {
		var cityarray = new Array();
		for (cindex = 0,i=0; cindex < collectionCountry.length; cindex++) {
			if (collectionCountry[cindex] == value) {
				cityarray[i++] = collectionCity[cindex];
			}
		}
		uniqueCity(cityarray);
		uCity.sort();

	} else if (type == "state" && value != "Filter results by State"){
		var cityarray = new Array();
		for (cindex = 0,i=0; cindex < collectionState.length; cindex++) {
			if (collectionState[cindex] == value) {
				cityarray[i++] = collectionCity[cindex];
			}
		}
		uniqueCity(cityarray);
		uCity.sort();
		
	} else {
		
		
		
	    if (value != "Filter results by City" ||  value != "all") {
            // Get the current city's corresponding state
            targetState = "";
            for (cindex = 0,i=0; cindex < collectionCity.length; cindex++) {
		        if (collectionCity[cindex] == value) {
			        targetState = collectionState[cindex];
			        break;
		        }
	        }
	        var cityarray = new Array();
	        for (cindex = 0,i=0; cindex < collectionState.length; cindex++) {
		        if (collectionState[cindex] == targetState) {
			        cityarray[i++] = collectionCity[cindex];
		        }
	        }
	        uniqueCity(cityarray);
	        uCity.sort();	    
		
		} else {
		    uniqueCity(collectionCity);
		    uCity.sort();
        }
	}
	sHTML += "<option value=\"Filter results by City\">Filter results by City</option>";
    for (lCity = 0; lCity < uCity.length; lCity++ ) {
        sHTML += "<option value=\"" + uCity[lCity] + "\">" + uCity[lCity] + "</option>";
	}
	sHTML += "</select>";	
		
    otab = document.getElementById("propExplore_sel");
    otab.rows[3].cells[2].innerHTML =  sHTML;
	if (type == "city" ) {
		

		document.getElementById("citysel").value=value;
		index = collectionCity.indexOf(value);
		document.getElementById("countrysel").value=collectionCountry[index];
		document.getElementById("statesel").value=collectionState[index];
	} 	
	
}

function cityChange(dis_flag) {
    var selcity = document.getElementById("citysel").value;
    if (selcity == "Filter results by City" ) {
        var selstate = document.getElementById("statesel").value;
        window.location="state-city-search.aspx?sType=state&sName=" + selstate;
    } else {
        
	    window.location="state-city-search.aspx?sType=city&sName=" + selcity + "&sDis=" + dis_flag;
	}    
}


function genCountrySelect(type, value) {
    var sHTML = "";
    //Static Special box pointing to the Last Minute Specials Page
    sHTML += "<select id=\"countrysel\" style=\"width:220px\"  onchange=\"countryChange();\" >";
    uniqueCountry(collectionCountry);
    uCountry.sort();
    uCountry.reverse();
	sHTML += "<option value=\"Filter results by Country\">Filter results by Country</option>";
    for (lCountry = 0; lCountry < uCountry.length; lCountry++ ) {
			
			sHTML += "<option value=\"" + uCountry[lCountry]  + "\">" + uCountry[lCountry] + "</option>";
			
	}
	sHTML += "</select>";	
		
    otab = document.getElementById("propExplore_sel");
    otab.rows[1].cells[2].innerHTML =  sHTML;;
	
	if (type == "country" ) {
		document.getElementById("countrysel").value=value;
	} 	
	
}

function countryChange() {
    var selcountry = document.getElementById("countrysel").value;
//    if () {
//        window.location="state-city-search.aspx?sType=country&sName=" + selcountry;
//    } else {
	    window.location="state-city-search.aspx?sType=country&sName=" + selcountry;
//	}    
}

function genStateSelect(type, value, dis_flag) {
    var sHTML = "";
    //Static Special box pointing to the Last Minute Specials Page
    sHTML += "<select id=\"statesel\" style=\"width:220px\" onchange=\"stateChange();\" >";
	
	if (type == "country" && value != "Filter results by Country") {
		var statearray = new Array();
		for (cindex = 0,i=0; cindex < collectionCountry.length; cindex++) {
			if (collectionCountry[cindex] == value) {
				statearray[i++] = collectionState[cindex];
			}
		}
		uniqueState(statearray);
		uState.sort();
	} else {
		uniqueState(collectionState);
		uState.sort();

	}	
	sHTML += "<option value=\"Filter results by State\">Filter results by State</option>";
    for (lState = 0; lState < uState.length; lState++ ) {
		sHTML += "<option value=\"" + uState[lState] + "\">" + uState[lState] + "</option>";
	}
	sHTML += "</select>";	
		
    otab = document.getElementById("propExplore_sel");
    otab.rows[2].cells[2].innerHTML = sHTML;
	
	if (type == "state" ) {
		document.getElementById("statesel").value=value;
		index = collectionState.indexOf(value);
		document.getElementById("countrysel").value=collectionCountry[index];
	} 
	if (dis_flag == "1") {
//	    document.getElementById("state_row").disabled="true";
//	    document.getElementById("country_row").disabled="true";
	    document.getElementById("state_row").style.display="none";
	    document.getElementById("country_row").style.display="none";
	    otab.rows[0].cells[1].innerHTML = "<span style=\"color: #444444\"><b>Filter properties list by City</b></span>";
	}
	
	
}
   
function stateChange() {

    var selstate = document.getElementById("statesel").value;
    if (selstate == "Filter results by State" ) {
        var selcountry = document.getElementById("countrysel").value;
        window.location="state-city-search.aspx?sType=country&sName=" + selcountry;
    } else {
	    window.location="state-city-search.aspx?sType=state&sName=" + selstate;
	}

}   
   
function logo_mouseout (event) {
	document.body.style.cursor='default';
}
function logo_mouseover (event) {
	document.body.style.cursor='pointer';
}

function logo_click(event){
	self.location.href = '/';
}

/* -------------------------QueryString.js--------------------------------*/

/* Client-side access to querystring name=value pairs
	Version 1.3
	28 May 2008
	
	License (Simplified BSD):
	http://adamv.com/dev/javascript/qslicense.txt
*/
function Querystring(qs) { // optionally pass a querystring to parse
//alert('hello');
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
//alert(key);
	var value = this.params[key];
//	alert(value);
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}


