// BookNow Ltd.
// JavaScript Document
// 07 Febuary 2005
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
function setCurrentDate() {
var currentDate = new Date();
document.dateForm.inyear.selectedIndex = 0;
document.dateForm.inmonth.selectedIndex = currentDate.getMonth();
setDays();
document.dateForm.inday.selectedIndex = currentDate.getDate();}
function setDays() {
var y = document.dateForm.inyear.options[document.dateForm.inyear.selectedIndex].value;
var m = document.dateForm.inmonth.selectedIndex;
var d;
if ( (m == 3) || (m == 5) || (m == 8) || (m == 10) ) {
days = 30;}
else if (m == 1) {
if ( (Math.floor(y/4) == (y/4)) && ((Math.floor(y/100) != (y/100)) || (Math.floor(y/400) == (y/400))) )
days = 29
else
days = 28}
else {
days = 31;}
if (days > document.dateForm.inday.length) {
for (i = document.dateForm.inday.length; i < days; i++) {
document.dateForm.inday.length = days;
document.dateForm.inday.options[i].text = i + 1;
document.dateForm.inday.options[i].value = i + 1;}}
if (days < document.dateForm.inday.length) {
document.dateForm.inday.length = days;
if (document.dateForm.inday.selectedIndex == -1) 
document.dateForm.inday.selectedIndex = days - 1;}}

var sel_day;
var sel_date;
function checkdate() {
	if(parseInt(document.dateForm.inday.options[document.dateForm.inday.selectedIndex].value)<=9){
		sel_date = "0"+document.dateForm.inday.options[document.dateForm.inday.selectedIndex].value;
	}else{
		sel_date = document.dateForm.inday.options[document.dateForm.inday.selectedIndex].value;}
		sel_day = sel_date+"/"+document.dateForm.inmonth.options[document.dateForm.inmonth.selectedIndex].value+"/"+document.dateForm.inyear.options[document.dateForm.inyear.selectedIndex].value+"-00:00";
		var todayDay = new Date();
		var SelectedDay = new Date(""+document.dateForm.inmonth.options[document.dateForm.inmonth.selectedIndex].text+" "+document.dateForm.inday.options[document.dateForm.inday.selectedIndex].text+", "+document.dateForm.inyear.options[document.dateForm.inyear.selectedIndex].value+" 23:59:59");
		if (SelectedDay<todayDay){
 			alert("You may only search from Tomorrows Date\nPlease check the date and try again.");
 			document.dateForm.inmonth.focus()
 		return;	}
top.location='https://www.booknow365.com/dublin-hotels-net/avail.asp?countyid=1&display=hoteldisplay&inday='+document.dateForm.inday.options[document.dateForm.inday.selectedIndex].text+'&inmonth='+document.dateForm.inmonth.options[document.dateForm.inmonth.selectedIndex].text+'&inyear='+document.dateForm.inyear.options[document.dateForm.inyear.selectedIndex].text+'&nights='+document.dateForm.nights.options[document.dateForm.nights.selectedIndex].text+'&requirement='+document.dateForm.requirement.options[document.dateForm.requirement.selectedIndex].value;
}

