function prevEmail(ID, emailserver, emailname, emailinner) {
	var span = document.getElementById(ID);
	if (span != null) {
		var str = "<a href='mailto:" + emailname + "@" + emailserver + "'>";
		if (emailinner == '') str += emailname + "@" + emailserver; else str += emailinner;
		str += "</a>";
		span.innerHTML = str;
	}
}
function Focus() { window.focus() }
function Close() { window.close() }
function BreakOutOfFrames() { if(parent!=window) { parent.location=location.href } }
function bookMarkPage() { if(document.all) { window.external.AddFavorite(this.location,"Brook Hotels") } }
function addOnloadEvent(b) { if(typeof window.addEventListener!="undefined") { window.addEventListener("load",b,false) } else { if(typeof window.attachEvent!="undefined") { window.attachEvent("onload",b) } else { if(window.onload!=null) { var a=window.onload;window.onload=function(c) { a(c);window[b]() } } else { window.onload=b } } } }
function oBookNow(a) { window.open("http://www.hol.co.uk/asp/bookings/availability.aspx?DoSearch=true&HotelCode="+a+"#prices","hol","screenx=20,screeny=20,top=20,left=20,width=780,height=600,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1") }
function oBookTNow(a) { window.open("http://www.hol.co.uk/asp/bookings/availability.aspx?DoSearch=true&TradeID=955&TradeUserID=2057&HotelCode="+a+"#prices","hol","screenx=20,screeny=20,top=20,left=20,width=780,height=600,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1") }
function checkDays() { var g=document.getElementById("ctl00_QuickBook1_ddlDay");var h=document.getElementById("ctl00_QuickBook1_ddlMonth");var k=document.getElementById("ctl00_QuickBook1_ddlMonthAndYear");var e=document.getElementById("ctl00_QuickBook1_ddlYear");if((g!=null&&h!=null&&e!=null)||(g!=null&&k!=null)) { var b=g.selectedIndex+1;var f;var m;if(k!=null) { f=parseInt(k.options[k.selectedIndex].value.substring(5,7));m=parseInt(k.options[k.selectedIndex].value.substring(0,4)) } else { f=h.selectedIndex+1;m=parseInt(e.options[e.selectedIndex].value) } var j=[31,daysInFebruary(m),31,30,31,30,31,31,30,31,30,31];var n=j[f-1];var a=false;var l=false;var d=g.length;for(var c=d;c>n;c--) { g.removeChild(g.options[c-1]);a=true } for(var c=d;c<n;c++) { AddSelectOption(g,c+1,c+1,false);l=true } if((a||l)&&g[b-1]==null) { g.focus();g.selectedIndex=g.length-1 } } }
function AddSelectOption(d,c,b,a) { if(d!=null&&d.options!=null) { d.options[d.options.length]=new Option(c,b,false,a) } }
function daysInFebruary(a) { return (((a%4==0)&&((!(a%100==0))||(a%400==0)))?29:28) }
function QuickBook() { if(!checkDate()) { return false } var b=document.getElementById("ctl00_QuickBook1_ddlDay");var f=document.getElementById("ctl00_QuickBook1_ddlMonthAndYear");var g=document.getElementById("ctl00_QuickBook1_ddlHotel");var h=document.getElementById("ctl00_QuickBook1_ddlRooms");var a=document.getElementById("ctl00_QuickBook1_ddlNights");var c=document.getElementById("ctl00_QuickBook1_ddlAdults");if(g.selectedIndex>0) { var e=window.open("about:blank","hol","screenx=20,screeny=20,top=20,left=20,width=780,height=600,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1");if(e==null) { alert("popup is null?") } else { var d="http://www.hol.co.uk/asp/bookings/availability.aspx?HotelCode="+g.options[g.selectedIndex].value;d+="&Rooms="+String(h.selectedIndex+1);d+="&Nights="+String(a.selectedIndex+1);d+="&Adults="+String(c.selectedIndex+1);d+="&ArrivalDate="+f.options[f.selectedIndex].value.substring(0,4)+"-"+f.options[f.selectedIndex].value.substring(5,7)+"-"+String(b.selectedIndex+1);d+="&DoSearch=true#prices";e.location.href=d } return false } else { alert("Please choose a hotel...");g.focus();return false } }
function checkDate() {
	var ddlDay=document.getElementById("ctl00_QuickBook1_ddlDay");
	var ddlMonth=document.getElementById("ctl00_QuickBook1_ddlMonth");
	var ddlMonthAndYear=document.getElementById("ctl00_QuickBook1_ddlMonthAndYear");
	var ddlYear=document.getElementById("ctl00_QuickBook1_ddlYear");
	var dDate;
	var iYear;
	var iMonth;
	var iDay;
	var aMonthDays=[0,31,28,31,30,31,30,31,31,30,31,30,31];
	dDate=new Date();
	iDay=dDate.getDate();
	iMonth=dDate.getMonth()+1;//changed
	iYear=dDate.getFullYear();
	var IDay=ddlDay.selectedIndex+1;//changed
	var IMonth;var IYear;
	if(ddlMonthAndYear!=null) {
		IMonth=parseInt(ddlMonthAndYear.options[ddlMonthAndYear.selectedIndex].value.substring(5,7),10);
		IYear=parseInt(ddlMonthAndYear.options[ddlMonthAndYear.selectedIndex].value.substring(0,4));
	}
	else {
		IMonth=ddlMonth.selectedIndex+1;//changed
		IYear=parseInt(ddlYear.options[ddlYear.selectedIndex].value);
	}
	// now, check if the year is OK
	if(IYear==iYear&&IMonth<iMonth) {
		alert("You cannot check the availability of dates prior to today.");
		return false;
	}
	if(IYear==iYear&&IMonth==iMonth&&IDay<iDay) {
		alert("You cannot check the availability of dates prior to today.");
		return false;
	}
	// check that the upper date limit is OK
	if(IMonth!=2&&IDay>aMonthDays[IMonth]) {
		alert("You have chosen an invalid date in the month.");
		return false;
	}
	// check the date in february is correct
	if(IMonth==2&&IDay>daysInFebruary(IYear)) {
		alert("You have chosen an invalid date in February.");
		return false;
	}
	return true;
}

//called on page load (first 'full, non ajax' load);
$(document).ready(function() {
	main();
});
function main() {
	//track click-throughs to 3rd party pages via Google Analytics...
	//$("a[rel*='nofollow']").click(function() {
	$("a[target*='_blank']").click(function() {
		if (typeof (pageTracker) != "undefined")
			pageTracker._trackPageview('/outgoing/' + $(this).attr('href'));
	});
}


function MM_showHideLayers() { //v3.0
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3) if ((obj = MM_findObj(args[i])) != null) {
        v = args[i + 2];
        if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v; }
        obj.visibility = v;
    }
}
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 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]; }
    }
}
