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('/bookings/load-date-events.php?ac=booking_form&cid='+cid+'&eid='+eid+'&dt='+dt, 'DateEvents'+cid,'get'); }; function checkUserRegistrationForm(available_places){ re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/; var name, email, phone, dataRight = true; var message = ""; adults = parseInt(document.frm.adults.value); seniors = parseInt(document.frm.seniors.value); card = parseInt(document.frm.card.value); children = parseInt(document.frm.children.value); children_3 = parseInt(document.frm.children_3.value); name = document.frm.customerName.value; address = document.frm.address.value; city = document.frm.city.value; state = document.frm.state.value; zip = document.frm.zip.value; email = document.frm.email.value; phone = document.frm.phone.value; mobile = document.frm.mobile.value; if (name.length==0){ message += "\n - Name"; dataRight=false; } if (address.length==0){ message += "\n - Address"; dataRight=false; } if (city.length==0){ message += "\n - City"; dataRight=false; } if (state.length==0){ message += "\n - State/Province"; dataRight=false; } if (zip.length==0){ message += "\n - Zip/Post code"; dataRight=false; } if (email.length==0){ message += "\n - Email"; dataRight=false; } if (phone.length==0){ message += "\n - Phone"; dataRight=false; } if (mobile.length==0){ message += "\n - Mobile"; dataRight=false; } if (email.length!=0 && email.match(re)==null){ dataRight=false; message += "\n - Your Email is Incorrect"; } if((adults+seniors+card+children+children_3)>available_places){ dataRight=false; message += "\n - You can book max " + available_places + " place(s)"; } 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,available_places) { if(checkUserRegistrationForm(available_places)){ 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 ) + "&adults=" + encodeURIComponent( document.frm.adults.value ) + "&seniors=" + encodeURIComponent( document.frm.seniors.value ) + "&card=" + encodeURIComponent( document.frm.card.value ) + "&children=" + encodeURIComponent( document.frm.children.value ) + "&children_3=" + encodeURIComponent( document.frm.children_3.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 )+ "&mobile=" + encodeURIComponent( document.frm.mobile.value ); ajaxpage('/bookings/load-date-events.php?ac=book&cid='+cid+'&eid='+eid+'&dt='+dt+'&'+poststr, 'DateEvents'+cid,'get'); } }; function ChangePrice(adults, seniors, card, children, children_3, adult_price, senior_price, card_price, child_price, child_price_3){ var price = adults * adult_price + seniors * senior_price + card * card_price + children * child_price + children_3 * child_price_3; document.getElementById("priceDiv").innerHTML = price.toFixed(2); } loadCalendar = '
'; document.writeln(loadCalendar);