var flagCaptcha = false; var flagFields = true; var message = 'Please fill in all mandatory fields ! \n'; 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 (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime(); page_request.open('GET', url+bustcacheparameter, true); page_request.send(null); 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; } function ShowToolTip(object) { document.getElementById(object).style.visibility = 'visible'; } function HideToolTip(object) { document.getElementById(object).style.visibility = 'hidden'; } function BookEvent(cid,eid,dt) { ajaxpage('/calendar/load-date-events.php?ac=booking_form&cid='+cid+'&eid='+eid+'&dt='+dt, 'DateEvents'+cid,'get'); }; function checkUserRegistrationForm(){ re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/; var firstname, lastname, email, phone, dataRight = true; var message = ""; firstname = document.frm.first_name.value; lastname = document.frm.last_name.value; email = document.frm.email.value; phone = document.frm.phone.value; if (firstname.length==0){ message += "\n - First Name"; dataRight=false; } if (lastname.length==0){ message += "\n - Last Name"; dataRight=false; } if (email.length==0){ message += "\n - Email"; dataRight=false; } if (phone.length==0){ message += "\n - Phone"; dataRight=false; } 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 submitBooking(cid,eid,dt) { if(checkUserRegistrationForm()){ var poststr = "&first_name=" + encodeURIComponent( document.frm.first_name.value ) + "&last_name=" + encodeURIComponent( document.frm.last_name.value ) + "&email=" + encodeURIComponent( document.frm.email.value ) + "&phone=" + encodeURIComponent( document.frm.phone.value ) + "&guests=" + encodeURIComponent( document.frm.guests.value ) + "&comments=" + encodeURIComponent( document.frm.comments.value ) + "&cellphone=" + encodeURIComponent( document.frm.cellphone.value ); ajaxpage('/calendar/load-date-events.php?ac=book&cid='+cid+'&eid='+eid+'&dt='+dt+'&'+poststr, 'DateEvents'+cid,'get'); } } loadCalendar = '