var portalName="ACCentral";
var pageCentered="N";
var progressBar="Y"
var progressLeft=10;
var progressTop=260;

var nav=navigator.appName;
var myindate = new Date();
var myoutdate = new Date();
myoutdate = new Date(myoutdate.setDate(myoutdate.getDate()+1));
var inmm 	= myindate.getMonth();
var indd 	= myindate.getDate();
var inyy 	= (nav=="Netscape")? myindate.getYear()+1900:myindate.getYear();
var outmm = myoutdate.getMonth();
var outdd = myoutdate.getDate();
var outyy = (nav=="Netscape")? myoutdate.getYear()+1900:myoutdate.getYear();
var dayimagepath="";


function set_default_date(){

document.frm1.afftCode.value=RG_AFF_CODE;
if (inyy<2007){
return;
}

with (document.frm1){
cmbCheckInMonth.selectedIndex		=	inmm;
cmbCheckInDate.selectedIndex			= indd-1;
cmbCheckInYear.selectedIndex			= inyy-2007;
cmbCheckOutMonth.selectedIndex	= outmm;
cmbCheckOutDate.selectedIndex		= outdd-1;
cmbCheckOutYear.selectedIndex		= outyy-2007;
cmbNoOfNights.selectedIndex				=	0;
}
document.images["inday"].src="dd"+(myindate.getDay())+".gif";
document.images["outday"].src="dd"+(myoutdate.getDay())+".gif";
setMonthDays("In");
setMonthDays("Out");
}

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="dd"+(tmpInDate.getDay())+".gif";
noDays = Number(document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value);
tmpInDate = new Date(tmpInDate.setDate(tmpInDate.getDate()+noDays));
with (document.frm1){
cmbCheckOutMonth.selectedIndex	= tmpInDate.getMonth();
cmbCheckOutDate.selectedIndex		= tmpInDate.getDate()-1;
cmbCheckOutYear.selectedIndex		= ((nav=="Netscape")? tmpInDate.getYear()+1900:tmpInDate.getYear())-2007;
document.images["outday"].src="dd"+(tmpInDate.getDay())+".gif";
}
setMonthDays("Out");
}

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 = Number(tmpOutDate-tmpInDate)/86400000;
document.images["outday"].src="dd"+(tmpOutDate.getDay())+".gif";
if (dateDifference<1 || dateDifference>15){
return;
}
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);
}
newlnth= document.frm1.elements["cmbCheck"+name+"Date"].options.length;
if (newlnth<selectedInd){
newlnth= document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex=newlnth-1;
}else{
document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex=selectedInd;
}
}

function checkValues(){
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 = Number(tmpOutDate-tmpInDate)/86400000;
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 (noNights!=dateDifference){
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;
}

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="%";

if (progressBar=="Y"){
op_win();
}

document.frm1.hotelCode.value=RG_HOTEL_CODE;

document.frm1.action = "http://www.secure-reservation.com/servlets/"+portalName+".ResevationSearch";
document.frm1.submit();
}

var sWith=screen.width;
var toadd= 0;
if (sWith>800 && pageCentered=="Y"){
toadd = (sWith-800)/2;
}

function op_win(){
if (nav=="Netscape"){
if (navigator.userAgent.indexOf("Netscape/7")>-1){
document.getElementById("progress").style.left=progressLeft+toadd;
document.getElementById("progress").style.top=progressTop;
document.getElementById("progress").style.visibility="visible";
}else{
document.layers["progress"].left=progressLeft+toadd;
document.layers["progress"].top=progressTop+toadd;
document.layers["progress"].visibility="show";
}
}else{
document.all["progress"].style.left=progressLeft+toadd;
document.all["progress"].style.top=progressTop;
document.all["progress"].style.visibility="visible";
}
}

function hide_progress(){
if (progressBar!="Y"){
return;
}
if (nav=="Netscape"){
if (navigator.userAgent.indexOf("Netscape/7")>-1){
document.getElementById("progress").style.visibility="hidden";
}else{
document.layers["progress"].visibility="hide";
}
}else{
document.all["progress"].style.visibility="hidden";
}
}


if (navigator.appName=="Netscape" && navigator.userAgent.indexOf("Netscape/7")==-1){
tmpstr="<layer name=\"progress\" visibility=\"hide\" top=\"200\" left=\"200\">";
}else{
tmpstr="<div id=\"progress\" style=\"position:absolute; left:200px; top:200px; width:220px; height:92px; z-index:1; visibility: hidden;\">";
}


tmpstr=tmpstr+"<table width=\"220\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"#FF0000\">"+
"<tr>"+
"<td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\">"+
"<tr>"+
"<td><table width=\"200\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\" bgcolor=\"#FFFFFF\">"+
"<tr>"+
"<td><img src=\"atlantic-city-hotels/images/space.gif\" width=\"1\" height=\"1\"></td>"+
"</tr>"+
"<tr>"+
"<td class=\"divtxt\">";
if (navigator.appName=="Netscape" && navigator.userAgent.indexOf("Netscape/7")==-1){
tmpstr=tmpstr+"Please wait one moment ...";
}else if (navigator.appName=="Netscape" && navigator.userAgent.indexOf("Netscape/7")>-1){
tmpstr=tmpstr+"<blink><span class=\"divtxt\">Please wait one moment ...&nbsp;&nbsp;&nbsp;</span></blink>";
}else{
tmpstr=tmpstr+"<blink><div id=\"progress1\" class=\"divstyle\"><marquee align=\"middle\" behavior=\"alternate\" scrollamount=\"400\" scrolldelay=\"180\" width=\"400\"><span class=\"divtxt\">Please wait one moment ...&nbsp;&nbsp;&nbsp;</span></marquee></div></blink>";
}


tmpstr=tmpstr+"</td>"+
"</tr>"+
"<tr>"+
"<td class=\"engtext1\">We are checking and retrieving hotel rates and availability</td>"+
"</tr>"+
"<tr>"+
"<td><img src=\"atlantic-city-hotels/images/space.gif\" width=\"1\" height=\"1\"></td>"+
"</tr>"+
"</table></td>"+
"</tr>"+
"</table></td>"+
"</tr>"+
"</table>";

if (navigator.appName=="Netscape" && navigator.userAgent.indexOf("Netscape/7")==-1){
tmpstr=tmpstr+"</layer>";
}else{
tmpstr=tmpstr+"</div>";
}

if (progressBar=="Y"){
document.write(tmpstr);
}