
function openWindow(url,width,height,name){if(window.open){var settings='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height;mywin=window.open(url,name,settings);window.mywin.focus();}return false;}function open_window(url){openWindow(url,300,300,"win");}function open_review_window(url){openWindow(url,750,550,"win");}function open_locationmap(url){openWindow(url,600,600,"winmap");}function open_videolink(url){openWindow(url,600,600,"winmap");}function checkdates(){if(document.bookingform.testonly.value=="true"){return true;}else if(document.bookingform.startdate.value.length==0||document.bookingform.enddate.value.length==0){alert('You must select your booking dates from the calendar before proceeding.');}else return true;return false;}function booking_validate(){return true;splitIndex=0;splitArray=new Array();if(document.bookingform.startdate.value.length==0||document.bookingform.enddate.value.length==0){alert('You must select some dates from the calendar to make an enquiry or booking.');return false;}else
{var one_day=1000*60*60*24;split(document.bookingform.startdate.value,'/');var startdate=new Date(splitArray[2],splitArray[0]-1,splitArray[1]);splitIndex=0;split(document.bookingform.enddate.value,'/');var enddate=new Date(splitArray[2],splitArray[0]-1,splitArray[1]);var days=Math.abs(Math.ceil((enddate.getTime()-startdate.getTime())/(one_day)));if(!isNaN(document.bookingform.minbooking.value)){if(document.bookingform.minbooking.value*1>days&&document.bookingform.minbooking.value*1!=0){datesokay=false;alert('The minimum booking period for this property is '+document.bookingform.minbooking.value*1+' days. Please select new dates.');return false;}}if(!isNaN(document.bookingform.maxbooking.value)){if(document.bookingform.maxbooking.value*1<days&&document.bookingform.maxbooking.value*1!=0){datesokay=false;alert('The maximum booking period for this property is '+document.bookingform.maxbooking.value*1+' days. Please select new dates.');return false;}}}return true;}

var old_addthis_open;var old_addthis_close;var old_addthis_is_open=false;var old_addthis_is_closing=false;if(window.addthis_open){$(function(){old_addthis_open=addthis_open;old_addthis_close=addthis_close;addthis_open=function(b,f,e,c,d,a){old_addthis_is_open=setTimeout(function(){old_addthis_open(b,f,e,c,d,a);},250);};addthis_close=function(){clearTimeout(old_addthis_is_open);old_addthis_is_open=false;old_addthis_close();};});}function isChildOf(parent,child){var result=false;if(child.tagName)parent.find(child.tagName).each(function(){if(this==child){result=true;return false;}});return result;}$(document).bind("mousemove",function(event){if(old_addthis_is_open){var over_addthis=isChildOf($("#at20mc"),event.target)||isChildOf($(".addthis_button"),event.target);if(over_addthis&&old_addthis_is_closing){clearTimeout(old_addthis_is_closing);old_addthis_is_closing=false;}else if(!over_addthis&&!old_addthis_is_closing)old_addthis_is_closing=setTimeout(addthis_close,100);}});

DatePickerThreeMonths=function(element,isNonPopup){this._element=element;this.isNonPopup=isNonPopup;this._abbreviatedMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this._longMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this._shortestDayNames=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];this._daysTableHeaderRows=[null,null,null];this._daysBodys=[null,null,null];this._monthsBodys=[null,null,null];this._cssClass=isNonPopup?"ajax__calendar":"ajax__calendar";this._buttonID=null;this._minDate=typeof minDate=="undefined"?AddDays(new Date(),1):ParseEuroShortDate(minDate);this._maxDate=typeof maxDate=="undefined"?this.addMonths(new Date(),19):ParseEuroShortDate(maxDate);if(typeof window.isRAHProperty!="undefined"){if(window.isRAHProperty)this._maxDate=typeof maxDate=="undefined"?this.addMonths(new Date(),12):ParseEuroShortDate(maxDate);}this._selectedDate=null;this._visibleDate=null;this._todaysDate=null;this._firstDayOfWeek=1;this._popupDiv=null;this._prevArrow=null;this._prevArrowImage=null;this._nextArrow=null;this._nextArrowImage=null;this._titles=[null,null,null];this._today=null;this._daysRow=null;this._monthsRow=null;this._yearsRow=null;this._daysBody=null;this._yearsBody=null;this._button=null;this._mode="days";this._selectedDateChanging=false;this._isIEen=false;this._isAnimating=false;this._width=170;this._height=139;this._blur=new DeferredOperation(Browser.isSf?1000:1,this,this._onblur);this._focus=new DeferredOperation(Browser.isSf?1000:1,this,this._onfocus);this._button$delegates={click:createDelegate(this,this._button_onclick)};this._element$delegates={focus:createDelegate(this,this._element_onfocus),mousedown:createDelegate(this,this._element_onfocus),focusout:createDelegate(this,this._element_onblur),blur:createDelegate(this,this._element_onblur),change:createDelegate(this,this._element_onchange)};this._popup$delegates={activate:createDelegate(this,this._popup_onfocus),focus:createDelegate(this,this._popup_onfocus),dragstart:createDelegate(this,this._popup_ondragstart),select:createDelegate(this,this._popup_onselect)};this._cell$delegates={mouseover:createDelegate(this,this._cell_onmouseover),mouseout:createDelegate(this,this._cell_onmouseout),mousedown:createDelegate(this,this._cell_onclick)};addDelegates(this._element,this._element$delegates);if($(this._element).hasClass("dateSelectButton"))this._buildButton();if(this._button)addDelegates(this._button,this._button$delegates);var value=this.get_selectedDate();if(value)this.set_selectedDate(value);if(isNonPopup){this.show();this.set_selectedDate(AddDays(new Date(),1));}$.data(this._element,"DatePickerThreeMonths",this);};DatePickerThreeMonths.prototype={get_selectedDate:function(){if(this._selectedDate===null){var value=this._element.value;if(value)this._selectedDate=ParseEuroShortDate(value);}return this._selectedDate;},set_selectedDate:function(value){var elt=this._element;if(this._selectedDate!=value){this._selectedDate=value;this._selectedDateChanging=true;var text="";if(value)text=dateFormat2(value);if(text!=elt.value){elt.value=text;try{this._fireChanged();}catch(e){}}this._selectedDateChanging=false;this._performLayout();}},get_todaysDate:function(){if(this._todaysDate!==null)return this._todaysDate;return new Date().getDateOnly();},dispose:function(){this._modeOrder=null;if(this._container){this._container.parentNode.removeChild(this._container);this._container=null;}if(this._popupDiv){removeDelegates(this._popupDiv,this._popup$delegates);this._popupDiv=null;}if(this._prevArrow){removeDelegates(this._prevArrow,this._cell$delegates);this._prevArrow=null;}if(this._prevArrowImage){removeDelegates(this._prevArrowImage,this._cell$delegates);this._prevArrowImage=null;}if(this._nextArrow){removeDelegates(this._nextArrow,this._cell$delegates);this._nextArrow=null;}if(this._nextArrowImage){removeDelegates(this._nextArrowImage,this._cell$delegates);this._nextArrowImage=null;}if(this._titles){this._title=[null,null,null];}if(this._today){this._today=null;}var i,j,row;if(this._daysRow){for(i=0;i<this._daysBody.rows.length;i++){row=this._daysBody.rows[i];for(j=0;j<row.cells.length;j++)removeDelegates(row.cells[j].firstChild,this._cell$delegates);}this._daysRow=null;}if(this._monthsRow){for(i=0;i<this._monthsBody.rows.length;i++){row=this._monthsBody.rows[i];for(j=0;j<row.cells.length;j++)removeDelegates(row.cells[j].firstChild,this._cell$delegates);}this._monthsRow=null;}if(this._yearsRow){for(i=0;i<this._yearsBody.rows.length;i++){row=this._yearsBody.rows[i];for(j=0;j<row.cells.length;j++)removeDelegates(row.cells[j].firstChild,this._cell$delegates);}this._yearsRow=null;}if(this._button){removeDelegates(this._button,this._button$delegates);this._button=null;}var elt=this._element;removeDelegates(elt,this._element$delegates);},getViewportScrollX:function(){if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft;}if(document.body&&document.body.scrollLeft){return document.body.scrollLeft;}if(window.pageXOffset){return window.pageXOffset;}if(window.scrollX){return window.scrollX;}return 0;},addMonths:function(date,months){date.setMonth(date.getMonth()+months);return date;},getViewportScrollY:function(){if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;if(document.body&&document.body.scrollTop)return document.body.scrollTop;if(window.pageYOffset)return window.pageYOffset;if(window.scrollY)return window.scrollY;return 0;},show:function(){if(!this._container){this._buildIFrame();this._buildCalendar();this._buildHeader(0);this._buildHeader(1);this._buildHeader(2);this._buildBody(0);this._buildBody(1);this._buildBody(2);this._buildFooter();}if(this.isNonPopup)return;if(!this._isIEen){this._isIEen=true;this._switchMonth(null);var _this=this;this._showTimer=setInterval(function(){var rect=_this._element.getClientRects()[0];var x=rect.left+_this.getViewportScrollX();var y=rect.top+_this._element.offsetHeight+_this.getViewportScrollY();var v=_this.viewport();var xOverflow=x+540-(v.x+v.cx);if(xOverflow>0)x-=xOverflow;var yOverflow=y+169-(v.y+v.cy);if(yOverflow>0)y=rect.top+_this.getViewportScrollY()-169;$(_this._iframe).pos(x,y).show();$(_this._popupDiv).pos(x,y).show();},250);}},viewport:function(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};},hide:function(){clearInterval(this._showTimer);if(this.isNonPopup)return;if(this._isIEen){$(this._popupDiv).hide();$(this._iframe).hide();this._isIEen=false;}},_buildButton:function(){this._buttonID=this._element.id+"_button";$(this._element).wrap("<table cellspacing=0 cellpadding=0 style=display:inline;clear:none;width:91px;height:auto;margin:0;float:left><tr><td style=padding-right:0px></td><td style=padding-right:0px id="+this._buttonID+"_cell ></td></tr></table>");$("#"+this._buttonID+"_cell").html("<a title='Open the calendar popup.' href=# id="+this._buttonID+" style=margin-left:1px;><img width=22px id="+this._buttonID+"_Image src="+urlBase+"/images/calendar.gif alt='Open the calendar popup.' style='border-width:0px;'></a>");this._button=$("#"+this._buttonID)[0];},_buildIFrame:function(){if(!this.isNonPopup)this._iframe=$("<iframe class=shimIFrame style=position:absolute;width:530px;height:155px;display:none />").appendTo(document.body).get(0);},_buildCalendar:function(){if(this.isNonPopup){this._container=$("<div/>").appendTo(this._element).addClass(this._cssClass).get(0);this._popupDiv=$("<div class=ajax__calendar_container style=width:530px tabindex=0 />").appendTo(this._container)[0];}else{this._container=$("<div />").appendTo(document.body).addClass(this._cssClass).get(0);this._popupDiv=$("<div class=ajax__calendar_container style=display:none;width:530px tabindex=0 />").appendTo(this._container)[0];}this._popupDiv.datePicker=this;addDelegates(this._popupDiv,this._popup$delegates);},_buildHeader:function(monthIndex){this._header=$("<div style=width:170px;float:left"+(monthIndex>0?";margin-left:10px":"")+" />").appendTo(this._popupDiv).addClass("ajax__calendar_header_3m").get(0);if(monthIndex==0){var prevArrowWrapper=$("<div/>").appendTo(this._header).get(0);this._prevArrow=$("<div>&lt;&lt;</div>").appendTo(prevArrowWrapper).addClass("ajax__calendar_prev_3m").get(0);this._prevArrow.mode="prev";addDelegates(this._prevArrow,this._cell$delegates);}if(monthIndex==2){var nextArrowWrapper=$("<div/>").appendTo(this._header).get(0);this._nextArrow=$("<div>&gt;&gt;</div>").appendTo(nextArrowWrapper).addClass("ajax__calendar_next_3m").get(0);this._nextArrow.mode="next";addDelegates(this._nextArrow,this._cell$delegates);}var titleWrapper=$("<div/>").appendTo(this._header).get(0);this._titles[monthIndex]=createElement(titleWrapper,"div","ajax__calendar_title");},_buildBody:function(monthIndex){this._body=$("<div class=ajax__calendar_body_3m style=float:left;position:relative;text-align:left;margin:0 >").appendTo(this._popupDiv)[0];if(monthIndex>0){this._body.style.marginLeft="10px";}this._buildDays(monthIndex);},_buildFooter:function(){},_buildDays:function(monthIndex){this._days=$("<div class=ajax__calendar_days>").appendTo(this._body)[0];this._daysTable=$("<table cellspacing=0 cellpadding=0 border=0 style=margin:auto />").appendTo(this._days)[0];this._daysTableHeader=createElement(this._daysTable,"thead");this._daysTableHeaderRows[monthIndex]=createElement(this._daysTableHeader,"tr");this._daysBodys[monthIndex]=createElement(this._daysTable,"tbody");var i,dayCell;for(i=0;i<7;i++){dayCell=createElement(this._daysTableHeaderRows[monthIndex],"td");createElement(dayCell,"div","ajax__calendar_dayname");}for(i=0;i<6;i++){var daysRow=createElement(this._daysBodys[monthIndex],"tr");for(var j=0;j<7;j++){dayCell=createElement(daysRow,"td");var dayDiv=createElement(dayCell,"div","ajax__calendar_day");dayDiv.mode="day";dayDiv.innerHTML="&nbsp;";dayDiv.title=this._shortestDayNames[j];addDelegates(dayDiv,this._cell$delegates);}}},_performLayout:function(){var elt=this._element;var selectedDate=this.get_selectedDate();var visibleDate=this._getEffectiveVisibleDate();var todaysDate=this.get_todaysDate();if((selectedDate>this._maxDate||selectedDate<this._minDate)&&selectedDate){this._element.value="";alert("Arrival date is incorrect");this._selectedDate=this._minDate;return;}var i,j,row,cell,dayCell;var vDate=new Date(visibleDate);for(var monthIndex=0;monthIndex<3;monthIndex++){var daysToBacktrack=vDate.getDay()-this._firstDayOfWeek;if(daysToBacktrack<=0){daysToBacktrack+=7;}var startDate=new Date(vDate.getFullYear(),vDate.getMonth(),vDate.getDate()-daysToBacktrack);this.layoutDays(this._daysTableHeaderRows[monthIndex],this._daysBodys[monthIndex],startDate,vDate);var title=this._titles[monthIndex];title.innerHTML=this._longMonthNames[vDate.getMonth()]+", "+vDate.getFullYear();title.date=vDate;vDate=AddMonth(vDate);}this._prevArrow.date=new Date(visibleDate.getFullYear(),visibleDate.getMonth()-1,1);this._nextArrow.date=new Date(visibleDate.getFullYear(),visibleDate.getMonth()+1,1);},layoutDays:function(daysTableHeaderRow,daysBody,currentDate,visibleDate){for(i=0;i<7;i++){dayCell=daysTableHeaderRow.cells[i].firstChild;dayCell.innerHTML=this._shortestDayNames[(i+this._firstDayOfWeek+6)%7];}for(var week=0;week<6;week++){var weekRow=daysBody.rows[week];for(var dayOfWeek=0;dayOfWeek<7;dayOfWeek++){dayCell=weekRow.cells[dayOfWeek].firstChild;dayCell.innerHTML=currentDate.getDate();dayCell.date=currentDate;if(currentDate<this._minDate||currentDate>this._maxDate)dayCell.parentNode.className="ajax__calendar_unable";else
dayCell.parentNode.className=this._getCssClass(currentDate,visibleDate,'d');if(dayOfWeek>=5)addCssClass(dayCell.parentNode,"ajax__calendar_weekend");if(typeof isBooked!="undefined"&&isBooked(currentDate.getFullYear(),currentDate.getMonth()+1,currentDate.getDate()))dayCell.parentNode.className+=" bookedDate";currentDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()+1);}}},_fireChanged:function(){var elt=this._element;if(document.createEventObject)elt.fireEvent("onchange");else if(document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",true,true);elt.dispatchEvent(e);}},_switchMonth:function(date){this._visibleDate=date;this._performLayout();},_isSelected:function(date,part){var value=this.get_selectedDate();if(!value){return false;}switch(part){case'd':if(date.getDate()!=value.getDate()){return false;}case'M':if(date.getMonth()!=value.getMonth()){return false;}case'y':if(date.getFullYear()!=value.getFullYear()){return false;}break;}return true;},_isOther:function(date,shownDate,part){switch(part){case'd':return(date.getFullYear()!=shownDate.getFullYear()||date.getMonth()!=shownDate.getMonth());case'M':return false;case'y':var minYear=(Math.floor(shownDate.getFullYear()/10)*10);return date.getFullYear()<minYear||(minYear+10)<=date.getFullYear();}return false;},_getCssClass:function(date,shownDate,part){return this._isSelected(date,part)?"ajax__calendar_active":(this._isOther(date,shownDate,part)?"ajax__calendar_other":"");},_getEffectiveVisibleDate:function(){var value=this._visibleDate;if(value===null)value=this.get_selectedDate();if(value===null)value=this.get_todaysDate();return new Date(value.getFullYear(),value.getMonth(),1);},_onblur:function(){this._focus.cancel();this.hide();},_onfocus:function(){this._blur.cancel();this._element.focus();},_element_onfocus:function(e){this._focus.cancel();this._blur.cancel();this.show();},_element_onblur:function(e){if((e.type=='blur'&&!Browser.isIE)||(e.type=='focusout'&&Browser.isIE)){this._focus.cancel();this._blur.post();}},_element_onchange:function(e){if(!this._selectedDateChanging){var elt=this._element;this._selectedDate=ParseEuroShortDate(elt.value);this._switchMonth(this._selectedDate);}},_popup_onfocus:function(e){if((e.type=='focus'&&!Browser.isIE)||(e.type=='activate'&&Browser.isIE)||Browser.isSf||Browser.isOp){this._blur.cancel();this._focus.post();}},_popup_ondragstart:function(e){e.stopPropagation();e.preventDefault();},_popup_onselect:function(e){e.stopPropagation();e.preventDefault();},_cell_onmouseover:function(e){if(Browser.isSf){for(var i=0;i<this._daysBody.rows.length;i++){var row=this._daysBody.rows[i];for(var j=0;j<row.cells.length;j++)removeCssClass(row.cells[j].firstChild.parentNode,"ajax__calendar_hover");}}var target=e.target?e.target:e.srcElement;if(!hasCssClass(target.parentNode,'bookedDate')&&!hasCssClass(target.parentNode,'ajax__calendar_unable'))addCssClass(target.parentNode,"ajax__calendar_hover");if(e.stopPropagation)e.stopPropagation();return false;},_cell_onmouseout:function(e){var target=e.target?e.target:e.srcElement;removeCssClass(target.parentNode,"ajax__calendar_hover");if(e.stopPropagation)e.stopPropagation();return false;},_cell_onclick:function(e){if(Browser.isSf||Browser.isOp)this._popup_onfocus(e);var target=e.target?e.target:e.srcElement;var visibleDate=this._getEffectiveVisibleDate();var isTargetDateInTheDateRange=target.date>=this._minDate&&target.date<=this._maxDate;var isTargetMonthValid=(target.date.getMonth()>=this._minDate.getMonth()&&target.date.getYear()==this._minDate.getYear()||target.date.getYear()>this._minDate.getYear());var isTargetYearValid=target.date.getYear()<=this._maxDate.getYear()&&target.date.getYear()>=this._minDate.getYear();var visibleDate=this._getEffectiveVisibleDate();removeCssClass(target.parentNode,"ajax__calendar_hover");switch(target.mode){case"prev":case"next":if(isTargetMonthValid&&isTargetYearValid&&target.date<=this._maxDate){this._switchMonth(target.date);break;}else
return;case"day":if(isTargetDateInTheDateRange){if(hasCssClass(target.parentNode,'bookedDate'))break;this.set_selectedDate(target.date);this._switchMonth(target.date);$(this._element).trigger("changed");this.hide();if(this.isNonPopup){var id=this._element.id;var fn=id+"_change('"+dateFormat(target.date)+"')";eval(fn);}}else
return;break;case"today":this.set_selectedDate(target.date);this._switchMonth(target.date);this.hide();break;}if(e.stopPropagation)e.stopPropagation();if(e.preventDefault)e.preventDefault();return false;},_button_onclick:function(e){if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();this._element.focus();}};$(function(){$(".dateEntryThreeMonths").each(function(){new DatePickerThreeMonths(this);});$(".dateSelectThreeMonths").each(function(){new DatePickerThreeMonths(this,true);});if(document.activeElement&&$(document.activeElement).hasClass("dateEntryThreeMonths"))$.data(document.activeElement,"DatePickerThreeMonths").show();});function hidePickers(){$(".ajax__calendar_container").each(function(){this.datePicker.hide();});}

