<!--
// Browser sniffer
var ns4 = (document.layers); 
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);
// START DEBUGGER
	function PageQuery(q) {
		if(q.length > 1) this.q = q.substring(1, q.length);
		else this.q = null;
		this.keyValuePairs = new Array();
		if(q) {
			for(var i=0; i < this.q.split("&").length; i++) {
				this.keyValuePairs[i] = this.q.split("&")[i];
			}
		}
		this.getKeyValuePairs = function() { return this.keyValuePairs; }
		this.getValue = function(s) {
			for(var j=0; j < this.keyValuePairs.length; j++) {
				if(this.keyValuePairs[j].split("=")[0] == s)
					return this.keyValuePairs[j].split("=")[1];
			}
			return false;
		}
		this.getParameters = function() {
			var a = new Array(this.getLength());
			for(var j=0; j < this.keyValuePairs.length; j++) {
				a[j] = this.keyValuePairs[j].split("=")[0];
			}
			return a;
		}
		this.getLength = function() { return this.keyValuePairs.length; }	
	}
	function queryString(key){
		var page = new PageQuery(window.location.search); 
		return unescape(page.getValue(key)); 
	}
	var bDebug = false;
	if(queryString('debug')=='true') {
		bDebug = true;
	}
// END DEBUGGER
function OpenWindow(url,name,opts) {
	newwindow = window.open(url,name,opts); 
	if (window.focus){
		newwindow.focus()
	}
}
function grayOut(vis, options) {
	// Pass true to gray out screen, false to ungray
	// options are optional.  This is a JSON object with the following (optional) properties
	// opacity:0-100         // Lower number = less grayout higher = more of a blackout 
	// zindex: #             // HTML elements with a higher zindex appear on top of the gray out
	// bgcolor: (#xxxxxx)    // Standard RGB Hex color code
	// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
	// Because options is JSON opacity/zindex/bgcolor are all optional and can appear
	// in any order.  Pass only the properties you need to set.
	var options = options || {}; 
	var zindex = options.zindex || 100;
	var opacity = options.opacity || 70;
	var opaque = (opacity / 100);
	var bgcolor = options.bgcolor || '#000000';
	var dark=document.getElementById('darkenScreenObject');
	if (!dark) {
		// The dark layer doesn't exist, it's never been created.  So we'll
		// create it here and apply some basic styles.
		// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
		var tbody = document.getElementsByTagName("body")[0];
		var tnode = document.createElement('div');           // Create the layer.
		tnode.style.position='absolute';                 // Position absolutely
		tnode.style.top='0px';                           // In the top
		tnode.style.left='0px';                          // Left corner of the page
		tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
		tnode.style.display='none';                      // Start out Hidden
		tnode.id='darkenScreenObject';                   // Name it so we can find it later
		tbody.appendChild(tnode);                            // Add it to the web page
		tbody.onclick="alert('')"
		dark=document.getElementById('darkenScreenObject');  // Get the object.
	}
	if (vis) {
		sSelectHide = 'none';
		// Calculate the page width and height 
		if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
			var pageWidth = document.body.scrollWidth+'px';
			var pageHeight = document.body.scrollHeight+'px';
		} else if( document.body.offsetWidth ) {
			var pageWidth = document.body.offsetWidth+'px';
			var pageHeight = document.body.offsetHeight+'px';
		} else {
			var pageWidth='100%';
			var pageHeight='100%';
		}   
		//set the shader to cover the entire page and make it visible.
		dark.style.opacity=opaque;                      
		dark.style.MozOpacity=opaque;                   
		dark.style.filter='alpha(opacity='+opacity+')'; 
		dark.style.zIndex=zindex;        
		dark.style.backgroundColor=bgcolor;  
		dark.style.width= pageWidth;
		dark.style.height= pageHeight;
		dark.style.display='block';				 
	} else {
		dark.style.display='none';
		sSelectHide = '';
	}
	oSelects = document.getElementsByTagName('select');
	for(x=0;x<oSelects.length;x++) {
		//oSelects[x].style.display = sSelectHide;
	}
}

function object_attach(id){
	var obj;
	if(ns4) obj = document.layers[id];
	else if(ie4) obj = document.all[id];
	else if(ie5 || ns6) obj = document.getElementById(id);
	return obj;
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
		}else{
			window.onload = function() {
				if (oldonload) {
				oldonload();
			}
		func();
		}
	}
}

