function isBrowserSupp() {
version =  parseFloat( navigator.appVersion );
if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {
return false;
}else{
return true;
}
return true;
}

function isLeapYear(yrStr){
var leapYear=false;
var year = parseInt(yrStr, 10);
// every fourth year is a leap year
if (year%4 == 0){
leapYear=true;
// unless it's a multiple of 100
if (year%100 == 0){
leapYear=false;
// unless it's a multiple of 400
if (year%400 == 0){
leapYear=true;
}
}
}
return leapYear;
}


function getDaysInMonth(mthIdx, YrStr){
var maxDays=31
if (mthIdx==1) {
if (isLeapYear(YrStr)){
maxDays=29;
}else {
maxDays=28;
}
}
if (mthIdx==3 || mthIdx==5 || mthIdx==8 || mthIdx==10){
maxDays=30;
}
return maxDays;
}

function adjustDate(mthIdx, Dt) {
var value=0;
var today = new Date()
var theYear = parseInt(today.getYear(),10)
if (mthIdx < today.getMonth()) {
theYear = (parseInt(today.getYear(), 10) + 1)
}
if(theYear<100){
theYear = "19" + theYear
}else{
if((theYear-100) < 10){
theYear = "0" + (theYear-100)
}else{
theYear = (theYear-100)+""
}
theYear = "20" + theYear
}


var numDays=getDaysInMonth(mthIdx, theYear);
if (mthIdx==1) {
if (Dt.options.selectedIndex + 1 < numDays){
return 0;
}else {
Dt.options.selectedIndex=numDays - 1;
//check for leap year
if (numDays==29){
return 99;
}else {
return 1;
}
}
}
if (Dt.options.selectedIndex + 1 < numDays){
value=0;
}else {
if (Dt.options.selectedIndex + 1 > numDays){
Dt.options.selectedIndex--;
value=3;
}else {
//index is 31 or 30
value=2;
}
}
return value;
}

//changes departure month when arrival month is changed
function amadChange(inM,inD,outM,outD) {
if (!isBrowserSupp()){
return;
}

var res = adjustDate(inM.options.selectedIndex, inD);
if (res != 0){
outD.options.selectedIndex=0;
if (outM.options.selectedIndex==11){
outM.options.selectedIndex=0
}else{
outM.options.selectedIndex=inM.options.selectedIndex + 1;
}
}else {
outM.options.selectedIndex = inM.options.selectedIndex;
outD.options.selectedIndex = inD.options.selectedIndex+1;
}
return;
}

function dmddChange(outM,outD) {
if (!isBrowserSupp()){
return;			
}
adjustDate(outM.options.selectedIndex,outD);	
return;	
}

function openWin(){
thor = window.open("http://travel.hotels-atlanta.com/components/processing.jsp?counter=0&cid=56056&specials=false","thor","top=200,left=220,width=500,height=250,resizable=1");
}

function submitForm(){
document.forms.frm_Search1.submit();
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function openWinfaq() { 
window.open( 'http://travel.hotels-atlanta.com/index.jsp?pageName=hotelFaq&cid=56056', 'WIN', 'width=500,height=500,top=20,left=20,toolbar=0,location=0,directories=0,status=1,menuBar=0,scrollBars=1,resizable=1' );
} 
function openPS() { 
window.open( 'http://www.travelnow.com/index.jsp?pageName=privacy&cid=56056', 'PS', 'width=500,height=500,top=20,left=20,toolbar=0,location=0,directories=0,status=1,menuBar=0,scrollBars=1,resizable=1' );
} 
function book_and_save(){
window.open( 'http://travel.hotels-atlanta.com/index.jsp?pageName=promo&amp;cid=56056', 'DISC', 'width=800,height='+(screen.height-150)+',top=20,left=20,toolbar=0,location=0,directories=0,status=1,menuBar=0,scrollBars=1,resizable=1' );
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function DDM(D,M,Y){
if (M==1 || M==3 || M==5 || M==7 || M==8 || M==10 || M==12){
Ret_D = 31;
}else{
	if (M!=2){
	Ret_D =30;
	}else{
	Ret_D = (Y%4==0)? 29:28;
	}
}
return Ret_D;
}



var MyDate= new Date();
var MM_day = MyDate.getDate();
var MM_month = MyDate.getMonth();
var MM_year = MyDate.getYear();

var MonthIndexIn =MM_month;
var MonthIndexOut =MM_month;
var DateIndexIn =MM_day+3;
var DateIndexOut =MM_day+5;
function get_currentdate(){
MaxDays = DDM(MM_day,MM_month+1,MM_year);
	if (DateIndexIn>MaxDays){
	DateIndexIn = DateIndexIn-MaxDays;
	MonthIndexIn= MM_month+1;
	if (MonthIndexIn>11){
	MonthIndexIn=0;
	}
	}

	if (DateIndexOut>MaxDays){
	DateIndexOut = DateIndexOut-MaxDays;
	MonthIndexOut= MM_month+1;
	if (MonthIndexOut>11){
	MonthIndexOut=0;
	}
	}	

document.frm_Search.arrivalMonth.selectedIndex = MonthIndexIn
document.frm_Search.arrivalDay.selectedIndex = DateIndexIn-1

document.frm_Search.departureMonth.selectedIndex = MonthIndexOut
document.frm_Search.departureDay.selectedIndex = DateIndexOut-1
	
}

function openphotos(file,input,width,height) {
attr = "top=5,left=75,width=" + width + ",height=" + height + ",resizable=1";
window.open(file, input, attr);
}