var weekWidth=420;var dayWidth=weekWidth/7;var leftPanelWidth=191;var dayCount=60;var totalWidth=dayWidth*dayCount;var propertyColorCount=3;var propertyRoomTypeCount=[];var typeExpanded=[];var typeRoomCount=[];var propertyExpanded=[];var frameName="";var items=[];var itemCount=0;var propertyCount=0;var typeCount=0;var roomCount=0;var propertyRoomTypes=[];var roomTypeRooms=[];var roomNames=[];var itemRowTemplate;var itemIds=[];var propertyIds=[];var roomTypeIds=[];var roomIds=[];var propertyNames=[];var _backgroundElement;var rates=[];function attachButtonHandlers(){var id=this.id;$("#"+id+" input:button").each(function(){var bid=this.id;if(bid.substring(0,id.length)==id){bid=bid.substring(id.length);if(bid.substring(0,6)=="Button"){bid=bid.substring(6);this.onclick=createDelegate(eval(id),eval(id+".OnButton"+bid));}}});}$(function(){$('span.modalClose').top(Browser.isIE?1:2).right((Browser.isIE&&Browser.ver==6)?10:2);$('span.modalRight').right((Browser.isIE&&Browser.ver==6)?26:18);$('span.modalButtons2').right((Browser.isIE&&Browser.ver==6)?14:6);$('div.modalPopup').each(attachButtonHandlers);$('div.modalPopup4').each(attachButtonHandlers);if(!window.FrameTop)return;if(document.body.style.MozUserSelect){document.body.style.MozUserSelect="none";}var date=new Date();date.setHours(0,0,0,0);date=AddDays(date,-7);FrameTop.setDate(date);FrameTopLeft.setDate(date);var scrollSync=function(){var x=e("calBody").scrollLeft;var y=e("calBody").scrollTop;$("#topScroll").left(-x);e("calLeft").scrollTop=y;FrameTop.checkMonthNameVisible(x);};$("#calBody").scroll(scrollSync);if(Browser.isCh){$(document.body).scroll(scrollSync);}var checkScroll;if(Browser.isIE||Browser.isSf){checkScroll=function(){scrollSync();setTimeout(checkScroll,Browser.isSf?100:250);};setTimeout(checkScroll,Browser.isSf?100:250);}$(document.body).mousedown(md).mousemove(mm).mouseup(mu);FrameBodyLeft.QueryCalendar();});function forXml(xml,tag,fields,callback){fields=fields.split(',');$.each(xml.getElementsByTagName(tag),function(){var s=[];for(var elId in fields){var elName=fields[elId];s[elName]=XmlGetValue(this,elName);}callback(s);});}function dateFormat(date){if(!date)return"";var day=String(date.getDate());var month=date.getMonth()+1;if(month<10)month="0"+String(month);else{month=String(month);}var year=date.getYear();year=year<1900?String(year+1900):String(year);return day+"/"+month+"/"+year;}function dateFormatShort(date){var result="";if(date){var day=date.getDate();if(day<10)result+="0";result+=String(day)+"/";var month=date.getMonth()+1;if(month<10)result+="0";result+=String(month)+"/";var year=date.getYear()%100;if(year<10)result+="0";result+=String(year);}return result;}function XmlGetValue(node,name){var element=node.getElementsByTagName(name);return element&&element[0]&&element[0].firstChild?element[0].firstChild.data:"";}function Today(){var result=new Date();return _Date(result.getFullYear(),result.getMonth(),result.getDate());}function _Date(year,month,day){var result=new Date();result.setHours(0,0,0,0);result.setDate(1);if(year<100){year=(year*1)+2000;}result.setFullYear(year);result.setMonth(month);result.setDate(day);if(result.getMonth()!=month){return null;}if(result.getDate()!=day){return null;}return result;}function AddDays(d,n){var result=new Date(d);for(var i=0;i<Math.abs(n);i++){result.setDate(result.getDate()+(n>=0?1:-1));result=_Date(result.getFullYear(),result.getMonth(),result.getDate());}return result;}function ParseEuroShortDate(input){if(!input)return null;var parts=input.split('/');if(parts.length!=3)return null;var year=parts[2];var month=parts[1]-1;var day=parts[0];if(month<0||month>11)return null;if(day<1||day>31)return null;return _Date(year,month,day);}function ParseUSShortDate(input){var parts=input.split('/');if(parts.length!=3){return null;}var year=parts[2];var month=parts[0]-1;var day=parts[1];year=String(year).substring(0,4);return((parseInt(year)==0)||(month<0||month>11)||(day<1||day>31))?null:_Date(year,month,day);}var queries=[];var modalQueries=[];var modalQueryCount=0;var blockedUIs=[];var blockedUICount=0;function genGuid(){if(window.ActiveXObject){try{return new ActiveXObject("Scriptlet.TypeLib").GUID;}catch(e){}}var result='';for(var j=0;j<32;j++){if(j==8||j==12||j==16||j==20)result=result+'-';var i=Math.floor(Math.random()*16).toString(16).toUpperCase();result=result+i;}return result;}function query(key,parent,url,callback){var req;if(queries[key]){req=queries[key];req.abort();}queries[key]=req=(typeof XMLHttpRequest!="undefined")?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");modalQueries[++modalQueryCount]={key:key,parent:parent,url:url,callback:callback,req:req};var argsSepLocation=url.indexOf('?');var urlPart=url.substring(0,argsSepLocation);var argsPart=url.substring(argsSepLocation+1);req.open("POST",urlPart,true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.setRequestHeader("Content-length",argsPart.length);req.setRequestHeader("Connection","close");req.send(argsPart+"&nocache="+genGuid());req.onreadystatechange=function(){var error;var uiBlock;if(req.readyState==4&&typeof req.responseText!="unknown"){req.onreadystatechange=(Browser.isIE&&Browser.ver<7)?function(){}:null;queries[key]=null;if(req.status==408||req.status==504){modalQueries[modalQueryCount].retryCount++;var retryMs=(modalQueries[modalQueryCount].retryCount*modalQueries[modalQueryCount].retryCount)*1000;if(retryMs>30000){retryMs=30000;}modalQueries[modalQueryCount].timeout=window.setTimeout("ReQuery()",retryMs);TestModalQueryComplete(req);}else if(req.status==403){ReloginForm.Show(ReQuery);TestModalQueryComplete(req);}else if(req.status==200){modalQueries[modalQueryCount--]=null;callback(req);TestModalQueryComplete(req);}else if(req.status==400){error=req.responseXML.getElementsByTagName("e");ValidationForm.Reset();if(error.length==1)ValidationForm.Add(error[0].firstChild.nodeValue.replace('&lt;','<').replace('&gt;','>'));else
ValidationForm.Add("Unknown validation error.");uiBlock=blockedUIs[blockedUICount];UnblockUI(uiBlock.parent);modalQueries[modalQueryCount--]=null;ValidationForm.Show();TestModalQueryComplete(req);}else if(req.status===0){}else{error="A server error has occurred. TakeABreak technical support have been informed.<br>Please try again shortly, or call support for more information.<br><br>We apologise for any inconvenience.";if(req.responseXML){var errorXml=req.responseXML.getElementsByTagName("message");if(errorXml.length==1){error=errorXml[0].firstChild.nodeValue.replace('&lt;','<').replace('&gt;','>').replace(/\n/g,"<br>");}}uiBlock=blockedUIs[blockedUICount];UnblockUI(uiBlock.parent);modalQueries[modalQueryCount--]=null;ErrorForm.Show(error);TestModalQueryComplete(req);}}};}var modalQueryCompleteCallback=null;function TestModalQueryComplete(req){if(modalQueryCompleteCallback){var callback=modalQueryCompleteCallback;modalQueryCompleteCallback=null;callback(req);}}function ReQuery(){var uiBlock=blockedUIs[blockedUICount];if(uiBlock.message.className!='modalRetryIcon'){uiBlock.message.className='modalRetryIcon';var m=document.createTextNode("Retrying...");uiBlock.message.appendChild(m);SizeUIBlock(uiBlock);}query(modalQueries[modalQueryCount].key,modalQueries[modalQueryCount].parent,modalQueries[modalQueryCount].url,modalQueries[modalQueryCount].callback);modalQueries[modalQueryCount--]=null;}function ModalQuery(key,parent,url,callback){while(modalQueryCount>0&&modalQueries[modalQueryCount].key==key){window.clearTimeout(modalQueries[modalQueryCount].timeout);var uiBlock=blockedUIs[blockedUICount];UnblockUI(uiBlock.parent);modalQueries[modalQueryCount--]=null;}BlockUI(parent);query(key,parent,url,function(req){UnblockUI(parent);callback(req);});}function Create(parent,type){var element=parent.document?parent.document.createElement(type):document.createElement(type);parent.appendChild(element);return element;}function BlockUI(parent,dialog,visible,alreadyPositioned){var container=parent?parent:document.body;parent=parent?parent:window;var z=10*(blockedUICount+1);var element=$("<div/>").appendTo(container).css('position','absolute').css("zIndex",z).get(0);var fade=$("<div/>").appendTo(element).addClass('modalBG').get(0);var message;if(dialog){message=dialog;$(message).show().css("zIndex",z+1);allowDrag=true;if(!alreadyPositioned)PositionUIBlockMessage(container,message);fade.onclick=FlashForegroundWindow;}else{allowDrag=false;message=$("<div/>").appendTo(element).addClass('modalBusyIcon').css("zIndex",z+1).get(0);}var uiBlock=blockedUIs[++blockedUICount]={parent:parent,container:container,element:element,fade:fade,message:message,allowDrag:allowDrag};if(!alreadyPositioned)SizeUIBlock(uiBlock);$(window).bind("resize.caldlg"+blockedUICount,function(){SizeUIBlock(uiBlock);}).bind("scroll.caldlg"+blockedUICount,function(){SizeUIBlock(uiBlock);});}function FlashForegroundWindow(){flashTitle(blockedUIs[blockedUICount].message);}function getPageSizeWithScroll(){if(window.innerHeight!=undefined&&window.scrollMaxY!=undefined){yWithScroll=window.innerHeight+window.scrollMaxY;xWithScroll=window.innerWidth+window.scrollMaxX;}else if(window.innerHeight&&document.body.scrollHeight>document.body.offsetHeight){yWithScroll=(window.innerHeight>document.body.scrollHeight)?window.innerHeight:document.body.scrollHeight;xWithScroll=(window.innerWidth>document.body.scrollWidth)?window.innerWidth:document.body.scrollWidth;}else if(document.body.scrollHeight>document.body.offsetHeight){yWithScroll=document.body.scrollHeight;xWithScroll=document.body.scrollWidth;}else{yWithScroll=document.body.offsetHeight;xWithScroll=document.body.offsetWidth;}arrayPageSizeWithScroll=new Array(xWithScroll,yWithScroll);return arrayPageSizeWithScroll;}function SizeUIBlock(uiBlock){var width;var height;if(uiBlock.parent.tagName=="BODY"||typeof(uiBlock.parent.tagName)=="undefined"){var size=getPageSizeWithScroll();width=size[0];height=size[1];}else{width=GetWidth(uiBlock.parent);height=GetHeight(uiBlock.parent);}$(uiBlock.element).bounds(uiBlock.container.scrollLeft,uiBlock.container.scrollTop,width,height);$(uiBlock.fade).size(width,height);if(!uiBlock.allowDrag)PositionUIBlockMessage(uiBlock.parent,uiBlock.message);}function PositionUIBlockMessage(parent,message){var left=(GetWidth(parent)-message.clientWidth)/2;var top=(GetHeight(parent)-message.clientHeight)/3;$(message).pos(left>=0?left:0,top>=0?top:0);}function UnblockUI(parent){var uiBlock=blockedUIs[blockedUICount];if(parent&&uiBlock.parent!=parent){alert("Block/Unblock mismatch");return;}$(uiBlock.message).stop().hide();$(window).unbind("resize.caldlg"+blockedUICount).unbind("scroll.caldlg"+blockedUICount);uiBlock.container.removeChild(uiBlock.element);blockedUIs[blockedUICount--]=null;}function GetWidth(element){if(element.innerWidth)return element.innerWidth;if(element.window==element&&element.document.documentElement)return element.document.documentElement.clientWidth;return element.clientWidth;}function GetHeight(element){if(element.tagName=="BODY")return GetWindowHeight();if(element.innerHeight)return element.innerHeight;if(element.window==element&&element.document.documentElement)return element.document.documentElement.clientHeight;return element.clientHeight;}var oldCursor;var draggingElement;var dragXoffset;var dragYoffset;var dragFocussedCount;function DragParent(e){hidePickers();if(!e){e=window.event;}if(e.button<=1){var target=e.currentTarget?e.currentTarget.parentNode:e.srcElement.parentNode;var clicked=e.originalTarget?e.originalTarget:e.srcElement;if(clicked.tagName=='IMG'){return false;}while(target.className!='modalPopup'&&target.className!='modalPopup4')target=target.parentNode;dragXoffset=e.clientX-parseInt(DePx(target.style.left),10);dragYoffset=e.clientY-parseInt(DePx(target.style.top),10);oldCursor=target.style.cursor;target.style.cursor='move';$(document).bind("mousemove.caldlgdrag",OnDragMove).bind("mouseup.caldlgdrag",OnDragFinish);$(window).bind("focus.caldlgdrag",OnDragFocus);$(document.body).bind("selectstart.caldlgdrag",function(){return false;});ClearSelection();draggingElement=target;dragFocussedCount=0;return CancelMouseEvent(e);}}function OnDragMove(e){if(!e)e=window.event;if(e.button<=1&&draggingElement){ClearSelection();var left=e.clientX-dragXoffset;var top=e.clientY-dragYoffset;var maxLeft=GetWindowWidth()-GetWidth(draggingElement);var maxHeight=GetWindowHeight()-GetHeight(draggingElement);left=left<maxLeft?left:maxLeft;top=top<maxHeight?top:maxHeight;draggingElement.style.left=left<0?'0px':(left+'px');draggingElement.style.top=top<0?'0px':(top+'px');return CancelMouseEvent(e);}}function OnDragFocus(){if(++dragFocussedCount>1)OnDragFinish();}function OnDragFinish(e){$(document).unbind("mousemove.caldlgdrag").unbind("mouseup.caldlgdrag");$(window).unbind("focus.caldlgdrag");$(document.body).unbind("selectstart.caldlgdrag");if(draggingElement){draggingElement.style.cursor=oldCursor;draggingElement=null;}return CancelMouseEvent(e);}function ClearSelection(){if(document.selection&&document.selection.clear){document.selection.clear();}else if(window.getSelection){var selection=window.getSelection();return;}}function AddArg(query,key,value){return AddArgNoTrim(query,key,(""+value).trim());}function AddArgNoTrim(query,key,value){query=trim(query);if(query!=="")query+="&";query+=escape(key)+"="+escape(value);return query;}function NumNights(date1,date2){var d=DaysDifference(date1,date2);return"= "+d+(d==1?" night":" nights");}function DaysDifference(date1,date2){if(!date1||!date2){return 0;}var t1=date1.getTime();var t2=date2.getTime();var ms=t2-t1;var s=ms/1000;var h=s/3600;var d=h/24;if(d<0){d=0;}d=Math.round(d);return d;}function GetRoomTypeIndexFromId(id){return Rooms.RoomType(id).index;}function GetRoomIndexFromId(id){if(id==0||Rooms.Room(id)==null)return 0;return Rooms.Room(id).index;}function AddRooms(doc,rs,roomIdList,dateFrom,dateTo,bookingId,_propertyId){var selectedRoomIds=roomIdList.split(',');rs.innerHTML="";var propertyId=_propertyId;if(roomIdList!=""){propertyId=Rooms.GetPropertyOfRoom(selectedRoomIds[0]).id;}var view=$(rs).html("");var base=$("<ul>").appendTo(view);$.each(Rooms.properties,function(i,property){var pNode=$("<li>").html("<a href=# class=node_p>&nbsp;"+property.name.escapeHTML()+"&nbsp;</a>").appendTo(view);pNode.get(0).id="p_"+property.id;var rtParent=$("<ul>").appendTo(pNode);rtParent.get(0).id="u_"+property.id;$.each(Rooms.roomTypes,function(i,roomType){if(roomType.propertyId==property.id){var rtNode=$("<li>").html("<a href=# class=node_rt>&nbsp;"+roomType.name.escapeHTML()+"&nbsp;</a>").appendTo(rtParent);rtNode.get(0).id="rt_"+roomType.id;var rParent=$("<ul>").appendTo(rtNode);$.each(Rooms.rooms,function(i,room){if(room.roomTypeId==roomType.id){var selected=false;for(var index=0;index<selectedRoomIds.length;index++){if(selectedRoomIds[index]*1==room.id){selected=true;break;}}var dateLeaving=new Date(dateTo);var enabled=!IsRoomBookedRange(i+1,dateFrom,dateLeaving,bookingId);if(!enabled)selected=false;var rNode=$("<li>").html("<table cellspacing=0 cellpadding=0><tr><td><input type=checkbox id=selectRoom_"+room.id+(selected?" checked":"")+(enabled?"":" disabled")+"></td><td><a href=# class=node_r onclick=e('selectRoom_"+room.id+"').checked=!e('selectRoom_"+room.id+"').checked >&nbsp;"+room.name.escapeHTML()+"&nbsp;</a></td></tr></table>").appendTo(rParent);}});}});});view.treeview({animated:"fast",collapsed:false,unique:false,selectable:true,persist:"function",serialize_save:function(data){window.RoomData=data;},serialize_load:function(){return window.RoomData;}});}function GetSelectedRooms(doc,rs){var list="";$("#BookingRoomSelectForm").find("input").each(function(i,input){if(input.checked){if(list!==""){list+=",";}var parts=input.id.split('_');list+=parts[1];}});return list;}function IsRoomBooked(roomIndex,date,excludeBookingId){for(var i=0;i<CalData.bookings.length;i++){var details=CalData.bookings[i];if(details.roomIndex==roomIndex){if(details.bookingId!=excludeBookingId){if(date.getTime()>=details.dateFrom.getTime()&&date.getTime()<details.dateTo.getTime()){return true;}}}}return false;}function IsRoomBookedRange(roomIndex,dateFrom,dateTo,excludeBookingId){if(!window.CalData)return false;if(CalData.bookings.length&&dateFrom&&dateTo){if(dateFrom.getTime()<dateTo.getTime()){for(var day=new Date(dateFrom);day.getTime()<dateTo.getTime();day=AddDays(day,1)){if(IsRoomBooked(roomIndex,day,excludeBookingId)){return true;}}}}return false;}function GetRoomList(roomIdList){if(roomIdList.toString().length==0)return"";var roomIds=roomIdList.split(',');var roomList="";for(var index=0;index<roomIds.length;index++){var roomId=roomIds[index]*1;if(roomId!==""){var roomIndex=GetRoomIndexFromId(roomId);if(roomList!==""){roomList+=", ";}roomList+=Rooms.Room(roomId).name;}}return roomList;}function hescape(value){return value.replace('&','&amp;').replace('>','&gt;').replace('<','&lt;').replace('"','&quot;');}function isDefined(variable){return typeof(variable)!="undefined";}if(Browser.isOp){document.onkeypress=KeyDown;}else{document.onkeydown=KeyDown;}function HasFocus(el){var color=getStyle(el,"backgroundColor");return color!="#ffffff"&&color!="rgb(255, 255, 255)";}function getStyle(element,cssRule){if(document.defaultView&&document.defaultView.getComputedStyle){var style=document.defaultView.getComputedStyle(element,'');var property=cssRule.replace(/[A-Z]/g,function(match,c){return("-"+match).toLowerCase();});var value=style.getPropertyValue(property);return value;}if(element.currentStyle){return element.currentStyle[cssRule];}return false;}var cancelButtons={"Cancel":true,"Close":true,"No":true};var okButtons={"Ok":true,"Next":true,"Finish":true,"Close":true,"Save":true,"Yes":true};function KeyDown(e){e=window.event?window.event:e;var key=e.keyCode;if(key==9&&e.shiftKey&&e.altKey&&e.ctrlKey){TestUI();return false;}if(key==86&&e.shiftKey&&e.altKey&&e.ctrlKey){alert("TakeABreak Property Management, version: "+manage_version);return false;}if(blockedUICount>0){var form=blockedUIs[blockedUICount].message;if((key==27||key==13)&&!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)){return EnterOrEscapePressed(form,key);}else if(key==9&&!(e.altKey||e.ctrlKey||e.metaKey)){if(e.shiftKey)ShiftTabPressed(form);else
TabPressed(form);return CancelMouseEvent(e);}else if(window.focusedElement&&focusedElement.className=="currencyField"){if(!NumericFieldKeyDown(e))return CancelMouseEvent(e);}}return true;}function EnterOrEscapePressed(form,key){if(key==13){var inputs=form.getElementsByTagName("textarea");for(i=0;i<inputs.length;i++){var elem=inputs[i];if(HasFocus(elem)&&!elem.readOnly){return true;}}}var action=key==27?cancelButtons:okButtons;var buttons=form.getElementsByTagName("input");for(var i=0;i<buttons.length;i++){if(buttons[i].type=="button"||buttons[i].type=="submit"){if(action[buttons[i].value]){if(key==13&&buttons[i].className!="defaultButton"){continue;}setTimeout(buttons[i].onclick,25);return false;}}}return true;}var foundFocused;var foundNext;function ElementToString(element){if(!element){return"none";}return element.tagName+" "+element.id+" (child of "+element.parentNode.tagName+" "+element.parentNode.id+")";}function TabPressed(form){foundFocused=false;foundNext=false;FocusNext(form,focusedElement);if(!foundNext){foundFocused=true;FocusNext(form,null);}}function FocusNext(element,focused){if(!foundFocused&&(element==focused)){foundFocused=true;return false;}if(IsVisible(element,true)){if(foundFocused&&(element.tagName=="INPUT"||element.tagName=="TEXTAREA"||element.tagName=="SELECT")&&!element.disabled){if(!element.type||element.type!="hidden"){foundNext=true;element.focus();return true;}}for(var i=0;i<element.childNodes.length;i++)if(FocusNext(element.childNodes[i],focused))return true;}return false;}var lastFocusable;function ShiftTabPressed(form){lastFocusable=null;FocusPrevious(form,focusedElement);if(!lastFocusable){FocusPrevious(form,null);if(lastFocusable)lastFocusable.focus();}}function FocusPrevious(element,focused){if(element==focused){if(lastFocusable)lastFocusable.focus();return true;}if(IsVisible(element,true)){if(element.tagName=="INPUT"||element.tagName=="TEXTAREA"||element.tagName=="SELECT"){if(element.disabled!==true){lastFocusable=element;return false;}}for(var i=0;i<element.childNodes.length;i++)if(FocusPrevious(element.childNodes[i],focused))return true;}return false;}function NumericFieldKeyDown(evt){if(evt.altKey||evt.ctrlKey||evt.metaKey){return true;}var key=(evt.keyCode)?evt.keyCode:evt.which;if(key!==null){key=parseInt(key,10);if((!evt.shiftKey)&&(key==46||key==190))return(focusedElement.value.indexOf(".")==-1);if((!evt.shiftKey)&&((key>=48&&key<=57)||(key>=96&&key<=105)||key==190))return true;return isUserFriendlyChar(key);}return true;}function isUserFriendlyChar(val){return((val==8||val==9||val==13||val==45||val==46)||(val>16&&val<21)||(val>34&&val<41)||val==110);}function ClearDefaultButtons(formElement){foreachChildTag(formElement,"input",function(input){if(input.className=="defaultButton")input.className="";});}function foreachChildTag(parent,tagName,callback){var elements=parent.getElementsByTagName(tagName);for(var i=0;i<elements.length;i++)if(callback(elements[i])===false)break;}foreachChildTag(document,"INPUT",SetFocusHandler);foreachChildTag(document,"TEXTAREA",SetFocusHandler);foreachChildTag(document,"SELECT",SetFocusHandler);function SetFocusHandler(element){$(element).focus(function(){focusedElement=element;});}function SetDefaultButton(formElement){ClearDefaultButtons(formElement);foreachChildTag(formElement,"INPUT",function(input){if((input.type=="button"||input.type=="submit")&&IsVisible(input)&&okButtons[input.value]&&!input.disabled){input.className='defaultButton';return false;}});}function ShowModalDialog(formElement,parentElement,dontFocusFirstElement,positionedAlready){SetDefaultButton(formElement);BlockUI(parentElement,formElement,false,positionedAlready);if(!dontFocusFirstElement){focusedElement=formElement;TabPressed(formElement);}}function IsVisible(element,checkParent){if(element.style&&element.style.display=="none")return false;if(checkParent&&element.parentNode)return IsVisible(element.parentNode,checkParent);return true;}function FormatCurrency(amount,allowWholeDollarsNoCents){var i=parseFloat(amount);if(isNaN(i))i=0.00;var minus='';if(i<0)minus='-';var s=new String(Math.abs(i));if(!allowWholeDollarsNoCents&&s.indexOf('.')<0)s+='.00';if(s.indexOf('.')==(s.length-2))s+='0';s=minus+s;return s;}var showingTooltip=false;var tooltipTimeout;function ShowTooltip(text,x1,x2,y){if(!e("tooltip")){t=document.createElement("div");t.style.display="none";t.id="tooltip";t.className="tooltip";document.body.appendChild(t);s=document.createElement("div");s.style.display="none";s.id="tooltipShadow";s.className="tooltipShadow";document.body.appendChild(s);}var t=e("tooltip");var s=e("tooltipShadow");t.style.left="-10000px";t.style.top="-10000px";t.style.display="block";s.style.display="block";document.body.appendChild(t);document.body.appendChild(s);t.innerHTML="<table cellspacing=0 cellpadding=0><tr><td nowrap>"+text+"</td></tr></table>";var x=FindBestX(x1,x2,t.clientWidth);y=FindBestY(y,t.clientHeight);t.style.display="none";s.style.display="none";t.style.left=(x)+"px";t.style.top=(y)+"px";s.style.left=(x+2)+"px";s.style.top=(y+4)+"px";clearTimeout(tooltipTimeout);showingTooltip=true;showTooltip();}function FindBestX(left,right,width){var maxX=GetWindowScrollX()+document.body.clientWidth;if(right+10+width<=maxX)return right+10;if(left-width-5>GetWindowScrollX())return left-width-5;return right+10;}function FindBestY(top,height){var maxY=GetWindowScrollY()+document.body.clientHeight;if(maxY<GetWindowHeight())maxY=GetWindowHeight();if(top+5+height<=maxY)return top+5;if(top-height-3>GetWindowScrollY())return top-height-3;return top+5;}function showTooltip(){if(showingTooltip){var t=e("tooltip");t.style.display="block";var s=e("tooltipShadow");s.style.width=t.clientWidth+"px";s.style.height=t.clientHeight+"px";s.style.display="block";}}function HideTooltip(){showingTooltip=false;clearTimeout(tooltipTimeout);var t=e("tooltip");if(t)t.style.display="none";var s=e("tooltipShadow");if(s)s.style.display="none";}var popupTimeout;function GetX(element){var left=element.offsetLeft;while(element.offsetParent){var parentOffset=element.offsetParent;left+=parentOffset.offsetLeft;element=parentOffset;}return left;}function GetY(element){var top=element.offsetTop;while(element.offsetParent){var parentOffset=element.offsetParent;top+=parentOffset.offsetTop;element=parentOffset;}return top;}function popupHelp(text,element){var left=GetX(element);var right=left+element.offsetWidth;var y=GetY(element);popupClear();popupTimeout=setTimeout(function(){ShowTooltip(text,left,right,y);},300);}function popupHelpMouse(text,element,event){if(!event)event=window.event;var left=mouseXfromEv(event)-10;var right=mouseXfromEv(event)+20;var y=mouseYfromEv(event);popupClear();popupTimeout=setTimeout(function(){ShowTooltip(text,left,right,y);},300);}function popupClear(){clearTimeout(popupTimeout);HideTooltip();}function dropDownValue(id){var element=e(id);if(!element)return"";if(!(element.options)&&(element.selectedIndex))return element.value;if(!(element.selectedIndex)&&(element.selectedIndex!=0))return"";if(!isDefined(element.options)&&isDefined(element.selectedIndex))return element.value;if(element.selectedIndex==-1)return"";var option=element.options[element.selectedIndex];return option.value!==""?option.value:option.innerHTML;}function setDropDownValue(id,value){var element=e(id);if(value===""){element.selectedIndex=-1;return;}for(var i=0;i<element.options.length;i++){var option=element.options[i];if(option.value==value){element.selectedIndex=i;return;}if(option.innerHTML==value){element.selectedIndex=i;return;}}element.value=value;}function mouseXfromEv(ev){return isDefined(ev.pageX)?ev.pageX:(GetWindowScrollX()+ev.clientX);}function mouseYfromEv(ev){return isDefined(ev.pageY)?ev.pageY:(GetWindowScrollY()+ev.clientY);}function flashTitle(dialog){var titleDiv=null;foreachChildTag(dialog,"DIV",function(div){if(div.className=="modalCaption"||div.className=="modalCaptionError"||div.className=="modalCaption4"){titleDiv=div;return false;}});if(titleDiv)flashDiv(titleDiv);}var flashing=null;var flashingFrom=null;function flashDiv(div){flashing=div;flashingFrom=div.className;setTimeout(function(){flashing.className=flashingFrom;flashing=null;},500);toggleDivFlash();}function toggleDivFlash(){if(flashing){flashing.className=flashing.className==flashingFrom?(flashingFrom+"Flashed"):flashingFrom;setTimeout(toggleDivFlash,75);}}function log(text){if(window.console)console.log(text);}function createElement(parent,tagName,className){var el=document.createElement(tagName);parent.appendChild(el);el.className=className;return el;}Date.prototype.getDateOnly=function Date$getDateOnly(){return new Date(this.getFullYear(),this.getMonth(),this.getDate());};function removeCssClass(el,className){if(el&&el.className){var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;)if(cls[--i]!=className)ar[ar.length]=cls[i];el.style.display="none";el.className=ar.join(" ");el.style.display="";}}function removeCssClasses(el,classNames){for(var i=0;i<classNames.length;i++)removeCssClass(el,classNames[i]);}function addCssClass(el,className){if(el){removeCssClass(el,className);el.style.display="none";el.className+=" "+className;el.style.display="";}}function addDelegates(el,delegates){for(var ev in delegates){var delegate=delegates[ev];addDelegate(el,ev,delegate);}}function addDelegate(el,event,delegate){if(el.addEventListener)el.addEventListener(event,delegate,false);else if(el.attachEvent){event="on"+event;el.attachEvent(event,delegate);}}function removeDelegates(el,delegated){for(var ev in delegates){var delegate=delegates[ev];removeDelegate(el,ev,delegate);}}function removeDelegate(el,event,delegate){if(el.detachEvent)el.detachEvent(event,delegate);else
el.removeEventListener(event,delegate,false);}function getVisible(element){return(element&&("none"!=element.style.display)&&("hidden"!=element.style.visibility));}DeferredOperation=function(delay,context,callback){this._delay=delay;this._context=context;this._callback=callback;this._completeCallback=null;this._errorCallback=null;this._timer=null;this._callArgs=null;this._isComplete=false;this._completedSynchronously=false;this._asyncResult=null;this._exception=null;this._throwExceptions=true;this._oncomplete$delegate=createDelegate(this,this._oncomplete);this.post=createDelegate(this,this.post);};DeferredOperation.prototype={get_isPending:function(){return(this._timer!==null);},get_isComplete:function(){return this._isComplete;},get_completedSynchronously:function(){return this._completedSynchronously;},get_exception:function(){return this._exception;},get_throwExceptions:function(){return this._throwExceptions;},set_throwExceptions:function(value){this._throwExceptions=value;},get_delay:function(){return this._delay;},set_delay:function(value){this._delay=value;},post:function(args){var ar=[];for(var i=0;i<arguments.length;i++){ar[i]=arguments[i];}this.beginPost(ar,null,null);},beginPost:function(args,completeCallback,errorCallback){this.cancel();this._callArgs=(args||[]).concat();this._completeCallback=completeCallback;this._errorCallback=errorCallback;if(this._delay==-1){this._oncomplete();this._completedSynchronously=true;}else{this._timer=setTimeout(this._oncomplete$delegate,this._delay);}},cancel:function(){if(this._timer){clearTimeout(this._timer);this._timer=null;}this._callArgs=null;this._isComplete=false;this._asyncResult=null;this._completeCallback=null;this._errorCallback=null;this._exception=null;this._completedSynchronously=false;},complete:function(){if(this._timer){try{this._oncomplete();}finally{this._completedSynchronously=true;}return this._asyncResult;}else if(this._isComplete){return this._asyncResult;}},_oncomplete:function(){var args=this._callArgs;var completeCallback=this._completeCallback;var errorCallback=this._errorCallback;this.cancel();try{if(args)this._asyncResult=this._callback.apply(this._context,args);else
this._asyncResult=this._callback.call(this._context);this._isComplete=true;this._completedSynchronously=false;if(completeCallback)completeCallback(this);}catch(e){this._isComplete=true;this._completedSynchronously=false;this._exception=e;if(errorCallback&&errorCallback(this))return;if(this._throwExceptions)throw e;}}};function BookingStatusDescription(status){switch(status){case'e':return"Owner Entered";case'a':return"Deposit Outstanding";case'f':return"Full Payment Outstanding";case'd':return"Deposit Paid";case'b':return"Balance Outstanding";case'c':return"Full Payment Paid";case'l':return"Deposit Expired";case'm':return"Full Payment Expired";case'x':return"Cancelled";default:return"TakeABreak Enquiry";}}function bookingExpired(d){var arrD=d.toString().split("/");var date=_Date(parseInt(arrD[2]),parseInt(arrD[1])-1,parseInt(arrD[0]));return date<new Date();}

