/* Base JS file for generating the calendars. It is used together with generate_hotels_calendars.js and/or generate_flights_calendars.js. */
/* Generates the calendars. */
var imgPath = '/tridion/images/';

$(function() {

cal = document.createElement('img');
cal.src = imgPath + 'new_calendar_tcm4-808153.gif';
cal.width = '14';
cal.height = '14';
cal.className = 'calendar';

$('#bookingForm input.date').after(cal);

$('.calendar').click(function() {
    p = $(this).prev().get(0).id;

    var noOfDays = flightBookingDays;
    switch (p){
        case 'departureDate':
            n = 'returnDate';
            break;
        case 'returnDate':
            n = 'departureDate';
            break;
        case 'departureDateHotel':
            n = 'returnDateHotel';
            noOfDays = hotelBookingDays;
            break;
        case 'returnDateHotel':
            n = 'departureDateHotel';
            noOfDays = hotelBookingDays;
            break;
        case 'in':
            n = 'out';
            noOfDays = hotelBookingDays;
            break;
        case 'out':
            n = 'in';
            noOfDays = hotelBookingDays;
            break;
        case 'checkin':
            n = 'checkout';
            noOfDays = hotelBookingDays;
            break;
        case 'checkout':
            n = 'checkin';
            noOfDays = hotelBookingDays;
            break;
        default:
            n = null;
    }

    initElementIds(p,n);
    calOpen = p;
    displayCalendarOnClick(document.getElementById(p),'dd/mm/yy',p,n,'','','',noOfDays);
});
});