function getQuerystring() {
	var URL = document.URL
	if(URL.indexOf('?')) {
		var arURL = URL.split('?')
		return arURL[1];	
	}
}

function validateNewsletter(fId) {
	var m = '';
	if(!fId.name.value || fId.name.value=='Enter your name') {m+='- Please enter your name\n'}
	if(!/.+@[^.]+(\.[^.]+)+/.test(fId.email.value) || isValidField(fId.email.value,2) == false || fId.email.value=='Enter your email'){m+='- Please enter a valid email address\n'}
	if(m){
		alert(m);
		return false;		
	}else{
		return true;		
	}
}

function validateEnquiry(fId) {
	var m = '';
	if(fId.title.value=='-'){m+='- Please select your title\n'}
	if(!fId.firstname.value || fId.firstname.value == '- First name -'){m+='- Please enter your first name\n'}
	if(!fId.surname.value || fId.surname.value == '- Surname -'){m+='- Please enter your surname\n'}
	if(!/.+@[^.]+(\.[^.]+)+/.test(fId.email.value) || isValidField(fId.email.value,2) == false){m+='- Please enter a valid email address\n'}
	if(!fId.enquiry.value){m+='- Please enter your enquiry\n'}
	if(!fId.answer.value){m+='- Please enter your answer\n'}
	if(m){
		alert(m);
		return false;		
	}else{
		return true;		
	}
}

function LoadGoogleMap(sDiv, iLat, iLng) {
	if(document.getElementById(sDiv)) {
		sDiv = document.getElementById(sDiv)
		sDiv.style.width = '500px';
		sDiv.style.height = '220px';
		if (GBrowserIsCompatible()) {
			var mygmap = new GMap2(sDiv);
			//map.addControl(new YSliderControl());
			mygmap.addControl(new GSmallMapControl());
    		mygmap.addControl(new GMapTypeControl());
			mygmap.setCenter(new GLatLng(iLat, iLng), 13);
			var point = new GLatLng(iLat,iLng);
			mygmap.addOverlay(new GMarker(point));
		}
	}
}

function SwitchPhoto(PlaceHolderName,ThumbImg){
	var ImagePath = ThumbImg;
	if (document.all){
		document.getElementById(PlaceHolderName).style.filter="blendTrans(duration=1)";
		document.getElementById(PlaceHolderName).filters.blendTrans.Apply();
	}
	if(document.getElementById) {
		document.getElementById(PlaceHolderName).src = ImagePath;
	}else{
		document.HotelImage.src = ImagePath;
	}
	if(document.all){
		document.getElementById(PlaceHolderName).filters.blendTrans.Play();
	}
}