window.bookButtonText="Next &gt;&gt;";window.thisPageNo=1;document.onkeypress=function(evt){var evt=(evt)?evt:((event)?event:null);var node=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);if(evt.keyCode==13){return false;}};var pId;function Track_RateCalcPanel(name){if(window.pageTracker&&pageTracker._trackPageview)if(window.console&&console.log)console.log("Tracked RateCalcPanel: "+name);}$(function(){window.estimatedPrice=0;if(allowRequestBooking&&allowEnquiry)$("#allowBoth").show();else if(allowRequestBooking)$("#allowOnlyBooking").show();else
$("#allowOnlyEnquiry").show();if($("#calcAdults").length==0)return;if(window.bookButtonText)$("#bookButton").html(bookButtonText).removeClass("btn150").addClass("btn75");Track_RateCalcPanel('Shown');pId=$("#Property").val();Rooms.Query(function(){$.each(Rooms.roomTypes,function(i,roomType){var title=roomType.name.escapeHTML()+" (sleeps "+roomType.sleeps+")";var tip=title+(roomType.sleepingconfig!=""?" - "+roomType.sleepingconfig:"");var d=$("<div id=roomTypeLine_"+roomType.id+" class='tooltipTitle roomTypeLine' title='"+tip+"'>").hide().appendTo($("#roomTypeHolder")).tooltip();$("<div style=float:left><select onchange=RoomsOrPeopleChanged()></span>").appendTo(d);$("<div style=float:right class=infoicon>").appendTo(d);$("<div style=padding-top:4px>&nbsp;"+title+"</div>").appendTo(d);$("<div style=clear:both>").appendTo(d);});if(maxAdults>0){$("#calcAdults").empty();$("#calcChildren").empty();for(var i=0;i<=maxAdults;i++){$("<option>"+i+"</option>").appendTo($("#calcAdults"));$("<option>"+i+"</option>").appendTo($("#calcChildren"));}setDropDownValue("calcAdults",2);}_DateChanged();},pId);});function SetMessage(id,msg,tooltip){if(id=="warning")_SetMessage("calcPrice");else
_SetMessage("warning");_SetMessage(id,msg,tooltip);}function _SetMessage(id,msg,tooltip){if(msg==null)msg="";if(tooltip==null)tooltip="";var e=$("#"+id);if(e[0]){e[0].title=tooltip;e.html(msg).tooltip();}}function IsSingleRoomProperty(){return Rooms.rooms.length==1;}function DateChanged(){Track_RateCalcPanel('DateChanged');_DateChanged();}function NightsChanged(){var nights=dropDownValue("calcStaying");Track_RateCalcPanel('NightsChanged/'+nights);_NightsChanged();}function RoomsOrPeopleChanged(){Track_RateCalcPanel('RoomsOrPeopleChanged');_RoomsOrPeopleChanged();}function _DateChanged(){var nights=dropDownValue("calcStaying");if(nights=="")nights=3;var date=ParseEuroShortDate($("#calcArriving").val());$("#calcStaying").empty();if(date!=null&&nights>0){var last;for(var i=0;i<120;i++){if(isBooked(date.getFullYear(),date.getMonth()+1,date.getDate()))break;last=i+1;$("<option>"+last+"</option>").appendTo($("#calcStaying"));date.setDate(date.getDate()+1);}}else{for(var i=0;i<120;i++)$("<option>"+(i+1)+"</option>").appendTo($("#calcStaying"));}setDropDownValue("calcStaying",nights);if(dropDownValue("calcStaying")!=nights)setDropDownValue("calcStaying",last);for(var j=0;;j++){if(j<10)controlIndex="0";var roomtypeselect=GetElement("ctl00_ContentPlaceHolder1_repeaterRoomsTypes_ctl"+controlIndex+j+"_listRoomCount1");if(roomtypeselect==null)break;roomtypeselect.disabled=false;if(isDateSelectChanged)roomtypeselect.value="0";}_NightsChanged();}function _NightsChanged(){var nights=dropDownValue("calcStaying");$("#pluralNights").css("display",nights>1?"inline":"none");var from=ParseEuroShortDate($("#calcArriving").val());var nights=dropDownValue("calcStaying");var to=AddDays(from,nights);function gotAvailability(notAvailCounts){var totalAvail=0;var roomTypes=$(".roomTypeLine","#roomTypeHolder");var count=1;roomTypes.each(function(i,lineDiv){var roomTypeId=lineDiv.id.split('_')[1]*1;var availCount=Rooms.Rooms(roomTypeId).length-(notAvailCounts==null?0:notAvailCounts[i]);if(availCount>0)$(lineDiv).show();else
$(lineDiv).hide();totalAvail+=availCount;var s=$(lineDiv).find("select");var numSelected=dropDownValue(s[0])*1;if(roomTypes.length==1&&numSelected==0)numSelected=1;if(numSelected>availCount)numSelected=availCount;s=s.parent();s.empty();s=$("<select id=roomTypeSelect"+count+">").appendTo(s);count++;for(var a=0;a<=availCount;a++)if(roomTypes.length!=1||a!=0)$("<option>"+a+"</option>").appendTo(s);setDropDownValue(s[0],numSelected);s.bind("change",RoomsOrPeopleChanged);});if(totalAvail==0){SetMessage("warning","No availability.","Enter or select the dates you're interested in staying, and select which rental options you would like...");return;}$("#roomTypeHolder").show();_RoomsOrPeopleChanged();}if(from!=null&&nights>0)ModalQuery("Availability",document.body,urlBase+'GetAvailableRooms.aspx?pid='+pId+'&start='+dateFormat(from)+'&end='+dateFormat(to),function(req){gotAvailability(req.responseText.split(','));});else
gotAvailability(null);}function _RoomsOrPeopleChanged(){var from=ParseEuroShortDate($("#calcArriving").val());var nights=dropDownValue("calcStaying")*1;var to=AddDays(from,nights);var adults=dropDownValue("calcAdults")*1;var children=dropDownValue("calcChildren")*1;var roomTypeIds=GetSelectedRoomIds();var error=true;if(from==null||nights<=0)SetMessage("warning","Select dates.","Enter or select the dates you're interested in staying, and select which rental options you would like...");else if(dropDownValue("calcStaying")=="")SetMessage("warning","No availability.","Enter or select the dates you're interested in staying, and select which rental options you would like...");else if(roomTypeIds=="")SetMessage("warning","Select rental options.","Enter or select the dates you're interested in staying, and select which rental options you would like...");else
error=false;$("#bestDeal").hide();$("#postPrice").empty();window.estimatedPrice=0;if(!error){function GotPrice(amount){window.estimatedPrice=amount;if(amount==0){Track_RateCalcPanel('ShownNoPrice');if(window.isRAHProperty){$("#allowOnlyEnquiry").show();$("#allowBoth").hide();$("#allowOnlyBooking").hide();$("#rahPropertyBookingTip").hide();}SetMessage("warning","<span class=flink onclick=goBookingNow(0); >Enquire</span> for price.","This property has not provided rates. Select Enquiry to request a quote");}else{if(window.isRAHProperty){if(typeof(isNewBookingForm)!="undefined"){if(isNewBookingForm){if(allowRequestBooking&&allowEnquiry){$("#allowBoth").show();$("#allowOnlyBooking").hide();$("#allowOnlyEnquiry").hide();$("#rahPropertyBookingTip").show();}else if(allowRequestBooking){$("#allowOnlyBooking").show();$("#allowOnlyEnquiry").hide();$("#allowBoth").hide();$("#rahPropertyBookingTip").show();}else{$("#allowOnlyEnquiry").show();$("#allowBoth").hide();$("#allowOnlyBooking").hide();}}}}Track_RateCalcPanel('ShownPrice');SetMessage("calcPrice","$"+FormatDollars(amount),"Total price: $AUD "+FormatDollars(amount)+" including GST. - This price is an estimate based on information provided and will be confirmed by the property operator.");$("#bestDeal").show();$("#postPrice").html("&nbsp;inc. GST");}}if(from==null||nights<=0)GotPrice(0);else
ModalQuery("Price",document.body,urlBase+'estprice.ajax?pp='+pId+'&startdate='+dateFormat(from)+'&enddate='+dateFormat(to)+'&nights='+nights+"&numAdults="+adults+"&numChildren="+children+"&roomTypeIds="+roomTypeIds,function(req){GotPrice(req.responseText);});}}function FormatDollars(value){var i=parseFloat(value);if(isNaN(i)){i=0.00;}var minus='';if(i<0){minus='-';}i=Math.abs(i);i=parseInt((i+.005)*100);i=i/100;s=new String(i);if(s.indexOf('.')==(s.length-2)){s+='0';}s=minus+s;return s;}function GetSelectedRoomIds(){var result="";$(".roomTypeLine","#roomTypeHolder").each(function(i,lineDiv){var s=$(lineDiv).find("select");var numSelected=dropDownValue(s[0])*1;var id=lineDiv.id.split('_')[1];for(var n=0;n<numSelected;n++){if(result!="")result+=",";result+=id;}});return result;}function newAvailCalendar_change(dateStr){$("#calcArriving").val(dateStr);DateChanged();$("#calcStaying").focus();}function goBookingPage(pageNo){if(isRAHProperty&&window.isBookingRequest){var from=ParseEuroShortDate($("#calcArriving").val());var nights=dropDownValue("calcStaying");var to=AddDays(from,nights);var arrival=dateFormatMilitary(from);var departure=dateFormatMilitary(to);var numAdults=dropDownValue("calcAdults");var numChildren=dropDownValue("calcChildren");document.location="http://"+rahUrl+"/home/booking/reservation.aspx?propertyid="+rahPropertyId+"&arrival="+arrival+"&departure="+departure+"&adults="+numAdults+"&children="+numChildren+"&hotdealid=0&source=viewproperty&referrer=takeabreak";;return;}$("#page1").hide();$("#page2").hide();$("#page3").hide();$("#page"+pageNo).show();thisPageNo=pageNo;if(thisPageNo==2)$("#firstName").focus();else if(thisPageNo==3)$("#streetAddress").focus();Validate();}function ValidateEmail(email){var regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;return regex.test(email);}function Validate(){$("#page2Title").html((window.isBookingRequest?"Booking ":"Enquiry ")+"Request");$("#page3title").html((window.isBookingRequest?"Booking ":"Enquiry ")+"Request");$("#buttonPage2").html(window.isNewBookingForm?"Next &gt;&gt;":(window.isBookingRequest?"Send Request":"Send Enquiry"));$("#buttonPage3").html(window.isBookingRequest?"Send Request":"Send Enquiry");if(thisPageNo==3){if(dropDownValue("country")==227)$("#state").removeAttr("disabled");else
$("#state").attr("disabled","true");}}var ErrorForm={Show:function(msg){$("#submiterrormessage").html(msg);}};function goBookingDone(fromPageNumber){var error="";if(fromPageNumber==2){if($("#firstName").val().trim()==""){error+="First Name is required\n";}if($("#lastName").val().trim()==""){error+="Last Name is required\n";}if($("#email").val().trim()==""){error+="Email is required\n";}else if(!ValidateEmail($("#email").val().trim())){error+="Email entered is not valid\n";}if($("#phone").val().trim()==""){error+="Phone Number is required\n";}}else if(fromPageNumber==3){if($("#streetAddress").val().trim()==""){error+="Address is required\n";}if($("#city").val().trim()==""){error+="City is required\n";}if(dropDownValue("country")==0){error+="Country is required\n";}if(dropDownValue("country")==227&&dropDownValue("state")==0){error+="State is required\n";}}if(error!=""){alert(error);return;}if(window.isNewBookingForm){if(fromPageNumber==2){goBookingPage(3);return;}}var from=ParseEuroShortDate($("#calcArriving").val());var nights=dropDownValue("calcStaying");var to=AddDays(from,nights);var query="Enquiry.ajax?pu="+window.propertyUnitId;query=AddArg(query,"fr",dateFormat(from));query=AddArg(query,"to",dateFormat(to));query=AddArg(query,"na",dropDownValue("calcAdults"));query=AddArg(query,"nc",dropDownValue("calcChildren"));query=AddArg(query,"rt",GetSelectedRoomIds());query=AddArg(query,"fn",$("#firstName").val());query=AddArg(query,"ln",$("#lastName").val());query=AddArg(query,"em",$("#email").val());query=AddArg(query,"pn",$("#phone").val());query=AddArg(query,"eq",$("#enquirerQuestion").val());query=AddArg(query,"er",$("#operatorQuestionResponse").length>0?$("#operatorQuestionResponse").val():"");query=AddArg(query,"nl",$("#checkNewsletter:checked").length>0?"y":"");query=AddArg(query,"li",$("#checkLinen:checked").length>0?"y":"");query=AddArg(query,"en",window.isBookingRequest?"":"y");query=AddArg(query,"ep",window.estimatedPrice);query=AddArg(query,"ra",window.isRAHProperty);query=AddArg(query,"pp",window.propertyId);query=AddArg(query,"isint",window.isInternationalSite);var country=dropDownValue("country");if(country==9999)country=0;var state=country==227?dropDownValue("state"):"";if(state==0)state="";query=AddArg(query,"sa",$("#streetAddress").val());query=AddArg(query,"ci",$("#city").val());query=AddArg(query,"co",country);query=AddArg(query,"st",state);ModalQuery("Enquiry",document.body,query,function(req){if(req.status==200){forXml(req.responseXML,'r','id,nl,du',function(result){if(result.id=="error"||result.id=="0"){alert('Unfortunately a network error occured please try another property or try again shortly');return false;}__doPostBack('__Page',"@@@@@enquiry_"+result.id+"_"+result.nl+"_"+result.du);return false;});}});}var errors;function AddToErrors(message){if(message==null)return;message=message.trim();if(message=="")return;if(errors!="")errors+="\n";errors+=message;}function goBookingNow(type){$("#submiterrormessage").html("");var from=ParseEuroShortDate($("#calcArriving").val());var nights=dropDownValue("calcStaying")*1;var roomTypeIds=GetSelectedRoomIds();var to=AddDays(from,nights);errors="";if(from==null||nights<=0)AddToErrors("Please enter the dates you wish to stay.");if(roomTypeIds=="")AddToErrors("Please select the rental options you want.");if(type==0&&nights<enquiryMinimumNights)AddToErrors("Minimum nights for an enquiry is "+enquiryMinimumNights+". You can make a booking instead.");if(errors==""){var checkedRoomTypes=[];var roomTypeIdArray=roomTypeIds.split(',');for(var i=0;i<roomTypeIdArray.length;i++){var roomTypeId=roomTypeIdArray[i]*1;if(!checkedRoomTypes[roomTypeId]){AddToErrors(Rates.CheckRestrictionNumNights(roomTypeId,from,to));AddToErrors(Rates.CheckRestrictionFullWeekonly(roomTypeId,from,to));AddToErrors(Rates.CheckRestrictionFullWeekend(roomTypeId,from,to));AddToErrors(Rates.CheckRestrictionMidAndWeekend(roomTypeId,from,to));checkedRoomTypes[roomTypeId]=true;}}}if(errors!=""){alert(errors+".");return;}window.isBookingRequest=type==1;goBookingPage(2);}

