﻿function addDate(sender, e)
{
    //Get the selected date from the arrival textbox
    var arrivalDate = document.getElementById('CheckInDateTextBox').value;

    //This method works in IE but no FF
    //var arrivalDate = document.getElementById("CheckInDateTextBox").getAttribute("value");

    //Split the values
    var temp = new Array();
    temp = arrivalDate.split("/");

    //Create a new date object
    var departureDate = new Date();

    //Set the date by using client's selected values (javascript month start with 0 like array)
    departureDate.setFullYear(temp[2], temp[1]-1, temp[0]);

    //Add day (+1) to the selected date
    departureDate.setFullYear(departureDate.getFullYear(), departureDate.getMonth(), departureDate.getDate()+1);

    //Format the date and month values to 2 digits
    var departerDateToTextBox = departureDate.format('dd/MM/yyyy');    

    //Put the value into the departure textbox   
    document.getElementById('DepartureDateTextBox').setAttribute('value', departerDateToTextBox);

    //pass the selected date to server to add date (required postback)
    //CallServer(arrivalDate, "");    
}