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) { document.getElementById('DateEvents1').innerHTML='Loading booking form...'; ajaxpage('/booking/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\.-_]+)\.([0-9a-zA-Z\.-_]+)/; repeople = /([0-9]+)/; var name, email, phone, dataRight = true; var message = ""; name = document.frm.customerName.value; email = document.frm.email.value; phone = document.frm.phone.value; if (name.length==0){ message += "\n - 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 booking form:\n" + message; } alert(message); } return dataRight; } function submitBooking(eid,dt) { if(checkUserRegistrationForm()){ var poststr = "customerName=" + encodeURIComponent( document.frm.customerName.value ) + "&email=" + encodeURIComponent( document.frm.email.value ) + "&phone=" + encodeURIComponent( document.frm.phone.value ) + "¬es=" + encodeURIComponent( document.frm.notes.value ) + "&people=" + encodeURIComponent( document.frm.people.value ); document.getElementById('DateEvents1').innerHTML='Processing booking. Please wait...'; ajaxpage('/booking/load-date-events.php?ac=book&cid='+1+'&eid='+eid+'&dt='+dt+'&'+poststr, 'DateEvents'+1,'get'); } }; function TopMessageF(){ document.getElementById('TopMessage').innerHTML='Loading calendar...'; }; function loadEvents(dt) { window.document.getElementById('DateEvents1').innerHTML='Loading events...'; ajaxpage('/booking/load-date-events.php?cid=1&dt='+dt,'DateEvents1','get'); } loadCalendar = '
'; document.writeln(loadCalendar);