var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');function LZ(x){return(x<0||x>9?"":"0")+x;}function formatDate(date,format){if(date==null){return"";}format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length<4){y=""+(y-0+1900);}value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["NNN"]=MONTH_NAMES[M+11];value["d"]=d;value["dd"]=LZ(d);value["E"]=DAY_NAMES[E+7];value["EE"]=DAY_NAMES[E];value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}else if(H>12){value["h"]=H-12;}else{value["h"]=H;}value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H>11){value["a"]="PM";}else{value["a"]="AM";}value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}if(value[token]!=null){result=result+value[token];}else{result=result+token;}}return result;}function _isInteger(val){var digits="1234567890";for(var i=0;i<val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}return true;}function _getInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length<minlength){return null;}if(_isInteger(token)){return token;}}return null;}function getDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getYear();var month=now.getMonth()+1;var date=1;var hh=0;var mm=0;var ss=0;var ampm="";while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}if(token=="yyyy"||token=="yy"||token=="y"){if(token=="yyyy"){x=4;y=4;}if(token=="yy"){x=2;y=2;}if(token=="y"){x=2;y=4;}year=_getInt(val,i_val,x,y);if(year==null){return 0;}i_val+=year.length;if(year.length==2){if(year>70){year=1900+(year-0);}else{year=2000+(year-0);}}}else if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<MONTH_NAMES.length;i++){var month_name=MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12){month-=12;}i_val+=month_name.length;break;}}}if((month<1)||(month>12)){return 0;}}else if(token=="EE"||token=="E"){for(var i=0;i<DAY_NAMES.length;i++){var day_name=DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val+=day_name.length;break;}}}else if(token=="MM"||token=="M"){month=_getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return 0;}i_val+=month.length;}else if(token=="dd"||token=="d"){date=_getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0;}i_val+=date.length;}else if(token=="hh"||token=="h"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}i_val+=hh.length;}else if(token=="HH"||token=="H"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}i_val+=hh.length;}else if(token=="KK"||token=="K"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}i_val+=hh.length;}else if(token=="kk"||token=="k"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}i_val+=hh.length;hh--;}else if(token=="mm"||token=="m"){mm=_getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}i_val+=mm.length;}else if(token=="ss"||token=="s"){ss=_getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}i_val+=ss.length;}else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}else{return 0;}i_val+=2;}else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}else{i_val+=token.length;}}}if(i_val!=val.length){return 0;}if(month==2){if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(date>29){return 0;}}else{if(date>28){return 0;}}}if((month==4)||(month==6)||(month==9)||(month==11)){if(date>30){return 0;}}if(hh<12&&ampm=="PM"){hh=hh-0+12;}else if(hh>11&&ampm=="AM"){hh-=12;}var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();}function parseDate(val){var preferEuro=(arguments.length==2)?arguments[1]:false;generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');dateFirst=new Array('d/M/y','d-M-y','d.M.y');var checkList=new Array(preferEuro?'dateFirst':'monthFirst');var d=null;for(var i=0;i<checkList.length;i++){var l=window[checkList[i]];for(var j=0;j<l.length;j++){d=getDateFromFormat(val,l[j]);if(d!=0){return new Date(d);}}}return null;}

var Rooms={properties:[],roomTypes:[],rooms:[],roomTypesOfProperty:[],roomsOfRoomTypes:[],Query:function(callback,propertyId){this.properties=[];this.roomTypes=[];this.rooms=[];this.roomTypesOfProperty=[];this.roomsOfRoomTypes=[];ModalQuery("Properties",e("panel"),"/Manage/Manage.ajax?properties"+(propertyId?"_no_acct":"")+"=1"+(propertyId?"&propertyView="+propertyId:""),function(req){if(req.status==200){var rts=[];forXml(req.responseXML,'rt','i,n,pi,s,c',function(roomType){var i=roomType.pi;if(!rts[i])rts[i]=[];rts[i][rts[i].length]=roomType;});var rs=[];forXml(req.responseXML,'r','i,n,rti',function(room){var i=room.rti;if(!rs[i])rs[i]=[];rs[i][rs[i].length]=room;});var indexRoom=1;forXml(req.responseXML,'p','i,n,al,s,r,d,pr',function(property){Rooms.properties[Rooms.properties.length]={id:parseInt(property.i),name:property.n,askLinen:property.al,suspendReason:property.s,rates:property.r,deal:property.d,priceRange:property.pr};var _rts=rts[property.i];if(_rts)$.each(_rts,function(i,roomType){Rooms.roomTypes[Rooms.roomTypes.length]={id:parseInt(roomType.i),propertyId:parseInt(roomType.pi),name:roomType.n,sleeps:parseInt(roomType.s),sleepingconfig:roomType.c};if(!Rooms.roomTypesOfProperty[property.i])Rooms.roomTypesOfProperty[property.i]=[];Rooms.roomTypesOfProperty[property.i][Rooms.roomTypesOfProperty[property.i].length]=Rooms.roomTypes[Rooms.roomTypes.length-1];var _rs=rs[roomType.i];if(_rs)$.each(_rs,function(i,room){Rooms.rooms[Rooms.rooms.length]={index:indexRoom++,id:parseInt(room.i),roomTypeId:parseInt(room.rti),name:room.n};if(!Rooms.roomsOfRoomTypes[roomType.i])Rooms.roomsOfRoomTypes[roomType.i]=[];Rooms.roomsOfRoomTypes[roomType.i][Rooms.roomsOfRoomTypes[roomType.i].length]=Rooms.rooms[Rooms.rooms.length-1];});});});var indexRT=1;$.each(Rooms.roomTypes,function(i,roomType){if(Rooms.RoomTypeHasRoom(roomType.id))roomType.index=indexRT++;});var index=1;$.each(Rooms.properties,function(i,property){if(Rooms.PropertyHasRoom(property.id))property.index=index++;});if(callback)callback();}});},QueryFromText_SleepsOnly:function(text){var arrSleeps=text.split(';');for(var i=0;i<arrSleeps.length;i++){var parts=arrSleeps[i].split(',');var roomTypeId=parts[0]*1;var _sleeps=parts[1]*1;Rooms.roomTypes[Rooms.roomTypes.length]={id:roomTypeId,propertyId:0,name:'',sleeps:_sleeps,sleepingconfig:''};}},Property:function(id){var result=null;$.each(this.properties,function(){if(this.id==id)result=this;});return result;},RoomType:function(id){var result=null;$.each(this.roomTypes,function(){if(this.id==id)result=this;});return result;},Room:function(id){var result=null;$.each(this.rooms,function(){if(this.id==id)result=this;});return result;},Properties:function(){return Rooms.properties;},RoomTypes:function(propertyId){var result=[];$.each(Rooms.roomTypes,function(){if(propertyId==null||this.propertyId==propertyId)result[result.length]=this;});return result;},Rooms:function(roomTypeId){var result=[];$.each(Rooms.rooms,function(){if(roomTypeId==null||this.roomTypeId==roomTypeId)result[result.length]=this;});return result;},GetRoomByIndex:function(index){var result=null;$.each(Rooms.rooms,function(){if(this.index==index)result=this;});return result;},GetPropertyOfRoom:function(id){var roomTypeId=Rooms.Room(id).roomTypeId;var propertyId=Rooms.RoomType(roomTypeId).propertyId;return Rooms.Property(propertyId);},PropertyHasRoom:function(propertyId){var result=false;$.each(this.roomTypes,function(i,roomType){if(roomType.propertyId==propertyId){result=Rooms.RoomTypeHasRoom(roomType.id);if(result)return false;}});return result;},RoomTypeHasRoom:function(roomTypeId){var result=false;$.each(this.rooms,function(i,room){if(room.roomTypeId==roomTypeId){result=true;return false;}});return result;},ToString:function(){var result="";$.each(Rooms.properties,function(){result+="["+this.name;var propertyId=this.id;$.each(Rooms.roomTypes,function(){if(this.propertyId==propertyId){result+=":"+this.name;var roomTypeId=this.id;$.each(Rooms.rooms,function(){if(this.roomTypeId==roomTypeId)result+="-"+this.name;});}});result+="]";});return result;}};function GetSuspendedIcon(id,spaceAfter){var property=Rooms.Property(id);if(property.suspendReason!="")return"<img class=suspend src=images/suspended2.png style=display:inline onmouseover=\"popupHelp('"+property.suspendReason.escapeHTML()+"', this)\" onmouseout=popupClear() />"+(spaceAfter?"&nbsp;":"");return"";}

var Rates={rates:[],restrictions:"",GetRoomTypeIds:function(roomIds){var result="";if(roomIds.length>0){var roomIdList=roomIds.split(',');for(var i=0;i<roomIdList.length;i++){var roomId=roomIdList[i];var room=Rooms.Room(roomId);if(result!="")result+=",";result+=room.roomTypeId;}}return result;},Calculate:function(from,to,numAdults,numChildren,roomIds){return this.CalculateForRoomTypes(from,to,numAdults,numChildren,this.GetRoomTypeIds(roomIds));},CalculateForRoomTypes:function(from,to,numAdults,numChildren,roomTypeIds){var total=0;var roomTypeIdList=Array();var bookingdays=0;var next14day=AddDays(new Date(),14);var possibleLastMinute=from<=next14day;for(var date=from;date<to;date=AddDays(date,1))bookingdays++;if(roomTypeIds.toString().indexOf(',')==-1)roomTypeIdList[0]=roomTypeIds;else
roomTypeIdList=roomTypeIds.split(',');for(var i=0;i<roomTypeIdList.length;i++){var amt=this.CalculateRoomType(from,to,roomTypeIdList[i],possibleLastMinute);if(isNaN(amt)||amt==0)return 0;total+=amt;}total+=this.CalculateExtraCharge(numAdults,numChildren,roomTypeIds,from,to,possibleLastMinute);return Math.floor(total*100)/100;},GetRateThatAppliesToDate:function(rates,date){for(var i=rates.length-1;i>=0;i--){var rate=rates[i];if(rate.from==null||(rate.from<=date&&rate.to>=date))return rate;}return null;},GetDailyRate:function(date,rates,weeklyValid,weekendValid,dayOfBooking,possibleLastMinute){var rate=this.GetRateThatAppliesToDate(rates,date);if(rate){var amt=NaN;if(rate.UseDailyRates){amt=rate["AmtDay"+(dayOfBooking>7?7:dayOfBooking)];if(date.getDay()==5||date.getDay()==6)amt+=rate.AmtDailyWeekendSurcharge;}else{if(weeklyValid!=null&&weeklyValid&&rate.AmtWeekly!=0){amt=rate.AmtWeekly/7;}else if(weekendValid!=null&&weekendValid&&parseInt(rate.AmtWeekend)>0){if(isNaN(amt)||amt>rate.AmtWeekend/2)amt=rate.AmtWeekend/2;}else if((date.getDay()==5||date.getDay()==6)&&parseInt(rate.AmtWeekendNight)>0){if(isNaN(amt)||amt>rate.AmtWeekendNight)amt=rate.AmtWeekendNight;}else if(isNaN(amt)||amt>=rate.AmtWeeknight)amt=rate.AmtWeeknight;}if(possibleLastMinute){amt*=(1-rate.LastMinutePercentage);}return amt*1;}return NaN;},CalculateRoomType:function(from,to,roomTypeId,possibleLastMinute){var total=0;var rates=this.Get(roomTypeId);var weeklyDaysLeft=0;var weekendDaysLeft=0;var index=0;var getAddDates=AddDays(from,7);var firstDayRate=this.GetRateThatAppliesToDate(rates,from);if(!firstDayRate)return 0;var bookingdays=0;for(var date=from;date<to;date=AddDays(date,1)){bookingdays++;}total=firstDayRate.AmtBase;if(possibleLastMinute&&bookingdays>=firstDayRate.LastMinuteNights&&from<=firstDayRate.LastMinuteCutOffDate){total*=(1-firstDayRate.LastMinutePercentage);}else{possibleLastMinute=false;}var dayOfBooking=1;for(var date=from;date<to;date=AddDays(date,1)){if(weeklyDaysLeft<=0&&AddDays(date,7)<=to)weeklyDaysLeft=7;if(weekendDaysLeft<=0&&date.getDay()==5&&AddDays(date,2)<=to)weekendDaysLeft=2;var amt=this.GetDailyRate(date,rates,weeklyDaysLeft>0,weekendDaysLeft>0,dayOfBooking++,possibleLastMinute);weeklyDaysLeft--;weekendDaysLeft--;index++;if(amt==NaN)return NaN;total=total*1+amt*1;}return Math.round(total*100)/100;},CalculateExtraCharge:function(numAdults,numChildren,roomTypeIds,from,to,possibleLastMinute){var amt=0;var bookingdays=0;for(var date=from;date<to;date=AddDays(date,1)){bookingdays++;}for(var date=from;date<to;date=AddDays(date,1))amt+=this.CalculateExtraChargePerNight(numAdults,numChildren,roomTypeIds,date,possibleLastMinute,bookingdays);return amt;},CalculateNumberOfPeopleWithoutExtraCharge:function(roomTypeIdList,date){var freeCapacity=0;for(var i=0;i<roomTypeIdList.length;i++){var roomTypeId=roomTypeIdList[i];var roomType=Rooms.RoomType(roomTypeId);var rates=this.Get(roomTypeId);var rate=this.GetRateThatAppliesToDate(rates,date);if(rate==null){return 0;}freeCapacity+=rate.ExtraChargeAbove>0?rate.ExtraChargeAbove:this.GetSleeps(roomType,roomTypeId);}return freeCapacity;},extras:0,CalculateExtraChargePerNight:function(numAdults,numChildren,roomTypeIds,date,possibleLastMinute,bookingDays){var roomTypeIdList=roomTypeIds.split(',');if(isNaN(numAdults)||numAdults.toString().length==0)numAdults=0;if(isNaN(numChildren)||numChildren.toString().length==0)numChildren=0;var numPeople=parseInt(numAdults)+parseInt(numChildren);this.extras=numPeople-this.CalculateNumberOfPeopleWithoutExtraCharge(roomTypeIdList,date);return this.CalculateExtraChargePerNightExtras(numAdults,numChildren,roomTypeIdList,date,true,possibleLastMinute,bookingDays)+this.CalculateExtraChargePerNightExtras(numAdults,numChildren,roomTypeIdList,date,false,possibleLastMinute,bookingDays);},CalculateExtraChargePerNightExtras:function(numAdults,numChildren,roomTypeIdList,date,capToSleeps,possibleLastMinute,bookingDays){var amt=0;var chargedRooms=[];while(this.extras>0){var maxExtraCharge=0;var extraPeopleCharged=0;var chargingRoomIndex=0;for(var i=0;i<roomTypeIdList.length;i++){if(!chargedRooms[i]){var roomTypeId=roomTypeIdList[i];var roomType=Rooms.RoomType(roomTypeId);var rates=this.Get(roomTypeIdList[i]);var rate=this.GetRateThatAppliesToDate(rates,date);if(rate==null)return 0;possibleLastMinute=possibleLastMinute&&bookingDays>rate.LastMinuteNights;if(rate.ExtraChargeAbove!=null&&rate.ExtraChargeAbove>0&&(rate.ExtraChargeAmount>maxExtraCharge||(rate.ExtraCoupleChargeAmount/2>maxExtraCharge))){var people=capToSleeps?Rates.GetSleeps(roomType,roomTypeId)-rate.ExtraChargeAbove:this.extras;if(people>0){if(rate.ExtraCoupleChargeAmount>0){maxExtraCharge=rate.ExtraCoupleChargeAmount/2;extraPeopleCharged=people;extraPeopleCharged=Math.ceil(extraPeopleCharged/2)*2;if(extraPeopleCharged>this.extras)extraPeopleCharged=Math.ceil(this.extras/2)*2;}else{maxExtraCharge=rate.ExtraChargeAmount;extraPeopleCharged=people;if(extraPeopleCharged>this.extras)extraPeopleCharged=this.extras;}}chargingRoomIndex=i;}}}if(maxExtraCharge==0)break;this.extras-=extraPeopleCharged;if(extraPeopleCharged>0&&rate.ExtraChildChargeAmount>0&&numChildren>0){if(extraPeopleCharged<=numChildren){amt+=rate.ExtraChildChargeAmount*extraPeopleCharged;extraPeopleCharged=0;}else{amt+=rate.ExtraChildChargeAmount*numChildren;extraPeopleCharged=Math.abs(extraPeopleCharged-numChildren);}}amt+=maxExtraCharge*extraPeopleCharged;if(possibleLastMinute)amt*=(1-rate.LastMinutePercentage);chargedRooms[chargingRoomIndex]=true;}return amt;},GetSleeps:function(roomType,roomTypeId){if(roomType==null){var element=e(roomTypeId);if(element==null)return 0;return element.value*1;}return roomType.sleeps;},CheckRestrictionNumNights:function(roomTypeId,from,to){var rates=this.Get(roomTypeId);var numNights=DaysDifference(from,to);var minNights=-1;for(var date=from;date<to;date=AddDays(date,1)){var rate=this.GetRateThatAppliesToDate(rates,date);if(rate==null)return null;if(rate.minimumNights&&rate.minimumNights>minNights)minNights=rate.minimumNights;}if(minNights>numNights)return Rooms.RoomType(roomTypeId).name+": Minimum nights for this date range is "+minNights;return null;},CheckRestrictionFullWeekonly:function(roomTypeId,from,to){if(this.restrictions=="w"){var rates=this.Get(roomTypeId);for(var date=from;date<to;date=AddDays(date,1)){var rate=this.GetRateThatAppliesToDate(rates,date);if(rate==null)return null;if(rate.applyRestrictions&&!this.IncludesWholeWeek(date,from,to))return Rooms.RoomType(roomTypeId).name+": Partial week bookings are restricted for this date range";}}return null;},CheckRestrictionFullWeekend:function(roomTypeId,from,to){if(this.restrictions=="e"){var rates=this.Get(roomTypeId);for(var date=from;date<to;date=AddDays(date,1)){var rate=this.GetRateThatAppliesToDate(rates,date);if(rate==null)return null;if(rate.applyRestrictions&&!this.IncludesWholeWeekend(date,from,to))return Rooms.RoomType(roomTypeId).name+": Partial weekend bookings are restricted for this date range";}}return null;},CheckRestrictionMidAndWeekend:function(roomTypeId,from,to){if(this.restrictions=="b"){var rates=this.Get(roomTypeId);for(var date=from;date<to;date=AddDays(date,1)){var rate=this.GetRateThatAppliesToDate(rates,date);if(rate==null)return null;if(rate.applyRestrictions&&!this.IncludesMidOrWeekend(date,from,to))return Rooms.RoomType(roomTypeId).name+": Partial mid-week or weekend bookings are restricted for this date range";}}return null;},IncludesWholeWeek:function(date,from,to){var dayOfWeek=date.getDay();var startOfWeek=dayOfWeek==7?date:AddDays(date,-dayOfWeek);var endOfWeek=AddDays(startOfWeek,7);return startOfWeek>=from&&endOfWeek<=to;},IncludesWholeWeekend:function(date,from,to){var dayOfWeek=date.getDay();if(dayOfWeek<5||dayOfWeek>6)return true;var startOfWeekend=dayOfWeek==5?date:AddDays(date,-1);var endOfWeekend=AddDays(startOfWeekend,2);return startOfWeekend>=from&&endOfWeekend<=to;},IncludesMidOrWeekend:function(date,from,to){var dayOfWeek=date.getDay();if(dayOfWeek==5||dayOfWeek==6)return this.IncludesWholeWeekend(date,from,to);var startOfWeek=dayOfWeek==7?date:AddDays(date,-dayOfWeek);var endOfWeek=AddDays(startOfWeek,5);return startOfWeek>=from&&endOfWeek<=to;},Query:function(callback){this.rates=[];ModalQuery("Rates",document.body,"Manage.ajax?getrates=1",function(req){if(req.status==200){forXml(req.responseXML,'re','c',function(restriction){Rates.restrictions=restriction.c;});forXml(req.responseXML,'r','i,rt,o,n,f,t,mn,ar,w,we,wn,wen,en,ea,ec,eh,b,d1,d2,d3,d4,d5,d6,d7,ud,dws,x,ln,lp,ld',function(rate){Rates.rates[Rates.rates.length]={id:rate.i,roomTypeId:rate.rt,order:rate.o,name:rate.n,from:ParseEuroShortDate(rate.f),to:ParseEuroShortDate(rate.t),minimumNights:rate.mn*1,applyRestrictions:ParseBool(rate.ar),AmtWeekly:rate.w,AmtWeekend:rate.we,AmtWeeknight:rate.wn,AmtWeekendNight:rate.wen,ExtraChargeAbove:rate.en*1,ExtraChargeAmount:rate.ea*1,ExtraCoupleChargeAmount:rate.ec*1,ExtraChildChargeAmount:rate.eh*1,AmtBase:rate.b*1,AmtDay1:rate.d1*1,AmtDay2:rate.d2*1,AmtDay3:rate.d3*1,AmtDay4:rate.d4*1,AmtDay5:rate.d5*1,AmtDay6:rate.d6*1,AmtDay7:rate.d7*1,UseDailyRates:rate.ud,AmtDailyWeekendSurcharge:rate.dws*1,Expired:rate.x,LastMinuteNights:rate.ln*1,LastMinutePercentage:rate.lp*1/100,LastMinuteCutOffDate:ParseEuroShortDate(rate.ld)};});if(callback)callback();}});},QueryFromText:function(text,isEuroDateFormat){var arrRates=text.split(';');this.restrictions=arrRates[0];for(var i=1;i<arrRates.length;i++){var arrRate=arrRates[i].split(',');if(arrRate.length==29)Rates.rates[i]={id:arrRate[0],roomTypeId:arrRate[1],order:arrRate[2],name:arrRate[3],from:isEuroDateFormat?Rates.ParseEuroShortDate(arrRate[4]):Rates.ParseUSShortDate(arrRate[4]),to:isEuroDateFormat?Rates.ParseEuroShortDate(arrRate[5]):Rates.ParseUSShortDate(arrRate[5]),AmtWeekly:arrRate[6],AmtWeekend:arrRate[7],AmtWeeknight:arrRate[8],AmtWeekendNight:arrRate[9],ExtraChargeAbove:arrRate[10]*1,ExtraChargeAmount:arrRate[11]*1,ExtraCoupleChargeAmount:arrRate.length>12?arrRate[12]*1:0,ExtraChildChargeAmount:arrRate.length>12?arrRate[13]*1:0,AmtBase:arrRate[14]*1,AmtDay1:arrRate[15]*1,AmtDay2:arrRate[16]*1,AmtDay3:arrRate[17]*1,AmtDay4:arrRate[18]*1,AmtDay5:arrRate[19]*1,AmtDay6:arrRate[20]*1,AmtDay7:arrRate[21]*1,UseDailyRates:((arrRate[22]!=null&&arrRate[22]!="False")?true:false),AmtDailyWeekendSurcharge:arrRate[23]*1,LastMinuteNights:arrRate[24]*1,LastMinutePercentage:arrRate[25]*1/100,LastMinuteCutOffDate:Rates.ParseEuroShortDate(arrRate[26]),applyRestrictions:ParseBool(arrRate[27]),minimumNights:arrRate[28]*1};}},Get:function(roomTypeId){var result=[];$.each(this.rates,function(){if(this.roomTypeId==roomTypeId)result[result.length]=this;});return result;},GetRate:function(id){var result;$.each(this.rates,function(){if(this.id==id){result=this;return false;}});return result;},ParseUSShortDate:function(input){var parts=input.split('/');if(parts.length!=3)return null;var year=parts[2];var month=parts[0]-1;var day=parts[1];year=String(year).substring(0,4);return(parseInt(year)==0||parseInt(year)<2009||month<0||month>11||day<1||day>31)?null:Rates.ToDate(year,month,day);},ParseEuroShortDate:function(input){var parts=input.split('/');if(parts.length!=3)return null;var year=parts[2];var month=parts[1]-1;var day=parts[0];year=String(year).substring(0,4);return(parseInt(year)==0||parseInt(year)<2009||month<0||month>11||day<1||day>31)?null:Rates.ToDate(year,month,day);},ToDate:function(year,month,day){var result=new Date();result.setHours(0,0,0,0);result.setDate(1);result.setFullYear(year);result.setMonth(month);result.setDate(day);return(result.getFullYear()!=year||result.getMonth()!=month||result.getDate()!=day)?null:result;},ToString:function(){var result="";$.each(Rooms.properties,function(){result+="["+this.name;var propertyId=this.id;$.each(Rooms.roomTypes,function(){if(this.propertyId==propertyId){result+=":"+this.name;var roomTypeId=this.id;$.each(Rates.Get(roomTypeId),function(){result+="-"+this.order+","+this.name+","+(this.from==""?"":dateFormat(this.from))+","+(this.to==""?"":dateFormat(this.to))+","+this.AmtWeekly+","+this.AmtWeekend+","+this.AmtWeeknight+","+this.AmtWeekendNight;});}});result+="]";});return result;}};

