
function fSearch() {
    var hotelIdMap = {
        "HT10004548":{"HotelID":"2449","countryID":"137","cityName":"Alor Star","cityCode":"AOR"},
        "HT10004549":{"HotelID":"2448","countryID":"137","cityName":"Langkawi","cityCode":"LANK"},
        "HT10004550":{"HotelID":"2453","countryID":"137","cityName":"Langkawi","cityCode":"LANK"},
        "HT10004551":{"HotelID":"2445","countryID":"137","cityName":"Cherating","cityCode":"CHRG"},
        "HT10004551a":{"HotelID":"2450","countryID":"137","cityName":"Cherating","cityCode":"CHRG"},
        "HT10004552":{"HotelID":"2441","countryID":"137","cityName":"Subang Jaya","cityCode":"SBJ"},
        "HT10004554":{"HotelID":"2442","countryID":"137","cityName":"Kuala Lumpur","cityCode":"KUL"},
        "HT10004553":{"HotelID":"2446","countryID":"137","cityName":"Kuala Lumpur","cityCode":"KUL"},
        "HT10004562":{"HotelID":"2438","countryID":"38","cityName":"London","cityCode":"LON"},
        "HT10004563":{"HotelID":"2436","countryID":"15","cityName":"Paris","cityCode":"PAR"},
        "HT10004560":{"HotelID":"2434","countryID":"125","cityName":"Bali-Sanur Beach","cityCode":"SANH"},
        "HT10004561":{"HotelID":"2432","countryID":"125","cityName":"Bali-Kuta Beach","cityCode":"KUTB"},
        "HT10004567":{"HotelID":"2440","countryID":"153","cityName":"Doha","cityCode":"DOH"},
        "HT10004566":{"HotelID":"2447","countryID":"258","cityName":"Khartoum","cityCode":"KRT"},
        "HT10004565":{"HotelID":"2435","countryID":"5","cityName":"Phnom Penh","cityCode":"PNH"},
        "HT10004557":{"HotelID":"2452","countryID":"112","cityName":"Chenzhou","cityCode":"CHNZ"},
        "HT10004555":{"HotelID":"2444","countryID":"112","cityName":"Shenzhen","cityCode":"SHEN"},
        "HT10004558":{"HotelID":"2443","countryID":"112","cityName":"Sanya (Hainan)","cityCode":"SANY"},
        "HT10004556":{"HotelID":"2456","countryID":"112","cityName":"Kaifeng","cityCode":"KAIF"},
        "HT10004564":{"HotelID":"2437","countryID":"40","cityName":"Halong Bay","cityCode":"HALO"},
        "Madinah":{"HotelID":"2451","countryID":"157","cityName":"madinah","cityCode":"MED"}
    };

    var slcHotel = document.getElementById("slcHotel");
    var map = hotelIdMap[slcHotel.value];
    if ( map == null ) {
        alert( "Please select hotel." );
        return;   
    }
    var strMess = "";
    var URL = "http://holidayvilla.easygds.com/GQRooms.aspx?";
    for ( var i in map ) {
        URL += i + "=" + encodeURIComponent(map[i]) + "&";
    }
    URL += "promoCode=&lang=en-GB";

    var objCi = document.getElementById("txtCi");
    var objCo = document.getElementById("txtCo");
    var dteCi = objCi.value.substr(3, 2) + "/" + objCi.value.substr(0, 2) + "/" + objCi.value.substr(6, 4);
    var dteCo = objCo.value.substr(3, 2) + "/" + objCo.value.substr(0, 2) + "/" + objCo.value.substr(6, 4);

    if (objCi.value == "") strMess += "Please enter Check-In Date \n";
    if (objCo.value == "") strMess += "Please enter Check-Out Date \n";
    if (objCi.value != "" && objCo.value != "") {
        var dteCiTmp = objCi.value.substr(6, 4) + objCi.value.substr(0, 2) + objCi.value.substr(3, 2);
        var dteCoTmp = objCo.value.substr(6, 4) + objCo.value.substr(0, 2) + objCo.value.substr(3, 2);
        var dteServer = new Date().getFullYear().toString() +
					(parseFloat(new Date().getMonth() + 1) < 10 ?
						"0" + parseFloat(new Date().getMonth() + 1).toString() :
						parseInt(new Date().getMonth() + 1).toString()) +
					(parseFloat(new Date().getDate()) < 10 ?
						"0" + new Date().getDate().toString() :
						new Date().getDate().toString());

        if (parseFloat(dteCiTmp) < parseFloat(dteServer)) {
            strMess += "Check-In Date should be later than or the same as " + new Date().toDateString("MMM dd, yyyy") + " \n";
        }
        else if (parseFloat(dteCiTmp) > parseFloat(dteCoTmp)) {
            strMess += "Check-Out Date should be later than Check-In Date \n";
        }
    }

    if (strMess != "") {
        alert(strMess);
        return;
    }

    URL += "&CheckInDate=" + encodeURIComponent(dteCi);
    URL += "&CheckOutDate=" + encodeURIComponent(dteCo);
    URL += "&noOfRooms=" + encodeURIComponent(document.getElementById("txtRoom").value);
    URL += "&noOfAdults=" + encodeURIComponent(document.getElementById("txtAdult").value);
    URL += "&noOfChilds=" + encodeURIComponent(document.getElementById("txtChild").value);
    window.location.href = URL;
};