// Checks if field contains valid characters
// 1 - Numeric Integer, 2 - Email, 3 - Numeric Decimals
function isValidField(sText, iType){
	if(iType==1)
	{ ValidChars = "0123456789"; }
	else if(iType==2)
	{ ValidChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-@"; }
	else if(iType==3)
	{ ValidChars = "0123456789."; }
	else if(iType==4)
	{ ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "; }
	var isValid=true;
	var Char;
	for (i = 0; i < sText.length && isValid == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{ isValid = false; }
	}
	return isValid;
}
function echeck(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return (true)
	}
	return (false)
}
function writeInDiv(sText, sID) {
	if(document.getElementById(sID)) {
		document.getElementById(sID).innerHTML = sText;
	}
}

function checkPackageForm(sForm) {
	sCurForm = sForm;
	sCurSearchType = 'Package';
	sSubmitForm = document.getElementsByName('frm'+sForm);
	sLocationID = document.getElementById('packageLocationTo'+sForm);
	var e = sSubmitForm.elements, m = '';
	if(countPassengers()>9) {
		alert('You can only search for a maximum of 9 passengers when your search includes a flight');
		return false;
	}
	if(sLocationID.value==''){m += '- Please select a destination.\n';}
	if(validateDate('startdate_d'+sForm,'startdate_m'+sForm,'startdate_y'+sForm)<=2) {m += '- Departure date is not valid.\n';}
	bBoard = false;
	for(x=0;x<document.forms['frm'+sForm].board.length;x++) {
		if(document.forms['frm'+sForm].board[x].checked==true) {
			bBoard = true;	
		}
	}
	if(!bBoard){m += '- Please select at least one board option.\n';}
	
	if(document.getElementById('rooms'+sForm)) {
		if(document.getElementById('rooms'+sForm).value=='0') {
			m+='- Please select no. of rooms\n';
		}
	}
	if(m) {
		OpenSearch();
		alert('The following errors occurred:\n\n' + m);
		return false;
	}else{
		sSubmitForm[0].submit();
	}	
}

//topsearch
function showhidechangeoptions(type) {
	if(type == "show") {
		div_switch("slimSearchTop", true, true);
		div_switch("slimSearchBottom", true, true);
		div_switch("DivShow", false, true);
		div_switch("DivHide", true, true);
	}
	if(type == "hide") {
		div_switch("slimSearchTop", false, true);
		div_switch("slimSearchBottom", false, true);
		div_switch("DivShow", true, true);
		div_switch("DivHide", false, true);
	}
}
var SelectedSearchTab = 'search_tab1';
function SwitchTabs(id, on) {
	if(SelectedSearchTab!=id && SelectedHeaderTab!=id) {
		sExtra = '';
		if(on==1){
			if(document.getElementById(id).className.indexOf('Over')<0){
				document.getElementById(id).className = document.getElementById(id).className + 'Over'
			}else{
				SelectedSearchTab = id;
			}
		}else{
			if(document.getElementById(id).className.indexOf('Over') > -1) {
				document.getElementById(id).className = Left(document.getElementById(id).className,document.getElementById(id).className.length-4);
			}
		}
	}
}
function SwitchSearch(id) {
	/* HIDE PREDICTIVE TEXT OPTIONS IF SHOWING */
	if(document.getElementById('as_idFreetextHotel')) {
		document.getElementById('as_idFreetextHotel').style.display = 'none';
	}
	if(document.getElementById('as_idFreetextFlight')) {
		document.getElementById('as_idFreetextFlight').style.display = 'none';
	}
	if(document.getElementById('as_idFreetextFlightHotel')) {
		document.getElementById('as_idFreetextFlightHotel').style.display = 'none';
	}
	for(x=1;x<8;x++) {
		if(document.getElementById('search_tab'+x)) {
			document.getElementById('search_tab'+x).className = 'searchtab';
		}
		if(document.getElementById('search'+x)) {
			document.getElementById('search'+x).style.display = 'none';
		}
	}
	SelectedSearchTab = id;
	if(document.getElementById(id)) {
		document.getElementById(id).className = 'searchtabOver';
	}
	if(document.getElementById('search'+Right(id,1))) {
		document.getElementById('search'+Right(id,1)).style.display = '';
	}
}

function SwitchLanding(id) {
	for(x=1;x<8;x++) {
		if(document.getElementById('landing_tab'+x)) {
			document.getElementById('landing_tab'+x).className = 'searchtab';
		}
		if(document.getElementById('divLanding'+x)) {
			document.getElementById('divLanding'+x).style.display = 'none';
		}
	}
	SelectedSearchTab = id;
	if(document.getElementById(id)) {
		document.getElementById(id).className = 'searchtabOver';
	}
	if(document.getElementById('divLanding'+Right(id,1))) {
		document.getElementById('divLanding'+Right(id,1)).style.display = '';
	}
	if(Right(id,1)=='4'){
		if(document.getElementById('divLandingSearch')) {
			document.getElementById('divLandingSearch').style.display = '';
		}	
	}else{
		if(document.getElementById('divLandingSearch')) {
			document.getElementById('divLandingSearch').style.display = 'none';
		}
	}
	if(Right(id,1)=='3'){
		if(document.getElementById('divLandingOffers')) {
			document.getElementById('divLandingOffers').style.display = '';
		}	
	}else{
		if(document.getElementById('divLandingOffers')) {
			document.getElementById('divLandingOffers').style.display = 'none';
		}
	}
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

// Clears a text field only if the value matches what is passed in
function clearField(fId, sMatch, sChange){
	if(sChange == null) sChange = '';
	if(fId.value == sMatch)
	{ fId.value = sChange; }
}
// Shows/hides div objects
function div_switch(id, bShow, bBlock) {
	if(document.getElementById(id)){
		if(bShow==true) {
			document.getElementById(id).style.display = '';
		}else{
			document.getElementById(id).style.display = 'none';
		}
	}
}

function checkFormFieldSelectedIndex(sFieldName, sErrTxt) {
	oTitleElements = document.getElementsByTagName("select")
	for (i = 0; i < oTitleElements.length; i++)
	{
		if(oTitleElements.item(i).id.indexOf(sFieldName) == 0)
		{
			if(oTitleElements.item(i).selectedIndex == 0)
			{ alert(sErrTxt); oTitleElements.item(i).focus(); return false; break; }
		}
	}
	return true;
}

function checkFormFieldValue(sFieldName, sDefaultVal, sErrTxt, iMinLen){
	if(iMinLen==undefined || iMinLen==null) { iMinLen = 1; }
	oFormElements = document.getElementsByTagName("input")
	for (i = 0; i < oFormElements.length; i++){
		if(oFormElements.item(i).id.indexOf(sFieldName) == 0){
			if(oFormElements.item(i).value == '' || oFormElements.item(i).value == sDefaultVal || oFormElements.item(i).value.length < iMinLen || (sFieldName == 'surname' && oFormElements.item(i).value.indexOf(' ') > -1)){
				alert(sErrTxt);
				oFormElements.item(i).focus();
				return false;
				break;
			}
		}
	}
	oFormElements = document.getElementsByTagName("textarea")
	for (i = 0; i < oFormElements.length; i++){
		if(oFormElements.item(i).id.indexOf(sFieldName) == 0){
			if(oFormElements.item(i).value == '' || oFormElements.item(i).value == sDefaultVal){
				alert(sErrTxt);
				oFormElements.item(i).focus()
				return false;
				break;
			}
		}
	}
	return true;
}

function formatCurrency(num){
	if(typeof num != "undefined") {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		return (((sign)?'':'-') + '&pound;' + num + '.' + cents);
	}
}

// START ALT POP JS
	// onmouseover="ShowInfoPop('This is a test','And it works!!')" onmouseout="HideInfoPop()"
	Xoffset=20;
	Yoffset=20;
	var yyy=-1000;
	var newDiv, newFrame;
	function ShowInfoPop(title,msg,newYoffset){
		if(newYoffset) {
			Yoffset = newYoffset;
		}
		if(window.Event && document.captureEvents)
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove=get_mouse;
		sHTML='';
		sHTML+='<div class="infotitle">'+title+'</div>'
		sHTML+='<div class="infotext">'+msg+'</div>'
		yyy=Yoffset;
		document.getElementById('CTInfoBox').innerHTML = sHTML;
		document.getElementById('CTInfoBox').style.display='block';
		if(document.getElementById('CTInfoBoxFrame')) {
			document.getElementById('CTInfoBoxFrame').style.display='block';
			document.getElementById('CTInfoBoxFrame').style.width=document.getElementById('CTInfoBox').offsetWidth+'px';
			document.getElementById('CTInfoBoxFrame').style.height=document.getElementById('CTInfoBox').offsetHeight+'px';
		}
		
	}
	function HideInfoPop(){
		yyy=-1000;
		if(document.getElementById('CTInfoBoxFrame')) {
			document.getElementById('CTInfoBoxFrame').style.display='none';
		}
		document.getElementById('CTInfoBox').style.display='none';
	}
	function get_mouse(e){
		if (!e) {
			var e = window.event||window.Event;
		}
		if('undefined'!=typeof e.pageX){
			mouseX = e.pageX;
			mouseY = e.pageY;
		}else{
			mouseX = e.clientX + document.documentElement.scrollLeft;
			mouseY = e.clientY + document.documentElement.scrollTop;
		}
		
		iMouseX = mouseX+Xoffset;
		//alert(document.documentElement.scrollTop);
		if(document.getElementById('CTInfoBoxFrame')) {
			document.getElementById('CTInfoBoxFrame').style.left=mouseX+Xoffset+'px';
			document.getElementById('CTInfoBoxFrame').style.top=mouseY+yyy+'px';
		}
		if(document.getElementById('CTInfoBox')) {
			document.getElementById('CTInfoBox').style.left=mouseX+Xoffset+'px';
			document.getElementById('CTInfoBox').style.top=mouseY+yyy+'px';
		}
	}
// END ALT POP JS



-->