var roomsID=0;var ajaxCount=0;var controlIndex;var req;var isCalculated=false;var isDateSelectChanged=false;function GetElement(name){if(document.all){return document.all(name);}return document.getElementById(name);}function e(name,tag){if(!name)return null;if(name.tagName)return name;var result=document.getElementById(name);if(!result&&tag){var serverCtrlName=name.replace(/_/g,'$');var regExId=new RegExp("[_$]"+name+"$","ig");var items=document.getElementsByTagName(tag);for(var i=0;i<items.length;i++){var item=items[i];if((item.id&&item.id.match(regExId))||(item.name&&item.name==serverCtrlName))return item;}}return result;}function check_email(sender,args){var filter=/^.+@.+\..{2,6}$/;args.IsValid=filter.test(args.Value);}var setdate_callback;function SetSelectedDateRange(dateFrom,shortdateFrom,dateTo,shortdateTo,callback){setdate_callback=callback;var dd=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl00_listRoomCount1");var numSelected=dropDownValue(dd)*1;ajaxCount=0;if(GetElement("startdate")!=null&&GetElement("enddate")!=null){if(GetElement("startdate").value!=shortdateFrom||GetElement("enddate").value!=shortdateTo)isDateSelectChanged=true;}var enqiryEntry_arrive=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelArriving");var enqiryEntry_depart=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelDeparting");var advancedSearch_arrive=GetElement("ctl00_ContentPlaceHolder1_AdvancedSearchPanel1_labelArriving");var advancedSearch_depart=GetElement("ctl00_ContentPlaceHolder1_AdvancedSearchPanel1_labelDeparting");if(enqiryEntry_arrive!=null)enqiryEntry_arrive.innerHTML=dateFrom+" afternoon";if(enqiryEntry_depart!=null)enqiryEntry_depart.innerHTML=dateTo+" morning";if(advancedSearch_arrive!=null)advancedSearch_arrive.innerHTML=dateFrom+" afternoon";if(advancedSearch_depart!=null)advancedSearch_depart.innerHTML=dateTo+" morning";var lblarrivedate=GetElement("lblArrdate");var lbldepartdate=GetElement("lblDepdate");if(lblarrivedate!=null)lblarrivedate.innerHTML=dateFrom+" afternoon";if(lbldepartdate!=null)lbldepartdate.innerHTML=dateTo+" morning";GetElement("startdate").value=shortdateFrom;GetElement("enddate").value=shortdateTo;var from=((parseDate(shortdateFrom,true).getTime()/1000)/3600)/24;var to=((parseDate(shortdateTo,true).getTime()/1000)/3600)/24;var days=to-from;days=Math.round(days);if(enqiryEntry_arrive!=null&&enqiryEntry_depart!=null){var propertyID=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_txtPropertyId");if(propertyID!=null){ajax(urlBase+'GetAvailableRooms.aspx?pid='+propertyID.value+'&start='+shortdateFrom+'&end='+shortdateTo,UpdateRoomsCount);var enqiryEntry_txt_typeIds=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds");if(enqiryEntry_txt_typeIds!=null&&isDateSelectChanged&&(!CheckOneRoomProperty(enqiryEntry_txt_typeIds.value)))enqiryEntry_txt_typeIds.value="";var enqiryEntry_res_estPrice=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_resultEstPrice");if(enqiryEntry_res_estPrice&&isDateSelectChanged)enqiryEntry_res_estPrice.value=0;}}var enqiryEntry_nights=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelNights");if(enqiryEntry_nights!=null)enqiryEntry_nights.innerHTML=days;var lblnights=GetElement("lblNights");if(lblnights!=null)lblnights.innerHTML=days;var j=0;while(true){if(j<10)controlIndex="0";var roomtypeselect=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+controlIndex+j+"_listRoomCount1");if(roomtypeselect==null)break;roomtypeselect.disabled=false;j++;}var enqiryEntry_txt_typeIds=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds");if(enqiryEntry_txt_typeIds!=null){isCalculated=false;var totalNumOfAdults=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumAdults").value*1;var totalNumOfChildren=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumChildren").value*1;var totalNumOfPeople=totalNumOfAdults+totalNumOfChildren;SetEstPrice(CalculateEstPrice(ParseEuroShortDate(shortdateFrom),ParseEuroShortDate(shortdateTo),enqiryEntry_txt_typeIds.value,false,totalNumOfAdults,totalNumOfChildren));}}function CheckOneRoomProperty(roomtypeIds){if(StringTrim(roomtypeIds.toString()).indexOf(',')==-1)return roomtypeIds;else{var oneroomproperty=true;var roomtypeId=0;var arrtypeIds=StringTrim(roomtypeIds.toString()).split(',');for(var i=0;i<arrtypeIds.length-1;i++){roomtypeId=arrtypeIds[i];if(arrtypeIds[i]!=arrtypeIds[i+1]){oneroomproperty=false;}}if(oneroomproperty)return roomtypeId;else
return"";}}function CalculateEstPrice(from,to,typeids,isDropdonwEvent,numOfAdults,numOfChildren){var amount=0;if(StringTrim(typeids.toString()).length>0&&isDropdonwEvent){amount=Rates.CalculateForRoomTypes(from,to,numOfAdults,numOfChildren,typeids);}else if(StringTrim(CheckOneRoomProperty(typeids).toString()).length>0&&StringTrim(CheckOneRoomProperty(typeids).toString()).indexOf(",")==-1){amount=Rates.CalculateForRoomTypes(from,to,numOfAdults,numOfChildren,CheckOneRoomProperty(typeids));}else if(!isDropdonwEvent){var shortdateFrom=GetElement("startdate").value;var shortdateTo=GetElement("enddate").value;var typeIdsSelected=getSelectedRoomIds("EnquiryEntry1");var enqiryEntry_span_estPrice=GetElement("spanEstimatePrice");if(enqiryEntry_span_estPrice!=null)if(shortdateFrom.length==0||shortdateTo.length==0){enqiryEntry_span_estPrice.innerHTML="<font color='red'>Please select dates to estimate price.</font>";return;}if(StringTrim(typeIdsSelected.toString()).length>0)amount=Rates.CalculateForRoomTypes(ParseEuroShortDate(shortdateFrom),ParseEuroShortDate(shortdateTo),numOfAdults,numOfChildren,typeIdsSelected);}if(isNaN(amount))return 0;return amount;}function getSelectedRoomIds(listName){var result="";var i=0;while(true){if(i<10)controlIndex="0";var dropdownCount=GetElement("ctl00_ContentPlaceHolder1_"+listName+(listName==""?"":"_")+"repeaterRoomTypes_ctl"+controlIndex+i+"_listRoomCount1");var typeid=GetElement("ctl00$ContentPlaceHolder1$"+listName+(listName==""?"":"$")+"repeaterRoomTypes$ctl"+controlIndex+i+"$roomSleeps1");if(dropdownCount==null||typeid==null)break;else{var roomtypeid=typeid.value;var roomtypecount=dropdownCount.value;var enqiryEntry_span_estPrice=GetElement("spanEstimatePrice");if(roomtypeid==0)break;if(enqiryEntry_span_estPrice!=null){if(roomtypecount>0){for(var j=0;j<roomtypecount;j++){if(i>=1||j>1)result+=",";result+=roomtypeid;}}}}i=i+1;}return result;}function CheckNoRoomtypeChoose(){if(GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds")!=null&&GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds").value.indexOf(',')==-1)return false;var i=0;var count=0;while(true){if(i<10)controlIndex="0";var dropdownCount=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+controlIndex+i+"_listRoomCount1");if(dropdownCount==null)break;else{var roomtypecount=dropdownCount.value;count=count+parseInt(roomtypecount);}i=i+1;}if(count==0)return true;return false;}function SetEstPrice(amount){if(e("estimatedprice","input")!=null)e("estimatedprice","input").value=amount;var enqiryEntry_span_estPrice=GetElement("spanEstimatePrice");var enqiryEntry_lbl_estPrice=GetElement("lblEstPrice");var enqiryEntry_res_estPrice=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_resultEstPrice");var enqiryEntry_txt_typeIds=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds");var pricePerPerson=0;var totalNumOfPeople=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumAdults").value*1+GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumChildren").value*1;var totalNights=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelNights").innerHTML;if(enqiryEntry_span_estPrice!=null){if(amount>0||enqiryEntry_res_estPrice.value>0){var pricePerPersonOutput="";if(totalNumOfPeople!=0){pricePerPerson=amount/(totalNumOfPeople*totalNights);pricePerPerson=roundToPrecision(pricePerPerson,2);pricePerPersonOutput=" (which equates to $AUD"+pricePerPerson+" per person per night)";}else{pricePerPersonOutput=" (to see how much it will cost per person, please enter number of Adults an Children.)";}if(CheckNoRoomtypeChoose()){if(parseInt(CaculateTotalSelectedRooms())>0){enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="<font color='red'>Please select room types to estimate price.</font>";}else{enqiryEntry_res_estPrice.value=amount;enqiryEntry_span_estPrice.innerHTML="<span style='background-color:#2d3290'><font color='white'>$AUD "+StringTrim(amount.toString())+pricePerPersonOutput+"</font></span>";enqiryEntry_lbl_estPrice.innerHTML="<font color='red'>$AUD "+StringTrim(amount.toString())+pricePerPersonOutput+"</font>";}}else{var output=amount;if(amount==0){output=amount;pricePerPersonOutput="";}enqiryEntry_res_estPrice.value=amount;enqiryEntry_span_estPrice.innerHTML="<span style='background-color:#2d3290'><font color='white'>$AUD"+output+pricePerPersonOutput+"</font></span>";enqiryEntry_lbl_estPrice.innerHTML="<font color='red'>$AUD"+output+pricePerPersonOutput+"</font>";}return;}else if(GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl00_listRoomCount1")==null){enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="not available yet";}else{if(enqiryEntry_txt_typeIds.value.length<=0&&totalNumOfPeople==0)enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="<font color='red'>Please enter number of people and select room types to estimate price.</font>";else if(parseInt(CaculateTotalSelectedRooms())>0&&totalNumOfPeople>0&&totalNights!=null&&totalNights>0&&amount==0)enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="not available yet";else if(parseInt(CaculateTotalSelectedRooms())==0){if(totalNights>0)enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="<font color='red'>Please enter number of people and select room types to estimate price.</font>";else
enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="<font color='red'>Please select room types to estimate price.</font>";}else
enqiryEntry_lbl_estPrice.innerHTML=enqiryEntry_span_estPrice.innerHTML="not available yet";}}}function CaculateTotalSelectedRooms(){var i=0;var typeids="";var totalRoomSelected=0;while(true){if(i<10)controlIndex="0";var dropdownCount=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+controlIndex+i+"_listRoomCount1");var typeid=GetElement("ctl00$ContentPlaceHolder1$EnquiryEntry1$repeaterRoomTypes$ctl"+controlIndex+i+"$roomSleeps1");if(dropdownCount==null||typeid==null)break;else{totalRoomSelected+=dropdownCount.value;}i=i+1;}return totalRoomSelected;}function roundToPrecision(inputNum,desiredPrecision){var precisionGuide=Math.pow(10,desiredPrecision);return(Math.round(inputNum*precisionGuide)/precisionGuide);}function ResetEstPrice(){var i=0;var typeids="";var amount=0;var totalNumAdults=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumAdults").value*1;var totalNumChildren=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumChildren").value*1;var totalNumOfPeople=totalNumAdults+totalNumChildren;var shortdateFrom=GetElement("startdate").value;var shortdateTo=GetElement("enddate").value;while(true){if(i<10)controlIndex="0";var dropdownCount=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+controlIndex+i+"_listRoomCount1");var typeid=GetElement("ctl00$ContentPlaceHolder1$EnquiryEntry1$repeaterRoomTypes$ctl"+controlIndex+i+"$roomSleeps1");if(dropdownCount==null||typeid==null)break;else{var roomtypeid=typeid.value;var roomtypecount=dropdownCount.value;var enqiryEntry_span_estPrice=GetElement("spanEstimatePrice");if(enqiryEntry_span_estPrice!=null){if(shortdateFrom.length==0||shortdateTo.length==0){enqiryEntry_span_estPrice.innerHTML="<font color='red'>Please select dates to estimate price.</font>";return;}}if(roomtypecount>0){for(var j=0;j<roomtypecount;j++){typeids+=roomtypeid+",";}}}i=i+1;}typeids=typeids.substring(0,typeids.length-1);amount=CalculateEstPrice(ParseEuroShortDate(shortdateFrom),ParseEuroShortDate(shortdateTo),typeids,true,totalNumAdults,totalNumChildren);var enqiryEntry_txt_typeIds=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds");if(enqiryEntry_txt_typeIds!=null)enqiryEntry_txt_typeIds.value=typeids;SetEstPrice(amount);}function sleep(milliseconds){var start=new Date().getTime();for(var i=0;i<1e7;i++){if((new Date().getTime()-start)>milliseconds){break;}}}function callAjax(_leadingZero,_i,_shortdateFrom,_shortdateTo){var roomID=GetElement("ctl00$ContentPlaceHolder1$EnquiryEntry1$repeaterRoomTypes$ctl"+_leadingZero+_i+"$roomSleeps1");var returnajax;if(roomID!=null){returnajax=ajax(urlBase+'GetAvailableRooms.aspx?rtid='+roomID.value+'&start='+_shortdateFrom+'&end='+_shortdateTo,UpdateRoomsCount);}return returnajax;}function check_mobile(sender,args){if(args.Value.length==0){args.IsValid=false;return;}if(args.Value.length>=10){var str=args.Value.substring(0,2);if(str=='04'){args.IsValid=true;return;}}args.IsValid=false;}function check_children(sender,args){args.IsValid=args.Value.length==0||!isNaN(args.Value);}function check_children_ages(sender,args){var numOfChildren=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumChildren").value;if(!isNaN(numOfChildren)&&numOfChildren*1>0){if(trim(args.Value).length==0||args.Value=='0'||trim(GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputChildrenAges").value).length==0){args.IsValid=false;}}else
args.IsValid=true;}function check_rooms(sender,args){var i=0;while(true){var leadingZero='';if(i<10){leadingZero='0';}var name="ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+leadingZero+i+"_listRoomCount";var dropdown=GetElement(name);if(dropdown==null)break;if(dropdown.selectedIndex!=0){args.IsValid=true;return;}i++;}args.IsValid=i==0;}function check_capacity(sender,args){var sleeps=0;var i=0;while(true){var leadingZero='';if(i<10){leadingZero='0';}var name="ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+leadingZero+i+"_listRoomCount";var dropdown=GetElement(name);if(dropdown==null)break;name="countctl00$ContentPlaceHolder1$EnquiryEntry1$repeaterRoomTypes$ctl"+leadingZero+i+"$roomSleeps";if(GetElement(name)==null){name="countctl00:ContentPlaceHolder1:EnquiryEntry1:repeaterRoomTypes:ctl"+leadingZero+i+":roomSleeps";}var sleepControl=GetElement(name);if(sleepControl==null)break;sleeps+=(sleepControl.value*dropdown.value);i++;}if(i==0){sleeps=GetElement("maxadults").value*1;if(sleeps==0){args.IsValid=true;return;}}var maxAdults=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumAdults").value;var maxChild=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumChildren").value;if(isNaN(maxAdults)){maxAdults=0;}if(isNaN(maxChild)){maxChild=0;}var max=(maxAdults*1+maxChild*1);if(max==0){args.IsValid=true;return;}if(sleeps==0){args.IsValid=true;return;}args.IsValid=sleeps>=max;}function check_nights(sender,args){if(GetElement("isTest").value=="true"){args.isValid=true;}else{args.IsValid=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelNights").innerHTML!="";}}function check_nights_min(sender,args){if(GetElement("isTest").value=="true"){args.isValid=true;}else{var minNights=GetElement("minnights").value*1;var nights=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelNights").innerHTML*1;args.IsValid=minNights==0||nights>=minNights;}}function check_nights_max(sender,args){if(GetElement("isTest").value=="true"){args.isValid=true;}else{var maxNights=GetElement("maxnights").value*1;var nights=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_labelNights").innerHTML*1;args.IsValid=maxNights==0||nights<=maxNights;}}function check_date_future(sender,args){var from=parseDate(GetElement("startdate").value,true);if(from!=null){from=from.getTime();}if(from==null){args.IsValid=true;return;}var now=new Date();now=now.getTime();if(from>now){args.IsValid=true;return;}else{args.IsValid=true;return;}}function validate(){if(typeof(Page_ClientValidate)=='function'){Page_ClientValidate();}bookMark();}function bookMark(){if(GetElement('ctl00_ContentPlaceHolder1_EnquiryEntry1_inputFirstName')!=null){GetElement('ctl00_ContentPlaceHolder1_EnquiryEntry1_inputFirstName').focus();}}function displayValidationOnLoad(msg){alert(msg.toString());bookMark();}function check_input_correct_email(sender,args){args.IsValid=args.Value.length==0||args.Value=='0'||GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputCorrectedEmail").value.length!=0;}function UpdateRoomsCount(){if(req.readyState==4&&req.status==200){while(true){if(ajaxCount<10)controlIndex="0";var dropdownCount=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+controlIndex+ajaxCount+"_listRoomCount1");var roomCount=GetElement("availctl00$ContentPlaceHolder1$EnquiryEntry1$repeaterRoomTypes$ctl"+controlIndex+ajaxCount+"$roomSleeps1");if(dropdownCount==null||roomCount==null||req.responseText==null)break;var dd=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_repeaterRoomTypes_ctl"+controlIndex+ajaxCount+"_listRoomCount1");var numSelected=dropDownValue(dd)*1;if(req.responseText.length>=0){var arrAvailables=req.responseText.split(',');if(dropdownCount!=null&&roomCount!=null){var availNow=parseInt(roomCount.value)-parseInt(arrAvailables[ajaxCount]);var inner="<option>0</option>";if(availNow==0){dropdownCount.style.disabled=true;}else{dropdownCount.style.disabled=false;for(var i=1;i<=availNow;i++){inner+="<option>"+i+"</option>";}}select_innerHTML(dropdownCount,inner);}}else{if(dropdownCount!=null&&roomCount!=null){var inner1="<option>0</option>";for(var i=1;i<=roomCount.value;i++){inner1+="<option>"+i+"</option>";}select_innerHTML(dropdownCount,inner1);}}setDropDownValue(dd,numSelected);ajaxCount++;}if(setdate_callback)setdate_callback();}}function AddDays(d,n){var result=new Date(d);for(var i=0;i<Math.abs(n);i++){result.setDate(result.getDate()+(n>=0?1:-1));result=_Date(result.getFullYear(),result.getMonth(),result.getDate());}return result;}function _Date(year,month,day){var result=new Date();result.setHours(0,0,0,0);result.setDate(1);if(year<100){year=(year*1)+2000;}result.setFullYear(year);result.setMonth(month);result.setDate(day);if(result.getMonth()!=month){return null;}if(result.getDate()!=day){return null;}return result;}function ParseUSShortDate(input){var parts=input.split('/');if(parts.length!=3){return null;}var year=parts[2];var month=parts[0]-1;var day=parts[1];if(month<0||month>11){return null;}if(day<1||day>31){return null;}return _Date(year,month,day);}function ParseEuroShortDate(input){if(!input)return null;var parts=input.split('/');if(parts.length!=3){return null;}var year=parts[2];var month=parts[1]-1;var day=parts[0];if(month<0||month>11){return null;}if(day<1||day>31){return null;}return _Date(year,month,day);}function ajax(url,handler){if(typeof XMLHttpRequest!="undefined")req=new XMLHttpRequest();else if(window.ActiveXObject)req=new ActiveXObject("Microsoft.XMLHTTP");req.open("GET",url+"&r="+Math.random(),true);req.onreadystatechange=handler;req.send(null);}function select_innerHTML(objeto,innerHTML){objeto.innerHTML="";var selTemp=document.createElement("micoxselect");var opt;selTemp.id="micoxselect1";document.body.appendChild(selTemp);selTemp=document.getElementById("micoxselect1");selTemp.style.display="none";if(innerHTML.toLowerCase().indexOf("<option")<0)innerHTML="<option>"+innerHTML+"</option>";innerHTML=innerHTML.toLowerCase().replace(/<option/g,"<span").replace(/<\/option/g,"</span");selTemp.innerHTML=innerHTML;for(var i=0;i<selTemp.childNodes.length;i++){var spantemp=selTemp.childNodes[i];if(spantemp.tagName){opt=document.createElement("OPTION");if(document.all){objeto.add(opt);}else{objeto.appendChild(opt);}for(var j=0;j<spantemp.attributes.length;j++){var attrName=spantemp.attributes[j].nodeName;var attrVal=spantemp.attributes[j].nodeValue;if(attrVal){try{opt.setAttribute(attrName,attrVal);opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));}catch(e){}}}if(spantemp.style)for(var y in spantemp.style)try{opt.style[y]=spantemp.style[y];}catch(e){}opt.value=spantemp.innerHTML;opt.text=spantemp.innerHTML;opt.selected=spantemp.getAttribute('selected');opt.className=spantemp.className;}}document.body.removeChild(selTemp);selTemp=null;}function numOfPeopleChangedAction(){var typeIds=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_hiddenTypeIds").value;var amount;var shortdateFrom=GetElement("startdate").value;var shortdateTo=GetElement("enddate").value;var totalNumOfAdults=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumAdults").value*1;var totalNumOfChildren=GetElement("ctl00_ContentPlaceHolder1_EnquiryEntry1_inputNumChildren").value*1;var totalNumOfPeople=totalNumOfAdults+totalNumOfChildren;if(StringTrim(CheckOneRoomProperty(typeIds).toString()).length>0&&StringTrim(CheckOneRoomProperty(typeIds).toString()).indexOf(",")==-1){amount=CalculateEstPrice(ParseEuroShortDate(shortdateFrom),ParseEuroShortDate(shortdateTo),CheckOneRoomProperty(typeIds),false,totalNumOfAdults,totalNumOfChildren);SetEstPrice(amount);}else{amount=CalculateEstPrice(ParseEuroShortDate(shortdateFrom),ParseEuroShortDate(shortdateTo),typeIds,false,totalNumOfAdults,totalNumOfChildren);SetEstPrice(amount);}}function CFChangedAction(from,to,typeids,nights){if(e("roomTypeRequested","input"))e("roomTypeRequested","input").value="";var numOfAdults=e("numadults","input").value;var numOfChildren=e("numchildren","input").value;if(isNaN(numOfAdults))numOfAdults=0;if(isNaN(numOfChildren))numOfChildren=0;var selectedtypeids="";if(StringTrim(typeids.toString()).indexOf(',')==-1)selectedtypeids=typeids;else{var arrTypeIds=StringTrim(typeids.toString()).split(',');for(var i=0;i<arrTypeIds.length;i++){if(e("room"+arrTypeIds[i],"input")!=null&&e("room"+arrTypeIds[i],"input").value>0){selectedtypeids+=arrTypeIds[i]+",";if(e("roomTypeRequested","input"))if(e("roomTypeRequested","input").value=="")e("roomTypeRequested","input").value=arrTypeIds[i]+","+e("room"+arrTypeIds[i],"input").value+";";else
e("roomTypeRequested","input").value+=arrTypeIds[i]+","+e("room"+arrTypeIds[i],"input").value+";";}}selectedtypeids=selectedtypeids.substring(0,parseInt(selectedtypeids.length-1));}if(selectedtypeids.length>0){var numOfPeople=numOfAdults*1+numOfChildren*1;var amount=CalculateEstPrice(ParseEuroShortDate(from),ParseEuroShortDate(to),selectedtypeids,true,numOfAdults,numOfChildren);CFSetEstPrice(amount,numOfPeople,nights);}else{if(e("spanEstimatePrice")!=null)e("spanEstimatePrice").innerHTML="<font color='red'>Please select room types to estimate price.</font>";}}function CFGetEstimatePrice(from,to,typeids,isDropdonwEvent,numOfPeople,objRates,objSleeps,nights){if(Rates!=null){if(trim(objRates.toString())!="")Rates.QueryFromText(objRates,false);Rooms.QueryFromText_SleepsOnly(objSleeps);var amount=0;if(StringTrim(typeids.toString()).indexOf(',')==-1){amount=CalculateEstPrice(ParseEuroShortDate(from),ParseEuroShortDate(to),typeids,isDropdonwEvent,numOfPeople,0);CFSetEstPrice(amount,numOfPeople,nights);}else{if(e("spanEstimatePrice")!=null)e("spanEstimatePrice").innerHTML="<font color='red'>Please enter number of people and select room types to estimate price.</font>";}}else{if(e("spanEstimatePrice")!=null)e("spanEstimatePrice").innerHTML="<font color='red'>Not available yet.</font>";}}function CFSetEstPrice(amount,numOfPeople,nights){if(e("estimatedprice","input")!=null)e("estimatedprice","input").value=amount;var pricePerPersonOutput="";if(amount>0){if(numOfPeople>0){pricePerPerson=amount/(numOfPeople*nights);pricePerPerson=roundToPrecision(pricePerPerson,2);pricePerPersonOutput=" (which equates to $AUD"+pricePerPerson+" per person per night)";}else{pricePerPersonOutput=" (to see how much it will cost per person, please enter number of Adults an Children.)";}if(e("spanEstimatePrice")!=null)e("spanEstimatePrice").innerHTML="<font color='red'>$AUD"+amount+pricePerPersonOutput+"</font>";if(e("lblEstiPrice")!=null)e("lblEstiPrice").innerHTML="<span style='background-color:#2d3290'><font color='white'>$AUD"+amount+pricePerPersonOutput+"</font></span>";}else{if(e("spanEstimatePrice")!=null)e("spanEstimatePrice").innerHTML="Not available yet";}}function StringTrim(s){return s.replace(/^\s*/,"").replace(/\s*$/,"");}function IsLiveServer(){return location.host!="localhost"&&location.host!="fileserver";}function rewriteSummary(){}if(window.$)$(function(){var element=e("ctl00_ContentPlaceHolder1_hiddenEstPrice");if(element&&trim(element.value)!="")Rates.QueryFromText(element.value,true);});
;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{fade:false,showURL:false,extraClass:"",top:15,left:15,id:"tooltip",clickhide:false,track:true,delay:0,showBody:" - ",fixPNG:true,opacity:0.75},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(settings.clickhide?hide:save);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery)helper.body.empty().append(bodyContent);else
helper.body.html(bodyContent);helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION")return;if(!track&&helper.parent.is(":visible"))$(document.body).unbind('mousemove',update);if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);$(function(){$('.tooltipTitle').tooltip();});
;(function($){var helper={},current,title,tID,tIdHide,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.shortlist={defaults:{id:'shortlist',top:15,left:15}};$.fn.extend({shortlist:function(settings){settings=$.extend({},$.shortlist.defaults,settings);createHelper(settings);helper.parent.mouseover(createDelegate(this[0],mouseoverMenu)).mouseout(createDelegate(this[0],mouseout));return this.each(function(){$.data(this,"shortlist",settings);this.propertyId=this.title;$(this).removeAttr("title");}).mouseover(mouseover).mouseout(mouseout).click(mouseclick);},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});}});function mouseclick(event){var cookie=readCookie("myshortlist");var newCookie=cookie.length==0?this.propertyId:(cookie+","+this.propertyId);createCookie("myshortlist",newCookie,365);}function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><div class=head></div><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('div.head',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);helper.title.html("Shortlist").show();$('<div id=slm_add class=item><span class=sl_add>Add</span></div>').appendTo(helper.body).mousedown(function(){if(!isOnShortList(current.propertyId))actionAdd(current.propertyId);});$('<div id=slm_del class=item><span class=sl_del>Remove</span></div>').appendTo(helper.body).mousedown(function(){if(isOnShortList(current.propertyId))actionDel(current.propertyId);});$('<div class=item><span class=sl_view>View</span></div>').appendTo(helper.body).mousedown(actionView);$('<div style=clear:both />').appendTo(helper.body);$('div',helper.body).mouseover(mouseoverItem).mouseout(mouseoutItem);}function settings(element){return $.data(element,"shortlist");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function mouseover(){if(tIdHide)clearTimeout(tIdHide);tIdHide=null;if($.shortlist.blocked||this==current)return;current=this;if(isOnShortList(current.propertyId)){$('#slm_add').addClass('disabled');$('#slm_del').removeClass('disabled');}else{$('#slm_add').removeClass('disabled');$('#slm_del').addClass('disabled');}helper.body.show();if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else
helper.parent.show();update();}function update(event){if($.shortlist.blocked)return;if(event&&event.target.tagName=="OPTION")return;if(!track&&helper.parent.is(":visible"))$(document.body).unbind('mousemove',update);if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){var posTarget=findPos(event.target);left=posTarget.left;top=posTarget.top+event.target.offsetHeight+1;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function mouseout(event){if($.shortlist.blocked)return;clearTimeout(tID);tIdHide=setTimeout(createDelegate(this,hide),500);}function mouseoverMenu(){if(tIdHide)clearTimeout(tIdHide);tIdHide=null;}function hide(){if(tID)clearTimeout(tID);tIdHide=null;tID=null;current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();}function mouseoverItem(event){if(!$(this).hasClass("disabled"))$(this).addClass("hover");}function mouseoutItem(event){$(this).removeClass("hover");}function findPos(obj){var curleft=curtop=0;if(obj.offsetParent)do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);return{left:curleft,top:curtop};}})(jQuery);$(function(){$('.infoicon').tooltip({track:true,delay:250,showURL:false,showBody:" - ",fixPNG:true,opacity:0.75});$('.shortlist_button').shortlist();});function gotoDetails(url){document.location=url;}function addshortlist(id){if(isOnShortList(id))return;var cookie=readCookie("myshortlist");var newCookie=cookie.length==0?id:(cookie+","+id);createCookie("myshortlist",newCookie,365);alert("The property has been added to your shortlist");refreshPage();}function deleteFromShortlist(id){if(!isOnShortList(id))return;if(confirm("Are you sure you want to delete this property from your shortlist?")){var cookie=readCookie("myshortlist");var newCookie="";if(cookie.indexOf(',')!=0){var oldCookie=cookie.split(',');for(var i=0;i<oldCookie.length;i++){if(oldCookie[i]!=id){if(newCookie!="")newCookie+=",";newCookie+=oldCookie[i];}}eraseCookie("myshortlist");createCookie("myshortlist",newCookie,365);refreshPage();}}}function clearShortlist(id){if(confirm("Are you sure you want to clear your shortlist?")){eraseCookie("myshortlist");refreshPage();}}function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}return"";}function eraseCookie(name){createCookie(name,"",-1);}function refreshPage(){var url=window.location.href;if(url.toLowerCase().indexOf('shortlist.aspx?')!=-1){url=url.split('?')[0];window.location.href=url;}else
window.location.reload();}function isOnShortList(id){var ids=readCookie("myshortlist").split(',');for(var i=0;i<ids.length;i++)if(ids[i]==id)return true;return false;}

