
Zapatec.Calendar.setup({
showOthers        : true,
step              : 1,
electric          : false,
inputField        : "txtdeptDateOway",
button            : "deptDateOwayimgExact",
ifFormat          : "%d/%m/%Y",
daFormat          : "%d/%m/%Y",
numberMonths      : 2,
displayArea		  : null,
flat 			  : null,
multiple		  : null,
numberMonths : 2,
monthsInRow : 1,
dateStatusFunc :    dateInRange1, //the function to call
onUpdate       :    filterDates1,
vertical : true
});



Zapatec.Calendar.setup({
showOthers        : true,
step              : 1,
electric          : false,
inputField        : "txtretnDateOway",
button            : "retnDateOwayimg",
ifFormat          : "%d/%m/%Y",
daFormat          : "%d/%m/%Y",
numberMonths      : 2,
displayArea		  : null,
flat 			  : null,
multiple		  : null,
numberMonths : 2,
monthsInRow : 1,
dateStatusFunc :    dateInRange2, //the function to call
onUpdate       :    filterDates2,
vertical : true
});




Zapatec.Calendar.setup({
showOthers        : true,
step              : 1,
electric          : false,
inputField        : "date1",
button            : "checkInImg",
ifFormat          : "%d/%m/%Y",
daFormat          : "%d/%m/%Y",
numberMonths      : 2,
displayArea		  : null,
flat 			  : null,
multiple		  : null,
numberMonths : 2,
monthsInRow : 1,
dateStatusFunc :    dateInRange1, //the function to call
onUpdate       :    filterDates1,
vertical : true
});

var deptShowCalendar =new Date();
function  returnDateField(){
var input =document.getElementById("date1").value;
var deptShowCalendar
if(input!="DD/MM/YYYY"){
var dayfield=input.split("/")[0]
var monthfield=input.split("/")[1]
var yearfield=input.split("/")[2]
//alert(yearfield+""+monthfield+""+dayfield);
deptShowCalendar=new Date(yearfield,monthfield-1,dayfield);
}


Zapatec.Calendar.setup({
showOthers        : true,
step              : 1,
electric          : false,
inputField        : "date2",
button            : "checkOutImg",
ifFormat          : "%d/%m/%Y",
daFormat          : "%d/%m/%Y",
date               :deptShowCalendar,
numberMonths      : 2,
displayArea		  : null,
flat 			  : null,
multiple		  : null,
numberMonths : 2,
monthsInRow : 1,
dateStatusFunc :    dateInRange2, //the function to call
// onUpdate       :    filterDates2,
vertical : true
});
}




var startDate;
var endDate;
var callbacks = 0;

function resetDates() {
//loadJsFiles();
startDate = endDate = null;
htlstartDate = htlendDate = null;
}

function compareDatesOnly(date1, date2) {
var year1 = date1.getYear();
var year2 = date2.getYear();
var month1 = date1.getMonth();
var month2 = date2.getMonth();
var day1 = date1.getDate();
var day2 = date2.getDate();

if (year1 > year2) {
return -1;
}
if (year2 > year1) {
return 1;
}

//years are equal
if (month1 > month2) {
return -1;
}
if (month2 > month1) {
return 1;
}

//years and months are equal
if (day1 > day2) {
return -1;
}
if (day2 > day1) {
return 1;
}

//days are equal
return 0;
}

function filterDates1(cal) {
startDate = cal.date;
if (endDate == null) { 
Zapatec.Calendar.setup({
inputField     :    "arrivalDate",
button         :    "button8b",  // What will trigger the popup of the calendar
ifFormat       :    "%Y-%m-%d ",
timeFormat     :    "24",
date           :     startDate,
electric       :     false,
showsTime      :     false,          //no time
disableFunc    :    dateInRange2, //the function to call
onUpdate       :    filterDates2
});
}
}



function filterDates2(cal) {
endDate = cal.date;
}


function dateInRange1(date) {
if (endDate != null) {
// Disable dates after end date
var compareEnd = compareDatesOnly(date, endDate);
if  (compareEnd < 0) {
return (true);
}
// Hilight end date with "edges" style
if  (compareEnd == 0) {
{return "edges";}
}


// Hilight inner dates with "between" style
if (startDate != null){
var compareStart = compareDatesOnly(date, startDate);
if  (compareStart < 0) {
return "between";
} 
} 
}

//disable days prior to today
var today = new Date();
var compareToday = compareDatesOnly(date, today);
if (compareToday > 0) {
return(true);
}


//all other days are enabled
return false;
//alert(ret + " " + today + ":" + date + ":" + compareToday + ":" + days1 + ":" + days2);
return(ret);
}



