//Compressed file generated: Sat Feb 4 13:55:54 2012 ( provide parameter nocache=1 to clear cache )
// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function ba(b){if(!T){O=b,Z(a.extend(J,a.data(O,e))),x=a(O),P=0,J.rel!=="nofollow"&&(x=a("."+V).filter(function(){var b=a.data(this,e).rel||this.rel;return b===J.rel}),P=x.index(O),P===-1&&(x=x.add(O),P=x.length-1));if(!R){R=S=!0,q.show();if(J.returnFocus)try{O.blur(),a(O).one(k,function(){try{this.focus()}catch(a){}})}catch(c){}p.css({opacity:+J.opacity,cursor:J.overlayClose?"pointer":"auto"}).show(),J.w=X(J.initialWidth,"x"),J.h=X(J.initialHeight,"y"),U.position(0),n&&y.bind("resize."+o+" scroll."+o,function(){p.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("resize."+o),$(g,J.onOpen),I.add(C).hide(),H.html(J.close).show()}U.load(!0)}}function _(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;J.slideshow&&x[1]&&(d=function(){E.text(J.slideshowStop).unbind(c).bind(i,function(){if(P<x.length-1||J.loop)a=setTimeout(U.next,J.slideshowSpeed)}).bind(h,function(){clearTimeout(a)}).one(c+" "+j,e),q.removeClass(b+"off").addClass(b+"on"),a=setTimeout(U.next,J.slideshowSpeed)},e=function(){clearTimeout(a),E.text(J.slideshowStart).unbind([i,h,j,c].join(" ")).one(c,d),q.removeClass(b+"on").addClass(b+"off")},J.slideshowAuto?d():e())}function $(b,c){c&&c.call(O),a.event.trigger(b)}function Z(b){for(var c in b)a.isFunction(b[c])&&c.substring(0,2)!=="on"&&(b[c]=b[c].call(O));b.rel=b.rel||O.rel||"nofollow",b.href=a.trim(b.href||a(O).attr("href")),b.title=b.title||O.title}function Y(a){return J.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function X(a,b){b=b==="x"?y.width():y.height();return typeof a=="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function W(c,d){var e=b.createElement("div");c&&(e.id=f+c),e.style.cssText=d||!1;return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close or ESC key",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0},e="colorbox",f="cbox",g=f+"_open",h=f+"_load",i=f+"_complete",j=f+"_cleanup",k=f+"_closed",l=f+"_purge",m=a.browser.msie&&!a.support.opacity,n=m&&a.browser.version<7,o=f+"_IE6",p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K,L,M,N,O,P,Q,R,S,T=!1,U,V=f+"Element";U=a.fn[e]=a[e]=function(b,c){var f=this,g;if(!f[0]&&f.selector)return f;b=b||{},c&&(b.onComplete=c);if(!f[0]||f.selector===undefined)f=a("<a/>"),b.open=!0;f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(V)}),g=b.open,a.isFunction(g)&&(g=g.call(f)),g&&ba(f[0]);return f},U.init=function(){y=a(c),q=W().attr({id:e,"class":m?f+(n?"IE6":"IE"):""}),p=W("Overlay",n?"position:absolute":"").hide(),r=W("Wrapper"),s=W("Content").append(z=W("LoadedContent","width:0; height:0; overflow:hidden"),B=W("LoadingOverlay").add(W("LoadingGraphic")),C=W("Title"),D=W("Current"),F=W("Next"),G=W("Previous"),E=W("Slideshow").bind(g,_),H=W("Close")),r.append(W().append(W("TopLeft"),t=W("TopCenter"),W("TopRight")),W(!1,"clear:left").append(u=W("MiddleLeft"),s,v=W("MiddleRight")),W(!1,"clear:left").append(W("BottomLeft"),w=W("BottomCenter"),W("BottomRight"))).children().children().css({"float":"left"}),A=W(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(p,q.append(r,A)),s.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),K=t.height()+w.height()+s.outerHeight(!0)-s.height(),L=u.width()+v.width()+s.outerWidth(!0)-s.width(),M=z.outerHeight(!0),N=z.outerWidth(!0),q.css({"padding-bottom":K,"padding-right":L}).hide(),F.click(function(){U.next()}),G.click(function(){U.prev()}),H.click(function(){U.close()}),I=F.add(G).add(D).add(E),s.children().removeClass("hover"),a("."+V).live("click",function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),ba(this))}),p.click(function(){J.overlayClose&&U.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;R&&J.escKey&&b===27&&(a.preventDefault(),U.close()),R&&J.arrowKey&&x[1]&&(b===37?(a.preventDefault(),G.click()):b===39&&(a.preventDefault(),F.click()))})},U.remove=function(){q.add(p).remove(),a("."+V).die("click").removeData(e).removeClass(V)},U.position=function(a,c){function g(a){t[0].style.width=w[0].style.width=s[0].style.width=a.style.width,B[0].style.height=B[1].style.height=s[0].style.height=u[0].style.height=v[0].style.height=a.style.height}var d,e=Math.max(b.documentElement.clientHeight-J.h-M-K,0)/2+y.scrollTop(),f=Math.max(y.width()-J.w-N-L,0)/2+y.scrollLeft();d=q.width()===J.w+N&&q.height()===J.h+M?0:a,r[0].style.width=r[0].style.height="9999px",q.dequeue().animate({width:J.w+N,height:J.h+M,top:e,left:f},{duration:d,complete:function(){g(this),S=!1,r[0].style.width=J.w+N+L+"px",r[0].style.height=J.h+M+K+"px",c&&c()},step:function(){g(this)}})},U.resize=function(a){if(R){a=a||{},a.width&&(J.w=X(a.width,"x")-N-L),a.innerWidth&&(J.w=X(a.innerWidth,"x")),z.css({width:J.w}),a.height&&(J.h=X(a.height,"y")-M-K),a.innerHeight&&(J.h=X(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=z.wrapInner("<div style='overflow:auto'></div>").children();J.h=b.height(),b.replaceWith(b.children())}z.css({height:J.h}),U.position(J.transition==="none"?0:J.speed)}},U.prep=function(b){function h(b){U.position(b,function(){var b,d,g,h,j=x.length,k,n;!R||(n=function(){B.hide(),$(i,J.onComplete)},m&&Q&&z.fadeIn(100),C.html(J.title).add(z).show(),j>1?(typeof J.current=="string"&&D.html(J.current.replace(/\{current\}/,P+1).replace(/\{total\}/,j)).show(),F[J.loop||P<j-1?"show":"hide"]().html(J.next),G[J.loop||P?"show":"hide"]().html(J.previous),b=P?x[P-1]:x[j-1],g=P<j-1?x[P+1]:x[0],J.slideshow&&E.show(),J.preloading&&(h=a.data(g,e).href||g.href,d=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,d=a.isFunction(d)?d.call(b):d,Y(h)&&(a("<img/>")[0].src=h),Y(d)&&(a("<img/>")[0].src=d))):I.hide(),J.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],J.fastIframe?n():a(k).load(n),k.name=f+ +(new Date),k.src=J.href,J.scrolling||(k.scrolling="no"),m&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(z).one(l,function(){k.src="//about:blank"})):n(),J.transition==="fade"?q.fadeTo(c,1,function(){q[0].style.filter=""}):q[0].style.filter="",y.bind("resize."+f,function(){U.position(0)}))})}function g(){J.h=J.h||z.height(),J.h=J.mh&&J.mh<J.h?J.mh:J.h;return J.h}function d(){J.w=J.w||z.width(),J.w=J.mw&&J.mw<J.w?J.mw:J.w;return J.w}if(!!R){var c=J.transition==="none"?0:J.speed;y.unbind("resize."+f),z.remove(),z=W("LoadedContent").html(b),z.hide().appendTo(A.show()).css({width:d(),overflow:J.scrolling?"auto":"hidden"}).css({height:g()}).prependTo(s),A.hide(),a(Q).css({"float":"none"}),n&&a("select").not(q.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(j,function(){this.style.visibility="inherit"}),J.transition==="fade"?q.fadeTo(c,0,function(){h(0)}):h(c)}},U.load=function(b){var c,d,g=U.prep;S=!0,Q=!1,O=x[P],b||Z(a.extend(J,a.data(O,e))),$(l),$(h,J.onLoad),J.h=J.height?X(J.height,"y")-M-K:J.innerHeight&&X(J.innerHeight,"y"),J.w=J.width?X(J.width,"x")-N-L:J.innerWidth&&X(J.innerWidth,"x"),J.mw=J.w,J.mh=J.h,J.maxWidth&&(J.mw=X(J.maxWidth,"x")-N-L,J.mw=J.w&&J.w<J.mw?J.w:J.mw),J.maxHeight&&(J.mh=X(J.maxHeight,"y")-M-K,J.mh=J.h&&J.h<J.mh?J.h:J.mh),c=J.href,B.show(),J.inline?(W().hide().insertBefore(a(c)[0]).one(l,function(){a(this).replaceWith(z.children())}),g(a(c))):J.iframe?g(" "):J.html?g(J.html):Y(c)?(a(Q=new Image).addClass(f+"Photo").error(function(){J.title=!1,g(W("Error").text("This image could not be loaded"))}).load(function(){var a;Q.onload=null,J.scalePhotos&&(d=function(){Q.height-=Q.height*a,Q.width-=Q.width*a},J.mw&&Q.width>J.mw&&(a=(Q.width-J.mw)/Q.width,d()),J.mh&&Q.height>J.mh&&(a=(Q.height-J.mh)/Q.height,d())),J.h&&(Q.style.marginTop=Math.max(J.h-Q.height,0)/2+"px"),x[1]&&(P<x.length-1||J.loop)&&(Q.style.cursor="pointer",Q.onclick=function(){U.next()}),m&&(Q.style.msInterpolationMode="bicubic"),setTimeout(function(){g(Q)},1)}),setTimeout(function(){Q.src=c},1)):c&&A.load(c,function(b,c,d){g(c==="error"?W("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},U.next=function(){!S&&x[1]&&(P<x.length-1||J.loop)&&(P=P<x.length-1?P+1:0,U.load())},U.prev=function(){!S&&x[1]&&(P||J.loop)&&(P=P?P-1:x.length-1,U.load())},U.close=function(){R&&!T&&(T=!0,R=!1,$(j,J.onCleanup),y.unbind("."+f+" ."+o),p.fadeTo(200,0),q.stop().fadeTo(300,0,function(){q.add(p).css({opacity:1,cursor:"auto"}).hide(),$(l),z.remove(),setTimeout(function(){T=!1,$(k,J.onClosed)},1)}))},U.element=function(){return a(O)},U.settings=d,a(U.init)})(jQuery,document,this);


jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyInit:function(callback){jQuery.historyCallback=callback;var current_hash=location.hash;jQuery.historyCurrentHash=current_hash;if((jQuery.browser.msie)&&(jQuery.browser.version<8)){if(jQuery.historyCurrentHash==''){jQuery.historyCurrentHash='#';}
jQuery("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var ihistory=jQuery("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=current_hash;}
else if(jQuery.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;jQuery.historyForwardStack=[];jQuery.isFirst=true;}
jQuery.historyCallback(current_hash.replace(/^#/,''));setInterval(jQuery.historyCheck,100);},historyAddHistory:function(hash){jQuery.historyBackStack.push(hash);jQuery.historyForwardStack.length=0;this.isFirst=true;},historyCheck:function(){if((jQuery.browser.msie)&&(jQuery.browser.version<8)){var ihistory=jQuery("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash;if(current_hash!=jQuery.historyCurrentHash){location.hash=current_hash;jQuery.historyCurrentHash=current_hash;jQuery.historyCallback(current_hash.replace(/^#/,''));}}else if(jQuery.browser.safari){if(!jQuery.dontCheck){var historyDelta=history.length-jQuery.historyBackStack.length;if(historyDelta){jQuery.isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());}else{for(var i=0;i<historyDelta;i++)jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());}
var cachedHash=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(cachedHash!=undefined){jQuery.historyCurrentHash=location.hash;jQuery.historyCallback(cachedHash);}}else if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(document.URL.indexOf('#')>=0){jQuery.historyCallback(document.URL.split('#')[1]);}else{var current_hash=location.hash;jQuery.historyCallback('');}
jQuery.isFirst=true;}}}else{var current_hash=location.hash;if(current_hash!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=current_hash;jQuery.historyCallback(current_hash.replace(/^#/,''));}}},historyLoad:function(hash){var newhash;if(jQuery.browser.safari){newhash=hash;}
else{newhash='#'+hash;location.hash=newhash;}
jQuery.historyCurrentHash=newhash;if((jQuery.browser.msie)&&(jQuery.browser.version<8)){var ihistory=jQuery("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;jQuery.historyCallback(hash);}
else if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(hash);var fn=function(){jQuery.dontCheck=false;};window.setTimeout(fn,200);jQuery.historyCallback(hash);location.hash=newhash;}
else{jQuery.historyCallback(hash);}}});


jQuery(document).ready(function(){SearchBox.init();SpecificSearch.init();});var SearchBox=function(){var selectedGroupType;var _initialized=false;function init(){if(_initialized){return true;}
if(!jQuery('form#search-box').length&&!jQuery('form#search-adjust').length){return false;}
jQuery("#search-adjust-toggler").click(function(){jQuery('form#search-adjust').toggle();});jQuery('#grouptype').change(handleAccoTypeChange);jQuery('#duration').change(handleDurationChange);jQuery('#home_search_submit').click(function(){submit();return false;});jQuery('#search_specific_submit').click(function(){submit();return false;});jQuery("#search-adjust-submit").click(function(){submit();return false;});handleAccoTypeChange();_initialized=true;}
function updateSelects(selectedDate){var selectedDate=new Date(selectedDate);jQuery('#pick-day option[value='+selectedDate.getDate()+']').attr('selected','selected');var month=(selectedDate.getMonth()+1).toString();var withLeadingZero=month.length==1?'0'+month:month;jQuery('#pick-month option[value='+withLeadingZero+']').attr('selected','selected');jQuery('#pick-year option[value='+(selectedDate.getFullYear())+']').attr('selected','selected');}
function handleAccoTypeChange(){var box=jQuery("#grouptype");if(box){var val=box.val();if(val){var type=val.substr(0,val.indexOf("_"));var id=val.substr(val.indexOf("_")+1);}
if(typeof(gtIdsNumberOfPersons)!="undefined"){if(gtIdsNumberOfPersons[id]){var range=gtIdsNumberOfPersons[id];if(range.length==2){var sel=jQuery("#adults");fillSelectWithNumbers(sel,range[0],range[1]);}}}
selectedGroupType=type;switch(type){case"0":if(jQuery("#durationOther").length>0){jQuery("#duration").val("0");jQuery("#duration").hide();jQuery("#durationOtherLabel").show();jQuery("#durationOther").show();}
if(jQuery("#childSelect").length>0){jQuery("#childSelect").show();}
if(jQuery("#arrivalSelect").length>0){jQuery("#periodSelect").hide();jQuery("#arrivalSelect").show();}
break;default:if(jQuery("#durationOther").length>0){jQuery("#duration").show();jQuery("#durationOtherLabel").hide();jQuery("#durationOther").hide();jQuery("#duration")[0].selectedIndex=0;}
if(jQuery("#arrivalSelect").length>0){jQuery("#arrivalSelect").hide();jQuery("#periodSelect").show();}
if(jQuery("#childSelect").length>0){jQuery("#childSelect").hide();}
handleDurationChange();}}}
function handleDurationChange(){var val=jQuery("#duration").val();switch(val){case"0":if(jQuery("#arrivalSelect").length>0){jQuery("#arrivalSelect").show();jQuery("#periodSelect").hide();}
jQuery("#durationOther").show();break;case"14":case"21":jQuery("#durationOther").hide();jQuery("#arrivalSelect").show();jQuery("#periodSelect").hide();selectedGroupType=0;break;default:jQuery("#durationOther").hide();jQuery("#arrivalSelect").hide();jQuery("#periodSelect").show();selectedGroupType=1;}}
function fillSelectWithNumbers(el,start,end){if(!el.length)return false;var selected=el.val();el.empty();for(var i=start;i<=end;i++){var opt=jQuery('<option></option>').text(i).attr('value',i).appendTo(el);if(i==selected){opt.attr('selected','selected');}}}
function submit(){if(selectedGroupType==0&&document.search.Date_Year){var mydate=new Date();mydate.setHours(0);mydate.setMinutes(0);mydate.setSeconds(0);mydate.setMilliseconds(0);mydate.setFullYear(document.search.Date_Year.value,parseFloat(document.search.Date_Month.value)-1,document.search.Date_Day.value);var gmtSeconds=mydate.getTimezoneOffset()*60;var tempvalue=parseInt((mydate.getTime()/1000)-gmtSeconds);tempvalue=tempvalue+'-'+tempvalue;document.search.arrival.value=tempvalue;}else{document.search.arrival.value=document.search.arrivalOptions.value;}
if(jQuery('#arrivalSelect').css('display')=='none'){jQuery('#pick-day, #pick-month, #pick-year').remove();}
var durationOther=jQuery('#durationOther');if(durationOther.css('display')=='none'){durationOther.remove();}
jQuery('#search-box').submit();jQuery('#search-adjust').submit();return false;}
return{init:init}}();var SpecificSearch=function(){var _initialized=false;var _JQsearchForm;function init(){if(_initialized){return;}
_JQsearchForm=jQuery('#search-specific-box');if(!_JQsearchForm.length){return false;}
_JQsearchForm.find('input').keydown(function(e){if(e.keyCode==13){jQuery(this).parents('form').submit();return false;}});jQuery("#search_specific_submit").click(submitForm);_JQsearchForm.submit(function(){submitForm();return false;});_initialized=true;}
function submitForm(){var gotoUrl='';var value=jQuery("#input-search-by-name").val();var action=_JQsearchForm.attr('action');if(value!=''){gotoUrl=action+value;}else{value=jQuery("#input-search-by-accommodationnumber").val();gotoUrl=action+value;}
window.location.href=gotoUrl;return false;}
return{init:init};}();


function log(output){try{console.log(output);}catch(e){console={log:function(){}}}}
jQuery(document).ready(function(){if(typeof(onLoadFunctions)!='undefined'&&onLoadFunctions.length){for(var i=0;i<onLoadFunctions.length;i++){onLoadFunctions[i]();}}});var Ajax=function(){var baseUrl='/ajax/';var queue=new Array();function doRequest(action,params,onSuccess,onFailure){var request=function(){jQuery.ajax({type:'GET',url:baseUrl+action,data:params,success:handleSucceededRequest,error:handleFailedRequest,dataType:'json'});};queue.push({req:request,onSuccess:onSuccess,onFailure:onFailure});if(queue.length==1){request();}}
function handleSucceededRequest(resp){if(queue[0].onSuccess){queue[0].onSuccess(resp);}
queue.shift();if(queue.length){queue[0].req();}}
function handleFailedRequest(){queue.shift();util.throwError('Seems to be a server side error request');}
return{doRequest:doRequest}}();var util=function(){var loadingEl=null;function setLoading(loading){if(!loadingEl){loadingEl=jQuery('<div id="loading-indicator"></div>').appendTo('body');}
if(loading==undefined||loading){loadingEl.show();}else{loadingEl.hide();}}
function throwError(msg){setLoading(false);}
return{setLoading:setLoading,throwError:throwError};}();


var specialPageLoad=null;jQuery(document).ready(function(){if(SliceDice.init()){TBhistory.init();}else{}});var TBhistory=function(){function init(){jQuery.historyInit(pageload);}
function pageload(hash){SliceDice.doAction(hash);}
function add(hash){jQuery.historyLoad(hash);}
return{init:init,add:add};}();var SliceDice=function(){var searchResultsEl=null;var searchContainer=null;var viewContainer=null;var favouritesContainer=null;var sideSearch=null;var sideView=null;var detailEl=null;var appliedFilterList=null;var appliedFiltersContainer=null;var detailViewAction='ag';var currentView='';var lastRequestString='';var searchProperties={};var currentPage=1;var currentResultId=0;var conf={filterlist:'#filterlist'};var buildCompleted=false;function init(){setSearchProperties();if(typeof(totalArray)==='undefined'||!totalArray.length||parseInt(searchProperties.disableSlicedice)){jQuery('#search').css('visibility','visible');jQuery('#side-search').show();jQuery('.pagination').hide();jQuery('.map-link').live('click',openMapSingle);return false;}
if(searchProperties.searchType=='company'){detailViewAction='comp';}
searchResultsEl=jQuery('#search-results');detailEl=jQuery('#single-allotmentgroup');searchContainer=jQuery('#search');viewContainer=jQuery('#view');favouritesContainer=jQuery('#favourites');sideView=jQuery('#side-view');sideSearch=jQuery('#side-search');initTabs();jQuery('#tb_showonmap').click(openMap);jQuery('.map-link').live('click',openMapSingle);jQuery('#breadcrumbs span.current').click(function(){setView('search');return false;}).css('cursor','pointer');return true;}
function build(filter1,filter2,filter3,page){if(filter1==undefined||filter2==undefined||filter3==undefined){buildFilterList();}else{setFilters(filter1,filter2,filter3);applyfilters();updateResultSet(page)}
attachResultBoxEvents();buildPagination();buildCompleted=true;}
var attached=false;function attachResultBoxEvents(){if(attached){return false;}
jQuery('div.resultbox h3 a').live('click',function(e){if(e.button==2){return true;}
var anchor=jQuery(this);var url=cleanUrl(anchor.attr('href'));specialPageLoad=function(){jQuery('#prices-link').trigger("click");}
currentResultId=anchor.attr('id').replace('res-','');goTo('view-'+url);return false;});jQuery('div.resultbox').live('click',function(e){if(e.button==2){return true;}
if(e.target.tagName=='A'&&jQuery(e.target).hasClass('link')){return true;}
var parent=jQuery(e.target).parent();if((parent[0].tagName=='A'&&parent.hasClass('bookdirectlink'))){var anchor=jQuery(parent);var url=cleanUrl(anchor.attr('ajaxurl'));specialPageLoad=function(){jQuery('#prices-link').trigger("click");}
goTo('view-'+url);return false;}
if((e.target.tagName=='A'&&e.target.className=='roomlink')){var anchor=jQuery(e.target);var url=cleanUrl(anchor.attr('href'));specialPageLoad=function(){jQuery('#prices-link').trigger("click");}
goTo('view-'+url);return false;}
jQuery(this).find('h3').eq(0).children('a').eq(0).click();return false;}).live('mouseover',function(){jQuery(this).addClass('hover');}).live('mouseout',function(){jQuery(this).removeClass('hover');}).css('cursor','pointer');jQuery('div.resultbox a.favourites, #overview a.favourites').live('click',function(){var anchor=jQuery(this);var allotmentgroupId=anchor.attr('id').replace('fav-add-','');addToFavourites(allotmentgroupId,anchor);return false;});jQuery('div.resultbox a.del-favourites,#overview a.del-favourites').live('click',function(){var anchor=jQuery(this);var allotmentgroupId=anchor.attr('id').replace('fav-del-','');removeFromFavourites(allotmentgroupId,anchor);return false;});jQuery('ul#favourites-list li a').live('click',function(){var url=jQuery(this).attr('href');goTo('view-'+url);return false;});jQuery('#prev-result').live('click',function(){viewPrevious();return false;});jQuery('#next-result').live('click',function(){viewNext();return false;});jQuery('#back-to-search,#back-to-search2').live('click',function(){var filterHash=createCurrentFilterHash();goTo('filter-P'+currentPage+filterHash);return false;});attached=true;}
function setSearchProperties(){var inputs=jQuery('#search-properties').find('input[type=hidden]');for(var i=0,j=inputs.length;i<j;i++){var input=inputs.eq(i);searchProperties[input.attr('name')]=input.val();}}
var filters=[];function setFilters(filter1,filter2,filter3){filters=[];for(var i=0;i<facilities.length;i++){if(((facilities[i][2]&filter1)==facilities[i][2])&&((facilities[i][3]&filter2)==facilities[i][3])&&((facilities[i][4]&filter3)==facilities[i][4])){facilities[i][6]=true;filters.push(i);}else{facilities[i][6]=false;}}}
function addfilter(iFilter){if(iFilter!=undefined){var igroup=facilities[iFilter][0];var name=facilities[iFilter][1];var groupname=facilitygroups[igroup][1];TorTracker.trackEvent("Add filter",groupname,name);filters.push(iFilter);facilities[iFilter][6]=true;}
updateCurFilters();}
function removefilter(iFilter){if(iFilter!=undefined){var igroup=facilities[iFilter][0];var name=facilities[iFilter][1];var groupname=facilitygroups[igroup][1];TorTracker.trackEvent("Remove filter",groupname,name);for(var i=0;i<filters.length;i++){if(filters[i]==iFilter){break;}}
if(i<filters.length-1){filters=filters.slice(0,i).concat(filters.slice(i+1));}else if(i==filters.length-1){filters=filters.slice(0,-1);}
facilities[iFilter][6]=false;}
updateCurFilters();}
function createCurrentFilterHash(){var tmp=[];tmp.push('A',curFilter1,'B',curFilter2,'C',curFilter3,'S',sortMinPrice);return tmp.join('');}
var curFilter1=0;var curFilter2=0;var curFilter3=0;var sortMinPrice=0;function applyfilters(){updateCurFilters();resultArray=new Array();for(var i=0;i<totalArray.length;i++){if(((totalArray[i][1]&curFilter1)==curFilter1)&&((totalArray[i][2]&curFilter2)==curFilter2)&&((totalArray[i][3]&curFilter3)==curFilter3)){resultArray.push(totalArray[i]);}}
if(sortMinPrice){resultArray.sort(function(a,b){return a[4]-b[4];});}
buildFilterList();}
function updateCurFilters(){curFilter1=0;curFilter2=0;curFilter3=0;for(var i=0;i<filters.length;i++){curFilter1+=facilities[filters[i]][2];curFilter2+=facilities[filters[i]][3];curFilter3+=facilities[filters[i]][4];}}
function count(){for(var j=0;j<facilities.length;j++){facilities[j][5]=0;for(var i=0;i<resultArray.length;i++){if(((resultArray[i][1]&facilities[j][2])==facilities[j][2])&&((resultArray[i][2]&facilities[j][3])==facilities[j][3])&&((resultArray[i][3]&facilities[j][4])==facilities[j][4])){facilities[j][5]++;}}}}
function buildFilterList(){count();var filterlist=jQuery(conf.filterlist);if(!filterlist.length){return false;}
filterlist.html('');var groupContainer=null;var currentGroupId=-1;for(var a in facilitygroups){facilitygroups[a][2]=false;facilitygroups[a][3]=false;}
for(var i=0,j=facilities.length;i<j;i++){if(facilities[i][0]!=currentGroupId){if(groupContainer){if(facilitygroups[currentGroupId][0]&&facilitygroups[currentGroupId][3]){groupContainer.find('li:not(.applied) ').children('a').unbind('click').addClass('exclusive');}
filterlist.append(groupContainer);}
currentGroupId=facilities[i][0];groupContainer=jQuery('<div><h4>'+facilitygroups[currentGroupId][1]+'</h4></div>');var ul=jQuery('<ul></ul>');groupContainer.append(ul);}
if(!facilities[i][6]){var listItem=jQuery('<li></li>');if(facilities[i][5]>0){facilitygroups[currentGroupId][2]=true;var link=jQuery('<a></a>').bind('click',i,function(e){addfilter(e.data);var filterHash=createCurrentFilterHash();goTo('filter-P'+currentPage+filterHash);});link.html('<span>('+facilities[i][5]+')</span>'+facilities[i][1]);listItem.append(link);}else{listItem.html('<span>('+facilities[i][5]+')</span>'+facilities[i][1]);}
ul.append(listItem);}else{if(facilitygroups[currentGroupId][0]==1){facilitygroups[currentGroupId][3]=true;}
var listItem=jQuery('<li class="applied"><a>'+facilities[i][1]+'</a></li>').bind('click',i,function(e){removefilter(e.data);goTo('filter-P'+currentPage+createCurrentFilterHash());});ul.append(listItem)}}
if(groupContainer){filterlist.append(groupContainer);}}
function buildAppliedFilterList(){if(!appliedFilterList){appliedFiltersContainer=jQuery('#applied-filters');appliedFilterList=jQuery('<ul></ul>').appendTo(appliedFiltersContainer);}else{appliedFilterList.html('');}
if(filters.length){for(var i=0,j=filters.length;i<j;i++){jQuery('<li>'+facilities[filters[i]][1]+'</li>').bind('click',i,function(e){removefilter(filters[e.data]);var filterHash=createCurrentFilterHash();goTo('filter-P'+currentPage+filterHash);}).appendTo(appliedFilterList);}
appliedFiltersContainer.show();}else{appliedFiltersContainer.hide();}}
var companyResults=null;function updateResultSet(p){var data=searchProperties;var page=p||1;var limit=parseInt(searchProperties.limit)||1000;totalPages=resultArray.length%limit==0?resultArray.length/limit:Math.floor(resultArray.length/limit)+1;if(page>totalPages){page=totalPages;}
var rangeStart=(page-1)*limit;var rangeEnd=rangeStart+limit;switch(searchProperties.searchType){case'company':var ids=[];for(var i=rangeStart,j=resultArray.length;i<j&&i<rangeEnd;i++){ids.push('C',resultArray[i][0]);}
data.ids=ids.join('');break;case'house':var ids=[]
for(var i=rangeStart,j=resultArray.length;i<j&&i<rangeEnd;i++){ids.push('A',resultArray[i][0],'MP',resultArray[i][4],'OP',resultArray[i][7],'CNF',resultArray[i][5]);}
data.ids=ids.join('');break;case'hotel':var orgArray=buildOrgArray();var ids=[];for(var i=0,j=orgArray.length;i<j;i++){ids.push('ORG',orgArray[i].id);for(var k=0,l=orgArray[i].allotmentGroups.length;k<l;k++){ids.push('A',orgArray[i].allotmentGroups[k][0],'MP',orgArray[i].allotmentGroups[k][4],'OP',orgArray[i].allotmentGroups[k][7],'CNF',orgArray[i].allotmentGroups[k][5]);}}
data.ids=ids.join('');break;default:break;}
if(lastRequestString==data.ids&&!sortMinPrice){setView('search');setLoading(false);return false;}
lastRequestString=data.ids;setLoading(true);var action='ags/';if(searchProperties.searchType=='company'){action='comps';}
Ajax.doRequest(action,data,handleUpdateResult);currentPage=page;}
function handleUpdateResult(resp){searchResultsEl.html(resp.data.html);setView('search');setLoading(false);}
function buildOrgArray(){var orgArray=new Array();var currentOrg=null;for(var i=0,j=resultArray.length;i<j;i++){if(!currentOrg||(resultArray[i][6]!=currentOrg.id)||(resultArray[i][6]==0)){if(currentOrg){orgArray.push(currentOrg);}
currentOrg={id:resultArray[i][6],allotmentGroups:new Array()};}
currentOrg.allotmentGroups.push(resultArray[i]);}
if(currentOrg){orgArray.push(currentOrg);}
return orgArray;}
function initTabs(){jQuery('#search-tabs li a').click(function(){var a=jQuery(this);var id=a.attr('id');switch(id){case'show-results':setView('search');return false;case'show-favourites':setView('favourites');return false;}});}
function viewDetails(hash){setLoading(true);Ajax.doRequest(detailViewAction+hash,'',handleviewDetails);TorTracker.trackPageView(hash);}
function viewNext(){if(currentResultId){var result=jQuery('#res-'+currentResultId).parents('div.resultbox:first').next();if(result.length){result.click();}else if(total>currentPage){setLoading(true);goTo('filter-P'+(currentPage+1)+createCurrentFilterHash());}}}
function viewPrevious(){if(currentResultId){var result=jQuery('#res-'+currentResultId).parents('div.resultbox:first').prev();if(result.length){result.click();}else if(currentPage!=1){goTo('filter-P'+(currentPage-1)+createCurrentFilterHash());}else if(currentPage==1){setView('search');}}}
function handleviewDetails(resp){detailEl.html(resp.data.html);Tabs.init();setView('view');setLoading(false);scroll(0,350);if(specialPageLoad!=null){specialPageLoad();specialPageLoad=null;}}
var paginationInited=false;var nextLink=null;var prevLink=null;var total=0;var paginationContainers=null;function buildPagination(){if(!paginationContainers){paginationContainers=jQuery('div.pagination');}
paginationContainers.show();total=resultArray.length;var limit=parseInt(searchProperties.limit);var pages=Math.ceil(total/limit);var firstInCurrentSet=((currentPage-1)*limit)+1;var lastInCurrentSet=Math.min((currentPage*limit),total);jQuery('span.p-total-results').text(total);if(searchProperties.searchType!='hotel'){jQuery('ul.p-total-pages',paginationContainers).text(pages);jQuery('span.p-first-in-set').text(firstInCurrentSet);jQuery('span.p-last-in-set').text(lastInCurrentSet);}
if(!paginationInited){jQuery('a.buttonsort').click(function(e){e.stopImmediatePropagation();sortMinPrice=1;jQuery(this).addClass('active');goTo('filter-P'+1+createCurrentFilterHash());});if(searchProperties.searchType=='hotel'){jQuery('a.next-page').hide();return true;}
jQuery('ul.p-pages li').live('click',function(){if(currentPage==parseInt(jQuery(this).text())){return false;}
goTo('filter-P'+jQuery(this).text()+createCurrentFilterHash());});nextLink=jQuery('a.next-page').click(function(){goTo('filter-P'+Math.min((currentPage+1),pages)+createCurrentFilterHash());});prevLink=jQuery('a.prev-page').click(function(){goTo('filter-P'+Math.max((currentPage-1),1)+createCurrentFilterHash());});paginationInited=true;}
if(searchProperties.searchType=='hotel'){return true;}
if(currentPage==pages){nextLink.css('visibility','hidden');}else{nextLink.css('visibility','inherit');}
if(currentPage==1){prevLink.css('visibility','hidden');}else{prevLink.css('visibility','inherit');}
var toShow=5;var firstToShow=Math.max((currentPage-Math.floor(toShow/2)),1);var lastToShow=Math.min(Math.max(currentPage+Math.floor(toShow/2),toShow),pages);var items=[];for(var i=firstToShow;i<=lastToShow;i++){if(currentPage!=i){items.push('<li>',i,'</li>');}else{items.push('<li class="current">',i,'</li>');}}
jQuery('ul.p-pages').html(items.join(''));return true;}
function setView(type){viewContainer.hide()
searchContainer.hide();favouritesContainer.hide();searchResultsEl.hide();sideView.hide();sideSearch.hide();if(paginationContainers){paginationContainers.css('visibility','hidden');}
jQuery('#search-tabs li').removeClass('current');switch(type){case'search':searchContainer.show().css('visibility','visible');searchResultsEl.show();sideSearch.show();if(paginationContainers){paginationContainers.css('visibility','visible');}
jQuery('#show-results').parent('li').addClass('current');break;case'view':updateBookingsCode();viewContainer.show();sideView.show();break;case'favourites':searchContainer.show().css('visibility','visible');searchResultsEl.hide();if(paginationContainers){paginationContainers.css('visibility','hidden');}
favouritesContainer.show();sideSearch.show();jQuery('#show-favourites').parent('li').addClass('current');getFavourites();break;default:return;}
currentView=type;}
var bookingsCodeEl=null;function updateBookingsCode(){var code=jQuery('#bookingsCodeHolder').val();if(bookingsCodeEl){bookingsCodeEl.text(code);}else{bookingsCodeEl=jQuery('#bookingscode').text(code);}}
function setLoading(loading){util.setLoading(loading);}
function openMap(){var searchType=searchProperties.searchType;var limit=parseInt(searchProperties.limit);var idString='';if(searchType=='house'){var ids=[];var amount=resultArray.length>limit?limit:resultArray.length;for(var i=0;i<amount;i++){ids.push('A',resultArray[i][0]);}
idString=ids.join('');}else if(searchType=='hotel'){var orgArray=buildOrgArray();var ids=[];for(var i=0,j=orgArray.length;i<j;i++){ids.push('ORG',orgArray[i].id);for(var k=0,l=orgArray[i].allotmentGroups.length;k<l;k++){ids.push('A',orgArray[i].allotmentGroups[k][0]);}}
idString=ids.join('');}
var url=createExternalMapUrl(searchType,idString);openExternalMapWithUrl(url);return false;}
function createExternalMapUrl(searchType,ids){var url='http://'+window.location.host+'/ajax/map/?searchType='+searchType+'&ids='+ids;return escape(url);}
function openMapSingle(){var id=jQuery(this).attr('id');if(id.indexOf('excursion-')>-1){var agId=id.replace('excursion-','');var url=createExternalMapUrl('excursion','A'+agId);}else{var agId=id.replace('ag-','');var url=createExternalMapUrl('house','A'+agId);}
openExternalMapWithUrl(url);return false;}
function openExternalMapWithUrl(url){loadMap(url);return false;}
function addToFavourites(allotmentgroupId,anchor){Ajax.doRequest('addtofav',{agId:allotmentgroupId},function(){anchor.hide();setLoading(false);});}
function removeFromFavourites(allotmentgroupId,anchor){Ajax.doRequest('removefromfav',{agId:allotmentgroupId},function(){anchor.hide();getFavourites();setLoading(false);});}
function getFavourites(){Ajax.doRequest('getfavs',{},function(resp){favouritesContainer.html(resp.data.html);setLoading(false);});}
function cleanUrl(url){if(url.indexOf('http')>-1){url=url.replace('http://'+window.location.hostname,'');}
return url;}
function goTo(hash){setLoading(true);TBhistory.add(hash);}
function doAction(hash){var action=hash.substring(0,hash.indexOf('-'));var param=hash.substring(hash.indexOf('-')+1);switch(action){case'view':if(!buildCompleted){build();}
viewDetails(param);break;case'filter':var matchP=param.match('P[0-9]+');var page=matchP?parseInt(matchP[0].substr(1)):0;var matchA=param.match('A[0-9]+');var filter1=matchA?parseInt(matchA[0].substr(1)):0;var matchB=param.match('B[0-9]+');var filter2=matchB?parseInt(matchB[0].substr(1)):0;var matchC=param.match('C[0-9]+');var filter3=matchC?parseInt(matchC[0].substr(1)):0;var matchMinPrice=param.match('S[0-1]+');sortMinPrice=matchMinPrice?parseInt(matchMinPrice[0].substr(1)):0;build(filter1,filter2,filter3,page);setView('search');break;default:build();setView('search');break;}}
return{init:init,doAction:doAction,getDetailViewAction:function(){return detailViewAction;},searchProperties:searchProperties,filters:filters,buildOrgArray:buildOrgArray,cleanUrl:cleanUrl,openMapSingle:openMapSingle};}();var Tabs=function(){var currentTabLink=null;var tabsContainer=null;var tabCache={};function init(){jQuery('ul#ag-tab-list li a').bind('click',openTab);jQuery('#book-link').click(function(){if(Calendar.dateSelected()&&document.forms.bookForm!=undefined){document.forms.bookForm.submit();return false;}else{jQuery('#prices-link').click();}
return false;});tabsContainer=jQuery('#ag-tab');tabCache={};}
function openTab(e){if(e.button==2)return true;jQuery('ul#ag-tab-list li').removeClass('current');currentTabLink=jQuery(this);var li=currentTabLink.parent();li.addClass('current');var tabId=currentTabLink.attr('id');var tabName=tabId.substring(0,tabId.indexOf('-'));if(tabCache[tabName]){tabsContainer.children().hide();tabCache[tabName].show();}else{setLoading(true);var url=SliceDice.cleanUrl(currentTabLink.attr('href'));TorTracker.trackPageView(url);Ajax.doRequest(SliceDice.getDetailViewAction()+url,'',handleGetTab);}
return false;}
function handleGetTab(resp){var tabName=resp.data.tab;tabsContainer.children().hide();tabCache[tabName]=jQuery('<div></div>').html(resp.data.html).appendTo(tabsContainer);switch(tabName){case'prices':Calendar.init();break;case'photos':PhotoViewer.init();break;}
setLoading(false);}
function setLoading(loading){util.setLoading(loading);}
function getCurrentTabUrl(){return currentTabLink?currentTabLink.attr('href'):'';}
return{init:init,getCurrentTabUrl:getCurrentTabUrl};}();var Calendar=function(){var optionForm=null;var calendarContainer=null;function init(){optionForm=jQuery('form#options');optionForm.find('select').change(function(){update();return false;});calendarContainer=jQuery('#pricetab').parent();jQuery('#next-month').click(function(){jQuery('#arrival-select').val(jQuery('#arrival-select option:selected').next().val());update();return false;});jQuery('#prev-month').click(function(){jQuery('#arrival-select').val(jQuery('#arrival-select option:selected').prev().val());update();return false;});jQuery('table#calendar td.available').hover(function(){jQuery(this).addClass('hover');},function(){jQuery(this).removeClass('hover');});}
function update(){var formEls=optionForm.find('input, select');var options={};formEls.each(function(){var el=jQuery(this);options[el.attr('name')]=el.val()||0;});util.setLoading(true);var url=Tabs.getCurrentTabUrl();if(!url)url=document.location.pathname;url=SliceDice.cleanUrl(url);Ajax.doRequest(SliceDice.getDetailViewAction()+url,options,handleUpdate);}
function handleUpdate(resp){util.setLoading(false);calendarContainer.html(resp.data.html);Calendar.init();}
var selectedTd=null;function showPriceSpecification(options,triggerTD){jQuery.colorbox.close();if(selectedTd){selectedTd.removeClass('selected');}
selectedTd=jQuery(triggerTD);util.setLoading(true);jQuery('#arrivalSpan').text(options.arrival);var duration=parseInt(options.duration);var arr=options.arrival.split('-');var day=parseInt(arr[0]);var month=arr[1];var year=parseInt(arr[2]);if(month.indexOf('0')==0){month=month.slice(1,2);}
month=parseInt(month)-1;var leaveDate=new Date(year,month,day+duration);var leaveDay=leaveDate.getDate().toString();if(leaveDay.length==1){leaveDay='0'+leaveDay;}
var leaveMonth=leaveDate.getMonth()+1;if(leaveMonth.toString().length==1){leaveMonth='0'+leaveMonth.toString();}
var leaveString=leaveDay+'-'+leaveMonth+'-'+leaveDate.getFullYear();jQuery('#leaveSpan').text(leaveString);if(duration>0){jQuery('#durationSpan').text(options.duration).parents('li:first').show();}else{jQuery('#durationSpan').parents('li:first').hide();}
jQuery('#allotment-count').text(options.allotment);jQuery('#adultsSpan').text(options.adults);jQuery('#babiesSpan').text(options.babies);jQuery('#roomsSpan').text(options.rooms);jQuery('#priceSpan').text(parseFloat(options.price).toFixed(2).toString().replace('.',','));var reservationCosts=parseFloat(jQuery('#reservationCosts').val()).toFixed(2);if(reservationCosts==0){jQuery('#reservationCostsSpan').parents('li:first').hide();}else{jQuery('#reservationCostsSpan').text(reservationCosts.toString().replace('.',',')).parents('li:first').show();}
var booking=document.forms.bookForm;booking.isVirtual.value=options.isVirtual;booking.accoPrice.value=options.price;booking.duration.value=options.duration;var arrivalArr=options.arrival.split('-');booking.departure.value=parseInt(Number(arrivalArr[2]))+'-'+parseInt(Number(arrivalArr[1]))+'-'+parseInt(Number(arrivalArr[0]));booking.totalAdults.value=options.adults;booking.totalBabies.value=options.babies;booking.totalAccommodations.value=options.rooms;booking.agesString.value=options.agesString;booking.configurationIds.value=options.confIds;var babyPriceSpan=jQuery('#babyPriceSpan');var babyPrice=0;if(options.babies&&babyPriceSpan.length){var babyDiscountAmount=booking.babyDiscountAmount.value;var babyDiscount=booking.babyDiscount.value;if(parseFloat(babyDiscountAmount)>0){babyPrice=parseFloat(babyDiscountAmount).toFixed(2);}else{babyPrice=parseFloat(parseFloat(options.price)*parseFloat(babyDiscount)/100).toFixed(2);}
babyPriceSpan.text(babyPrice);jQuery('#babyPriceDiv').show();}else{jQuery('#babyPriceDiv').hide();}
var onePersonExtraPrice=parseFloat(options.onePersonExtraPrice.replace(',','.'));if(onePersonExtraPrice){var totalOnePersonExtra=Math.max(0,(Math.max(options.rooms,1)*2)-options.adults);var onePersonExtra=onePersonExtraPrice;var onePersonExtraPrice=parseFloat(totalOnePersonExtra*onePersonExtra).toFixed(2);jQuery('#onePersonExtraSpan').text(onePersonExtraPrice);jQuery('#onePersonExtraDiv').show();}else{jQuery('#onePersonExtraDiv').hide();}
var additionsPrice=0;jQuery('input.additional-cost').each(function(){additionsPrice+=parseFloat(jQuery(this).val());});pricePerPerson=jQuery('#pricePerPerson').val();var amountPrice=1;if(pricePerPerson!='1'){onePersonExtraPrice=0;}
var amount=(parseFloat(amountPrice)*parseFloat(options.price.replace(',','.')))+parseFloat(reservationCosts)+parseFloat(onePersonExtraPrice)+parseFloat(additionsPrice)+parseFloat(babyPrice*parseInt(options.babies));var totalPrice=parseFloat(amount).toFixed(2);jQuery('#dateChosenDiv').show();jQuery('#chooseDateDiv').hide();var additionParams={totalPrice:totalPrice,allotmentgroupId:booking.allotmentgroupId.value,arrival:options.arrival,duration:options.duration,adults:options.adults,babies:options.babies,rooms:options.rooms};if(jQuery('#showOptionsNextToCalendar').length>0){Ajax.doRequest('options',additionParams,function(resp){jQuery('#price-specification-options li.option').remove();jQuery('#price-specification-options').append(resp.data.html);});}
Ajax.doRequest('additions',additionParams,function(resp){jQuery('#price-specification li.addition').remove();jQuery('#price-specification').append(resp.data.html);showReceipt(true);util.setLoading(false);selectedTd.addClass('selected');});}
function showConfigurations(options){Ajax.doRequest('configurations',options,function(resp){jQuery.colorbox({html:resp.data.html,fixed:true,opacity:0.75,transition:'none',width:300,speed:100});});}
function showReceipt(show){if(show){jQuery('#price-specification-wrap, #calendar-bookForm').show();jQuery('#no-price-selected').hide();}
else{jQuery('#price-specification-wrap, #calendar-bookForm').hide();jQuery('#no-price-selected').show();}}
return{init:init,showConfigurations:showConfigurations,showPriceSpecification:showPriceSpecification,dateSelected:function(){return selectedTd!=null;}};}();var TorTracker=function(){function trackEvent(category,action,label){try{pageTracker._trackEvent(category,action,label);}catch(e){}
return false;}
function trackPageView(pageUrl){try{pageTracker._trackPageview(pageUrl);}catch(e){}
return false;}
return{trackEvent:trackEvent,trackPageView:trackPageView};}();var PhotoViewer=function(){function init(){jQuery.getScript('/javascript/thickbox.js');}
return{init:init};}();(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return}var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return}var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return}if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery)