var globalCalWidth="95%";var holidays=new Array();holidays["1 Jan 2006"]=holidays["25 Dec 2005"]=holidays["31 Dec 2005"]=true;if(typeof booked=="undefined")booked=new Array();var tempSelected=new Array();var clickanddrag=true;if(!document.all||(navigator.userAgent.indexOf("Opera")!=-1)){clickanddrag=false;}var monthNamesShort=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var monthNamesLong=new Array("January","February","March","April","May","June","July","August","September","October","November","December");var daysInMonthLeapyear=new Array(31,29,31,30,31,30,31,31,30,31,30,31);var daysInMonthNormalYear=new Array(31,28,31,30,31,30,31,31,30,31,30,31);var dayOfWeek=new Array("S","M","T","W","T","F","S");var colorWhite="#FFFFFF";var colorDarkRed="#800000";var colorMedRed="#B00000";var colorLightGrey="#E0E0E0";var colorMedGray="#808080";var colorOffWhite="#F8F8F8";var colorDkBlue="#0000E0";var holidayColorFG=colorMedRed;var dowColorBG=colorLightGrey;var dowColorFG=colorDkBlue;var headerColorBG=colorMedGray;var headerColorFG=colorOffWhite;var urlArgs=getURLArgs(true);var thisMonth=urlArgs.month?parseInt(urlArgs.month)%12:today.getMonth()+1;var thisYear=urlArgs.year?parseInt(urlArgs.year):today.getFullYear();var firstDayOfWeekIndex=1;var target;var lastAvailableMonth;var lastAvailableYear;var firstDisplayedDate;var lastDisplayedDate;var lastMonth;var nextMonth;var lastMonthsYear;var nextMonthsYear;var cellClasses;var scrollAgain=true;var selecting=false;var firstSelected;var lastSelected;var selectedDays;var refreshing=false;var firstSelectedDate;var lastSelectedDate;var existingSelectionStartDate=null;var existingSelectionEndDate=null;var ifTemp="n";function isBooked(year,month,day){var absMonth=year*12+month;var relMonth=absMonth-(thisYear*12+thisMonth);if((booked!=null)&&(booked.length>0)&&relMonth>=0&&relMonth<booked.length&&booked[relMonth][day-1]!=null){return booked[relMonth][day-1]==1;}return false;}function isPartialSelected(dt){if(isPartialBooked(dt.getFullYear(),dt.getMonth()+1,dt.getDate())){return true;}return false;}function isPartialBooked(year,month,day){var absMonth=year*12+month;var relMonth=absMonth-(thisYear*12+thisMonth);if((booked!=null)&&(booked.length>0)&&(booked[relMonth][day-1]!=null)){return booked[relMonth][day-1]==2;}return false;}function isTempSelected(year,month,day){var absMonth=year*12+month;var relMonth=absMonth-(thisYear*12+thisMonth);if((tempSelected!=null)&&(tempSelected.length>0)&&(tempSelected[relMonth][day-1]!=null)){return tempSelected[relMonth][day-1]==1;}return false;}function documentMouseDown(e){return false;}function documentMouseUp(){selecting=false;}function drawCalendars(toTarget,bookedDays){drawCalendarsForMonths(toTarget,bookedDays,18,"n");}function drawCalendarsForMonths(toTarget,bookedDays,numberOfMonths,temp){lastAvailableMonth=thisMonth+((numberOfMonths-2)+1);lastAvailableYear=thisYear;while(lastAvailableMonth>12){lastAvailableYear++;lastAvailableMonth-=12;}target=toTarget;if(temp=="y")tempSelected=bookedDays;else
booked=bookedDays;ifTemp=temp;refreshCalendars(thisYear,thisMonth);}function refreshCalendars(year,month){cellClasses=new Object();lastMonth=month-1;lastMonthsYear=lastMonth==0?year-1:year;lastMonth=lastMonth==0?12:lastMonth;nextMonth=month+1;nextMonthsYear=nextMonth>12?year+1:year;nextMonth=nextMonth>12?nextMonth-12:nextMonth;var nextMonth2=month+2;var nextMonth2sYear=nextMonth2>12?year+1:year;nextMonth2=nextMonth2>12?nextMonth2-12:nextMonth2;firstDisplayedDate=new Date(year,month-1,1);lastDisplayedDate=new Date(nextMonth2sYear,nextMonth2-1,daysInMonth(nextMonth2sYear,nextMonth2-1));var result;if(clickanddrag){result="<DIV id='calendarMouseCapture' name='calendarMouseCapture' onMouseUp='mouseUpFreeDay(lastSelected)' onMouseOver='mouseOverSelecting()'>";}else{var result="<DIV id='calendarMouseCapture' name='calendarMouseCapture'>";}result+="<TABLE ALIGN='TOP' WIDTH='90\%'><TR VALIGN='TOP'><TD valign='center'>";result+=writeButton(lastMonth,lastMonthsYear,"<<");result+="</TD><TD>";result+=writeCalendar(year,month);result+="</TD><TD>";result+=writeCalendar(nextMonthsYear,nextMonth);result+="</TD><TD>";result+=writeCalendar(nextMonth2sYear,nextMonth2);result+="</TD><TD valign='center'>";result+=writeButton(nextMonth,nextMonthsYear,">>");result+="</TD></TR></TABLE></DIV>";if(calendar_element.id=="calendar"){result+="<DIV id='calMarked' class=detailstext>Dates marked in <font color='#e60404'>red</font> are not available.</DIV>";result+="<DIV id='comment' class=detailstext>click/drag date to view the room availability.</DIV>";}target.innerHTML=result;}function writeCalendar(year,month){var result=writeHeader(month,year);result+=writeDays(month,year);result+=writeFooter();return result;}function writeHeader(month,year){var result="<CENTER><TABLE class='calendar' BORDER='0' CELLPADDING='2' CELLSPACING='0' WIDTH='80%'>";result+="<TR class='calHeader'><TD COLSPAN='5'>";result+=monthNamesLong[month-1];result+="</TD><TD COLSPAN='2' ALIGN='right'>";result+=year;result+="</TD></TR><TR class='calDayNames'>";for(var index=0;index<7;index++){result+="<TD>";result+=dayOfWeek[((firstDayOfWeekIndex+index)%7)];result+="</TD>";}result+="</TR>";return result;}function writeDays(month,year){var boldDayFrom=month==thisMonth&&year==thisYear?today.getDate():0;var boldDayTo=boldDayFrom;var useBold=boldDayFrom!=0;var startDate=new Date(year,month-1,1);var days=daysInMonth(year,month-1);var leadingBlanks=(7-firstDayOfWeekIndex+startDate.getDay())%7;var result="<TR ALIGN='RIGHT'>";if(leadingBlanks!=0){result+="<TD class='calEmptyDays' colspan='"+leadingBlanks+"'></TD>";}var rows=0;for(var day=1;day<=days;day++){var currentCell=leadingBlanks+day-1;if(currentCell%7==0&&day>1){result+="</TR><TR ALIGN='RIGHT'>";rows++;}var isHolidayOrWeekend=isHoliday(year,monthNamesShort[month-1],day)||isWeekend(year,monthNamesShort[month-1],day);var isBolded=useBold&&day>=boldDayFrom&&day<=boldDayTo;result+=writeDay(year,month,day,isHolidayOrWeekend,isBolded);}var trailingBlanks=(7-(leadingBlanks+days)%7)%7;if(trailingBlanks!=0){result+="<TD class='calEmptyDays' colspan='"+trailingBlanks+"'></TD>";}if(rows<5){result+="</TR><TR><TD class='calEmptyDays' colspan=7>&nbsp;</TD>";}return result;}function isDateAgo(year,month,day){var d=new Date();if(d.getFullYear()==year&&d.getMonth()+1==month&&d.getDate()>=day)return true;return false;}function idOfDayCell(year,month,day){return"c"+year+"_"+month+"_"+day;}function isSelected(dt){if(firstSelected==null||isBooked(dt.getFullYear(),dt.getMonth()+1,dt.getDate())||isDateAgo(dt.getFullYear(),dt.getMonth()+1,dt.getDate())){return false;}return dt>=firstSelectedDate&&dt<=lastSelectedDate;}function writeDay(year,month,day,isHolidayOrWeekend,isBolded){var id=idOfDayCell(year,month,day);var className=isHolidayOrWeekend?"Weekend":(isBolded?"Marked":"Weekday");cellClasses[id]=className;var dt=new Date(year,month-1,day);if(isSelected(dt)){return"<TD id='"+id+"' class='highlightedDays' onMouseOver='mouseOverFreeDay(this);' onMouseOut='mouseOutFreeDay(this);' onMouseDown='mouseDownFreeDay(this);' onMouseUp='mouseUpFreeDay(this);'>"+day+"</TD>";}if(isTempSelected(year,month,day)){return"<TD id='"+id+"' class='highlightedDays' onMouseOver='mouseOverFreeDay(this);' onMouseOut='mouseOutFreeDay(this);' onMouseDown='mouseDownFreeDay(this);' onMouseUp='mouseUpFreeDay(this);'>"+day+"</TD>";}if(isBooked(year,month,day)){return"<TD id='"+id+"' class='calendarBooked"+className+"' onMouseDown='mouseDownBookedDay(this);' onMouseOver='mouseOverBookedDay(this);'>"+day+"</TD>";}if(isPartialBooked(year,month,day)){if(clickanddrag)return"<TD id='"+id+"' class='calendarPartialBooked"+className+"' onMouseOver='mouseOverFreeDay(this);' onMouseOut='mouseOutFreeDay(this);' onMouseDown='mouseDownFreeDay(this);' onMouseUp='mouseUpFreeDay(this);'>"+day+"</TD>";else
return"<TD id='"+id+"' class='calendarPartialBooked"+className+"'onClick='mouseClickFreeDay(this);'>"+day+"</TD>";}if(clickanddrag){return"<TD id='"+id+"' class='calendarFree"+className+"' onMouseOver='mouseOverFreeDay(this);' onMouseOut='mouseOutFreeDay(this);' onMouseDown='mouseDownFreeDay(this);' onMouseUp='mouseUpFreeDay(this);'>"+day+"</TD>";}else{return"<TD id='"+id+"' class='calendarFree"+className+"' onClick='mouseClickFreeDay(this);'>"+day+"</TD>";}}function writeButton(month,year,caption){var enabled=true;var absMonth=year*12+month;var absLastMonth=lastAvailableYear*12+lastAvailableMonth;var absThisMonth=thisYear*12+thisMonth;if(caption=="<<"){if(absMonth<absThisMonth){enabled=false;}}if(caption==">>"){if((absMonth+1)>=absLastMonth){enabled=false;}}if(!enabled)return"<INPUT TYPE=button class=stdbutton VALUE='"+caption+"' disabled onclick='refreshCalendars("+year+","+month+");'";else
return"<INPUT TYPE=button class=stdbutton VALUE='"+caption+"' onclick='refreshCalendars("+year+","+month+");'";}function mouseOverSelecting(){if(selecting){var element=window.event.srcElement;if(element!=null){if(element.className=='highlightedDays'||element.className=='highlightedPartialDays'||element.className.substr(0,15)=='calendarPartial'||element.className.substr(0,14)=='calendarBooked'||element.className.substr(0,12)=='calendarFree'){mouseOverBookedDay(element);}else if(scrollAgain){if(element.value=='>>'){if(element.disabled==false){scrollAgain=false;refreshCalendars(nextMonthsYear,nextMonth);self.setTimeout('scrollAgain = true;',600);}}else if(element.value=='<<'){if(element.disabled==false){scrollAgain=false;refreshCalendars(lastMonthsYear,lastMonth);self.setTimeout('scrollAgain = true;',600);}}}}}}function mouseOverBookedDay(cell){if(selecting){lastSelected=cell;highlightSelected();}}function mouseOverFreeDay(cell){if(selecting){lastSelected=cell;highlightSelected();}}function mouseOutFreeDay(cell){}function writeFooter(){return"</TR></TABLE>";}function InRange(month,year){var absMonth=year*12+month;var absLastMonth=lastAvailableYear*12+lastAvailableMonth;var absThisMonth=thisYear*12+thisMonth;if(absMonth<absThisMonth){return false;}if((absMonth-2)<=absThisMonth){return false;}if((absMonth+2)>=absLastMonth){return false;}return true;}function setCellStyle(cell,style){if(cell.className!=style){cell.className=style;}}function highlightDay(cell){if(isPartialSelected(dateOf(cell))){setCellStyle(cell,"highlightedPartialDays");}else
setCellStyle(cell,"highlightedDays");}function unHighlightDay(cell){if(!isSelected(dateOf(cell))){if(isPartialSelected(dateOf(cell))){setCellStyle(cell,"calendarPartialBookedWeekday");}else
setCellStyle(cell,"calendarFree"+cellClasses[cell.id]);}}function mouseDownFreeDay(cell){selecting=true;firstSelected=cell;lastSelected=cell;calendarMouseCapture.setCapture();highlightSelected();}function mouseClickFreeDay(cell){if(!selecting){selecting=true;firstSelected=cell;lastSelected=cell;highlightSelected();}else{lastSelected=cell;highlightSelected();selecting=false;}}function mouseDownBookedDay(){}function AddDay(dt){if(dt<new Date())dt=new Date();var day=dt.getDate()+1;var month=dt.getMonth();var year=dt.getFullYear();if(day>daysInMonth(year,month)){day=1;month++;if(month==13){year++;month=1;}}return new Date(year,month,day);}function SubDay(dt){var day=dt.getDate()-1;var month=dt.getMonth();var year=dt.getFullYear();if(day==0){if(--month==0){month=12;year--;}day=daysInMonth(year,month);}return new Date(year,month,day);}function highlightSelected(callback){firstSelectedDate=dateOf(firstSelected);lastSelectedDate=dateOf(lastSelected);var selectingBackwards=firstSelectedDate>lastSelectedDate;if(selectingBackwards){var temp=firstSelectedDate;firstSelectedDate=lastSelectedDate;lastSelectedDate=temp;}var firstNonBookedDate=null;var lastNonBookedDate=null;if(selectingBackwards){for(var dt=lastSelectedDate;dt>=firstSelectedDate;dt=SubDay(dt)){if(isBooked(dt.getFullYear(),dt.getMonth()+1,dt.getDate())||isDateAgo(dt.getFullYear(),dt.getMonth()+1,dt.getDate())){break;}if(lastNonBookedDate==null){lastNonBookedDate=dt;}firstNonBookedDate=dt;}}else
{for(var dt=firstSelectedDate;dt<=lastSelectedDate;dt=AddDay(dt)){if(isBooked(dt.getFullYear(),dt.getMonth()+1,dt.getDate())||isDateAgo(dt.getFullYear(),dt.getMonth()+1,dt.getDate())){break;}if(firstNonBookedDate==null){firstNonBookedDate=dt;}lastNonBookedDate=dt;}}firstSelectedDate=firstNonBookedDate;lastSelectedDate=lastNonBookedDate;if(firstSelectedDate==existingSelectionStartDate){if(lastSelectedDate==existingSelectionEndDate){return;}if(lastSelectedDate>existingSelectionEndDate){for(var dt=AddDay(existingSelectionEndDate);dt<=lastSelectedDate;dt=AddDay(dt)){var year=dt.getFullYear();var month=dt.getMonth();var day=dt.getDate();var cell;if(clickanddrag){cell=document.all(idOfDayCell(year,month,day));}else{cell=document.getElementById(idOfDayCell(year,month,day));}if(cell!=null){highlightDay(cell);}}existingSelectionEndDate=lastSelectedDate;return;}if(lastSelectedDate<existingSelectionEndDate){for(var dt=AddDay(lastSelectedDate);dt<=existingSelectionEndDate;dt=AddDay(dt)){var year=dt.getFullYear();var month=dt.getMonth();var day=dt.getDate();var cell;if(clickanddrag){cell=document.all(idOfDayCell(year,month,day));}else{cell=document.getElementById(idOfDayCell(year,month,day));}if(cell!=null){unHighlightDay(cell);}}existingSelectionEndDate=lastSelectedDate;return;}}if(lastSelectedDate==existingSelectionEndDate){if(firstSelectedDate<existingSelectionStartDate){for(var dt=firstSelectedDate;dt<existingSelectionStartDate;dt=AddDay(dt)){var year=dt.getFullYear();var month=dt.getMonth();var day=dt.getDate();var cell;if(clickanddrag){cell=document.all(idOfDayCell(year,month,day));}else{cell=document.getElementById(idOfDayCell(year,month,day));}if(cell!=null){highlightDay(cell);}}existingSelectionStartDate=firstSelectedDate;return;}if(firstSelectedDate>existingSelectionEndDate){for(var dt=existingSelectionStartDate;dt<firstSelectedDate;dt=AddDay(dt)){var year=dt.getFullYear();var month=dt.getMonth();var day=dt.getDate();var cell;if(clickanddrag){cell=document.all(idOfDayCell(year,month,day));}else{cell=document.getElementById(idOfDayCell(year,month,day));}if(cell!=null){unHighlightDay(cell);}}existingSelectionStartDate=firstSelectedDate;return;}}existingSelectionStartDate=firstSelectedDate;existingSelectionEndDate=lastSelectedDate;if(!self.SetSelectedDateRange){window.parent.setTimeout("SetSelectedDateRange('"+dateToStr(firstSelectedDate)+"', '"+dateToShortStr(firstSelectedDate)+"', '"+dateToStr(AddDay(lastSelectedDate))+"', '"+dateToShortStr(AddDay(lastSelectedDate))+"');",0);}else{self.setTimeout(function(){SetSelectedDateRange(dateToStr(firstSelectedDate),dateToShortStr(firstSelectedDate),dateToStr(AddDay(lastSelectedDate)),dateToShortStr(AddDay(lastSelectedDate)),callback);},0);}for(var dt=firstDisplayedDate;dt<=lastDisplayedDate;dt=AddDay(dt)){var year=dt.getFullYear();var month=dt.getMonth();var day=dt.getDate();if(!(isBooked(year,month+1,day)||isDateAgo(year,month+1,day))){var cell;if(clickanddrag){cell=document.all(idOfDayCell(year,month+1,day));}else{cell=document.getElementById(idOfDayCell(year,month+1,day));}if(cell!=null){if(dt>=firstSelectedDate&&dt<=lastSelectedDate){highlightDay(cell);}else
{unHighlightDay(cell);}}}}}function dateToStr(date){var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");if(date<new Date())date=new Date();return weekday[date.getDay()]+" "+monthname[date.getMonth()]+" "+date.getDate()+", "+date.getFullYear();}function dateToShortStr(date){if(date<new Date())date=new Date();var thisMonth=date.getMonth()+1;return date.getDate()+"/"+thisMonth+"/"+date.getFullYear();}function dateOf(cell){var parts=cell.id.substring(1).split('_');return new Date(parts[0],parts[1]-1,parts[2]);}function mouseUpFreeDay(cell){calendarMouseCapture.releaseCapture();selecting=false;}function isLeapYear(year){return year%4==0&&(year%100!=0||year%400==0);}function isValidDayOfMonth(day,month,year){if(day<=0){return false;}if(isLeapYear(year)){return day<=daysInMonthLeapyear[month];}return day<=daysInMonthNormalYear[month];}function daysInMonth(year,month){return isLeapYear(year)?daysInMonthLeapyear[month]:daysInMonthNormalYear[month];}function julianDateOf(date){return julianDate(date.getDate(),date.getMonth(),date.getFullYear());}function julianDate(day,month,year){var result=0;if(year>=2000){result+=day;while(month>0){result+=daysInMonth(year,month--);}while(year>2000){result+=isLeapYear(year--)?366:365;}}else
{result-=daysInMonth(year,month)-day;while(month<11){result-=daysInMonth(year,++month);}while(year<1999){result-=isLeapYear(++year)?366:365;}}return result;}function dateDiff(firstDate,secondDate){return julianDate(secondDate.getDate(),secondDate.getMonth(),secondDate.getFullYear())-julianDate(firstDate.getDate(),firstDate.getMonth(),firstDate.getFullYear());}function isHoliday(year,month,day){if(holidays[day+" "+month+" "+year]){return true;}return false;}function isWeekend(year,month,day){return new Date(day+" "+month+" "+year).getDay()%6==0;}function getURLArgs(){var args=new Object();var query=location.search.substring(1);var pairs=query.split("&");for(var i=0;i<pairs.length;i++){var parts=unescape(pairs[i]).split("=");var value=parts.length==2?parts[1]:true;args[parts[0]]=value;}return args;}function InitialiseSelectedRange(startYear,startMonth,startDay,endYear,endMonth,endDay,callback){var element1="c"+startYear+"_"+startMonth+"_"+startDay;var element2="c"+endYear+"_"+endMonth+"_"+endDay;firstSelected=GetSelfElement(element1);lastSelected=GetSelfElement(element2);var thisyear=nextMonthsYear;var thismonth=nextMonth;while(firstSelected==null||lastSelected==null){refreshCalendars(thisyear,thismonth);firstSelected=GetSelfElement(element1);lastSelected=GetSelfElement(element2);thismonth++;if(thismonth==13){thismonth=1;thisyear++;}if(thisyear==lastAvailableYear&&thismonth==lastAvailableMonth){break;}}highlightSelected(callback);}function GetSelfElement(element){if(document.all){return document.all(element);}else{return document.getElementById(element);}}

