

//id is a #
//class is a .

$('#flight_only').hide();
$('#ddlPackCityTo').hide();

if (document.aspnetForm.ctl00_ContentPlaceHolder1_Search1_Packages != null) {
    if (document.aspnetForm.ctl00_ContentPlaceHolder1_Search1_Packages.checked) {

        $('#ddlCityTo').show();
        $('#txtCityTo').hide();
        $('#FlightFrom').show();
        $('#AirlineMenu').show();
        $('#flight_only').hide();

    }
}


//     if ($("#datepicker").val() == null) {
//        $("#datepicker").val(getDate())
//     }
//    

//     function getDate() {
//         var date = new Date()
//         var year = date.getFullYear()
//         var month = date.getMonth()
//         var day = date.getDay()
//         var today = month + "/" + day + "/" + year

//         return today
//
//     }

function MM_jumpMenu(targ, selObj, restore) { //v3.0
    eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
    if (restore) selObj.selectedIndex = 0;
}




function popUp(URL) {
    window.open(URL, 'CallBack', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=645,height=440,left = 240,top = 240');
}

function alertLinkSearchBox() {
         
        if (document.getElementById('ddlCityTo') != null) {

            if (document.getElementById('ddlCityTo').value == "") {
                // \n 
                alert('Please select a holiday destination.');

                return false;
            }
        }                      

        if (document.getElementById('datepicker') != null) {

            if (document.getElementById('datepicker').value == "") {

                alert('Please select a departure date.');

                return false;
            }
        }
   
}


function alertLinkPackageSearch() {

    if (document.getElementById('ddlCityTo') != null) {

        if (document.getElementById('ddlCityTo').value == "") {
            
            alert('Please select a holiday destination.');

            return false;
        }
    }

    if (document.getElementById('datepicker') != null) {

        if (document.getElementById('datepicker').value == "") {

            alert('Please select a departure date.');

            return false;
        }
    }

}


function alertLinkDateBox() {
    if (document.getElementById('datepicker') != null) {

        if (document.getElementById('datepicker').value == "") {

            alert('Please select a departure date.');

            return false;
        }
    }
}

function DisableDays(date) {
    // var noDisable = $.datepicker.DisableDays(date);
    // return [false, 'CLOSED'];

    var test1 = date.getDate();


    return [true, ''];
}


$(function () {


    $('#datepicker').datepicker({
        numberOfMonths: 2,
        showButtonPanel: true,
        showOn: 'button',
        buttonImage: '/media/JQuery/UI/calendar.gif',
        buttonText: 'Please select a travel date',
        buttonImageOnly: true,
        duration: 'fast',
        dateFormat: "dd/mm/yy",
        beforeShowDay: DisableDays,

        minDate: 0

    });

});


//ADD by waq

function DisableDays2(date) {
    // var noDisable = $.datepicker.DisableDays(date);
    // return [false, 'CLOSED'];
    var date = '16/12/2010';
    return [true, date];
}

function setDatePicker() {
    if (document.getElementById('datepicker1').value == '') {
        document.getElementById('datepicker1').value = document.getElementById('datepicker01').value;
        document.getElementById('datepicker1').style.color = '#FFFFFF';
    }
}
function setDatePicker2() {
    document.getElementById('datepicker1').style.color = '#000000';
}

var date = new Date();
var m = date.getMonth(), d = date.getDate() + 5, y = date.getFullYear();
var m2 = date.getMonth(), d2 = date.getDate() + 6, y2 = date.getFullYear();

$(
    function () {
        $('#datepicker01').datepicker({

            numberOfMonths: 2,
            showButtonPanel: true,
            showOn: 'button',
            buttonImage: 'http://www.bestattravel.co.uk/media/JQuery/UI/calendar.gif',
            buttonText: 'Please select a travel date',
            buttonImageOnly: true,
            duration: 'fast',
            dateFormat: "dd/mm/yy",
            beforeShowDay: DisableDays,
            onSelect: function () { setDatePicker(); },
            minDate: new Date(y, m, d)
        });
    });

$(

    function () {

        $('#datepicker1').datepicker({

            numberOfMonths: 2,
            showButtonPanel: true,
            showOn: 'button',
            buttonImage: 'http://www.bestattravel.co.uk/media/JQuery/UI/calendar.gif',
            buttonText: 'Please select a travel date',
            buttonImageOnly: true,
            duration: 'fast',
            dateFormat: "dd/mm/yy",
            beforeShowDay: DisableDays,
            minDate: new Date(y2, m2, d2),
            onSelect: function () { setDatePicker2(); }

        });

    });
//End ADD by waq

function ChangeRooms() {
    switch ($("#cboRooms option:selected").text()) {

        case "1":
            $('#BSRT-Room2-positioner').hide();

            $('#Room2_Child_Group').hide();
            $('#cboChild1_2_Group').hide();
            $('#cboChild2_2_Group').hide();
            $('#cboChild3_2_Group').hide();


            $('#BSRT-Room3-positioner').hide();

            $('#Room3_Child_Group').hide();
            $('#cboChild1_3_Group').hide();
            $('#cboChild2_3_Group').hide();
            $('#cboChild3_3_Group').hide();

            break;

        case "2":
            $('#BSRT-Room2-positioner').show();
            $('#BSRT-Room3-positioner').hide();

            $('#Room3_Child_Group').hide();
            $('#cboChild1_3_Group').hide();
            $('#cboChild2_3_Group').hide();
            $('#cboChild3_3_Group').hide();

            break;
        case "3":
            $('#BSRT-Room2-positioner').show();
            $('#BSRT-Room3-positioner').show();
            break;

    }
}


$("#cboRooms").change(function () {
    ChangeRooms();
})


$("#cboChild1").change(function () {

    ChangeChild1();

})

function ChangeChild1() {

    switch ($("#cboChild1 option:selected").text()) {
        case "0":
            $('#Room1_Child_Group').hide();
            $('#cboChild1_1_Group').hide();
            $('#cboChild2_1_Group').hide();
            $('#cboChild3_1_Group').hide();
            break;

        case "1":
            $('#Room1_Child_Group').show();
            $('#cboChild1_1_Group').show();
            $('#cboChild2_1_Group').hide();
            $('#cboChild3_1_Group').hide();
            break;
        case "2":
            $('#Room1_Child_Group').show();
            $('#cboChild1_1_Group').show();
            $('#cboChild2_1_Group').show();
            $('#cboChild3_1_Group').hide();
            break;
        case "3":
            $('#Room1_Child_Group').show();
            $('#cboChild1_1_Group').show();
            $('#cboChild2_1_Group').show();
            $('#cboChild3_1_Group').show();
            break;

    }


}

$("#cboChild2").change(function () {
    ChangeChild2();
})


function ChangeChild2() {

    switch ($("#cboChild2 option:selected").text()) {
        case "0":
            $('#Room2_Child_Group').hide();
            $('#cboChild1_2_Group').hide();
            $('#cboChild2_2_Group').hide();
            $('#cboChild3_2_Group').hide();
            break;

        case "1":
            $('#Room2_Child_Group').show();
            $('#cboChild1_2_Group').show();
            $('#cboChild2_2_Group').hide();
            $('#cboChild3_2_Group').hide();
            break;
        case "2":
            $('#Room2_Child_Group').show();
            $('#cboChild1_2_Group').show();
            $('#cboChild2_2_Group').show();
            $('#cboChild3_2_Group').hide();
            break;
        case "3":
            $('#Room2_Child_Group').show();
            $('#cboChild1_2_Group').show();
            $('#cboChild2_2_Group').show();
            $('#cboChild3_2_Group').show();
            break;

    }

}

$("#cboChild3").change(function () {
    ChangeChild3();
})

function ChangeChild3() {

    switch ($("#cboChild3 option:selected").text()) {
        case "0":
            $('#Room3_Child_Group').hide();
            $('#cboChild1_3_Group').hide();
            $('#cboChild2_3_Group').hide();
            $('#cboChild3_3_Group').hide();
            break;

        case "1":
            $('#Room3_Child_Group').show();
            $('#cboChild1_3_Group').show();
            $('#cboChild2_3_Group').hide();
            $('#cboChild3_3_Group').hide();
            break;
        case "2":
            $('#Room3_Child_Group').show();
            $('#cboChild1_3_Group').show();
            $('#cboChild2_3_Group').show();
            $('#cboChild3_3_Group').hide();
            break;
        case "3":
            $('#Room3_Child_Group').show();
            $('#cboChild1_3_Group').show();
            $('#cboChild2_3_Group').show();
            $('#cboChild3_3_Group').show();
            break;

    }

}

// $("#cboAdults1").change(function() {
//      alert('Handler for ' + $("#cboAdults1 option:selected").text() + ' called.');
//})

    