var doeksen={shows_options:false,latest_dep_query:'',cur_departure:'',cur_departure_id:0,cur_return:'',cur_return_id:0,options:'',group_types:'',group_types_html:'',passengers:'',cur_option:0,is_backoffice:0,init:function(){if(!jQuery('#doeksenForm').length){return false;}
if(jQuery('#doeksen_group').val()==1){doeksen.getGroupTypes();}else{doeksen.checkDepartures();}},checkDepartures:function(){jQuery('#doeksen-loading').fadeIn('normal');var query='depDate='+jQuery('#d_dep_date').val();jQuery('#rpList select').each(function(){var sub=this.name.substring(1,6);if(sub=='Day'){query+='&days[]='+this.value;}else if(sub=='Month'){query+='&months[]='+this.value;}else if(sub=='Year'){query+='&years[]='+this.value;}});doeksen.latest_dep_query=query;if(!doeksen.shows_options){Ajax.doRequest('getDepartureOptions',query,doeksen.handle_checkDepartures);}else{Ajax.doRequest('getDepartures',query,doeksen.handle_checkDepartures);}},handle_checkDepartures:function(resp){jQuery('#doeksen-loading').fadeOut('normal');jQuery('#dep-options-loading').fadeOut('normal');if(resp.status){if(resp.data['options']){doeksen.options=resp.data['options']['raw'];if(resp.data['passenger_cats']!=undefined){doeksen.passengers=resp.data['passenger_cats']['raw'];jQuery('#options_holder').html(resp.data['passenger_cats']['html']+resp.data['options']['html']);}
jQuery('#departures_holder').html(resp.data['departures']);jQuery('#departure_options_0').change(doeksen.changeOption);jQuery('#use_arrangement').change(doeksen.changeArrangement);jQuery('#doeksen_holder').slideDown('slow');jQuery('#options_holder .doeksen_passenger_cat').change(doeksen.changePassengers);doeksen.shows_options=true;doeksen.latest_dep_query=doeksen.getBasicQuery();}else{jQuery('#departures_holder').html(resp.data);jQuery('#doeksen_data_holder').slideDown('slow');}
jQuery('#departures_holder .departure_select').click(doeksen.getRetourn);jQuery('#doeksen-new-departures').click(doeksen.getNewDepartures);}},getBasicQuery:function(){var query='depDate='+jQuery('#d_dep_date').val();if(jQuery('#use_arrangement').attr('checked')){query+='&arrangement='+jQuery('#doeksen_arrangement').val();}
query+='&product='+jQuery('#doeksen_product').val();for(var i in doeksen.passengers){if(doeksen.passengers[i]>0){query+='&passengers['+i+']='+doeksen.passengers[i];}}
return query;},changeArrangement:function(){doeksen.latest_dep_query=doeksen.getBasicQuery();doeksen.hideData();},changePassengers:function(){var cat=jQuery(this).attr('rel');var val=jQuery(this).val();doeksen.passengers[cat]=val;doeksen.latest_dep_query=doeksen.getBasicQuery();doeksen.hideData();},changeOption:function(){var trigger=jQuery(this);var option=trigger.val();var arr=trigger.attr('id').split('_');var this_id=arr[2];var quantity=jQuery('#options-amount-'+this_id);var select=jQuery('#doeksen_options_amount_'+this_id);if(doeksen.latest_dep_query!=''){doeksen.cur_departure='';doeksen.cur_departure_id=0;doeksen.cur_return='';doeksen.cur_return_id=0;if(option!=''){for(var i in doeksen.options){if(doeksen.options[i]['code']==option.substr(0,2)){if(doeksen.options[i]['max_quantity']>1){if(!select.val()){var max_q=parseInt(doeksen.options[i]['max_quantity']);var cnt='<select id="doeksen_options_amount_'+this_id+'" name="doeksen_options_amount_'+this_id+'"> ';for(var j=1;j<=doeksen.options[i]['max_quantity'];j++){cnt+='<option value="'+j+'"';if(j==1){cnt+=' selected';}
cnt+='>'+j+'</option>'}
cnt+='</select>&nbsp;';quantity.html(cnt).fadeIn('slow');quantity.change(doeksen.changeOption);}}else{quantity.fadeOut('slow',function(){quantity.html('');});}}}
var rel=trigger.attr('rel');if(rel!=undefined&&rel!=0){var cur_options=jQuery('#first-options');var extra_options=jQuery('#extra-options');var tmp_span=jQuery('<div></div>').hide();tmp_span.append('<br/>'+cur_options.html()).hide();extra_options.append(tmp_span);doeksen.cur_option++;jQuery('#extra-options span:last').html('').attr('id','options-amount-'+doeksen.cur_option);var new_opt=jQuery('#extra-options select:last');new_opt.attr('id','departure_options_'+doeksen.cur_option).attr('name','doeksen_options['+doeksen.cur_option+']').attr('rel','1').change(doeksen.changeOption);new_opt.find('option:first').attr('selected','selected');tmp_span.slideDown('slow');trigger.attr('rel','0');}}else{select.fadeOut('normal');}
doeksen.hideData();}},hideData:function(){jQuery('#doeksen_data_holder').slideUp('slow',function(){jQuery('#departures_holder').html('');jQuery('#retourns_holder').html('');jQuery('#doeksen_price_holder').html('');});},getNewDepartures:function(){var query=doeksen.latest_dep_query;doeksen.hideData();jQuery('#dep-options-loading').fadeIn('normal');query+=doeksen.getOptions();Ajax.doRequest('getDepartures',query,doeksen.handle_checkDepartures);},hide_doeksen:function(){var holder=jQuery('#doeksen_holder');doeksen.shows_options=false;latest_dep_query='';cur_departure='';cur_departure_id=0;cur_return='';cur_return_id=0;if(holder.is(':visible')){holder.slideUp('slow',function(){jQuery('#options_holder').html('');jQuery('#departures_holder').html('');jQuery('#retourns_holder').html('');jQuery('#doeksen_price_holder').html('');jQuery('#options-amount').html('').hide();});}},getRetourn:function(){var code=jQuery(this).val();if(code!=doeksen.cur_departure){jQuery('#retourns_holder').slideUp('slow',function(){jQuery('#retourns_holder').html('');});jQuery('#doeksen_price_holder').fadeOut('slow',function(){jQuery('#doeksen_price_holder').html('');});doeksen.cur_return=code;doeksen.cur_return_id=id;var id=jQuery(this).attr('rel');var duration=jQuery('#d_duration').val();doeksen.cur_departure=code;doeksen.cur_departure_id=id;jQuery('#dep-'+id+'-loading').fadeIn('normal');var query=doeksen.latest_dep_query+'&departure_code='+code+'&duration='+duration;query+=doeksen.getOptions();Ajax.doRequest('getDepartures',query,doeksen.handle_getRetourn);}},handle_getRetourn:function(resp){jQuery('#dep-'+doeksen.cur_departure_id+'-loading').fadeOut('normal');if(resp.status){jQuery('#retourns_holder').html(resp.data).slideDown('slow');jQuery('#retourns_holder .retourn_select').click(doeksen.getPrice);}},getPrice:function(){var code=jQuery(this).val();if(code!=doeksen.cur_return){jQuery('#doeksen_price_holder').fadeOut('slow',function(){jQuery('#doeksen_price_holder').html('');});var id=jQuery(this).attr('rel');doeksen.cur_return=code;doeksen.cur_return_id=id;jQuery('#retourn-'+id+'-loading').fadeIn('normal');var query=doeksen.latest_dep_query+'&departure_code='+doeksen.cur_departure+'&return_code='+code;query+=doeksen.getOptions();Ajax.doRequest('getPrice',query,doeksen.handle_getPrice);}},handle_getPrice:function(resp){jQuery('#retourn-'+doeksen.cur_return_id+'-loading').fadeOut('normal');if(resp.status){if(doeksen.is_backoffice==1){jQuery('#doeksen_backoffice_holder').fadeIn('slow');}
jQuery('#doeksen_price_holder').html(resp.data).fadeIn('slow');}},getOptions:function(){var query='';var regex=new RegExp('[0-9]');var cnt=0;var options=jQuery('.doeksen_options').each(function(){var obj=jQuery(this);if(obj.val()!=''){query+='&options['+cnt+']='+obj.val();var arr=obj.attr('id').split('_');var this_id=arr[2];var quantity=jQuery('#options-amount-'+this_id);var select=jQuery('#options-amount-'+this_id+' select');if(quantity.is(':visible')){if(regex.test(select.val())){query+='&options_amount['+cnt+']='+select.val();}}else{quantity.html('');}
cnt++;}});return query;},getGroupTypes:function(){if(jQuery(this).is(':checked')){if(doeksen.group_types==''){jQuery('#doeksen-loading').fadeIn('normal');Ajax.doRequest('getGroupTypes','',doeksen.handle_getGroupTypes);}else{doeksen.showGroupTypes();}}else{doeksen.hide_doeksen();}},handle_getGroupTypes:function(resp){if(resp.status){doeksen.group_types=resp.data['raw'];doeksen.group_types_html=resp.data['html'];doeksen.showGroupTypes();}},showGroupTypes:function(){jQuery('#options_holder').html(doeksen.group_types_html);jQuery('#group_types').change(doeksen.changeGroupType);doeksen.changeGroupType();},changeGroupType:function(){var id=jQuery('#group_types').val();var holder=jQuery('#group_count_holder');var place=jQuery('#group_count_place');var loading=jQuery('#dep-group-type-loading');var data_holder=jQuery('#doeksen_data_holder');if(holder.is(':visible')){loading.fadeIn('normal');}
data_holder.slideUp('slow',function(){jQuery('#retourns_holder').html('').hide();jQuery('#doeksen_price_holder').html('').hide();});holder.slideUp('slow',function(){place.html('');if(doeksen.group_types!=''){for(var i in doeksen.group_types){if(doeksen.group_types[i]['id']==id){var min=doeksen.group_types[i]['min_passengers'];var max=Math.min(doeksen.group_types[i]['max_passengers'],50);var txt='<select name="doeksen_group_count" id="group_count">';for(var j=min;j<=max;j++){txt+='<option value="'+j+'">'+j+'</option>';}
txt+='</select>';place.html(txt);jQuery('#group_count').change(doeksen.changeGroupCount);doeksen.changeGroupCount();holder.slideDown('slow');loading.fadeOut('normal');break;}}}});},changeGroupCount:function(){jQuery('#doeksen_data_holder').slideUp('slow',function(){jQuery('#retourns_holder').html('').hide();jQuery('#doeksen_price_holder').html('').hide();});var group=jQuery('#group_types').val();var count=jQuery('#group_count').val();var dep_date=jQuery('#d_dep_date').val();var query='group='+group+'&group_count='+count+'&depDate='+dep_date;doeksen.latest_dep_query=query;if(jQuery('#group_types').is(':visible')){jQuery('#dep-group-count-loading').fadeIn('normal');}
Ajax.doRequest('getGroupDepartures',query,doeksen.handle_changeGroupCount);},handle_changeGroupCount:function(resp){var holder=jQuery('#doeksen_holder');jQuery('#dep-group-count-loading').fadeOut('normal');if(resp.status){jQuery('#departures_holder').html(resp.data);jQuery('#departures_holder .departure_select').click(doeksen.getGroupReturn);jQuery('#doeksen_data_holder').slideDown('slow');}
if(holder.is(':hiden')){jQuery('#doeksen-loading').fadeOut('normal');holder.slideDown('slow');}},getGroupReturn:function(){var obj=jQuery(this);jQuery('#dep-'+obj.attr('rel')+'-loading').fadeIn('normal');jQuery('#doeksen_price_holder').fadeOut('slow',function(){jQuery('#doeksen_price_holder').html('');});jQuery('#retourns_holder').slideUp('slow');doeksen.cur_departure=obj.val();doeksen.cur_departure_id=obj.attr('rel');var duration=jQuery('#d_duration').val();var query=doeksen.latest_dep_query+'&duration='+duration+'&departure_code='+doeksen.cur_departure;Ajax.doRequest('getGroupDepartures',query,doeksen.handle_getGroupReturn);},handle_getGroupReturn:function(resp){jQuery('#dep-'+doeksen.cur_departure_id+'-loading').fadeOut('normal');if(resp.status){jQuery('#retourns_holder').html(resp.data).slideDown('slow');jQuery('#retourns_holder .retourn_select').click(doeksen.getGroupPrice);}},getGroupPrice:function(){var obj=jQuery(this);jQuery('#retourn-'+obj.attr('rel')+'-loading').fadeIn('normal');jQuery('#doeksen_price_holder').fadeOut('slow');jQuery('#doeksen_price_holder').fadeOut('slow',function(){jQuery('#doeksen_price_holder').html('');});doeksen.cur_return=obj.val();doeksen.cur_return_id=obj.attr('rel');var query=doeksen.latest_dep_query+'&departure_code='+doeksen.cur_departure+'&return_code='+doeksen.cur_return;Ajax.doRequest('getGroupPrice',query,doeksen.handle_getGroupPrice);},handle_getGroupPrice:function(resp){jQuery('#retourn-'+doeksen.cur_return_id+'-loading').fadeOut('normal');if(resp.status){jQuery('#doeksen_price_holder').html(resp.data).fadeIn('slow');}}}
jQuery(document).ready(function(){doeksen.init();});


