
﻿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 bookMarkPage(){if(document.all){window.external.AddFavorite(this.location,"The Travellers Guide")}}
var separator="+#+";var TCN_selValueGroup=new Array();var TCN_contents=new Array();var TCN_tempArray=new Array();var TCN_counter=0;function TCN_addContent(str){TCN_contents[TCN_counter]=str;TCN_counter++;}
function TCN_split(){TCN_arrayValues=new Array();for(i=0;i<TCN_contents.length;i++){TCN_arrayValues[i]=TCN_contents[i].split(separator);TCN_tempArray[0]=TCN_arrayValues;}}
function TCN_makeSelValueGroup(){TCN_selValueGroup=new Array();var args=TCN_makeSelValueGroup.arguments;for(i=0;i<args.length;i++){TCN_selValueGroup[i]=args[i];TCN_tempArray[i]=new Array();}}
function TCN_makeComboGroup(){TCN_comboGroup=new Array();var args=TCN_makeComboGroup.arguments;for(i=0;i<args.length;i++)TCN_comboGroup[i]=findObj(args[i]);}
function TCN_setDefault(){for(i=TCN_selValueGroup.length-1;i>=0;i--){if(TCN_selValueGroup[i]!=""){for(j=0;j<TCN_contents.length;j++){if(TCN_arrayValues[j][(i*2)+1]==TCN_selValueGroup[i]){for(k=i;k>=0;k--){if(TCN_selValueGroup[k]=="")TCN_selValueGroup[k]=TCN_arrayValues[j][(k*2)+1];}}}}}}
function TCN_loadMenu(daIndex){var selectionMade=false;daArray=TCN_tempArray[daIndex];TCN_comboGroup[daIndex].options.length=0;for(i=0;i<daArray.length;i++){existe=false;for(j=0;j<TCN_comboGroup[daIndex].options.length;j++){if(daArray[i][(daIndex*2)+1]==TCN_comboGroup[daIndex].options[j].value)existe=true;}
if(existe==false){lastValue=TCN_comboGroup[daIndex].options.length;TCN_comboGroup[daIndex].options[TCN_comboGroup[daIndex].options.length]=new Option(daArray[i][daIndex*2],daArray[i][(daIndex*2)+1]);if(TCN_selValueGroup[daIndex]==TCN_comboGroup[daIndex].options[lastValue].value){TCN_comboGroup[daIndex].options[lastValue].selected=true;selectionMade=true;}}}
if(selectionMade==false)TCN_comboGroup[daIndex].options[0].selected=true;}
function TCN_reload(from){if(!from){TCN_split();TCN_setDefault();TCN_loadMenu(0);TCN_reload(TCN_comboGroup[0]);}else{for(j=0;j<TCN_comboGroup.length;j++){if(TCN_comboGroup[j]==from)index=j+1;}
if(index<TCN_comboGroup.length){TCN_tempArray[index].length=0;for(i=0;i<TCN_comboGroup[index-1].options.length;i++){if(TCN_comboGroup[index-1].options[i].selected==true){for(j=0;j<TCN_tempArray[index-1].length;j++){if(TCN_comboGroup[index-1].options[i].value==TCN_tempArray[index-1][j][(index*2)-1])TCN_tempArray[index][TCN_tempArray[index].length]=TCN_tempArray[index-1][j];}}}
TCN_loadMenu(index);TCN_reload(TCN_comboGroup[index]);}}}
function findObj(n,d){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=findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function daysInFebruary(year){return(((year%4==0)&&((!(year%100==0))||(year%400==0)))?29:28);}
function QuickBook(){if(!checkDate()){return false}var b=document.getElementById("ddlDay");var f=document.getElementById("ddlMonthAndYear");var g=document.getElementById("ddlHotel");var h=document.getElementById("ddlRooms");var a=document.getElementById("ddlNights");var c=document.getElementById("ddlAdults");var sHotelCode=g[g.selectedIndex].value;if(sHotelCode!='BR'&&sHotelCode!=''){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 checkDays(){var ddlDay=document.getElementById("ddlDay");var ddlMonth=document.getElementById("ddlMonth");var ddlMonthAndYear=document.getElementById("ddlMonthAndYear");var ddlYear=document.getElementById("ddlYear");if((ddlDay!=null&&ddlMonth!=null&&ddlYear!=null)||(ddlDay!=null&&ddlMonthAndYear!=null)){var iDay=ddlDay.selectedIndex+1;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;iYear=parseInt(ddlYear.options[ddlYear.selectedIndex].value);}
var aMonthDays=[31,daysInFebruary(iYear),31,30,31,30,31,31,30,31,30,31];var iMonthDays=aMonthDays[iMonth-1];var hasLessOptions=false;var hasMoreOptions=false;var iOptionsCount=ddlDay.length;var i=iOptionsCount;for(i=iOptionsCount;i>iMonthDays;i--){ddlDay.removeChild(ddlDay.options[i-1]);hasLessOptions=true;}
for(i=iOptionsCount;i<iMonthDays;i++){AddSelectOption(ddlDay,i+1,i+1,false);hasMoreOptions=true;}
if((hasLessOptions||hasMoreOptions)&&ddlDay[iDay-1]==null){ddlDay.focus();ddlDay.selectedIndex=ddlDay.length-1;}}}
function googleTranslateElementInit(){new google.translate.TranslateElement({pageLanguage:'en'},'google_translate_element');}
$(document).ready(function(){main();});function main(){$(document).bind("contextmenu",function(e){return false;});var inputs=$('input[type=text], input[type=password], select, textarea');inputs.triggerHandler("focus");inputs.focus(function(){$(this).addClass('input_onfocus');});inputs.blur(function(){$(this).removeClass('input_onfocus');});$("a[target*='_blank']").click(function(){if(typeof(pageTracker)!="undefined")
pageTracker._trackPageview('/outgoing/'+$(this).attr('href'));});if(parent!=window){parent.location=location.href;}
if($().lightBox)
$('a.lightbox').lightBox({fixedNavigation:true});if($().flash){$('#celEnglandMap').flash({swf:'http://ttg.cdn.as34013.net/img/swf/england.swf',height:550,width:512});}
populateQB();}
function k(z){var rn=Math.floor(Math.random()*11);window.open(z);}
function affimg(){var deviation=0.15;var targetwidth=250;var targetheight=190;var images=$('.tiles img');if(images.length>0){var targetratio=targetwidth/targetheight;images.each(function(n){var width=$(images[n]).width();var height=$(images[n]).height();var ratio=width/height;if(Math.abs(targetratio-ratio)<deviation){width=targetwidth;height=targetheight;}
else if(ratio>=targetratio)
{width=targetwidth;height=width/ratio;}
else
{height=targetheight;width=height*ratio;}
$(images[n]).width(width);$(images[n]).height(height);});}}