var s_id=0; var cur_id=0; var first=0; var last=0; var sum=0; var half_day=0; var calendar_id11=11; var total_msg='Total nights so far: '; var min_bl=2; var max_bl=10; var res_ids11=new Array(); function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); } function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); } function getAbsPos(elt,which) { iPos = 0; while (elt != null) { iPos += elt["offset" + which]; elt = elt.offsetParent; } return iPos; } function updatePaint11(evnt,o_id,s_col,f_col,p_col,b_col,url) { if (first==1) { half_day=0; sum=0; last=0; for (var i=0;i< res_ids11.length;i++) { if ((s_id< res_ids11[i] && res_ids11[i]res_ids11[i] && res_ids11[i]>o_id)) { return; } } var tdays=Math.abs(eval(o_id-s_id))/(60*60*24); document.getElementById("Messages"+calendar_id11).innerHTML=''; if (tdays>max_bl) { document.getElementById("Messages"+calendar_id11).innerHTML='Maximum 10 days per booking'; return; } if (o_id>s_id) { for (var i=s_id;i<=o_id;i=i+(60*60*24)) { try { if (last) { cur_id=i-(60*60*24); return; } var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2 || thestyle.scope==4) { if (i==s_id) { if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+s_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+s_col+")"; } } else { if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+f_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+f_col+")"; } cur_id=i-(60*60*24); return; } } else if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+b_col+")"; last=1; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+p_col+")"; last=1; } else if (thestyle.scope==1) { if (s_id==i) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+s_col+")"; } else if (i==o_id) { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+f_col+")"; } else { thestyle.style.backgroundColor="#"+s_col; } } else { } sum=parseFloat(sum)+parseFloat(thestyle.abbr); } catch (error) { } } } else { for (var i=s_id;i>=o_id;i=i-(60*60*24)) { try { if (last) { cur_id=i+(60*60*24); return; } var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+s_col+")"; last=1; if (i==s_id) { half_day=2; } } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+s_col+")"; last=1; if (i==s_id) { half_day=2; } } else if (thestyle.scope==3 || thestyle.scope==5) { if (i==s_id) { if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+b_col+")"; half_day=1; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+p_col+")"; half_day=1; } } else { if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+b_col+")"; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+p_col+")"; } cur_id=i+(60*60*24); return; } } else if (thestyle.scope==1) { if (s_id==i) { if (s_id==o_id) { var e = (window.event) ? window.event : evnt; var half=thestyle.offsetWidth/2; var half_sum=parseInt(half)+parseInt(getAbsX(thestyle)); if (half_sum>e.clientX) { half_day=1; thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+f_col+")"; } else { half_day=2; thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+s_col+")"; } } else { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+f_col+")"; } } else if (i==o_id) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+s_col+")"; } else { thestyle.style.backgroundColor="#"+s_col; } } else { } sum=parseFloat(sum)+parseFloat(thestyle.abbr); } catch (error) { } } } if (cur_id>o_id && o_id>=s_id) { var i=o_id; for (i=i+(60*60*24);i<=cur_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+f_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+f_col+")"; } else if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+b_col+")"; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+p_col+")"; } else if (thestyle.scope==1) { thestyle.style.backgroundColor="#"+f_col; } } catch (error) { } } } else if (cur_id=s_id) { var i=cur_id; for (i;i< s_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+f_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+f_col+")"; } else if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+b_col+")"; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+p_col+")"; } else if (thestyle.scope==1) { thestyle.style.backgroundColor="#"+f_col; } } catch (error) { } } } else if (cur_id< o_id && o_id<=s_id) { var i=cur_id; for (i;i< o_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+f_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+f_col+")"; } else if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+b_col+")"; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+p_col+")"; } else if (thestyle.scope==1) { thestyle.style.backgroundColor="#"+f_col; } } catch (error) { } } } else if (cur_id>s_id && o_id<=s_id) { var i=s_id; for (i=i+(60*60*24);i<=cur_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+f_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+f_col+")"; } else if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+b_col+")"; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+p_col+")"; } else if (thestyle.scope==1) { thestyle.style.backgroundColor="#"+f_col; } } catch (error) { } } } cur_id=o_id; } if (o_id==-1) { var i=s_id; for (i;i<=cur_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id11+i); thestyle.style.backgroundImage=""; thestyle.style.backgroundPosition="center"; thestyle.style.backgroundColor=""; if (thestyle.scope==2) { thestyle.style.backgroundImage="url("+url+"?color1="+b_col+"&color2="+f_col+")"; } else if (thestyle.scope==4) { thestyle.style.backgroundImage="url("+url+"?color1="+p_col+"&color2="+f_col+")"; } else if (thestyle.scope==3) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+b_col+")"; } else if (thestyle.scope==5) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+p_col+")"; } else if (thestyle.scope==1) { thestyle.style.backgroundColor="#"+f_col; } } catch (error) { } } } } function updateRes11() { cal_id_len=0; temp_cal_id=calendar_id11; while(temp_cal_id>=1) { cal_id_len++; temp_cal_id=temp_cal_id/10; } var all_date=window.document.getElementsByTagName("td");; if (all_date) { for (var i=0;i< all_date.length;i++) { if (all_date[i].scope==-1 || all_date[i].scope==-2) { res_ids11.push(all_date[i].id.substr(parseInt(1)+parseInt(cal_id_len))); } } } } function uclick11(evnt,o_id,s_col,f_col,p_col,b_col,url,c_id,b_id,s_month,s_year) { if (first==1) { var tdays=Math.abs(eval(o_id-s_id))/(60*60*24);var thestyle= window.document.getElementById("d"+calendar_id11+cur_id);sum=parseFloat(sum)-parseFloat(thestyle.abbr); if (tdays< min_bl) { document.getElementById("Messages"+calendar_id11).innerHTML='Minimum 2 days per booking'; } else { if (s_id>cur_id) { var sdate = new Date(cur_id * 1000); var edate = new Date(s_id * 1000); } else { var sdate = new Date(s_id * 1000); var edate = new Date(cur_id * 1000); } if (s_id!=cur_id) { half_day=0; } window.document.getElementById("AvailabilityCalendar"+b_id).innerHTML='Loading booking form...'; window.document.getElementById("Messages"+calendar_id11).innerHTML=''; ajaxpage('/calendar/load-bookingform.php?view=1&half_day='+half_day+'&from='+s_id+'&to='+cur_id+'&sMonth='+s_month+'&sYear='+s_year+'&cid='+c_id,"AvailabilityCalendar"+b_id,'get'); } first=0; res_ids11=new Array(); } else { if (s_id>0) { if (s_id>cur_id) { var tmp_id=s_id; s_id=cur_id; cur_id=tmp_id; } updatePaint11(evnt,'-1',s_col,f_col,p_col,b_col,url); } first=1; s_id=o_id; cur_id=o_id; window.document.getElementById("DateBookings"+b_id).innerHTML=''; updatePaint11(evnt,o_id,s_col,f_col,p_col,b_col,url); } } var flagCaptcha = false; var flagFields = true; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; function ajaxpage(url, containerid, requesttype){ var page_request = createRequestObject(); if (requesttype=='get'){ if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) } else if (requesttype=='post') { page_request.open('POST', url, true); page_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); page_request.setRequestHeader("Content-length", poststr.length); page_request.setRequestHeader("Connection", "close"); page_request.send(poststr); }; page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText; updateRes11(); }; } function ShowToolTip(object) { document.getElementById(object).style.visibility = 'visible'; } function HideToolTip(object) { document.getElementById(object).style.visibility = 'hidden'; } function pause(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis) } function checkUserRegistrationForm(){ re = /([0-9a-zA-Z\.\-\_]+)@([0-9a-zA-Z\.\-\_]+)\.([0-9a-zA-Z\.\-\_]+)/; var name, title, surname, address, town, county, postcode, country, email, phone, cc_holder_name, cc_number, security_code, dataRight = true; var message = ""; title = document.frm11.title.value; name = document.frm11.customerName.value; email = document.frm11.email.value; phone = document.frm11.phone.value; surname = document.frm11.surname.value; address = document.frm11.address.value; town = document.frm11.town.value; county = document.frm11.county.value; postcode= document.frm11.postcode.value; country = document.frm11.country.value; cc_holder_name = document.frm11.cc_holder_name.value; cc_number = document.frm11.cc_number.value; security_code = document.frm11.security_code.value; if (title.length==0){ message += "\n - Title"; dataRight=false; } if (name.length==0){ message += "\n - Forname"; dataRight=false; } if (surname.length==0){ message += "\n - Surname"; dataRight=false; } if (address.length==0){ message += "\n - Street Address"; dataRight=false; } if (town.length==0){ message += "\n - Town"; dataRight=false; } if (county.length==0){ message += "\n - County"; dataRight=false; } if (postcode.length==0){ message += "\n - Postcode"; dataRight=false; } if (country.length==0){ message += "\n - Country"; dataRight=false; } if (phone.length==0){ message += "\n - Home Tel"; dataRight=false; } if (email.length==0){ message += "\n - Email"; dataRight=false; } if (email.length!=0 && email.match(re)==null){ dataRight=false; message += "\n - Your Email is Incorrect"; } if (cc_holder_name.length==0){ message += "\n - Card Holder Name"; dataRight=false; } if (cc_number.length==0){ message += "\n - Credit Card Number"; dataRight=false; } if (security_code.length==0){ message += "\n - Security Number"; dataRight=false; } if (!dataRight){ if (message != ""){ message ="\nYou failed to correctly fill in the booking form:\n" + message; } alert(message); } return dataRight; } function ProcessingBooking11() { document.getElementById('DateBookings11').innerHTML='Processing booking. Please wait...'; }; function submitBooking11(from, to, sMonth, sYear) { if(checkUserRegistrationForm()){ s_id=0; cur_id=0; var poststr = "ac=book&startDate="+from+"&endDate="+to+"&half_day=" + encodeURIComponent( document.frm11.half_day.value ) + "&customerName=" + encodeURIComponent( document.frm11.customerName.value ) + "&email=" + encodeURIComponent( document.frm11.email.value ) + "&phone=" + encodeURIComponent( document.frm11.phone.value ) + "¬es=" + encodeURIComponent( document.frm11.notes.value ) + "&price=" + encodeURIComponent( document.frm11.price.value ) + "&surname=" + encodeURIComponent( document.frm11.surname.value ) + "&address=" + encodeURIComponent( document.frm11.address.value ) + "&town=" + encodeURIComponent( document.frm11.town.value ) + "&county=" + encodeURIComponent( document.frm11.county.value ) + "&postcode=" + encodeURIComponent( document.frm11.postcode.value ) + "&country=" + encodeURIComponent( document.frm11.country.value ) + "&mobile=" + encodeURIComponent( document.frm11.mobile.value ) + "&title=" + encodeURIComponent( document.frm11.title.value ) + "&cc_type=" + encodeURIComponent( document.frm11.cc_type.value ) + "&cc_holder_name=" + encodeURIComponent( document.frm11.cc_holder_name.value ) + "&cc_number=" + encodeURIComponent( document.frm11.cc_number.value ) + "&exp_month=" + encodeURIComponent( document.frm11.exp_month.value ) + "&exp_year=" + encodeURIComponent( document.frm11.exp_year.value ) + "&security_code=" + encodeURIComponent( document.frm11.security_code.value ); ProcessingBooking11(); document.getElementById('AvailabilityCalendar11').innerHTML=''; ajaxpage('/calendar/load-bookingform.php?ac=book&cid=11&'+poststr,'DateBookings11','get'); }; }; function TopMessageF11(){ document.getElementById('TopMessage11').innerHTML='Loading calendar...'; }; loadCalendar11 = '
'; document.writeln(loadCalendar11);