$(startCalendar);

(function($){$.fn.galleryView=function(options){var loaded=false;var opts=$.extend($.fn.galleryView.defaults,options);var id;var iterator=0;var item_count=0;var slide_method;var theme_path;var paused=false;var gallery_width;var gallery_height;var pointer_height;var pointer_width;var strip_width;var strip_height;var wrapper_width;var f_frame_width;var f_frame_height;var frame_caption_size=20;var gallery_padding;var filmstrip_margin;var frame_img_scale=new Object();var panel_img_scale=new Object();var img_h=new Object();var img_w=new Object();var panel_nav_displayed=false;var j_gallery;var j_filmstrip;var j_frames;var j_frame_img_wrappers;var j_panels;var j_pointer;function showItem(i,immediately){$('.nav-next-overlay',j_gallery).unbind('click');$('.nav-prev-overlay',j_gallery).unbind('click');$('.nav-next',j_gallery).unbind('click');$('.nav-prev',j_gallery).unbind('click');j_frames.unbind('click');j_frames.removeClass('current').find('img').stop().animate({'opacity':opts.frame_opacity},opts.transition_speed);j_frames.eq(i).addClass('current').find('img').stop().animate({'opacity':1.0},opts.transition_speed);if(Browser&&Browser.isIE&&Browser.ver*1>=8){immediately=true;}if(immediately)j_panels.hide().eq(i%item_count).show();else
j_panels.fadeOut(opts.transition_speed).eq(i%item_count).fadeIn(opts.transition_speed);if(slide_method=='strip'){j_filmstrip.stop();var distance=getPos(j_frames[i]).left-(getPos(j_pointer[0]).left+(pointer_width/2)-(f_frame_width/2));var diststr=(distance>=0?'-=':'+=')+Math.abs(distance)+'px';j_filmstrip.animate({'left':diststr},opts.transition_speed,opts.easing,function(){var old_i=i;if(i>item_count){i=i%item_count;iterator=i;j_filmstrip.css('left','-'+((f_frame_width+opts.frame_gap)*i)+'px');}else if(i<=(item_count-strip_size)){i=(i%item_count)+item_count;iterator=i;j_filmstrip.css('left','-'+((f_frame_width+opts.frame_gap)*i)+'px');}if(old_i!=i){j_frames.eq(old_i).removeClass('current').find('img').css({'opacity':opts.frame_opacity});j_frames.eq(i).addClass('current').find('img').css({'opacity':1.0});}j_panels.hide().eq(i%item_count).show();$('.nav-prev-overlay',j_gallery).click(showPrevItem);$('.nav-next-overlay',j_gallery).click(showNextItem);$('.nav-prev',j_gallery).click(showPrevItem);$('.nav-next',j_gallery).click(showNextItem);enableFrameClicking();});}else if(slide_method=='pointer'){j_pointer.stop();var pos=getPos(j_frames[i]);j_pointer.animate({'left':(pos.left+(f_frame_width/2)-(pointer_width/2)+'px')},opts.transition_speed,opts.easing,function(){j_panels.hide().eq(i%item_count).show();$('.nav-prev-overlay',j_gallery).click(showPrevItem);$('.nav-next-overlay',j_gallery).click(showNextItem);$('.nav-prev',j_gallery).click(showPrevItem);$('.nav-next',j_gallery).click(showNextItem);enableFrameClicking();});}};function extraWidth(el){if(!el)return 0;if(el.length==0)return 0;el=el.eq(0);var ew=0;ew+=getInt(el.css('paddingLeft'));ew+=getInt(el.css('paddingRight'));ew+=getInt(el.css('borderLeftWidth'));ew+=getInt(el.css('borderRightWidth'));return ew;}function extraHeight(el){if(!el)return 0;if(el.length==0)return 0;el=el.eq(0);var eh=0;eh+=getInt(el.css('paddingTop'));eh+=getInt(el.css('paddingBottom'));eh+=getInt(el.css('borderTopWidth'));eh+=getInt(el.css('borderBottomWidth'));return eh;}function showNextItem(){if(focussed){$(document).stopTime("transition");if(++iterator==j_frames.length)iterator=0;showItem(iterator);if(!paused)$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});}};function showPrevItem(){$(document).stopTime("transition");if(--iterator<0)iterator=item_count-1;showItem(iterator);if(!paused)$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});};function getPos(el){var left=0,top=0;var el_id=el.id;if(el.offsetParent)do{left+=el.offsetLeft;top+=el.offsetTop;}while(el=el.offsetParent);if(el_id==id){return{'left':left,'top':top};}else{var gPos=getPos(j_gallery[0]);var gLeft=gPos.left;var gTop=gPos.top;return{'left':left-gLeft,'top':top-gTop};}};function enableFrameClicking(){j_frames.each(function(i){if($('a',this).length==0){$(this).click(function(){if(iterator!=i){$(document).stopTime("transition");showItem(i);iterator=i;if(!paused){$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});}}});}});};function getInt(i){i=parseInt(i,10);if(isNaN(i)){i=0;}return i;}function isImageOk(img){if(!img.complete){return false;}if(typeof img.naturalWidth!="undefined"&&img.naturalWidth==0){return false;}return true;}function imageLoaded(img,i){img_h[i]=img.height;img_w[i]=img.width;frame_img_scale[i]=Math.min(opts.frame_height/img_h[i],opts.frame_width/img_w[i]);panel_img_scale[i]=Math.min(opts.panel_height/img_h[i],opts.panel_width/img_w[i]);$(img.parentNode).css({'height':Math.min(opts.frame_height,img_h[i%item_count]*frame_img_scale[i%item_count])+'px','width':Math.min(opts.frame_width,img_w[i%item_count]*frame_img_scale[i%item_count])+'px','position':'relative','top':Math.max(0,(opts.frame_height-(frame_img_scale[i%item_count]*img_h[i%item_count]))/2)+'px','left':Math.max(0,(opts.frame_width-(frame_img_scale[i%item_count]*img_w[i%item_count]))/2)+'px','overflow':'hidden','visibility':'visible'});$(img).css({'opacity':opts.frame_opacity,'height':img_h[i%item_count]*frame_img_scale[i%item_count]+'px','width':img_w[i%item_count]*frame_img_scale[i%item_count]+'px','position':'relative','top':Math.min(0,(opts.frame_height-(frame_img_scale[i%item_count]*img_h[i%item_count]))/2)+'px','left':Math.min(0,(opts.frame_width-(frame_img_scale[i%item_count]*img_w[i%item_count]))/2)+'px'});$('img',j_panels).eq(i).css({'height':panel_img_scale[i%item_count]*img_h[i%item_count],'width':panel_img_scale[i%item_count]*img_w[i%item_count],'position':'relative','top':(opts.panel_height-(panel_img_scale[i%item_count]*img_h[i%item_count]))/2+'px','left':(opts.panel_width-(panel_img_scale[i%item_count]*img_w[i%item_count]))/2+'px'});if(i==0){j_filmstrip.css('visibility','visible');j_gallery.css('visibility','visible');if(!loaded){loaded=true;$('.loader').hide();showItem(iterator,true);startAutoNext();}}}function buildGallery(){$('img',j_frames).each(function(i){if(isImageOk(this)){imageLoaded(this,i);}else{var img=this;$(this).load(function(){imageLoaded(img,i%item_count);imageLoaded(img,i%item_count+item_count);});img_h[i]=opts.frame_height;img_w[i]=opts.frame_width;frame_img_scale[i]=1;panel_img_scale[i]=1;$(this.parentNode).css({'position':'relative','top':'0px','left':'0px','overflow':'hidden'});$(this).css({'opacity':opts.frame_opacity,'position':'relative','top':'0px','left':'0px'});}});}function mouseIsOverGallery(x,y){var pos=getPos(j_gallery[0]);var top=pos.top;var left=pos.left;return x>left&&x<left+gallery_width+(gallery_padding*2)&&y>top&&y<top+gallery_height+gallery_padding+Math.max(gallery_padding,filmstrip_margin);};function startAutoNext(){if(item_count>1){$(document).stopTime("animation_pause");paused=false;$(document).everyTime(opts.transition_interval,"transition",function(){showNextItem();});}}function initGallery(element){$(element).css('visibility','hidden');$(element).wrap("<div/>");j_gallery=$(element).parent();j_gallery.css('visibility','hidden').attr('id',$(element).attr('id')).addClass('gallery');$(element).removeAttr('id').addClass('filmstrip');id=j_gallery.attr('id');theme_path=urlBase+'script/themes/';j_filmstrip=$('.filmstrip',j_gallery);j_frames=$('li',j_filmstrip).addClass('frame');for(i=j_frames.length-1;i>=0;i--){p=$('<div class=panel>');im=$('<img />');im.attr('src',j_frames.eq(i).find('img').eq(0).attr('src')).appendTo(p);p.prependTo(j_gallery);j_frames.eq(i).find('.panel-overlay').remove().appendTo(p);}j_panels=$('.panel',j_gallery);$("img",j_frames).wrap('<div class="img_wrap" />');j_frame_img_wrappers=$('.img_wrap',j_frames);j_frame_img_wrappers.css('visibility','visible');f_frame_width=opts.frame_width+extraWidth(j_frame_img_wrappers);f_frame_height=opts.frame_height+extraHeight(j_frame_img_wrappers);item_count=j_panels.length;strip_size=Math.floor((opts.panel_width-((opts.frame_gap+22)*2))/(f_frame_width+opts.frame_gap));if(strip_size>=item_count){slide_method='pointer';strip_size=item_count;}else{slide_method='strip';}iterator=(strip_size<item_count?item_count:0)+opts.start_frame-1;filmstrip_margin=getInt(j_filmstrip.css('marginTop'));j_filmstrip.css('margin','0px');gallery_width=opts.panel_width;gallery_height=opts.panel_height+(f_frame_height+filmstrip_margin+frame_caption_size);var c=slide_method=='pointer'?1:3;strip_width=(f_frame_width*item_count*c)+(opts.frame_gap*(item_count*c));strip_height=(f_frame_height+filmstrip_margin+frame_caption_size);wrapper_width=((strip_size*f_frame_width)+((strip_size-1)*opts.frame_gap));wrapper_height=((strip_size*f_frame_height)+((strip_size-1)*opts.frame_gap));pointer_height=opts.pointer_size;pointer_width=opts.pointer_size*2;gallery_padding=getInt(j_gallery.css('paddingTop'));j_gallery.css({'padding':'0px','position':'relative','width':gallery_width+(gallery_padding*2)+'px','height':gallery_height+gallery_padding+Math.max(gallery_padding,filmstrip_margin)+'px'});enableFrameClicking();$().mousemove(function(e){if(mouseIsOverGallery(e.pageX,e.pageY)){if(!paused){$(document).oneTime(500,"animation_pause",function(){$(document).stopTime("transition");paused=true;});}}else if(paused)startAutoNext();});}function initFilmstrip(){j_filmstrip.wrap('<div class="strip_wrapper"></div>');if(slide_method=='strip'){j_frames.clone().appendTo(j_filmstrip);j_frames.clone().appendTo(j_filmstrip);j_frames=$('li',j_filmstrip);}j_frames.append('<div class="caption"></div>').each(function(i){$(this).find('.caption').html($(this).find('img').attr('title'));});j_filmstrip.css({'listStyle':'none','margin':'0','padding':'0','width':strip_width+'px','position':'relative','zIndex':'900','top':'0px','left':(slide_method=='strip'?-((f_frame_width+opts.frame_gap)*iterator):0)+'px','height':strip_height+'px'});j_frames.css({'float':'left','position':'relative','height':(f_frame_height+frame_caption_size)+'px','width':f_frame_width+'px','zIndex':'901','padding':'0','cursor':'pointer','marginTop':filmstrip_margin+'px','marginRight':opts.frame_gap+'px'});$('.strip_wrapper',j_gallery).css({'position':'absolute','overflow':'hidden','top':(opts.panel_height+gallery_padding)+'px','left':((gallery_width-wrapper_width)/2)+gallery_padding+'px','width':wrapper_width+'px','height':strip_height+'px'});$('.caption',j_gallery).css({'position':'absolute','top':f_frame_height+'px','left':'0','margin':'0','width':f_frame_width+'px','padding':'0','height':frame_caption_size+'px','overflow':'hidden','lineHeight':frame_caption_size+'px'});j_pointer=$('<div></div>');var transColor=$.browser.msie&&$.browser.version.substr(0,1)=='6'?'pink':'transparent';j_pointer.addClass('pointer').appendTo(j_gallery).css({'position':'absolute','zIndex':'1000','width':'0px','fontSize':'0px','lineHeight':'0%','borderTopWidth':pointer_height+'px','borderRightWidth':(pointer_width/2)+'px','borderBottomWidth':pointer_height+'px','borderLeftWidth':(pointer_width/2)+'px','borderStyle':'solid','top':(opts.panel_height-(pointer_height*2)+gallery_padding+filmstrip_margin)+'px','left':((gallery_width-wrapper_width)/2)+(slide_method=='strip'?0:((f_frame_width+opts.frame_gap)*iterator))+((f_frame_width/2)-(pointer_width/2))+gallery_padding+'px','borderTopColor':transColor,'borderRightColor':transColor,'borderLeftColor':transColor});var navNext=$('<img />').addClass('nav-next').attr('src',theme_path+opts.nav_theme+'/next.png').appendTo(j_gallery).css({'position':'absolute','cursor':'pointer','top':(opts.panel_height+filmstrip_margin+gallery_padding)+((f_frame_height-22)/2)+'px','right':((gallery_width+(gallery_padding*2))/2)-(wrapper_width/2)-opts.frame_gap-22+'px'}).click(showNextItem);var navPrev=$('<img />').addClass('nav-prev').attr('src',theme_path+opts.nav_theme+'/prev.png').appendTo(j_gallery).css({'position':'absolute','cursor':'pointer','top':(opts.panel_height+filmstrip_margin+gallery_padding)+((f_frame_height-22)/2)+'px','left':((gallery_width+(gallery_padding*2))/2)-(wrapper_width/2)-opts.frame_gap-22+'px'}).click(showPrevItem);$('img',j_frames).mouseover(function(){$(this).stop().animate({'opacity':1.0},300);}).mouseout(function(){if(!$(this).parent().parent().hasClass('current'))$(this).stop().animate({'opacity':opts.frame_opacity},300);});}function initPanels(){j_panels.each(function(i){if($('.panel-overlay',this).length>0)$(this).append('<div class="overlay-background"></div>');});j_panels.each(function(i){$(this).css({'width':(opts.panel_width-extraWidth(j_panels))+'px','height':(opts.panel_height-extraHeight(j_panels))+'px','position':'absolute','overflow':'hidden','display':'none'});$(this).css({'top':gallery_padding+'px','left':gallery_padding+'px'});});$('.panel-overlay',j_panels).css({'position':'absolute','zIndex':'999','width':(opts.panel_width-extraWidth($('.panel-overlay',j_panels)))+'px','left':'0'});$('.overlay-background',j_panels).css({'position':'absolute','zIndex':'998','width':opts.panel_width+'px','left':'0','opacity':opts.overlay_opacity});$('.panel-overlay',j_panels).css('bottom',0);$('.overlay-background',j_panels).css('bottom',0);$('.panel iframe',j_panels).css({'width':opts.panel_width+'px','height':opts.panel_height+'px','border':'0'});};return this.each(function(){initGallery(this);initFilmstrip();initPanels();galleryPos=getPos(j_gallery[0]);buildGallery();});};var focussed=true;var onfocussed=function(){if(!focussed){focussed=true;}};var onblurred=function(){if(focussed){focussed=false;}};var _activeElement;function dbg(value){var old=$("#dbg").html();var _new=old;if(old!="")_new+="<BR>";_new+=value;$("#dbg").html(_new);}if($.browser.msie){}else{$(document.body).focus(onfocussed);$(document.body).blur(onblurred);$(document).focus(onfocussed);$(document).blur(onblurred);$(window).focus(onfocussed);$(window).blur(onblurred);}$.fn.galleryView.defaults={panel_width:600,panel_height:400,frame_width:60,frame_height:40,start_frame:1,filmstrip_size:3,transition_speed:400,transition_interval:6000,overlay_opacity:0.7,frame_opacity:0.3,pointer_size:8,nav_theme:'dark',easing:'swing',frame_gap:5};})(jQuery);

