var flagCaptcha = false; var flagFields = true; var maxSlots=10; var minSlots=2; 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 format_number(numbr) { cur_number=''; if (numbr>=1000) { if ((numbr%1000)< 10) { tmp_num='00'+(numbr%1000); } else if ((numbr%1000)< 100) { tmp_num='0'+(numbr%1000); } else { tmp_num=(numbr%1000); } cur_number=format_number(Math.floor((numbr/1000)).toFixed(0))+','+tmp_num; } else { return numbr; } return cur_number; } function recalc_price() { cur_price=document.getElementById("price").value; cur_price=parseFloat(cur_price)+parseFloat(document.getElementById("jetty_pickup_location").options[document.getElementById("jetty_pickup_location").selectedIndex].value)+parseFloat(document.getElementById("drop_off_location").options[document.getElementById("drop_off_location").selectedIndex].value) document.getElementById("priceDiv").innerHTML=format_number(cur_price); } function checkForm() { selected=0; all_inputs=document.getElementsByTagName("input"); for (i=0;i< all_inputs.length;i++) { if ((all_inputs[i].type=="checkbox")&&(all_inputs[i].name!="terms")) { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { selected++; } } } if (selected< minSlots) { alert("The minimum charter is "+minSlots+" hours(s). Please amend your booking."); return false; }; return true; } function selectTimeSlot(percent) { disableElements(); selItems=0; all_inputs=document.getElementsByTagName("input"); for (i=0;i< all_inputs.length;i++) { if ((all_inputs[i].type=="checkbox")&&(all_inputs[i].name!="terms")) { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { selItems++; } } } if(selItems>2) { singlePrice=document.getElementById("singleSecondPrice").value; } else { singlePrice=document.getElementById("singlePrice").value; } price=0; all_inputs=document.getElementsByTagName("input"); for (i=0;i< all_inputs.length;i++) { if ((all_inputs[i].type=="checkbox")&&(all_inputs[i].name!="terms")) { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { price = parseFloat(price) + parseFloat(singlePrice); selItems++; } } } price = parseFloat(price) + parseFloat(price)*parseFloat(percent)/100; document.getElementById("price").value=price; document.getElementById("priceDiv").innerHTML=format_number(parseFloat(price)+parseFloat(document.getElementById("jetty_pickup_location").options[document.getElementById("jetty_pickup_location").selectedIndex].value)+parseFloat(document.getElementById("drop_off_location").options[document.getElementById("drop_off_location").selectedIndex].value)); } function disableElements() { first=-1; last=-1; emptySpot=false; all_inputs=document.getElementsByTagName("input"); for (i=0;i< all_inputs.length;i++) { if ((all_inputs[i].type=="checkbox")&&(all_inputs[i].name!="terms")) { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { if (emptySpot) { all_inputs[i].checked=false; } else { if (first<0) { first=i; last=i; } if ((i-last)>1) { all_inputs[i].checked=false; emptySpot=true; } else { last=i; } } } } } if ((last-first+1)==maxSlots) { reachedMax=1; } else { reachedMax=0; } if (first>=0 && last>=0) { for (i=0;i(last+(1-reachedMax)))) { if ((! all_inputs[i].checked) && (! all_inputs[i].disabled)) { all_inputs[i].disabled=true; } } else { if ((! all_inputs[i].checked)) { all_inputs[i].disabled=false; } } } } } else { for (i=0;i100)) { alert("Please provide valid number of passengers expected (between 1 and 100)!"); return false; } return true; } function submitBooking(startdate,sMonth,sYear) { if (isValidForm()) { document.frm.price.value=parseFloat(document.frm.price.value)+parseFloat(document.getElementById("jetty_pickup_location").options[document.getElementById("jetty_pickup_location").selectedIndex].value)+parseFloat(document.getElementById("drop_off_location").options[document.getElementById("drop_off_location").selectedIndex].value); var poststr = "ac=book&startDate="+startdate+"&beverage_option=" + encodeURIComponent( document.frm.beverage_option.options[document.frm.beverage_option.selectedIndex].text ) +"&jetty_pickup_location=" + encodeURIComponent( document.frm.jetty_pickup_location.options[document.frm.jetty_pickup_location.selectedIndex].text ) +"&drop_off_location=" + encodeURIComponent( document.frm.drop_off_location.options[document.frm.drop_off_location.selectedIndex].text ) +"&entertainment_options=" + encodeURIComponent( document.frm.entertainment_options.options[document.frm.entertainment_options.selectedIndex].text ) +"&event_style=" + encodeURIComponent( document.frm.event_style.options[document.frm.event_style.selectedIndex].text ) +"&event_type=" + encodeURIComponent( document.frm.event_type.options[document.frm.event_type.selectedIndex].text ) +"&catering_options=" + encodeURIComponent( document.frm.catering_options.options[document.frm.catering_options.selectedIndex].text ) +"&num_passengers=" + encodeURIComponent( document.frm.num_passengers.value ) +"&customerName=" + encodeURIComponent( document.frm.customerName.value ) + "&email=" + encodeURIComponent( document.frm.email.value ) + "&phone=" + encodeURIComponent( document.frm.phone.value ) + "¬es=" + encodeURIComponent( document.frm.notes.value ) + "&price=" + encodeURIComponent( document.frm.price.value ); all_inputs=document.getElementsByTagName("input"); for (i=0;i