//This script did not form part of the downloaded scripts it was add later so it can be modified as necessary
/*This function is used to set the default values JJ/MM/AAAA or DD/MM/YYYY for textbox departure2,todate,outdate in case where no date 
 is selected from calendar after activation of the calendar*/
function getValArrival ()
{

var val;
var valdeparture2 =document.amadeus.departure2.value;
var valtodate =document.expediaform.todate.value;
var valoutdate =document.expediaformhotel.outdate.value;

if (valdeparture2 =="JJ/MM/AAAA" || valtodate =="JJ/MM/AAAA" || valoutdate =="JJ/MM/AAAA")
{

val = "JJ/MM/AAAA";


}

else 
{

val = "DD/MM/YYYY";

}

if (valdeparture2 =="" && valtodate !="" && valoutdate !="")
{

//{alert(valdeparture2  +  valtodate  + valoutdate );
document.amadeus.departure2.value = val;


}

if(valdeparture2 !="" && valtodate =="" && valoutdate !="")
{

document.expediaform.todate.value =val;


}

if (valdeparture2 !="" && valtodate !="" && valoutdate =="")
{


document.expediaformhotel.outdate.value =val;

}


}




/*This function is used to set the default values JJ/MM/AAAA or DD/MM/YYYY for textbox departure1,fromdate,indate in case where no date 
 is selected from calendar after activation of the calendar*/

function getValDeparture ()
{
var val;
var valdeparture1 =document.amadeus.departure1.value;
var valfromdate =document.expediaform.fromdate.value;
var valindate =document.expediaformhotel.indate.value;

if (valdeparture1 =="JJ/MM/AAAA" || valfromdate =="JJ/MM/AAAA" || valindate =="JJ/MM/AAAA")
{

val = "JJ/MM/AAAA";


}

else 
{

val = "DD/MM/YYYY";

}


if (valdeparture1 =="" && valfromdate !="" && valindate !="")
{

//{alert(valdeparture2  +  valtodate  + valoutdate );
document.amadeus.departure1.value = val;


}

if(valdeparture1 !="" && valfromdate =="" && valindate !="")
{

document.expediaform.fromdate.value =val;


}

if (valdeparture1 !="" && valfromdate !="" && valindate =="")
{


document.expediaformhotel.indate.value =val;

}


}


// this function is used to get the difference between the arrival date and the departure date. 
function getDateDifference (selectedDate)
{

var date = $.datepicker.parseDate('dd/mm/yy', selectedDate);
var todayDate= new Date();
var oneDay = 1000*60*60*24;

return Math.ceil((date.getTime()-todayDate.getTime())/oneDay );



}




