function check_dates(bam,bad,bay,bdm,bdd,bdy)
{ var currentTime = new Date();
  var month = currentTime.getMonth() + 1;
  if(month<10)
  { month="0"+month;
  }

  if(bad<10)
  { bad="0"+bad;
  }
      if(bdd<10)
  { bdd="0"+bdd;
  }

  var day = currentTime.getDate();
  var year = currentTime.getFullYear();
  
  if(bay.value<year)
  { alert("Arrival date must be after today");
  	return false;
  }
  if(bay.value==year && bam.value<month)
  { alert("Arrival date must be after today");
    return false;
  }
  if(bay.value==year && bam.value==month && bad.value<day)
  { alert("Arrival date must be after today");
    return false;
  }
  if(bdy.value<year)
  { alert("Departure date must be after today");
  	return false;
  }
  if(bdy.value==year && bam.value<month)
  { alert("Departure date must be after today");
    return false;
  }
  if(bdy.value==year && bam.value==month && bad.value<day)
  { alert("Departure date must be after today");
    return false;
  }
  if(bdy.value<bay.value)
  { alert("Departure date must be after Arrival date");
  	return false;
  }
  if(bdy.value==bay.value && bdm.value<bam.value)
  { alert("Departure date must be after Arrival date");
    return false;
  }
  if(bdy.value==bay.value && bdm.value==bam.value && bdd<bad)
  { alert("Departure date must be after Arrival date");
    return false;
  }
  
  return true;
	
}

function GoToUrl(noa,noc,bam,bad,bay,bdm,bdd,bdy,promocode)
{	
	var d = "https://reservations.synxis.com/xbe/rez.aspx?flashOk=0&lang=1&hotel=19743&Chain=6278";
	//var arrivalString = arrivalDate.split("-");
	//var departureString = departureDate.split("-");
	if(d == "exit") {
		return false;
	}
	if (d != null || d != "")
	{
	d += "&arrive="+bam.options[bam.selectedIndex].value+"/"+bad.options[bad.selectedIndex].value+"/"+bay.options[bay.selectedIndex].value+"&depart="+bdm.options[bdm.selectedIndex].value+"/"+bdd.options[bdd.selectedIndex].value+"/"+bdy.options[bdy.selectedIndex].value+"&Adult="+noa.options[noa.selectedIndex].value+"&Child="+noc.options[noc.selectedIndex].value+"&promo="+promocode.value;
	//d += "&noa="+noa.options[noa.selectedIndex].value+"&noc="+noc.options[noc.selectedIndex].value+"&bam="+arrivalString[0]+"&bad="+arrivalString[1]+"&bay="+arrivalString[2]+"&bdm="+departureString[0]+"&bdd="+departureString[1]+"&bdy="+departureString[2];
		if (d != "")
		{	//window.top.location.href = d;
			if(check_dates(bam,bad,bay,bdm,bdd,bdy) == true)
			{ window.open(d,'mywindow','toolbar=yes, location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');
			}
		}
		return false;
	}
	else {
		return true;
	}
}



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;
}
