var imgArray=new Array(6);var minHeight=0;var imgAIndex=0;var portraitImageCount=0;var landscapeImageCount=0;var smallImageCount=0;var imgContainer=new Array(7);var imgSrc=new Array(7);var imgTopLabel=new Array(7);var imgTopButtons=new Array(7);var imgControls=new Array(7);var imgMoveControls=new Array(7);var imgCaption=new Array(7);var imgHFDCompare=new Array(7);function arrangeImageGallery(){try{for(i=1;i<7;i++){var c=i+1;imgContainer[i]=document.getElementById("AdImageContainer"+c);if(document.getElementById("AdImageMoveControls"+c)){imgMoveControls[i]=document.getElementById("AdImageMoveControls"+c)}else{imgMoveControls[i]=null}if(document.getElementById("AdImageCaption"+c)){imgCaption[i]=document.getElementById("AdImageCaption"+c)}else{imgCaption[i]=null}if(document.getElementById("AdImageHFDCompare"+c)){imgHFDCompare[i]=document.getElementById("AdImageHFDCompare"+c)}else{imgHFDCompare[i]=null}if(document.getElementById("AdImageControls"+c)){imgControls[i]=document.getElementById("AdImageControls"+c)}else{imgControls[i]=null}if(document.getElementById("AdImageSrc"+c)){imgSrc[i]=document.getElementById("AdImageSrc"+c)}else{imgSrc[i]=null}if(document.getElementById("AdImageTopLabel"+c)){imgTopLabel[i]=document.getElementById("AdImageTopLabel"+c)}else{imgTopLabel[i]=null}if(document.getElementById("AdImageTopButtons"+c)){imgTopButtons[i]=document.getElementById("AdImageTopButtons"+c)}else{imgTopButtons[i]=null}}for(i=0;i<imgArray.length;i++){imgArray[i]=new Array(14)}for(i=2;i<8;i++){var b=document.getElementById("AdImage"+i);if(b){imgArray[imgAIndex][0]=b;imgArray[imgAIndex][1]=b.width;imgArray[imgAIndex][2]=b.height;if(imgArray[imgAIndex][2]>imgArray[imgAIndex][1]&&imgArray[imgAIndex][2]>=350){imgArray[imgAIndex][3]=1;portraitImageCount++}else{if(imgArray[imgAIndex][1]>=350){imgArray[imgAIndex][3]=0;landscapeImageCount++}else{imgArray[imgAIndex][3]=2;smallImageCount++}}imgArray[imgAIndex][4]=document.getElementById("AdImageContainer"+i).innerHTML;if(document.getElementById("AdImageTopLabel"+i)){imgArray[imgAIndex][8]=document.getElementById("AdImageTopLabel"+i).innerHTML}if(document.getElementById("AdImageTopButtons"+i)){imgArray[imgAIndex][9]=document.getElementById("AdImageTopButtons"+i).innerHTML}imgArray[imgAIndex][5]=b.src;if(document.getElementById("AdImageTop"+i)){imgArray[imgAIndex][6]=document.getElementById("AdImageTop"+i).value}else{imgArray[imgAIndex][6]=0}imgArray[imgAIndex][7]=document.getElementById("AdImagePosition"+i);if((minHeight==0||minHeight>imgArray[imgAIndex][2])&&imgArray[imgAIndex][2]>183&&imgArray[imgAIndex][3]==0){minHeight=imgArray[imgAIndex][2]}if(document.getElementById("AdImageControls"+i)){imgArray[imgAIndex][10]=document.getElementById("AdImageControls"+i).innerHTML}if(document.getElementById("AdImageMoveControls"+i)){imgArray[imgAIndex][11]=document.getElementById("AdImageMoveControls"+i).innerHTML}if(document.getElementById("AdImageCaption"+i)){imgArray[imgAIndex][12]=document.getElementById("AdImageCaption"+i).innerHTML}if(document.getElementById("AdImageHFDCompare"+i)){imgArray[imgAIndex][13]=document.getElementById("AdImageHFDCompare"+i).innerHTML}imgAIndex++}}var f=1;var a=1+landscapeImageCount;var g=1+landscapeImageCount+portraitImageCount;var e=1;for(i=0;i<imgArray.length;i++){if(imgArray[i][0]){if(imgArray[i][3]==0){e=f;imgContainer[e].style.width="350px";imgArray[i][0].style.width="350px";if(imgArray[i][2]>minHeight&&minHeight>0){imgContainer[e].style.height=minHeight+"px"}if(imgArray[i][1]/imgArray[i][2]>1.5&&imgTopLabel[e]){imgTopLabel[e].style.backgroundColor="#ff822f"}f++}else{if(imgArray[i][3]==1){e=a;imgContainer[e].style.height="350px";imgContainer[e].style.width=((350/imgArray[i][2])*imgArray[i][1])+"px";imgArray[i][0].style.height="350px";imgArray[i][11]="";imgArray[i][10]="<p>The order of portrait images cannot be changed. <br/><br/>The image will be automatically positioned at the end of the gallery.</p>";a++}else{if(imgArray[i][3]==2){e=g;imgContainer[e].style.width=imgArray[i][1]+"px";imgArray[i][0].style.width=imgArray[i][1]+"px";imgArray[i][11]="";imgArray[i][10]="<p>This image is below the size guidelines for the Holiday France Direct website. <br/><br/>The gallery order cannot be changed, the image will be automatically positioned at the end of the gallery.</p>";g++;if(imgTopLabel[e]){imgTopLabel[e].style.backgroundColor="#ff822f"}}}}imgContainer[e].innerHTML=imgArray[i][4];if(imgTopLabel[e]){imgTopLabel[e].innerHTML=imgArray[i][8]}if(imgTopButtons[e]){imgTopButtons[e].innerHTML=imgArray[i][9]}if(imgControls[e]){imgControls[e].innerHTML=imgArray[i][10]}if(imgMoveControls[e]){imgMoveControls[e].innerHTML=imgArray[i][11]}if(imgCaption[e]){imgCaption[e].innerHTML=imgArray[i][12]}if(imgHFDCompare[e]){imgHFDCompare[e].innerHTML=imgArray[i][13]}if(imgSrc[e]){imgSrc[e].src=imgArray[i][5].replace(".web.",".thumb.").replace("/id","/thumb/id").replace("proppics","smallproppics")}}}}catch(d){}}function closeAvailability(c,b,a){$("#displayAvailability").hide();$("#sitemask").hide();$("#orderBySizeVisible").show();$("#orderByPriceVisible").show()}function showAvailability(b,a){showAvailability(b,a,-1)}function showAvailability(e,c,b){$("#orderBySizeVisible").hide();$("#orderByPriceVisible").hide();var f=700;var a=$(window).scrollTop()+50;var d=110;if(f<$(window).width()){d+=($(window).width()/2)-(f/2)}$("#sitemask").show();$("#displayAvailability").css("top",a+"px");$("#displayAvailability").css("left",d+"px");$("#displayAvailability").html('<div id="headerlevel1Wrapper"><div id="headerlevel1"><cfif not isdefined("url.oldstyle")><a title="Close" href="javascript:closeAvailability()">Close X</a></cfif><h1>Property Availability</h1></div></div><div style="width:100%; text-align:center; padding:50px 0 50px 0; background-color:#EDF7FE;"><img src="images/ajax-loader-round-bluebg.gif" alt="Loading, please wait" /><br/><br/><h2>Please wait, loading availability.</h2></div>');$("#displayAvailability").show();$.post(strBaseHref+"showavail.cfm?mode=CSS&ownerCode="+e+"&propertyID="+c+"&year="+b,function(g){onViewAvailabilityCSSResponse(g,e,c,b)})}function onViewAvailabilityResponse(a){$("#displayAvailability").html(a)}function onViewAvailabilityCSSResponse(b,f,e,d){try{document.getElementsByTagName("head")[0].removeChild(document.getElementsByTagName("head")[0].lastChild)}catch(c){}var a=document.createElement("style");a.type="text/css";if(a.styleSheet){a.styleSheet.cssText=b}else{a.appendChild(document.createTextNode(b))}document.getElementsByTagName("head")[0].appendChild(a);$.post(strBaseHref+"showavail.cfm?mode=PAGE&ownerCode="+f+"&propertyID="+e+"&year="+d,function(g){onViewAvailabilityResponse(g)})}function setMaxLength(){var a=document.getElementsByTagName("textarea");for(var b=0;b<a.length;b++){if(a[b].getAttribute("maxlength")){a[b].onkeyup=a[b].onchange=checkMaxLength;a[b].onkeyup()}}}function checkMaxLength(){var a=this.getAttribute("maxlength");var b=this.value.length;if(b>a){this.value=this.value.substring(0,a)}}var newWin;function Ajax(){this.toString=function(){return"Ajax"};this.makeRequest=function(b,c,a){this.request=(window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("MSXML2.XMLHTTP");this.request.onreadystatechange=a;this.request.open(b,c,true);this.request.send(c);this.request.contenttype="text/html";this.request.charset="ISO-8859-1"};this.checkReadyState=function(b,a){if(!a){var a="Loading..."}switch(this.request.readyState){case 1:document.getElementById(b).innerHTML=a;break;case 2:document.getElementById(b).innerHTML=a;break;case 3:document.getElementById(b).innerHTML=a;break;case 4:return this.request.status}}}function ShowError(a){if(document.getElementById("error_"+a)){document.getElementById("error_"+a).style.visibility="visible";document.getElementById("error_"+a).style.display=""}if(document.getElementById(a)){document.getElementById(a).style.border="1px #ff0000 solid";document.getElementById(a).style.background="#ffcccc"}}function HideError(a){if(document.getElementById("error_"+a)){document.getElementById("error_"+a).style.display="none";document.getElementById("error_"+a).style.visibility="hidden"}if(document.getElementById(a)){document.getElementById(a).style.border="1px #999999 solid";document.getElementById(a).style.background="#ffffff"}}var leftmostContent;var topPos=0;var slider;var container;var target;var timerId=-1;var minTop=0;var themeTopPos=0;var typeTopPos=0;function moveLeft(){leftSide-=1;slider.style.left=leftSide;if(target+leftSide<0){leftSide=0;slider.style.left=leftSide;slider.removeChild(leftmostContent);leftmostContent=slider.getElementsByTagName("div")[0];slider.appendChild(leftmostContent.cloneNode(true));target=leftmostContent.offsetWidth}}function moveThemeUp(){topPos-=1;if(topPos<=minTop){StopThemeScroll()}else{slider.style.top=topPos+"px"}}function moveThemeDown(){topPos+=1;if(topPos>=0){StopThemeScroll()}else{slider.style.top=topPos+"px"}}function moveTypeUp(){topPos-=1;if(topPos<=minTop){StopTypeScroll()}else{slider.style.top=topPos+"px"}}function moveTypeDown(){topPos+=1;if(topPos>=0){StopTypeScroll()}else{slider.style.top=topPos+"px"}}function printDebug(){document.getElementById("debugLeftSide").innerHTML=""+leftSide;document.getElementById("debugContentWidth").innerHTML=target+" "+leftmostContent.id}function holderMouseOver(){if(timerId!=-1){window.clearInterval(timerId)}}function holderMouseOut(){timerId=window.setInterval(moveLeft,20)}function ScrollTypeUp(){slider=document.getElementById("sliderType");container=document.getElementById("typeScroll");minTop=-363;topPos=typeTopPos;timerId=window.setInterval(moveTypeUp,15)}function ScrollTypeDown(){slider=document.getElementById("sliderType");container=document.getElementById("typeScroll");topPos=typeTopPos;timerId=window.setInterval(moveTypeDown,15)}function ScrollThemeUp(){slider=document.getElementById("sliderTheme");container=document.getElementById("themeScroll");minTop=-199;topPos=themeTopPos;timerId=window.setInterval(moveThemeUp,15)}function ScrollThemeDown(){slider=document.getElementById("sliderTheme");container=document.getElementById("themeScroll");topPos=themeTopPos;timerId=window.setInterval(moveThemeDown,15)}function StopThemeScroll(){themeTopPos=topPos;window.clearInterval(timerId)}function StopTypeScroll(){typeTopPos=topPos;window.clearInterval(timerId)}function GetScrollYPos(){var a;if(self.pageYOffset){a=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}}return a}function SetScrollYPos(a){window.scrollTo(0,a)}function checkFriendForm(){var a="";if(document.frmFriend.txtFriendName.value==""){a+="\n- Your friend's name"}if(document.frmFriend.txtFriendEmail.value==""){a+="\n- Your friend's email"}else{if(!isEmail(document.frmFriend.txtFriendEmail.value)){a+="\n- Your friend's email is invalid"}}if(document.frmFriend.txtName.value==""){a+="\n- Your name"}if(document.frmFriend.txtEmail.value==""){a+="\n- Your email"}else{if(!isEmail(document.frmFriend.txtEmail.value)){a+="\n- Your email is invalid"}}if(a==""){document.frmFriend.submit()}else{alert("Please complete the following:"+a)}}function IsDate(c,d,a){d=d-1;var b=new Date(c,d,a);if((c==b.getUTCFullYear())&&(d==b.getMonth())&&(a==b.getDate())){return true}else{return false}}function checkReviewInviteForm(){var d="";var h=document.getElementById("frmInvite");if(h.txtName.value==""){d+="\n- Guest's name"}if(h.txtEmail.value==""){d+="\n- Guest's email"}else{if(!isEmail(h.txtEmail.value)){d+="\n- Guest's email is invalid"}}var b=h.lstArrivalD.options[h.lstArrivalD.selectedIndex].value;var n=h.lstArrivalM.options[h.lstArrivalM.selectedIndex].value;var m=h.lstArrivalY.options[h.lstArrivalY.selectedIndex].value;var e=h.lstDepartureD.options[h.lstDepartureD.selectedIndex].value;var c=h.lstDepartureM.options[h.lstDepartureM.selectedIndex].value;var j=h.lstDepartureY.options[h.lstDepartureY.selectedIndex].value;var a=true;if(!IsDate(m,n,b)){a=false;d+="\n- Arrival date is invalid"}if(!IsDate(j,c,e)){a=false;d+="\n- Departure date is invalid"}if(a){var k=new Date(m,n,b);var g=new Date(j,c,e);if(k>g){d+="\n- Arrival date must be less than or equal to departure date"}}if(d==""){h.submit()}else{alert("Please complete the following:"+d)}}function OwnerLogout(){document.frmLogout.submit()}function AddToFavorites(){window.external.AddFavorite(location.href,document.title)}function showAvail(a){ShowPopUpWindow("winAvail",strBaseHref+"showavail.cfm?ownercode="+a,720,550,"yes","yes","yes")}function oifbookingscreen(){OIFBookingScreen()}function printPage(){window.print()}function downloadpack(){document.frmAdValues.frmType.value="download";document.frmAdValues.submit()}function DownloadFile(a){document.location.href=strBaseHref+"default.cfm/download."+a}function DownloadBrochure(){document.frmBrochureRequestValues.BrochureType.value="download";$("#downloadBrochureLinkCell").html("&nbsp;");$("#downloadBrochureImageCell").html("<p>Please wait, your brochure is being prepared.</p>");var a="forms/SaveBrochureRequest.cfm";$.post(a,$("#frmBrochureRequestValues").serialize(),function(){document.location.href=strThisFile+"/download.15319"})}function SendBrochureByPost(){$("#postBrochureLinkCell").html("&nbsp;");$("#postBrochureImageCell").html("<p>Please wait, your request is being processed.</p>");document.frmBrochureRequestValues.BrochureType.value="post";document.frmBrochureRequestValues.action=strThisFile;document.frmBrochureRequestValues.submit()}function ShowPopUpWindow(e,f,m,b,h,d,a,j,c,k,g){if(!c){l=(screen.width/2)-(m/2)}else{l=c}if(!k){tb="no"}else{tb=k}if(!g){mb="no"}else{mb="yes"}if(!j){t=(screen.height/2)-(b/2)}else{t=j}if(newWin){if(!newWin.closed){newWin.close()}}winstring="width="+m+",height="+b+",left="+l+",top="+t+",status="+h+",resizable="+d+",scrollbars="+a+",toolbar="+tb+",menubar="+mb;newWin=window.open(f,e,winstring);return}function SubmitForm(d){var b=document.frmSQL;var a=document.frmPSearch.txtSearch.value;b.sql.value="SELECT * FROM SearchOwners WHERE OwnerCode = '"+a.toUpperCase()+"' AND WebPublish = 1;";b.ViewAd.value="true";b.tmpOwnerCode.value=a;b.ViewResults.value="false";b.AdNum.value="1";b.action=strBaseHref;b.submit()}function SubmitFormMonth(a,c){var d=document.frmSQL;var b=a;d.sql.value="SELECT * FROM SearchOwners WHERE OwnerCode = '"+b.toUpperCase()+"' AND WebPublish = 1;";d.ViewAd.value="true";d.ViewResults.value="false";d.AdNum.value="1";d.action=strBaseHref+"default.cfm/yearmonth."+c+"/scrollto.bottom";d.submit()}function Add2Shortlist(a){document.location.href=strBaseHref+"default.cfm/adcode."+a+"/shortlistadd."+a}function ViewShortList(){document.location.href=strBaseHref+"default.cfm/loadindex.999"}function RemoveFromShortlist(a){document.location.href=document.location.href+"/shortlistremove."+a}function isEmail(a){if(a.indexOf("@")!="-1"&&a.indexOf(".")!="-1"&&a!=""){return true}return false}function SubmitForm2(formName){var f=eval("document."+formName);var msgString="";switch(formName.toLowerCase()){case"frmbrochure":if(f.lstTitle.selectedIndex==0){msgString+="\n* Title"}if(f.Initial.value==""){msgString+="\n* Initial"}if(f.Surname.value==""){msgString+="\n* Surname"}if(f.House.value==""){msgString+="\n* House Name"}if(f.Street.value==""){msgString+="\n* Address 1"}if(f.Town.value==""){msgString+="\n* Town"}if(f.Postcode.value==""){msgString+="\n* Postcode"}if(f.Email.value!=""||f.Data_Protection.checked){if(!isEmail(f.Email.value)){msgString+="\n* valid Email"}}break;case"frmquicksubscribe":if(f.txtQuickEmail.value==""){msgString+="\n* Email Address"}else{if(!isEmail(f.txtQuickEmail.value)){msgString+="\n* valid Email"}}break;case"frmmailing":if(f.Title.value==""){msgString+="\n* Title"}if(f.Forename.value==""){msgString+="\n* Forename"}if(f.Surname.value==""){msgString+="\n* Surname"}if(!isEmail(f.Email.value)){msgString+="\n* valid Email"}break;case"frmcontact":if(f.Title.value==""){msgString+="\n* Title"}if(f.Forename.value==""){msgString+="\n* Forename"}if(f.Surname.value==""){msgString+="\n* Surname"}if(f.HouseName.value==""){msgString+="\n* Housename"}if(f.StreetName.value==""){msgString+="\n* Streetname"}if(f.Town.value==""){msgString+="\n* Town"}if(f.Postcode.value==""){msgString+="\n* Postcode"}if(f.Country.value==""){msgString+="\n* Country"}if(f.Email_Address.value==""){msgString+="\n* Email Address"}if(f.Enquiry.value==""){msgString+="\n* Enquiry text"}break;case"frmadvertise":case"frmadvalues":var valAddress=true;if(f.PackType.value=="CHOICE"){valAddress=false}if(f.Title.value==""){msgString+="\n* Title"}if(f.Forename.value==""){msgString+="\n* First Name"}if(f.Surname.value==""){msgString+="\n* Surname"}if(valAddress){if(f.House_Name.value==""){msgString+="\n* House Name"}if(f.Street_Name.value==""){msgString+="\n* Street"}if(f.Town.value==""){msgString+="\n* Town"}if(f.PostCode.value==""){msgString+="\n* PostCode"}if(f.Country.value==""){msgString+="\n* Country"}}else{if(formName.toLowerCase()=="frmadvalues"){if(f.PostCode.value==""){msgString+="\n* PostCode"}}}if(f.Email.value==""){msgString+="\n* Email"}else{if(!isEmail(f.Email.value)){msgString+="\n* Valid email"}}if(formName.toLowerCase()=="frmadvalues"&&f.lstPropertyRegion.selectedIndex<1){msgString+="\n* Region where property located"}if(f.lstEnquirySource.selectedIndex<1){msgString+="\n* How did you hear about us"}break;default:break}if(msgString==""){f.action=strThisFile;f.submit()}else{alert("Please enter the following fields:"+msgString)}}function sendbypost(){document.frmAdValues.frmType.value="post";document.frmAdValues.submit()}var dtCh="/";var minYear=1900;var maxYear=2100;function isInteger(b){if(b.length==0){return false}var a;for(a=0;a<b.length;a++){var d=b.charAt(a);if(((d<"0")||(d>"9"))){return false}}return true}function trim(a){return a.replace(/^\s*|\s*$/g,"")}function stripCharsInBag(d,e){var b;var a="";for(b=0;b<d.length;b++){var f=d.charAt(b);if(e.indexOf(f)==-1){a+=f}}return a}function daysInFebruary(a){return(((a%4==0)&&((!(a%100==0))||(a%400==0)))?29:28)}function DaysArray(b){for(var a=1;a<=b;a++){this[a]=31;if(a==4||a==6||a==9||a==11){this[a]=30}if(a==2){this[a]=29}}return this}function isDate(d){var a=DaysArray(12);var e=d.indexOf(dtCh);var c=d.indexOf(dtCh,e+1);var g=d.substring(0,e);var h=d.substring(e+1,c);var f=d.substring(c+1);strYr=f;if(g.charAt(0)=="0"&&g.length>1){g=g.substring(1)}if(h.charAt(0)=="0"&&h.length>1){h=h.substring(1)}for(var b=1;b<=3;b++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)}}month=parseInt(h);day=parseInt(g);year=parseInt(strYr);if(e==-1||c==-1){return false}if(month<1||month>12){alert("Please enter a valid month");return false}if(day<1||day>31||(month==2&&day>daysInFebruary(year))||day>a[month]){return false}if(f.length!=4||year==0||year<minYear||year>maxYear){return false}if(d.indexOf(dtCh,c+1)!=-1||isInteger(stripCharsInBag(d,dtCh))==false){return false}return true}function MM_swapImgRestore(){var d,b,c=document.MM_sr;for(d=0;c&&d<c.length&&(b=c[d])&&b.oSrc;d++){b.src=b.oSrc}}function MM_preloadImages(){var f=document;if(f.images){if(!f.MM_p){f.MM_p=new Array()}var e,c=f.MM_p.length,b=MM_preloadImages.arguments;for(e=0;e<b.length;e++){if(b[e].indexOf("#")!=0){f.MM_p[c]=new Image;f.MM_p[c++].src=b[e]}}}}function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&e.getElementById){a=e.getElementById(f)}return a}function MM_swapImage(){var e,d=0,b,c=MM_swapImage.arguments;document.MM_sr=new Array;for(e=0;e<(c.length-2);e+=3){if((b=MM_findObj(c[e]))!=null){document.MM_sr[d++]=b;if(!b.oSrc){b.oSrc=b.src}b.src=c[e+2]}}}function MM_openBrWindow(c,a,b){window.open(c,a,b)}function replace(a,g,e){var c=a.length,f=g.length;if((c==0)||(f==0)){return a}var b=a.indexOf(g);if((!b)&&(g!=a.substring(0,f))){return a}if(b==-1){return a}var d=a.substring(0,b)+e;if(b+f<c){d+=replace(a.substring(b+f,c),g,e)}return d}function SetVisibility(d,c){var a=document.getElementById(d);var b="";if(a.className){b=a.className}if(c){b=replace(b,"hiddenElement","")+" visibleElement"}else{b=replace(b,"visibleElement","")+" hiddenElement"}a.className=b}function getElementsByClassName(b,f,a){var e=(f=="*"&&document.all)?document.all:b.getElementsByTagName(f);var h=new Array();a=a.replace(/\-/g,"\\-");var g=new RegExp("(^|\\s)"+a+"(\\s|$)");var d;for(var c=0;c<e.length;c++){d=e[c];if(g.test(d.className)){h.push(d)}}return(h)}function getRadioButtonValue(a){var c="";if(!a.length){if(a.checked){c=a.value}}else{for(var b=0;b<a.length;b++){if(a[b].checked){c=a[b].value;break}}}return c}function addToFavorites(b,a){if(window.external){window.external.AddFavorite(b,a)}else{alert("Sorry! Your browser doesn't support this function.")}}function ScrollToElement(d){var a=0;var c=0;var b=document.getElementById(d);while(b!=null){a+=b.offsetLeft;c+=b.offsetTop;b=b.offsetParent}window.scrollTo(a,c)}function ScrollTo(a){window.scrollTo(0,a)}var ajax=new Ajax();function SubmitKeywordSearch(){var a=document.getElementById("frmKeywordSearch");var b="";if(trim(a.searchtext.value)==""){b+="\r\n- Enter a reference or one or more keywords to search for."}if(""==b){a.action=strBaseHref+"default.cfm/loadindex.65/searchType.keyword";a.submit()}else{alert("Please correct the following errors and try again."+b)}}function startMapSearch(c,b){var a=strBaseHref+searchURLTemplate;a=a.replace("{squareID}",b);mainStartSearch(c,a)}function startSearch(b){var a=strBaseHref+searchURLTemplate;mainStartSearch(b,a)}function mainStartSearch(c,b){b=b.replace("{searchType}",c);if(document.getElementById("orderBySizePSearch")){b=b.replace("{orderBySize}",document.getElementById("orderBySizePSearch").value)}else{b=b.replace("{orderBySize}","ANY")}if(document.getElementById("orderByPricePSearch")){b=b.replace("{orderByPrice}",document.getElementById("orderByPricePSearch").value)}else{b=b.replace("{orderByPrice}","ANY")}if(c=="bnb"){var a=document.getElementById("region2").options[document.getElementById("region2").selectedIndex].value;if(a==""){a="all"}b=b.replace("{lstRegions}",a)}else{if(c=="selfcatering"){var a=document.getElementById("region").options[document.getElementById("region").selectedIndex].value;if(a==""){a="all"}b=b.replace("{lstRegions}",a);b=b.replace("{lstPeople}",document.getElementById("lstPeople").options[document.getElementById("lstPeople").selectedIndex].value);b=b.replace("{lstBeds}",document.getElementById("lstBeds").options[document.getElementById("lstBeds").selectedIndex].value);b=b.replace("{lstDay}",document.getElementById("day").options[document.getElementById("day").selectedIndex].value);b=b.replace("{lstMonth}",document.getElementById("month").options[document.getElementById("month").selectedIndex].value);b=b.replace("{lstYear}",document.getElementById("year").options[document.getElementById("year").selectedIndex].value);b=b.replace("{TypeID}",document.getElementById("TypeID").options[document.getElementById("TypeID").selectedIndex].value);b=b.replace("{ThemeID}",document.getElementById("ThemeID").options[document.getElementById("ThemeID").selectedIndex].value);b=b.replace("{lstLocation}",document.getElementById("lstLocation").options[document.getElementById("lstLocation").selectedIndex].value);b=b.replace("{lstPool}",document.getElementById("lstPool").options[document.getElementById("lstPool").selectedIndex].value)}}b=replaceSearchUrlDefaults(b);document.location.href=b}function replaceSearchUrlDefaults(a){a=a.replace("{frompanel}","0");a=a.replace("{orderBySize}","ANY");a=a.replace("{orderByPrice}","ANY");a=a.replace("{page}","1");a=a.replace("{lstRegions}","all");a=a.replace("{countryID}","-1");a=a.replace("{squareID}","-1");a=a.replace("{lstPeople}","all");a=a.replace("{lstBeds}","all");a=a.replace("{lstDay}","any");a=a.replace("{lstMonth}","any");a=a.replace("{lstYear}","any");a=a.replace("{TypeID}","any");a=a.replace("{ThemeID}","any");a=a.replace("{lstLocation}","all");a=a.replace("{lstPool}","all");a=a.replace("{orderType}","random");a=a.replace("{partialAvail}","NO");a=a.replace("{dailyAvail}","NO");a=a.replace("{orderType}","random");a=a.replace("{chkNoSmoking}","0");a=a.replace("{chkChildFac}","0");a=a.replace("{chkCouples}","0");a=a.replace("{chkInternetAccess}","0");a=a.replace("{chkPets}","0");a=a.replace("{chkMeals}","0");a=a.replace("{chkCleaning}","0");a=a.replace("{chkLinen}","0");a=a.replace("{chkBandB}","0");a=a.replace("{chkSpecNeeds}","0");a=a.replace("{chkShortBk}","0");a=a.replace("{chkOoS}","0");a=a.replace("{departmentCode}","");return a}function ChangeSearchDiv(a){SetVisibility("SpainDiv",false);SetVisibility("BandBDiv",false);SetVisibility("SelfCateringDiv",false);SetVisibility(a.value+"Div",true)}function navToPage(a,b,e,d){if(document.getElementById("frmSearch")){var c=document.getElementById("frmSearch");c.searchType.value=a;c.orderByPrice.value=b;c.orderBySize.value=e;c.page.value=d;submitSearchUrl(c)}}function removeSearchFilter(b,c){var a=document.frmSearch;if(b=="availability"){a.lstDay.value="any";a.lstMonth.value="any";a.lstYear.value="any"}else{if(b=="departmentCode"){a.departmentCode.value=""}else{if(b=="lstRegions"){a.departmentCode.value="";a.lstRegions.value=""}else{if(b=="countryID"){a.countryID.value="";a.lstRegions.value="";a.departmentCode.value=""}else{a[b].value=c}}}}a.page.value=1;submitSearchUrl(a)}function submitSearchUrl(b){var a=strBaseHref+searchURLTemplate;for(i=0;i<b.elements.length;i++){if(b.elements[i].value!=""){a=a.replace("{"+b.elements[i].name+"}",b.elements[i].value)}}a=replaceSearchUrlDefaults(a);document.location.href=a}var lastShortlistOCode="";var shortListPending=false;function addToShortlist(a){ajax.makeRequest("GET","shortlistadd.cfm?shortlistadd="+a,onShortlistAddResponse);lastShortlistOCode=a;shortListPending=true;self.setTimeout("checkShortListUpdate()",3000)}function checkShortListUpdate(){if(shortListPending){addToShortlist(lastShortlistOCode)}}function onShortlistAddResponse(){shortListPending=false;if(ajax.checkReadyState("shortlistConfirmOCode")==200){document.getElementById("shortlistConfirmOCode").innerHTML="<strong>"+lastShortlistOCode+"</strong>";var a=0;if(window.pageYOffset){a=window.pageYOffset}if(a==0&&document.getElementById("displayAvailability").offsetParent){a=document.getElementById("displayAvailability").offsetParent.scrollTop}if(a==0&&document.body.parentElement){a=document.body.parentElement.scrollTop}a+=210;document.getElementById("shortlistConfirm").style.top=a+"px";document.getElementById("shortlistConfirm").style.visibility="visible";document.getElementById("shortlistConfirm").style.display="";if(document.getElementById("addToShortlistButton")){document.getElementById("addToShortlistButton").style.visibility="hidden";document.getElementById("addToShortlistButton").style.display="none"}if(document.getElementById("addtoshortlistrow")){document.getElementById("addtoshortlistrow").style.visibility="hidden";document.getElementById("addtoshortlistrow").style.display="none"}if(document.getElementById("myShortlistTotal")){ajax.makeRequest("GET","getshortlisttotal.cfm",onShortlistTotalResponse)}}}function onShortlistTotalResponse(){if(ajax.checkReadyState("myShortlistTotal")==200){var a=ajax.request.responseText;if(a==1){document.getElementById("myShortlistTotal").innerHTML="My Shortlist (1 property)"}else{document.getElementById("myShortlistTotal").innerHTML="My Shortlist ("+a+" properties)"}}}function closeShortlistConfirm(){document.getElementById("shortlistConfirm").style.visibility="hidden";document.getElementById("shortlistConfirm").style.display="none"}function changeSearchSort(){var a=document.frmSearch;a.orderBySize.value=document.getElementById("orderBySizeVisible").options[document.getElementById("orderBySizeVisible").selectedIndex].value;a.orderByPrice.value=document.getElementById("orderByPriceVisible").options[document.getElementById("orderByPriceVisible").selectedIndex].value;a.page.value="1";submitSearchUrl(a)}function BackToResults(){var a=document.frmSearch;a.action=strBaseHref+"default.cfm/loadindex."+a.loadindex.value+"/searchType."+a.searchType.value+"/orderByPrice."+a.orderByPrice.value+"/orderBySize."+a.orderBySize.value+"/page."+a.page.value;a.submit()}function RemoveNode(b){var a=document.getElementById(b);a.parentNode.removeChild(a)}function GalleryPopup_Close(){if(window.name=="galleryimg"){window.close();return false}return true}function ResizeWin(b,c){var a=(screen.width/2)-(b/2);var d=(screen.height/2)-(c/2);window.resizeTo(b,c);window.moveTo(a,d)}function contact_RefreshForm(){var a=document.getElementById("contactownerform");a.postback.value=1;a.submit()}function SubmitRequestShortlistForm(a){var b="";if(!isEmail(a.email.value)){b+="\n* Please enter your email address"}if(b==""){a.RequestShortlistForm_Submit.value="Yes";a.submit()}else{alert("Please correct the following error(s), and try again:"+b)}}function SignInDetect(){try{document.getElementById("browserdetect_browser").value=BrowserDetect.browser;document.getElementById("browserdetect_version").value=BrowserDetect.version}catch(a){}}function regionSlideShowNext(){stopRegionSlideShow();regionSlideShowNextAction()}function regionSlideShowNextAction(){regionSlideShowPos++;if(regionSlideShowPos==regionSlideShowImgs.length){regionSlideShowPos=0}document.getElementById("regionSlideShow").src=regionSlideShowImgs[regionSlideShowPos];document.getElementById("regionSlideShow").alt=regionSlideShowImgsAlt[regionSlideShowPos];document.getElementById("regionSlideShow").title=regionSlideShowImgsAlt[regionSlideShowPos]}function regionSlideShowPrevious(){stopRegionSlideShow();regionSlideShowPos--;if(regionSlideShowPos<0){regionSlideShowPos=(regionSlideShowImgs.length-1)}document.getElementById("regionSlideShow").src=regionSlideShowImgs[regionSlideShowPos];document.getElementById("regionSlideShow").alt=regionSlideShowImgsAlt[regionSlideShowPos];document.getElementById("regionSlideShow").title=regionSlideShowImgsAlt[regionSlideShowPos]}function stopRegionSlideShow(){playingSlideShow=false;window.clearInterval(slideShowIntervalID);document.getElementById("regionSummaryPlayButton").style.background="url(images/navigation/slideshow_play.gif) no-repeat"}function startRegionSlideShow(){if(playingSlideShow){stopRegionSlideShow()}else{playingSlideShow=true;document.getElementById("regionSummaryPlayButton").style.background="url(images/navigation/slideshow_pause.gif) no-repeat";regionSlideShowNextAction();slideShowIntervalID=window.setInterval(regionSlideShowNextAction,1500)}}function showRefineSearchSection(a){document.getElementById("refineSearchDiv"+a).style.visibility="visible";document.getElementById("refineSearchDiv"+a).style.display="";document.getElementById("refineSearchLink"+a).style.visibility="hidden";document.getElementById("refineSearchLink"+a).style.display="none"}function IsNumeric(b){var d="0123456789.";var c=true;var a;for(i=0;i<b.length&&c==true;i++){a=b.charAt(i);if(d.indexOf(a)==-1){c=false}}return c}function toggleReviewSummary(){var a=document.getElementById("guestreviewbreakdown");if(a.style.display=="none"){a.style.display=""}else{a.style.display="none"}}function showBFBookingTerms(){ShowPopUpWindow("BookingWin",strBaseHref+"booking.cfm?showterms=1",550,550,"yes","yes","yes")}function OIFBookingScreen(){trackOutboundLink("ShowPopUpWindow('BookingWin', 'http://www.brittany-ferries.co.uk/index.cfm?articleid=880articleaction=nb&OIFMode=True',1005,600,'yes','yes','yes')","Book-your-travel")}function directBFBooking(){trackOutboundLink("ShowPopUpWindow('BookingWin', 'http://www.brittany-ferries.co.uk/index.cfm?articleid=880articleaction=nb&OIFMode=True',1005,600,'yes','yes','yes')","Book-ferry")}function trackOutboundLink(d,a){try{var b=_gat._getTracker("UA-1013783-1");b._trackEvent("BF Links",a)}catch(c){}setTimeout(d,100)}function renewAdvert(a,c){if(a&&c){$("#sitemask").css("display","block");$("#alertbox-wrapper").css("display","block");$("#alertbox-heading").html("Renew Subscription");var b="";b+='<li><a href="'+strBaseHref+'default.cfm/loadindex.302/web.1" title="Web Renewal"><span>Renew web advert</span></a></li>';b+='<li><a href="'+strBaseHref+'default.cfm/loadindex.302/brochure.1" title="Brochure Renewal"><span>Renew brochure advert</span></a></li>';$("#alertbox-options").html(b)}else{if(a){document.location.href=strBaseHref+"default.cfm/loadindex.302/web.1"}else{if(c){document.location.href=strBaseHref+"default.cfm/loadindex.302/brochure.1"}}}}function closeAlertBox(){$("#sitemask").css("display","none");$("#alertbox-wrapper").css("display","none")}function advertiseChangeDeliveryChoice(){var a=document.getElementById("frmAdValues");if(getRadioButtonValue(a.optDeliveryChoice)=="PRINT"){document.getElementById("divHouse_Name").style.display="";document.getElementById("divHouse_Name").style.visibility="visible";document.getElementById("divStreet_Name").style.display="";document.getElementById("divStreet_Name").style.visibility="visible";document.getElementById("divTown").style.display="";document.getElementById("divTown").style.visibility="visible";document.getElementById("divCountry").style.display="";document.getElementById("divCountry").style.visibility="visible"}else{document.getElementById("divHouse_Name").style.display="none";document.getElementById("divHouse_Name").style.visibility="hidden";document.getElementById("divStreet_Name").style.display="none";document.getElementById("divStreet_Name").style.visibility="hidden";document.getElementById("divTown").style.display="none";document.getElementById("divTown").style.visibility="hidden";document.getElementById("divCountry").style.display="none";document.getElementById("divCountry").style.visibility="hidden"}}function showOnlineQuestionnaire(g,a,e){$("#sitemask").css("display","block");var d=0;var c=0;if(a+25>$(window).width()){d=a-($(window).width()-25)}if(e+60>$(window).height()){c=e-($(window).height()-65)}a=a-d;e=e-c;var b=a;var f=e;if($("#onlineqdialog-choices:visible").length>0||$("#onlineqdialog-wrapper:visible").length==0){f=f-50}else{f=f+22}$("#onlineqdialog-wrapper").width((a+25)+"px");$("#onlineqdialog-wrapper").height((e+60)+"px");$("#onlineqdialog").width((a+5)+"px");$("#onlineqdialog").height((e+30)+"px");$("#onlineqdialog-iframe").width(b+"px");$("#onlineqdialog-iframe").height(f+"px");$("#onlineqdialog-wrapper").center();$("#onlineqdialog-wrapper").show("slow")}function hideOnlineQuestionnaire(){$("#onlineqdialog-wrapper").hide("slow");$("#sitemask").css("display","none")}function onlineQuestionnaireChoice(a,c){if(a==1){$("#onlineqdialog-iframe").height($("#onlineqdialog-iframe").height()+72);$("#onlineqdialog-choices").hide();$("#onlineqdialog-iframe").attr("src",onlineQIFrameUrl);$("#onlineqdialog-heading").css("padding-bottom","2px");$("#onlineqdialog-heading").css("padding-top","4px");$("#onlineqdialog").css("background-color","#D8ECFF");$("#onlineqdialog-heading").html("&nbsp;")}else{if(a==2){hideOnlineQuestionnaire();$(window).unbind("resize")}else{if(a==3){hideOnlineQuestionnaire();$(window).unbind("resize")}}}var b="onlinequestionnairestorepreference.cfm?id="+c+"&preference="+a;$.get(b,function(d){})}function highlightSpecialOffers(){$("#specoffcontainer").animate({backgroundColor:"#B8DCFF"},500,function(){$("#specoffcontainer").animate({backgroundColor:"#FFFFFF"},500)})}var fancyBoxOptions={transitionIn:"fade",transitionOut:"fade",speedIn:200,speedOut:200,padding:50,scrolling:"auto",overlayColor:"#222",width:"500px",showNavArrows:false,autoScale:false};var marketingFancyBoxOptions={transitionIn:"fade",transitionOut:"fade",speedIn:200,speedOut:200,padding:50,scrolling:"auto",overlayColor:"#222",autoScale:false};function ShowAdSampleFlash(){checkInitFancyBox();$("#ShowAdSampleLink").trigger("click")}function ShowWebListingPrices(){checkInitFancyBox2();$("#WebPriceLink").trigger("click")}function ShowPrintPrices(){checkInitFancyBox2();$("#BrochurePriceLink").trigger("click")}function ShowWebPrintPrices(){checkInitFancyBox2();$("#WebBrochureLink").trigger("click")}var fancyboxInited=false;function checkInitFancyBox2(){if(!fancyboxInited){$(".pricelisttable").fancybox(fancyBoxOptions);$(".marketingexample").fancybox(marketingFancyBoxOptions);$("a.FancyboxLink").fancybox(marketingFancyBoxOptions);fancyboxInited=true}}function checkInitFancyBox(){if(!fancyboxInited){$(".pricelisttable").fancybox(fancyBoxOptions);$(".marketingexample").fancybox(marketingFancyBoxOptions);$("a.FancyboxLink").fancybox(marketingFancyBoxOptions);fancyboxInited=true;$(this).trigger("click")}return false}function PostcodeAnywhere_Interactive_RetrieveByPostcodeAndBuilding_v1_30(c,d,f,b,e,a){if(c==""){alert("Please enter a post code")}else{$.getJSON(basehref+"postcodeserviceproxy.cfm",{Postcode:c,Building:d,UserName:f},function(h){if(h.Items.length==1&&typeof(h.Items[0].Error)!="undefined"){alert("Error while finding address: "+h.Items[0].Description)}else{if(h.Items.length==0){alert("Sorry, there were no results. Please either check and retry your search or enter your details below.")}else{if(h.Items.length==1){$("#"+b).hide();populateAddressFields(h.Items[0])}else{var g=e+'<select id="'+b+'List"><option>(Please Select)</option>';var j=false;for(i=0;i<h.Items.length;i++){if(h.Items[i].Company!=""){j=true;break}}if(j){h.Items.sort(function(m,k){return(m.Company!=""?m.Company+", ":""+m.Line1)>(k.Company!=""?k.Company+", ":""+k.Line1)?1:-1})}for(i=0;i<h.Items.length;i++){g+='<option value="'+i+'">';if(h.Items[i].Company!=""){g+=h.Items[i].Company+", "}g+=h.Items[i].Line1+"</option>"}g+="</select>";$("#"+b).html(g);$("#"+b).show();$("#"+b+"List").change(function(){populateAddressFields(h.Items[$("#"+b+"List").val()],a)})}}}})}}function setTextAreaMaxLengths(){var b=document.getElementsByTagName("textarea");if(b){if(b.length>0){for(var a=0;a<b.length;a++){if(b[a].getAttribute("maxlength")){b[a].onkeyup=b[a].onchange=checkMaxLength;b[a].onkeyup()}}}}}function checkMaxLength(){var a=this.getAttribute("maxlength");var b=this.value.length;if(b>a){this.value=this.value.substring(0,a)}}$(document).ready(function(){if(!window.console){window.console={log:function(){}}}});
