var nav=navigator.appName;
var nav=navigator.appName;
var myindate = new Date(2009,01,24,0,0,0,0);
var myoutdate=new Date(2009,01,25,0,0,0,0);
var inmm 	= myindate.getMonth();
var indd 	= myindate.getDate();
var inyy 	= myindate.getFullYear();
var outmm = myoutdate.getMonth();
var outdd = myoutdate.getDate();
var outyy = myoutdate.getFullYear();
var dayimagepath="images";
//var dayimagepath="http://www4.secure-reservation.com/html/ACG";
function set_default_date(){
document.frm1.cmbCheckInYear.options.length=0;
document.frm1.cmbCheckOutYear.options.length=0;
for (a=0; a<5; a++){
with (document.frm1){
if (a!=4){
cmbCheckInYear.options[a]= new Option(inyy+a,inyy+a);
}
cmbCheckOutYear.options[a]= new Option(inyy+a,inyy+a);
}
}
with (document.frm1){
cmbNoOfAdults.selectedIndex=1;
cmbCheckInMonth.selectedIndex		=	inmm;
cmbCheckInYear.selectedIndex			= inyy-inyy;
cmbCheckOutMonth.selectedIndex	= outmm;
cmbCheckOutYear.selectedIndex		= outyy-inyy;
cmbNoOfNights.selectedIndex				=	0;
}
document.images["inday"].src=""+dayimagepath+"/dd"+(myindate.getDay())+".gif";
document.images["outday"].src=""+dayimagepath+"/dd"+(myoutdate.getDay())+".gif";
setMonthDays("In");
setMonthDays("Out");
document.frm1.cmbCheckInDate.selectedIndex			= indd-1;
document.frm1.cmbCheckOutDate.selectedIndex		= outdd-1;
}

function setCheckOut(){
tmpInDate = new Date(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value,document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value,document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value,0,0,0,0);
document.images["inday"].src=""+dayimagepath+"/dd"+(tmpInDate.getDay())+".gif";
noDays = Number(document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value);
tmpOutDate = new Date(tmpInDate.setDate(tmpInDate.getDate()+noDays));
document.frm1.cmbCheckOutMonth.selectedIndex	= tmpOutDate.getMonth();
document.frm1.cmbCheckOutYear.selectedIndex		= tmpOutDate.getFullYear()-inyy;
setMonthDays("Out");
document.frm1.cmbCheckOutDate.selectedIndex		= tmpOutDate.getDate()-1;
document.images["outday"].src=""+dayimagepath+"/dd"+(tmpOutDate.getDay())+".gif";
}

function setNights(){
tmpInDate = new Date(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value,document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value,document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value,0,0,0,0);
tmpOutDate = new Date(document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value,document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value,document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value,0,0,0,0);
dateDifference = get_deference(tmpInDate,tmpOutDate);
document.images["outday"].src=""+dayimagepath+"/dd"+(tmpOutDate.getDay())+".gif";
if (dateDifference<1 || dateDifference>15){
return;
}
if (dateDifference>0){
document.frm1.cmbNoOfNights.selectedIndex = dateDifference-1;
}
}

function maxdate(mm,yy){
if (mm==1){
if(yy%4==0){return 29;}else{return 28;}
}else if (mm==0 || mm==2 || mm==4 || mm==6 || mm==7 || mm==9 || mm==11){
return 31;
}else{
return 30;
}
}

function setMonthDays(name){
tmpmm	= document.frm1.elements["cmbCheck"+name+"Month"].options[document.frm1.elements["cmbCheck"+name+"Month"].selectedIndex].value;
tmpyy	= document.frm1.elements["cmbCheck"+name+"Year"].options[document.frm1.elements["cmbCheck"+name+"Year"].selectedIndex].value;
maxdays = maxdate(tmpmm,tmpyy);
selectedInd=document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex; 
document.frm1.elements["cmbCheck"+name+"Date"].options.length=28;
toAdd=maxdays-28;
for (a=0; a<toAdd; a++){
document.frm1.elements["cmbCheck"+name+"Date"].options[document.frm1.elements["cmbCheck"+name+"Date"].options.length] = new Option(29+a,29+a);
}
new_lnth=document.frm1.elements["cmbCheck"+name+"Date"].options.length;
if (new_lnth<selectedInd+1){
document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex=document.frm1.elements["cmbCheck"+name+"Date"].options.length-1;
}else{
document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex=selectedInd;
}
}

