var HotelCode = 'YBFL';
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, "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, "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 = HotelCode; var h = document.getElementById("ctl00_QuickBook1_ddlRooms"); var a = document.getElementById("ctl00_QuickBook1_ddlNights"); var c = document.getElementById("ctl00_QuickBook1_ddlAdults");
	if (g != null) {
		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; 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;
}


// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth = 500;
defaultHeight = 350;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
	var isNN = (navigator.appName == "Netscape") ? 1 : 0;
	var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
}
var optNN = 'scrollbars=no,width=' + defaultWidth + ',height=' + defaultHeight + ',left=' + PositionX + ',top=' + PositionY;
var optIE = 'scrollbars=no,width=150,height=100,left=' + PositionX + ',top=' + PositionY;
function popup(imageURL, imageTitle) {
	if (isNN) { imgWin = window.open('about:blank', '', optNN); }
	if (isIE) { imgWin = window.open('about:blank', '', optIE); }
	with (imgWin.document) {
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>'); writeln('<sc' + 'ript>');
		writeln('var isNN,isIE;'); writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;'); writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){'); writeln('if (isIE){'); writeln('window.resizeTo(300,300);');
		writeln('width=300-(document.body.clientWidth-document.images[0].width);');
		writeln('height=300-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}'); writeln('if (isNN){');
		writeln('window.innerWidth=document.images["George"].width;'); writeln('window.innerHeight=document.images["George"].height;}}');
		writeln('function doTitle(){document.title="' + imageTitle + '";}'); writeln('</sc' + 'ript>');
		if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<img name="George" src=' + imageURL + ' style="display:block"></body></html>');
		close();
	}
}

function googleTranslateElementInit() {
	new google.translate.TranslateElement({
		pageLanguage: 'en'
	}, 'google_translate_element');
}

//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'));
	});

	//googleTranslateElementInit();

}