﻿//this is for single resort bookings that use worldHotels
//it sets the textboxes to use the jquery calendar and to also set
//the URL for world hotels booking.

// I have replaced the default document "$" by "other" to avoid conflict. Luiz

// the dateformat function is "yy-mm-dd" and not "yy-mm-dd". Luiz

// it's modified to replace Worldhotels(Trust) by SynXis. 
// The dateformat function is "mm/dd/yy" (ie. 09/21/2010).  Luiz

var other = jQuery.noConflict();

other(function() {
    if (other("#datepicker-in")) {
        other("#datepicker-in").datepicker();
        other("#datepicker-in").datepicker("option", "dateFormat", 'mm/dd/yy');
        other("#wh").hide();
    };
});


other(function() {
    if (other("#datepicker-out")) {
        other("#datepicker-out").datepicker();
        other("#datepicker-out").datepicker("option", "dateFormat", 'mm/dd/yy');
        other('#htbCheckOUT').val(other("#datepicker-out").val());
    };
});


other(function() {
    if (other("#datepicker-in2")) {
        other("#datepicker-in2").datepicker();
        other("#datepicker-in2").datepicker("option", "dateFormat", 'mm/dd/yy');
        other("#wh").hide();
    };
});


other(function() {
    if (other("#datepicker-out2")) {
        other("#datepicker-out2").datepicker();
        other("#datepicker-out2").datepicker("option", "dateFormat", 'mm/dd/yy');
    };
});


other(document).ready(function() {
    other("#imgBtnBookNow1").click(function() {

        if (other("#datepicker-in") == "") {

            alert("please select a check-in date");

        };

        var newURL = other("#ctl00_BodyContent_ctl00_urlBooker1").val();
        newURL += "&arrive=" + other("#datepicker-in").val();
        newURL += "&depart=" + other("#datepicker-out").val();
        newURL += "&adult=" + other("#occupancy").val();
        newURL += "&rooms=" + other("#prsRoomCount").val();

        // Add new parameters to the original URL.
        other(this).parent().attr('href', newURL);

        other("#wh").attr("src", newURL);
        other("#resortImages").hide();
        other("#description").hide();
        other("#columnThree").hide();
        other("#wh").show();



        // document.write(newURL);
        // alert("src = " + newURL);

        //window.location = newURL;

    });
});


other(document).ready(function() {
    other("#imgBtnBookNow2").click(function() {

        if (other("#datepicker-in2") == "") {

            alert("please select a check-in date");

        };

        var newURL = other("#ctl00_BodyContent_ctl00_urlBooker2").val();
        newURL += "&arrive=" + other("#datepicker-in2").val();
        newURL += "&depart=" + other("#datepicker-out2").val();
        newURL += "&adult=" + other("#occupancy2").val();
        newURL += "&rooms=" + other("#prsRoomCount2").val();

        // Add new parameters to the original URL.
        other(this).parent().attr('href', newURL);
        
        other("#wh").attr("src", newURL);
        other("#resortImages").hide();
        other("#description").hide();
        other("#columnThree").hide();
        other("#wh").show();
        
        // document.write(newURL);
        // alert("src = " + newURL);
        //window.location = newURL;

    });
});