function checkValues(affcode){
tmpInDate = new Date(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value,document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value,document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value,0,0,0,0);
tmpOutDate = new Date(document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value,document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value,document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value,0,0,0,0);
dateDifference = get_deference(tmpInDate,tmpOutDate);
noNights = document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value;
today = new Date();
if ((today-tmpInDate)>86400000){
alert("Check in date can not be less than the system date");
set_default_date();
return;
}

if (dateDifference>15 || dateDifference<1){
alert("Number of night(s) can not be grater than "+document.frm1.cmbNoOfNights.options.length+" or less than 1.\r\nPlease select again ...");
set_default_date();
return;
}else{
document.frm1.cmbNoOfNights.selectedIndex=dateDifference-1;
}

noOfRooms = document.frm1.cmbNoOfRooms.selectedIndex+1;
noOfAdults = document.frm1.cmbNoOfAdults.selectedIndex+1;

if(noOfRooms>noOfAdults){
alert("Number of adults is greater then the maximum no of adults for the rooms selected!");
return;
}

document.frm1.selCity.value="%";

var chk=chkRange();
if (!chk){
document.getElementById("chkMsg").style.display="block";
return;
}else{
document.getElementById("chkMsg").style.display="none";
}

op_win();
docdom=""+document.domain+"";
document.frm1.AffiliateMainPage.value=""+document.location+"";
document.frm1.action = "http://www4.secure-reservation.com/servlet/ACG.ResevationSearch";
document.frm1.submit();
}

function get_deference(ind,oud){
ind_d = ind.getDate();
ind_m = ind.getMonth();
ind_y = ind.getYear();
oud_d = oud.getDate();
oud_m = oud.getMonth();
oud_y = oud.getYear();
ret_val=0;
		if (ind_y==oud_y){
				if (ind_m==oud_m){
				ret_val=oud_d-ind_d;
				}else{
				ret_val=(maxdate(ind_m,ind_y)-ind_d)+oud_d
				}
		}else{
				if (ind_m==11 && oud_m==0){
				ret_val=(maxdate(ind_m,ind_y)-ind_d)+oud_d
				}
		}
return ret_val;
}

var sWith=screen.width;
var toadd= 0;
if (sWith>800){
toadd = (sWith-800)/2;
}

function op_win(){
var lpos=0;
var tpos=0;
	if (navigator.userAgent.indexOf("Netscape/")>-1){
		lpos=parseInt(document.images["searachIMG"].x);
		tpos=parseInt(document.images["searachIMG"].y);
	}else if(navigator.userAgent.indexOf("MSIE")>-1){
		posObj=document.images["searachIMG"];
		lpos=0;
		tpos=0;
		while(posObj.tagName!='BODY'){
		lpos+=posObj.offsetLeft;
		tpos+=posObj.offsetTop;
		posObj=posObj.offsetParent;
		}
	}
	if (navigator.userAgent.indexOf("Netscape/")>-1 || navigator.userAgent.indexOf("MSIE")>-1){
	document.getElementById("progress").style.left=lpos-65;
	document.getElementById("progress").style.top=tpos+55;
	document.getElementById("progress").style.visibility="visible";
	}
}


var brwag=navigator.userAgent;
function getTag(val,name,l,t,w,h){if (brwag.indexOf("/4.7")>-1){
tag1="<layer name=\""+name+"\" left=\""+l+"\" top=\""+t+"\" width=\""+w+"\" height=\""+h+"\" visibility=\"hide\">";
tag2="</layer>";}else{
tag1="<div id=\""+name+"\" style=\"position:absolute; width:"+w+"px; height:"+h+"px; z-index:1; left: "+l+"px; top: "+t+"px; visibility: hidden;\">";
tag2="</div>";}return eval("tag"+val+"");}
prloadtxt="<table width='190' height='75' border='0' cellpadding='0' cellspacing='0' class='msgborder'>"+
"<tr><td><table width='186' height='71' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFCC'>"+
"<tr><td><table width='170' border='0' align='center' cellpadding='2' cellspacing='0'><tr>";
if (brwag.indexOf("/4.7")>-1){prloadtxt=prloadtxt+"<td align='center'><span  class='blinkmsg'>Please Wait One Moment ...</span></td>";
}else if (brwag.indexOf("Netscape/7")>-1){prloadtxt=prloadtxt+"<td align='center'><blink><span  class='blinkmsg'>Please Wait One Moment ...</span></blink></td>";
}else{prloadtxt=prloadtxt+"<td align='center'><span style='width:155px;overflow:hidden;'><marquee align='middle' behavior='alternate' scrollamount='340' scrolldelay='240' width='340'><span class='blinkmsg'>Please Wait One Moment ...</span></marquee></span></td>";}
prloadtxt=prloadtxt+"</tr><tr>"+
"<td class='msgttxt'>We are checking and retrieving the rates and availability of our hotels</td>"+
"</tr></table></td></tr></table></td></tr></table>";
document.write(getTag(1,'progress',50,50,190,67)+prloadtxt+getTag(2));

function ret2digit(val){
if (val.length<2){return "0"+val+"";}else{return ""+val+"";}
}
function chkRange(){
var chkOK=true;
var inDT=Number(""+ret2digit(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value)+""+ret2digit(document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value)+""+ret2digit(document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value)+"");
var ouDT=Number(""+ret2digit(document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value)+""+ret2digit(document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value)+""+ret2digit(document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value)+"");

//if (inDT<20080104 && inDT>20080023 && ouDT<20080105 && ouDT>20080023){
//if (inDT<20080202 && inDT>20080124 && ouDT<20080203 && ouDT>20080024){
if (inDT<20090202 && inDT>20090123 && ouDT<20090203 && ouDT>20090124){

chkOK=true;
}else{
chkOK=false;
}
return chkOK;
}


//-->
