if (beds24availCalset != 1) { var beds24availCalset = 1; function availCal(target,calname,caladr,roomid,propid,caltoday,bgc,abgc,habgc,nabgc,htc,nmtc) { var self=this; function setLang() { self.daylist=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat','Sun','Mon','Tue','Wed','Thu','Fri','Sat'); self.months_sh=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); self.monthup_title='Go to the next month'; self.monthdn_title='Go to the previous month'; self.monthselect_title='Select month' } function addDates() { var i; var j; if(caladr[0].f>caladr[0].l) { self.maxDate=new Date(caltoday); self.maxDate.setMonth(self.maxDate.getMonth()+4); self.displayMonthInitial=getSelectMonth(caltoday) } else { self.maxDate=new Date(caladr[caladr.length-1].l); self.displayMonthInitial=getSelectMonth(caladr[0].f) } self.minDate=new Date(caltoday); self.startDay=0; self.displayMonth=self.displayMonthInitial } function getSelectMonth(d) { return(d.getFullYear()-2000)*12+d.getMonth() } function createCalendar() { var tbody,tr,td,a; self.calendar=document.createElement('table'); self.calendar.setAttribute('id',self.name+'_calendar'); self.calendar.setAttribute('title','Click your arrival date'); setClass(self.calendar,'calendar'); addEventHandler(self.calendar,'selectstart',function(){return false}); addEventHandler(self.calendar,'drag',function(){return false}); tbody=document.createElement('tbody'); tr=document.createElement('tr'); th=document.createElement('th'); a=document.createElement('a'); a.appendChild(document.createTextNode(calname)); if(propid>0) a.href='http://www.beds24.com/booking.php?propid='+propid+'&page=getdates'; else a.href='http://www.beds24.com/booking.php?roomid='+roomid+'&page=getdates'; a.setAttribute('target','_blank'); a.style['color']=htc; th.appendChild(a); tr.appendChild(th); tbody.appendChild(tr); tr=document.createElement('tr'); td=document.createElement('td'); td.appendChild(document.createTextNode('Click your arrival date')); tr.appendChild(td); tbody.appendChild(tr); tr=document.createElement('tr'); td=document.createElement('td'); td.appendChild(createControlHeading()); tr.appendChild(td); tbody.appendChild(tr); tr=document.createElement('tr'); td=document.createElement('td'); self.calendar.celltable=document.createElement('table'); setClass(self.calendar.celltable,'cells'); self.calendar.celltable.appendChild(createDayHeading()); self.calendar.celltable.appendChild(createCalCells()); td.appendChild(self.calendar.celltable); tr.appendChild(td); tbody.appendChild(tr); tr=document.createElement('tr'); tr.setAttribute('title','powered by Beds24.com'); td=document.createElement('td'); td.style.cssText=("font-size: 7pt;"); td.appendChild(document.createTextNode('powered by Beds24.com')); td.style['color']=htc; tr.appendChild(td); tbody.appendChild(tr); self.calendar.appendChild(tbody); addEventHandler(self.calendar,'mouseover',cal_onmouseover); addEventHandler(self.calendar,'mouseout',cal_onmouseout) } function createControlHeading(){var container=document.createElement('div');setClass(container,'mainheading');self.monthSelect=document.createElement('select');var monthDn=document.createElement('input'),monthUp=document.createElement('input');var opt,i;var td=new Date(caltoday);td.setDate(1);i=getSelectMonth(td);while(td<=self.maxDate){opt=document.createElement('option');opt.setAttribute('value',i);if(self.displayMonth==i)opt.setAttribute('selected','selected');opt.appendChild(document.createTextNode(self.months_sh[td.getMonth()]+" "+td.getFullYear()));self.monthSelect.appendChild(opt);td.setMonth(td.getMonth()+1);i++}self.monthSelect.setAttribute('title',self.monthselect_title);monthUp.setAttribute('type','button');monthUp.setAttribute('value','>');monthUp.setAttribute('title',self.monthup_title);monthDn.setAttribute('type','button');monthDn.setAttribute('value','<');monthDn.setAttribute('title',self.monthdn_title);self.monthSelect.owner=monthUp.owner=monthDn.owner=self;function selectonchange(){if(self.goToMonth(self.monthSelect.value))self.displayMonth=self.monthSelect.value;else self.monthSelect.value=self.displayMonth}addEventHandler(monthUp,'click',function(){self.nextMonth()});addEventHandler(monthDn,'click',function(){self.prevMonth()});addEventHandler(self.monthSelect,'change',selectonchange);container.appendChild(monthDn);container.appendChild(self.monthSelect);container.appendChild(monthUp);return container}function createDayHeading(){self.calHeading=document.createElement('thead');var tr=document.createElement('tr'),th;self.cols=new Array(false,false,false,false,false,false,false);for(var dow=0;dow<7;dow++){td=document.createElement('td');td.appendChild(document.createTextNode(self.daynames[dow]));td.style['color']=htc;td.style['width']='22px';td.style['border']='solid #CCCCCC 1px';td.style['fontSize']='9px';tr.appendChild(td)}self.calHeading.appendChild(tr);return self.calHeading}function createCalCells(){self.rows=new Array(false,false,false,false,false,false);self.cells=new Array();var row=-1,totalCells=42;var beginDate=new Date(2000,0,1);beginDate.setMonth(beginDate.getMonth()+self.displayMonth);var endDate=new Date(beginDate.getFullYear(),beginDate.getMonth(),self.monthDayCount[self.displayMonth%12]);var sdt=new Date(beginDate);sdt.setDate(sdt.getDate()+(self.startDay-beginDate.getDay())-(self.startDay-beginDate.getDay()>0?7:0));self.calCells=document.createElement('tbody');var tr,td;var cellIdx=0,cell,dayval;for(var i=0;i=caladr[i].f&&cell.date<=caladr[i].l){start=i;cell.date.canSelect=true;break}cell.setClass();return start}function deleteCells(){self.calendar.celltable.removeChild(self.calendar.celltable.childNodes[1])}function cal_onmouseover(){self.mousein=true}function cal_onmouseout(){self.mousein=false}self.clone=function(t){var nc=new availCal(t,calname,caladr,roomid,propid,caltoday,bgc,abgc,habgc,nabgc,htc,nmtc);return nc};self.setTarget=function(targetelement){self.tgt=document.getElementById(targetelement);self.tgt.appendChild(self.calendar);self.show()};self.reDraw=function(index){var len=index?index+1:self.cells.length;var s=0;for(var i=index||0;i=self.minDate&&testdatemax<=self.maxDate){self.monthSelect.value=self.displayMonth=newmonth;createCalCells();deleteCells();self.calendar.celltable.appendChild(self.calCells);return true}else return false};self.show=function(){self.calendar.style.display='block';self.visible=true};self.bgc=bgc;self.abgc=abgc;self.habgc=habgc;self.nabgc=nabgc;self.nmtc=nmtc;self.formname=target;addDates();setLang();setDays();createCalendar();self.setTarget(target)}function CalCell(owner,tableCell,dateObj,row){var self=this;function calCellonclick(){if(self.date.canSelect){m=self.date.getMonth()+1;owner.tgt.fdate.value=String(self.date.getFullYear())+"-"+String(m)+"-"+String(self.date.getDate());owner.tgt.submit()}}function calCellonmouseover(){if(self.date.canSelect)tableCell.style['backgroundColor']=owner.habgc}function calCellonmouseout(){self.setClass()}self.setClass=function(){if(self.date.canSelect!==false){if(owner.displayMonth%12==self.date.getMonth()){tableCell.style['backgroundColor']=owner.abgc;tableCell.style['cursor']='hand';tableCell.style['cursor']='pointer'}else{tableCell.style['backgroundColor']=owner.abgc;tableCell.style['color']=owner.nmtc;tableCell.style['cursor']='hand';tableCell.style['cursor']='pointer'}}else if(owner.displayMonth%12!=self.date.getMonth()){tableCell.style['backgroundColor']=owner.nabgc;tableCell.style['color']=owner.nmtc;tableCell.style['cursor']='default'}else{tableCell.style['backgroundColor']=owner.nabgc;tableCell.style['cursor']='default'}};self.tableRow=row;self.tableCell=tableCell;self.date=new Date(dateObj);self.date.canSelect=false;self.dayOfWeek=self.date.getDay();addEventHandler(tableCell,'click',calCellonclick);addEventHandler(tableCell,'mouseover',calCellonmouseover);addEventHandler(tableCell,'mouseout',calCellonmouseout);self.setClass()}Date.prototype.getUeDay=function(){return parseInt(Math.floor((this.getTime()-this.getTimezoneOffset()*60000)/86400000))};function addEventHandler(element,type,func){if(element.addEventListener)element.addEventListener(type,func,false);else if(element.attachEvent)element.attachEvent('on'+type,func)} } if (typeof (ca00000118) == 'undefined') { ca00000118 = new Array(); } if (typeof beds24noMakeAvailCal == 'undefined') { var beds24noMakeAvailCal = 0; } if (beds24noMakeAvailCal != 1) //if = 1 dont make the calendar { makeca00000118(); } function makeca00000118() { if (typeof ca00000118[0] == 'undefined') { var c = [ {f: Date(), l: Date()} ]; c[0]={f:new Date(2010,2,14),l:new Date(2010,2,16)}; c[1]={f:new Date(2010,2,22),l:new Date(2010,2,25)}; c[2]={f:new Date(2010,2,28),l:new Date(2010,3,1)}; c[3]={f:new Date(2010,3,5),l:new Date(2010,3,9)}; c[4]={f:new Date(2010,3,11),l:new Date(2010,4,7)}; c[5]={f:new Date(2010,4,9),l:new Date(2010,4,12)}; c[6]={f:new Date(2010,4,14),l:new Date(2010,5,2)}; c[7]={f:new Date(2010,5,7),l:new Date(2010,6,30)}; c[8]={f:new Date(2010,7,3),l:new Date(2010,7,16)}; c[9]={f:new Date(2010,7,18),l:new Date(2010,11,19)}; c[10]={f:new Date(2011,0,3),l:new Date(2011,2,13)}; if (document.getElementById ('ac00000118')) { ca00000118[0] = new availCal('ac00000118', 'Room 1', c, 118, 0,new Date(2010,2,13), '#FFFFFF', '#33CC33', '#009900', '#FF0000', '#000000', '#000000'); } } }