﻿
$(function() {
    var dates = $(".email_us input.datefrom, .email_us input.dateto").datepicker({
        dateFormat: 'dd/mm/yy',
        minDate: 0,
        maxDate: '+12M',
        changeMonth: true,
        changeYear: true,
        showOtherMonths: true,
        selectOtherMonths: true,
        showOn: 'both',
        showButtonPanel: true,
        closeText: 'Close calendar',
        buttonImage: '/content/calendar_icon2.jpg',
        buttonImageOnly: true,
        showAnim: 'slideDown',
        onSelect: function(selectedDate) {
            var option = $(this).hasClass('datefrom') ? "minDate" : "maxDate";
            var instance = $(this).data("datepicker");
            var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
            date.setDate(date.getDate() + 1);
            dates.not(this).datepicker("option", option, date);
        }
    });

    $("a[href=#email_info]").click(function (e) {
        $('#email_info').dialog({ 'width': 380, 'title': 'Email Hotel Booking Conditions', dialogClass: 'emailus_dialog', resizable: false });
        e.preventDefault();
    });

    $('a[href=#email_whatsnext]').click(function (e) {
        $('#email_whatsnext').dialog({ 'width': 380, 'title': 'Email Hotel Booking Conditions', dialogClass: 'emailus_dialog', resizable: false });
        e.preventDefault();
    });
    $('.defaulttext').toggleVal({ populateFrom: 'title', changedClass: 'defaulttext_changed', focusClass: 'defaulttext_changed' });

});
