function pause(millis){ var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis) } var s_id=0; var cur_id=0; var first=0; var last=0; var sum=0; var half_day=0; var min_bl=; var max_bl=; var res_ids=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 updatePaint(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;ires_ids[i] && res_ids[i]>o_id)) { return; } } if (tdays>max_bl) { 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'+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) { 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'+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) { 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'+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;is_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'+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'+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 updateRes() { 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_ids.push(all_date[i].id.substr(1)); } } } } function uclick(evnt,o_id,s_col,f_col,p_col,b_col,url,c_id,b_id,s_month,s_year) { if (first==1) { if (tdays< min_bl) { } 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; } document.getElementById("bookingForm").innerHTML = ""; ajaxpage('/book/b/load-bookingform.php?view=6&half_day='+half_day+'&from='+s_id+'&to='+cur_id+'&sMonth='+s_month+'&sYear='+s_year+'&cid='+c_id, "DateBookings"+b_id, 'get'); } first=0; res_ids=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; } updatePaint(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=''; updatePaint(evnt,o_id,s_col,f_col,p_col,b_col,url); } } var flagCaptcha = true; 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; updateRes(); }; } function ShowToolTip(object) { document.getElementById(object).style.visibility = 'visible'; } function HideToolTip(object) { document.getElementById(object).style.visibility = 'hidden'; } function checkLuhn(input) { var sum = 0; var numdigits = input.length; var parity = numdigits % 2; for(var i=0; i < numdigits; i++) { var digit = parseInt(input.charAt(i)) if(i % 2 == parity) digit *= 2; if(digit > 9) digit -= 9; sum += digit; } return (sum % 10) == 0; } function checkUserRegistrationForm(){ re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/; var name, email, phone, address, ccval, city, postal, guests, province, country, dataRight = true; var message = ""; city = document.frm.city.value; postal = document.frm.zip.value; guests = document.frm.number.value; country = document.frm.country.value; province = document.frm.state.value; name = document.frm.customerName.value; email = document.frm.email.value; phone = document.frm.phone.value; address = document.frm.address.value; if (typeof document.frm.ccnumber != 'undefined'){ ccval = document.frm.ccnumber.value; } if (name.length==0){ message += "\n - Name"; dataRight=false; } if (email.length==0){ message += "\n - Email"; dataRight=false; } if (city.length==0){ message += "\n - City"; dataRight=false; } if (postal.length==0){ message += "\n - Postal/Zip Code"; dataRight=false; } if (guests.length==0){ message += "\n - # Of Guests"; dataRight=false; } if (country.length==0){ message += "\n - Country"; dataRight=false; } if (province.length==0){ message += "\n - Province/State"; dataRight=false; } if (phone.length==0){ message += "\n - Phone"; dataRight=false; } if (address.length==0){ message += "\n - Address"; dataRight=false; } if (typeof document.frm.ccnumber != 'undefined'){ if (ccval .length==0){ message += "\n - Credit Card Number"; dataRight=false; } } if (typeof document.frm.ccnumber != 'undefined'){ if (ccval.length!=0 && !checkLuhn(document.frm.ccnumber.value.replace(/[^\d]/g, ''))){ dataRight=false; message += "\n - Your CreditCard is Incorrect"; } } if (email.length!=0 && email.match(re)==null){ dataRight=false; message += "\n - Your Email is Incorrect"; } if (!dataRight){ if (message != ""){ message ="\nYou failed to correctly fill in the form:\n" + message + "\n\nPlease re-enter and click the Book button again!"; } alert(message); } return dataRight; } function submitCCBooking(from, to, sMonth, sYear) { s_id=0; cur_id=0; if(checkUserRegistrationForm()){ var poststr = "from=" + from + "&to=" + to + "&customerName=" + encodeURIComponent( document.frm.customerName.value ) + "&email=" + encodeURIComponent( document.frm.email.value ) + "&phone=" + encodeURIComponent( document.frm.phone.value ) +"&cell=" + encodeURIComponent( document.frm.cell.value ) + "¬es=" + encodeURIComponent( document.frm.notes.value ) + "&address=" + encodeURIComponent( document.frm.address.value ) + "&city=" + encodeURIComponent( document.frm.city.value ) + "&state=" + encodeURIComponent( document.frm.state.value ) + "&zip=" + encodeURIComponent( document.frm.zip.value ) + "&country=" + encodeURIComponent( document.frm.country.value ) + "&number=" + encodeURIComponent( document.frm.number.value ) + "&ccnumber=" + encodeURIComponent( document.frm.ccnumber.value ) + "&ccidentifier=" + encodeURIComponent( document.frm.ccidentifier.value ) + "&ccmonth=" + encodeURIComponent( document.frm.ccmonth.value ) + "&ccyear=" + encodeURIComponent( document.frm.ccyear.value ) + "&cardtype=" + encodeURIComponent( document.frm.cardtype.value ); document.location = 'booked.php?ac=book&cid=45&'+poststr; } }; function submitPPBooking(from, to, sMonth, sYear) { s_id=0; cur_id=0; if(checkUserRegistrationForm()){ var poststr2 = "from=" + from + "&to=" + to + "&customerName=" + encodeURIComponent( document.frm.customerName.value ) + "&email=" + encodeURIComponent( document.frm.email.value ) + "&phone=" + encodeURIComponent( document.frm.phone.value ) +"&cell=" + encodeURIComponent( document.frm.cell.value ) + "¬es=" + encodeURIComponent( document.frm.notes.value ) + "&address=" + encodeURIComponent( document.frm.address.value ) + "&city=" + encodeURIComponent( document.frm.city.value ) + "&state=" + encodeURIComponent( document.frm.state.value ) + "&number=" + encodeURIComponent( document.frm.number.value ) + "&zip=" + encodeURIComponent( document.frm.zip.value ) + "&country" + encodeURIComponent( document.frm.country.value ); document.location = 'booked.php?ac=book&cid=45&'+poststr2; } }; loadCalendar = '
'; document.writeln(loadCalendar);