function dateInRange2(date) {
if (startDate != null) {
// Disable dates before start date
var compareDays = compareDatesOnly(startDate, date);
if  (compareDays < 0) {
return (true);
}

// Hilight end date with "edges" style
if  (compareDays == 0) {
{return "edges";}
}

// Hilight inner dates with "between" style
if ((endDate != null) && (date > startDate) && (date < endDate)) {
return "between";
} 
} 

var now = new Date();
if (compareDatesOnly(now, date) < 0) {
return (true);
}

//all other days are enabled
return false;
}

	
	
	
// below calendars are for hotels // added on 21-04-07	
	
	

var checkInShowCalendar =new Date()
//checkInShowCalendar =new Date(checkInShowCalendar.setDate(checkInShowCalendar.getDate( ) + 1))

//function hotelCheckInDate(){
Zapatec.Calendar.setup({
showOthers        : true,
step              : 1,
electric          : false,
//inputField        : "arrDateOway",
button            : "arrDateOwayimg",
ifFormat          : "%d/%m/%Y",
daFormat          : "%d/%m/%Y",
//date              :checkInShowCalendar,
numberMonths      : 2,
displayArea		  : null,
flat 			  : null,
multiple		  : null,
numberMonths : 2,
monthsInRow : 1,
dateStatusFunc :    dateInRange3, //the function to call
onUpdate       :    filterDates3,
vertical : true
});
//}

	
	
	
var depthtlShowCalendar =new Date();
returnDateField1();
function  returnDateField1(){
//var input =document.getElementById("arrDateOway").value;
var depthtlShowCalendar
//if(input.toUpperCase()!="DD/MM/YYYY"){
//var dayfield=input.split("/")[0]
//var monthfield=input.split("/")[1]
//depthtlShowCalendar=new Date(yearfield,monthfield-1,dayfield);
//}else{
//depthtlShowCalendar=new Date();		

//}
Zapatec.Calendar.setup({
showOthers        : true,
step              : 1,
electric          : false,
inputField        : "HdeptDateOway",
button            : "HdeptDateOwayimg",
ifFormat          : "%d/%m/%Y",
daFormat          : "%d/%m/%Y",
date              :depthtlShowCalendar,
numberMonths      : 2,
displayArea		  : null,
flat 			  : null,
multiple		  : null,
numberMonths : 2,
monthsInRow : 1,
dateStatusFunc :    dateInRange4, //the function to call
//onUpdate       :    filterDates2,
vertical : true
});								  
}


var controlDate=0;								
var htlstartDate;
var htlendDate;
var htlcallbacks = 0;


function filterDates3(cal) {
htlstartDate = cal.date;
htlstartDate.setDate(htlstartDate.getDate()+1)
if (htlendDate == null) { 
Zapatec.Calendar.setup({
inputField     :    "arrivalDate",
button         :    "button8b",  // What will trigger the popup of the calendar
ifFormat       :    "%Y-%m-%d ",
timeFormat     :    "24",
date           :     htlstartDate,
electric       :     false,
showsTime      :     false,          //no time
disableFunc    :    dateInRange4, //the function to call
onUpdate       :    filterDates4
});
}
}

function filterDates4(cal) {
htlendDate = cal.date;
htlendDate.setDate(htlendDate.getDate()-1)
}


function dateInRange3(date) {
if (htlendDate != null) {
// Disable dates after end date
var compareEnd = compareDatesOnly(date, htlendDate);
if  (compareEnd < 0) {
return (true);
}
// Hilight end date with "edges" style
if  (compareEnd == 0) {
{return "edges";}
}
// Hilight inner dates with "between" style
if (htlstartDate != null){
var compareStart = compareDatesOnly(date, htlstartDate);
if  (compareStart < 0) {
return "between";
} 
} 
}
//disable days prior to today
var today = new Date();
today.setDate(today.getDate()+controlDate)
var compareToday = compareDatesOnly(date, today);
if (compareToday > 0) {
return(true);
}
//all other days are enabled
return false;
//alert(ret + " " + today + ":" + date + ":" + compareToday + ":" + days1 + ":" + days2);
return(ret);
}



function dateInRange4(date) {
if (htlstartDate != null) {
// Disable dates before start date
var compareDays = compareDatesOnly(htlstartDate, date);
if  (compareDays < 0) {
return (true);
}
// Hilight end date with "edges" style
if  (compareDays == 0) {
{return "edges";}
}
// Hilight inner dates with "between" style
if ((htlendDate != null) && (date > htlstartDate) && (date < htlendDate)) {
return "between";
} 
} 

var now = new Date();
now.setDate(now.getDate()+controlDate)
if (compareDatesOnly(now, date) < 0) {
return (true);
}

//all other days are enabled
return false;
}						