jQuery.fn.extend({everyTime:function(interval,label,fn,times,belay){return this.each(function(){jQuery.timer.add(this,interval,label,fn,times,belay);});},oneTime:function(interval,label,fn){return this.each(function(){jQuery.timer.add(this,interval,label,fn,1);});},stopTime:function(label,fn){return this.each(function(){jQuery.timer.remove(this,label,fn);});}});jQuery.extend({timer:{global:[],guid:1,dataKey:"jQuery.timer",regex:/^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,powers:{'ms':1,'cs':10,'ds':100,'s':1000,'das':10000,'hs':100000,'ks':1000000},timeParse:function(value){if(value==undefined||value==null)return null;var result=this.regex.exec(jQuery.trim(value.toString()));if(result[2]){var num=parseFloat(result[1]);var mult=this.powers[result[2]]||1;return num*mult;}else{return value;}},add:function(element,interval,label,fn,times,belay){var counter=0;if(jQuery.isFunction(label)){if(!times)times=fn;fn=label;label=interval;}interval=jQuery.timer.timeParse(interval);if(typeof interval!='number'||isNaN(interval)||interval<=0)return;if(times&&times.constructor!=Number){belay=!!times;times=0;}times=times||0;belay=belay||false;var timers=jQuery.data(element,this.dataKey)||jQuery.data(element,this.dataKey,{});if(!timers[label])timers[label]={};fn.timerID=fn.timerID||this.guid++;var handler=function(){if(belay&&this.inProgress)return;this.inProgress=true;if((++counter>times&&times!==0)||fn.call(element,counter)===false)jQuery.timer.remove(element,label,fn);this.inProgress=false;};handler.timerID=fn.timerID;if(!timers[label][fn.timerID])timers[label][fn.timerID]=window.setInterval(handler,interval);this.global.push(element);},remove:function(element,label,fn){var timers=jQuery.data(element,this.dataKey),ret;if(timers){if(!label){for(label in timers)this.remove(element,label,fn);}else if(timers[label]){if(fn){if(fn.timerID){window.clearInterval(timers[label][fn.timerID]);delete timers[label][fn.timerID];}}else{for(var fn in timers[label]){window.clearInterval(timers[label][fn]);delete timers[label][fn];}}for(ret in timers[label])break;if(!ret){ret=null;delete timers[label];}}for(ret in timers)break;if(!ret)jQuery.removeData(element,this.dataKey);}}}});jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(index,item){jQuery.timer.remove(item);});});

DatePicker=function(element){this._element=element;this._abbreviatedMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this._longMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this._shortestDayNames=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];this._cssClass="ajax__calendar";this._buttonID=null;this.d=new Date();this._minDate=typeof minDate=="undefined"?ParseEuroShortDate(this.d.getDate()+"/"+(this.d.getMonth()+1)+"/"+this.d.getFullYear()):ParseEuroShortDate(minDate);this.d1=this.addMonths(new Date(),19);this._maxDate=typeof maxDate=="undefined"?ParseEuroShortDate(this.d1.getDate()+"/"+(this.d1.getMonth()+1)+"/"+this.d1.getFullYear()):ParseEuroShortDate(maxDate);this._selectedDate=null;this._visibleDate=null;this._todaysDate=null;this._firstDayOfWeek=1;this._popupDiv=null;this._prevArrow=null;this._prevArrowImage=null;this._nextArrow=null;this._nextArrowImage=null;this._title=null;this._today=null;this._daysRow=null;this._monthsRow=null;this._yearsRow=null;this._daysBody=null;this._monthsBody=null;this._yearsBody=null;this._button=null;this._mode="days";this._selectedDateChanging=false;this._isIEen=false;this._isAnimating=false;this._width=170;this._height=139;this._modes={"days":null,"months":null,"years":null};this._modeOrder={"days":0,"months":1,"years":2};this._blur=new DeferredOperation(Browser.isSf?1000:1,this,this._onblur);this._focus=new DeferredOperation(Browser.isSf?1000:1,this,this._onfocus);this._button$delegates={click:createDelegate(this,this._button_onclick)};this._element$delegates={focus:createDelegate(this,this._element_onfocus),focusout:createDelegate(this,this._element_onblur),blur:createDelegate(this,this._element_onblur),change:createDelegate(this,this._element_onchange)};this._popup$delegates={activate:createDelegate(this,this._popup_onfocus),focus:createDelegate(this,this._popup_onfocus),dragstart:createDelegate(this,this._popup_ondragstart),select:createDelegate(this,this._popup_onselect)};this._cell$delegates={mouseover:createDelegate(this,this._cell_onmouseover),mouseout:createDelegate(this,this._cell_onmouseout),mousedown:createDelegate(this,this._cell_onclick)};addDelegates(this._element,this._element$delegates);if(this._button)addDelegates(this._button,this._button$delegates);var value=this.get_selectedDate();if(value)this.set_selectedDate(value);};DatePicker.prototype={get_selectedDate:function(){if(this._selectedDate===null){var value=this._element.value;if(value)this._selectedDate=ParseEuroShortDate(value);}return this._selectedDate;},set_selectedDate:function(value){var elt=this._element;if(this._selectedDate!=value){this._selectedDate=value;this._selectedDateChanging=true;var text="";if(value)text=dateFormat2(value);if(text!=elt.value){elt.value=text;this._fireChanged();}this._selectedDateChanging=false;this._performLayout();}},get_todaysDate:function(){if(this._todaysDate!==null)return this._todaysDate;return new Date().getDateOnly();},dispose:function(){this._modes=null;this._modeOrder=null;if(this._container){this._container.parentNode.removeChild(this._container);this._container=null;}if(this._popupDiv){removeDelegates(this._popupDiv,this._popup$delegates);this._popupDiv=null;}if(this._prevArrow){removeDelegates(this._prevArrow,this._cell$delegates);this._prevArrow=null;}if(this._prevArrowImage){removeDelegates(this._prevArrowImage,this._cell$delegates);this._prevArrowImage=null;}if(this._nextArrow){removeDelegates(this._nextArrow,this._cell$delegates);this._nextArrow=null;}if(this._nextArrowImage){removeDelegates(this._nextArrowImage,this._cell$delegates);this._nextArrowImage=null;}if(this._title){removeDelegates(this._title,this._cell$delegates);this._title=null;}if(this._today){removeDelegates(this._today,this._cell$delegates);this._today=null;}var i,j,row;if(this._daysRow){for(i=0;i<this._daysBody.rows.length;i++){row=this._daysBody.rows[i];for(j=0;j<row.cells.length;j++)removeDelegates(row.cells[j].firstChild,this._cell$delegates);}this._daysRow=null;}if(this._monthsRow){for(i=0;i<this._monthsBody.rows.length;i++){row=this._monthsBody.rows[i];for(j=0;j<row.cells.length;j++)removeDelegates(row.cells[j].firstChild,this._cell$delegates);}this._monthsRow=null;}if(this._yearsRow){for(i=0;i<this._yearsBody.rows.length;i++){row=this._yearsBody.rows[i];for(j=0;j<row.cells.length;j++)removeDelegates(row.cells[j].firstChild,this._cell$delegates);}this._yearsRow=null;}if(this._button){removeDelegates(this._button,this._button$delegates);this._button=null;}var elt=this._element;removeDelegates(elt,this._element$delegates);},getViewportScrollX:function(){if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft;}if(document.body&&document.body.scrollLeft){return document.body.scrollLeft;}if(window.pageXOffset){return window.pageXOffset;}if(window.scrollX){return window.scrollX;}return 0;},addMonths:function(date,months){date.setMonth(date.getMonth()+months);return date;},getViewportScrollY:function(){if(document.documentElement&&document.documentElement.scrollTop)return document.documentElement.scrollTop;if(document.body&&document.body.scrollTop)return document.body.scrollTop;if(window.pageYOffset)return window.pageYOffset;if(window.scrollY)return window.scrollY;return 0;},show:function(){if(!this._container){this._buildCalendar();this._buildHeader();this._buildBody();this._buildFooter();}if(!this._isIEen){this._isIEen=true;this._switchMonth(null);var rect=this._element.getClientRects()[0];$(this._popupDiv).pos(rect.left+this.getViewportScrollX(),rect.top+this._element.offsetHeight+this.getViewportScrollY()).show();}},hide:function(){if(this._isIEen){$(this._popupDiv).hide();this._switchMode("days",true);this._isIEen=false;}},_buildCalendar:function(){this._container=$("<div/>").appendTo(document.body).addClass(this._cssClass).get(0);this._popupDiv=$("<div/>").appendTo(this._container).addClass("ajax__calendar_container").hide().attr("tabindex","0").get(0);this._popupDiv.datePicker=this;addDelegates(this._popupDiv,this._popup$delegates);},_buildHeader:function(){this._header=$("<div/>").appendTo(this._popupDiv).addClass("ajax__calendar_header").get(0);var prevArrowWrapper=$("<div/>").appendTo(this._header).get(0);this._prevArrow=$("<div/>").appendTo(prevArrowWrapper).addClass("ajax__calendar_prev").get(0);this._prevArrow.mode="prev";addDelegates(this._prevArrow,this._cell$delegates);var nextArrowWrapper=$("<div/>").appendTo(this._header).get(0);this._nextArrow=$("<div/>").appendTo(nextArrowWrapper).addClass("ajax__calendar_next").get(0);this._nextArrow.mode="next";addDelegates(this._nextArrow,this._cell$delegates);var titleWrapper=$("<div/>").appendTo(this._header).get(0);this._title=createElement(titleWrapper,"div","ajax__calendar_title");this._title.mode="title";addDelegates(this._title,this._cell$delegates);},_buildBody:function(){this._body=createElement(this._popupDiv,"div","ajax__calendar_body");this._buildDays();this._buildMonths();this._buildYears();},_buildFooter:function(){var todayWrapper=createElement(this._popupDiv,"div");this._today=createElement(todayWrapper,"div","ajax__calendar_footer ajax__calendar_today");this._today.mode="today";addDelegates(this._today,this._cell$delegates);},_buildDays:function(){this._days=createElement(this._body,"div","ajax__calendar_days");this._modes["days"]=this._days;this._daysTable=createElement(this._days,"table");this._daysTable.cellPadding=0;this._daysTable.cellSpacing=0;this._daysTable.border=0;this._daysTable.style.margin="auto";this._daysTableHeader=createElement(this._daysTable,"thead");this._daysTableHeaderRow=createElement(this._daysTableHeader,"tr");this._daysBody=createElement(this._daysTable,"tbody");var i,dayCell;for(i=0;i<7;i++){dayCell=createElement(this._daysTableHeaderRow,"td");createElement(dayCell,"div","ajax__calendar_dayname");}for(i=0;i<6;i++){var daysRow=createElement(this._daysBody,"tr");for(var j=0;j<7;j++){dayCell=createElement(daysRow,"td");var dayDiv=createElement(dayCell,"div","ajax__calendar_day");dayDiv.mode="day";dayDiv.innerHTML="&nbsp;";addDelegates(dayDiv,this._cell$delegates);}}},_buildMonths:function(){this._months=createElement(this._body,"div","ajax__calendar_months");this._months.style.display="none";this._modes["months"]=this._months;this._monthsTable=createElement(this._months,"table");this._monthsTable.cellPadding=0;this._monthsTable.cellSpacing=0;this._monthsTable.border=0;this._monthsTable.style.margin="auto";this._monthsBody=createElement(this._monthsTable,"tbody");for(var i=0;i<3;i++){var monthsRow=createElement(this._monthsBody,"tr");for(var j=0;j<4;j++){var monthCell=createElement(monthsRow,"td");var monthDiv=createElement(monthCell,"div","ajax__calendar_month");monthDiv.mode="month";monthDiv.month=(i*4)+j;monthDiv.innerHTML="<br />"+this._abbreviatedMonthNames[(i*4)+j];addDelegates(monthDiv,this._cell$delegates);}}},_buildYears:function(){this._years=createElement(this._body,"div","ajax__calendar_years");this._years.style.display="none";this._modes["years"]=this._years;this._yearsTable=createElement(this._years,"table");this._yearsTable.cellPadding=0;this._yearsTable.cellSpacing=0;this._yearsTable.border=0;this._yearsTable.style.margin="auto";this._yearsBody=createElement(this._yearsTable,"tbody");for(var i=0;i<1;i++){var yearsRow=createElement(this._yearsBody,"tr");for(var j=0;j<3;j++){var yearCell=createElement(yearsRow,"td");var yearDiv=createElement(yearCell,"div","ajax__calendar_year");yearDiv.mode="year";yearDiv.year=((i*3)+j)-1;addDelegates(yearDiv,this._cell$delegates);}}},_performLayout:function(){var elt=this._element;var selectedDate=this.get_selectedDate();var visibleDate=this._getEffectiveVisibleDate();var todaysDate=this.get_todaysDate();if((selectedDate>this._maxDate||selectedDate<this._minDate)&&selectedDate){this._element.value="";alert("Arrival date is incorrect");this._selectedDate=this._minDate;return;}var i,j,row,cell,dayCell;switch(this._mode){case"days":var firstDayOfWeek=this._firstDayOfWeek;var daysToBacktrack=visibleDate.getDay()-firstDayOfWeek;if(daysToBacktrack<=0){daysToBacktrack+=7;}var startDate=new Date(visibleDate.getFullYear(),visibleDate.getMonth(),visibleDate.getDate()-daysToBacktrack);var currentDate=startDate;for(i=0;i<7;i++){dayCell=this._daysTableHeaderRow.cells[i].firstChild;if(dayCell.firstChild)dayCell.removeChild(dayCell.firstChild);dayCell.appendChild(document.createTextNode(this._shortestDayNames[(i+firstDayOfWeek+6)%7]));}for(var week=0;week<6;week++){var weekRow=this._daysBody.rows[week];for(var dayOfWeek=0;dayOfWeek<7;dayOfWeek++){dayCell=weekRow.cells[dayOfWeek].firstChild;if(dayCell.firstChild)dayCell.removeChild(dayCell.firstChild);dayCell.appendChild(document.createTextNode(currentDate.getDate()));dayCell.title=currentDate.getDay()-1>=0?this._shortestDayNames[currentDate.getDay()-1]:this._shortestDayNames[6];dayCell.date=currentDate;if(currentDate<this._minDate||currentDate>this._maxDate){removeCssClasses(dayCell.parentNode,["ajax__calendar_other","ajax__calendar_active"]);addCssClass(dayCell.parentNode,["ajax__calendar_unable"]);;}else{removeCssClasses(dayCell.parentNode,["ajax__calendar_unable","ajax__calendar_active","ajax__calendar_other"]);addCssClass(dayCell.parentNode,this._getCssClass(dayCell.date,'d'));}if(typeof isBooked!="undefined"){if(isBooked(currentDate.getFullYear(),currentDate.getMonth()+1,currentDate.getDate()))addCssClass(dayCell.parentNode,'bookedDate');else
removeCssClass(dayCell.parentNode,'bookedDate');}currentDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()+1);}}this._prevArrow.date=new Date(visibleDate.getFullYear(),visibleDate.getMonth()-1,1);this._nextArrow.date=new Date(visibleDate.getFullYear(),visibleDate.getMonth()+1,1);if(this._title.firstChild)this._title.removeChild(this._title.firstChild);this._title.appendChild(document.createTextNode(this._longMonthNames[visibleDate.getMonth()]+", "+visibleDate.getFullYear()));this._title.date=visibleDate;break;case"months":for(i=0;i<this._monthsBody.rows.length;i++){row=this._monthsBody.rows[i];for(j=0;j<row.cells.length;j++){cell=row.cells[j].firstChild;cell.date=new Date(visibleDate.getFullYear(),cell.month,1);if((cell.date.getYear()==this._minDate.getYear()&&cell.date.getMonth()<this._minDate.getMonth())||(cell.date.getYear()==this._maxDate.getYear()&&cell.date.getMonth()>this._maxDate.getMonth())){removeCssClasses(cell.parentNode,["ajax__calendar_active","ajax__calendar_other"]);addCssClass(cell.parentNode,["ajax__calendar_unable"]);;}else{removeCssClasses(cell.parentNode,["ajax__calendar_unable","ajax__calendar_active"]);typeof this._getCssClass(cell.date,'M')[0]=="undefined"?addCssClass(cell.parentNode,["ajax__calendar_other"]):addCssClass(cell.parentNode,this._getCssClass(cell.date,'M'));addCssClass(cell,["ajax__calendar_month"]);}}}if(this._title.firstChild)this._title.removeChild(this._title.firstChild);this._title.appendChild(document.createTextNode(visibleDate.getFullYear()));this._title.date=visibleDate;this._prevArrow.date=new Date(visibleDate.getFullYear()-1,0,1);this._nextArrow.date=new Date(visibleDate.getFullYear()+1,0,1);break;case"years":var minYear=(Math.floor(visibleDate.getFullYear()/10)*10);for(i=0;i<this._yearsBody.rows.length;i++){row=this._yearsBody.rows[i];for(j=0;j<row.cells.length;j++){cell=row.cells[j].firstChild;if(cell.firstChild)cell.removeChild(cell.lastChild);else
cell.appendChild(document.createElement("br"));cell.date=new Date(minYear+cell.year+1,0,1);cell.appendChild(document.createTextNode(minYear+cell.year+1));if(cell.date.getFullYear()<this._minDate.getFullYear()||cell.date.getFullYear()>this._maxDate.getFullYear())cell.style.display="none";removeCssClasses(cell.parentNode,["ajax__calendar_other","ajax__calendar_active"]);addCssClass(cell.parentNode,this._getCssClass(cell.date,'y'));}}if(this._title.firstChild)this._title.removeChild(this._title.firstChild);this._title.appendChild(document.createTextNode(minYear.toString()+"-"+(this._maxDate.getFullYear()).toString()));this._title.date=visibleDate;this._prevArrow.date=new Date(minYear-10,0,1);this._nextArrow.date=new Date(minYear+10,0,1);break;}if(this._today.firstChild)this._today.removeChild(this._today.firstChild);this._today.appendChild(document.createTextNode("Today: "+this._longMonthNames[todaysDate.getMonth()]+" "+todaysDate.getDate()+", "+todaysDate.getFullYear()));this._today.date=todaysDate;},_fireChanged:function(){var elt=this._element;if(document.createEventObject)elt.fireEvent("onchange");else if(document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",true,true);elt.dispatchEvent(e);}},_switchMonth:function(date){this._visibleDate=date;this._performLayout();},_switchMode:function(mode){if(this._mode!=mode){var moveDown=this._modeOrder[this._mode]<this._modeOrder[mode];var oldElement=this._modes[this._mode];var newElement=this._modes[mode];this._mode=mode;$(oldElement).hide();this._performLayout();$(newElement).show();$(newElement).pos(0,0);}},_isSelected:function(date,part){var value=this.get_selectedDate();if(!value){return false;}switch(part){case'd':if(date.getDate()!=value.getDate()){return false;}case'M':if(date.getMonth()!=value.getMonth()){return false;}case'y':if(date.getFullYear()!=value.getFullYear()){return false;}break;}return true;},_isOther:function(date,part){var value=this._getEffectiveVisibleDate();switch(part){case'd':return(date.getFullYear()!=value.getFullYear()||date.getMonth()!=value.getMonth());case'M':return false;case'y':var minYear=(Math.floor(value.getFullYear()/10)*10);return date.getFullYear()<minYear||(minYear+10)<=date.getFullYear();}return false;},_getCssClass:function(date,part){return this._isSelected(date,part)?"ajax__calendar_active":(this._isOther(date,part)?"ajax__calendar_other":"");},_getEffectiveVisibleDate:function(){var value=this._visibleDate;if(value===null)value=this.get_selectedDate();if(value===null)value=this.get_todaysDate();return new Date(value.getFullYear(),value.getMonth(),1);},_onblur:function(){this._focus.cancel();this.hide();},_onfocus:function(){this._blur.cancel();this._element.focus();},_element_onfocus:function(e){if(!this._button){this._focus.cancel();this._blur.cancel();this.show();}},_element_onblur:function(e){if((e.type=='blur'&&!Browser.isIE)||(e.type=='focusout'&&Browser.isIE)){if(!this._button){this._focus.cancel();this._blur.post();}}},_element_onchange:function(e){if(!this._selectedDateChanging){var elt=this._element;this._selectedDate=ParseEuroShortDate(elt.value);this._switchMonth(this._selectedDate);}},_popup_onfocus:function(e){if((e.type=='focus'&&!Browser.isIE)||(e.type=='activate'&&Browser.isIE)||Browser.isSf||Browser.isOp){if(!this._button){this._blur.cancel();this._focus.post();}}},_popup_ondragstart:function(e){e.stopPropagation();e.preventDefault();},_popup_onselect:function(e){e.stopPropagation();e.preventDefault();},_cell_onmouseover:function(e){if(Browser.isSf){for(var i=0;i<this._daysBody.rows.length;i++){var row=this._daysBody.rows[i];for(var j=0;j<row.cells.length;j++)removeCssClass(row.cells[j].firstChild.parentNode,"ajax__calendar_hover");}}var target=e.target?e.target:e.srcElement;if(!hasCssClass(target.parentNode,'bookedDate'))addCssClass(target.parentNode,"ajax__calendar_hover");if(e.stopPropagation)e.stopPropagation();return false;},_cell_onmouseout:function(e){var target=e.target?e.target:e.srcElement;removeCssClass(target.parentNode,"ajax__calendar_hover");if(e.stopPropagation)e.stopPropagation();return false;},_cell_onclick:function(e){if(Browser.isSf||Browser.isOp)this._popup_onfocus(e);var target=e.target?e.target:e.srcElement;var visibleDate=this._getEffectiveVisibleDate();var isTargetDateInTheDateRange=target.date>=this._minDate&&target.date<=this._maxDate;var isTargetMonthValid=(target.date.getMonth()>=this._minDate.getMonth()&&target.date.getYear()==this._minDate.getYear()||target.date.getYear()>this._minDate.getYear());var isTargetYearValid=target.date.getYear()<=this._maxDate.getYear()&&target.date.getYear()>=this._minDate.getYear();var visibleDate=this._getEffectiveVisibleDate();removeCssClass(target.parentNode,"ajax__calendar_hover");switch(target.mode){case"prev":case"next":if(isTargetMonthValid&&isTargetYearValid&&target.date<=this._maxDate){this._switchMonth(target.date);break;}else
return;case"title":switch(this._mode){case"days":this._switchMode("months");break;case"months":this._switchMode("years");break;}break;case"month":if(isTargetMonthValid&&target.date<=this._maxDate){if(target.month!=visibleDate.getMonth())this._visibleDate=target.date;this._switchMode("days");break;}else
return;case"year":if(isTargetYearValid){if(target.date.getFullYear()!=visibleDate.getFullYear())this._visibleDate=target.date;this._switchMode("months");break;}else
return;case"day":if(isTargetDateInTheDateRange){if(hasCssClass(target.parentNode,'bookedDate'))break;this.set_selectedDate(target.date);this._switchMonth(target.date);$(this._element).trigger("changed");this.hide();}else
return;break;case"today":this.set_selectedDate(target.date);this._switchMonth(target.date);this.hide();break;}if(e.stopPropagation)e.stopPropagation();if(e.preventDefault)e.preventDefault();return false;},_button_onclick:function(e){e.preventDefault();e.stopPropagation();if(!this._isIEen)this.show();else
this.hide();}};$(function(){$(".dateEntry").each(function(){new DatePicker(this);});});function hidePickers(){$(".ajax__calendar_container").each(function(){this.datePicker.hide();});}

$('#photos').galleryView({panel_width:400,panel_height:300,frame_width:40,frame_height:40,transition_speed:1200,border:'none',overlay_opacity:0.4,frame_opacity:0.6,pointer_height:0,pointer_width:0});function goBooking(){var url=document.location+"";document.location=url.split('#')[0]+'#booking';}function actionAdd(id){addshortlist(id);}function actionDel(id){deleteFromShortlist(id);}function actionView(){document.location='<%= UrlBase %>Shortlist.aspx';}
