var s_id=0; var cur_id=0; var first=0; var last=0; var sum=0; var half_day=0; var calendar_id1=1; var total_msg='Total nights so far: '; var min_bl=3; var max_bl=1000; var res_ids1=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 updatePaint1(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;i < res_ids1.length;i++) { if ((s_id < res_ids1[i] && res_ids1[i] < o_id)||(s_id>res_ids1[i] && res_ids1[i]>o_id)) { return; } } var tdays=Math.abs(eval(o_id-s_id))/(60*60*24); document.getElementById("Messages"+calendar_id1).innerHTML=''; if (tdays>max_bl) { document.getElementById("Messages"+calendar_id1).innerHTML='Maximum 1000 days per booking'; 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'+calendar_id1+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) { if (s_id==i) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+s_col+")"; } else if (i==o_id) { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+f_col+")"; } else { 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'+calendar_id1+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) { if (s_id==i) { if (s_id==o_id) { var e = (window.event) ? window.event : evnt; var half=thestyle.offsetWidth/2; var half_sum=parseInt(half)+parseInt(getAbsX(thestyle)); if (half_sum>e.clientX) { half_day=1; thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+f_col+")"; } else { half_day=2; thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+s_col+")"; } } else { thestyle.style.backgroundImage="url("+url+"?color1="+s_col+"&color2="+f_col+")"; } } else if (i==o_id) { thestyle.style.backgroundImage="url("+url+"?color1="+f_col+"&color2="+s_col+")"; } else { 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'+calendar_id1+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 && o_id>=s_id) { var i=cur_id; for (i;i < s_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id1+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 < o_id && o_id<=s_id) { var i=cur_id; for (i;i < o_id;i=i+(60*60*24)) { try { var thestyle= window.document.getElementById('d'+calendar_id1+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 && 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'+calendar_id1+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'+calendar_id1+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 updateRes1() { cal_id_len=0; temp_cal_id=calendar_id1; while(temp_cal_id>=1) { cal_id_len++; temp_cal_id=temp_cal_id/10; } 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_ids1.push(all_date[i].id.substr(parseInt(1)+parseInt(cal_id_len))); } } } } function uclick1(evnt,o_id,s_col,f_col,p_col,b_col,url,c_id,b_id,s_month,s_year) { if (first==1) { var tdays=Math.abs(eval(o_id-s_id))/(60*60*24);var thestyle= window.document.getElementById("d"+calendar_id1+cur_id);sum=parseFloat(sum)-parseFloat(thestyle.abbr);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 (tdays < min_bl) { document.getElementById("Messages"+calendar_id1).innerHTML='Minimum 3 days per booking'; } else if (sdate.getDay()==5&&sdate.getMonth()>=5&&sdate.getMonth()<=7){ document.getElementById("Messages"+calendar_id1).innerHTML='Booking must start from Saturday!'; } else if (edate.getDay()==6&&edate.getMonth()>=5&&edate.getMonth()<=7){ document.getElementById("Messages"+calendar_id1).innerHTML='Booking must end at Friday'; } 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; } // window.document.getElementById("AvailabilityCalendar"+b_id).innerHTML='Loading booking form...'; // window.document.getElementById("Messages"+calendar_id1).innerHTML=''; // abc_ajaxpage('/script2/load-bookingform.php?view=3&half_day='+half_day+'&from='+s_id+'&to='+cur_id+'&sMonth='+s_month+'&sYear='+s_year+'&cid='+c_id,"AvailabilityCalendar"+b_id,'get'); // var btn_click = 'abc_ajaxpage(\'/script2/load-bookingform.php?view=3&half_day=\'+half_day+\'&from=\'+s_id+\'&to=\'+cur_id+\'&sMonth=\'+s_month+\'&sYear=\'+s_year+\'&cid=\'+c_id,\"AvailabilityCalendar\"+b_id,\'get\');'; // console.log(btn_click); window.document.getElementById("Messages"+calendar_id1).innerHTML=''; document.getElementById("goto_booking_form1").onclick = function () { abc_ajaxpage('/script2/load-bookingform.php?view=3&half_day='+half_day+'&from='+s_id+'&to='+cur_id+'&sMonth='+s_month+'&sYear='+s_year+'&cid='+c_id,"AvailabilityCalendar"+b_id,'get'); window.document.getElementById("Messages1").innerHTML=''; document.getElementById('AvailabilityCalendar1').focus(); window.scrollTo(0, document.getElementById('AvailabilityCalendar1').offsetTop); //window.document.getElementById("Messages2").innerHTML=''; //window.document.getElementById("Messages3").innerHTML=''; }; } first=0; res_ids1=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; } updatePaint1(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=''; updatePaint1(evnt,o_id,s_col,f_col,p_col,b_col,url); } } var flagCaptcha = false; 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 abc_ajaxpage(url, containerid, requesttype){ // always reset the message container window.document.getElementById("Messages"+calendar_id1).innerHTML=''; 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; updateRes1(); }; } function ShowToolTip(object) { document.getElementById(object).style.visibility = 'visible'; } function HideToolTip(object) { document.getElementById(object).style.visibility = 'hidden'; } function pause(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis) } function checkUserRegistrationForm1(){ re = /([0-9a-zA-Z\.\-\_]+)@([0-9a-zA-Z\.\-\_]+)\.([0-9a-zA-Z\.\-\_]+)/; var name, email, phone, dataRight = true; var message = ""; name = document.frm1.customerName.value; address = document.frm1.customerAddress.value; email = document.frm1.email.value; phone = document.frm1.phone.value; terms = document.frm1.terms.checked; insurance_exclusions_check = document.frm1.insurance_exclusions_check.checked; if (name.length==0){ message += "\n - Name"; dataRight=false; } if (address.length==0){ message += "\n - Address"; dataRight=false; } if (email.length==0){ message += "\n - Email address"; dataRight=false; } if (phone.length==0){ message += "\n - Phone number"; dataRight=false; } if (email.length!=0 && email.match(re)==null){ dataRight=false; message += "\n - Your Email is incorrect"; } if (!terms){ message += "\n - You must accept our Terms & Conditions"; dataRight=false; } if (!insurance_exclusions_check){ message += "\n - You must confirm our Insurance Exclusions"; dataRight=false; } if (!dataRight){ if (message != ""){ message ="\nYou failed to correctly fill in the booking form:\n" + message; } alert(message); } return dataRight; } function ProcessingBooking1() { document.getElementById('DateBookings1').innerHTML='Processing booking. Please wait...'; } function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } function submitBooking1(from, to, sMonth, sYear, form) { if (checkUserRegistrationForm1()) { /*var post = '?1=1'; var form = document.forms['frm1']; for (var i in form.elements) { post += '&'+form.elements[i].name+'='+getFieldValue(form.elements[i]); } console.log(post);*/ s_id=0; cur_id=0; if (getRadioValue(document.frm1.european_insurance)==1||getRadioValue(document.frm1.transfer)=='Yes'){ ac = 'book'; } else { ac = 'summary'; } var poststr = "ac="+ac+"&startDate="+from+"&endDate="+to+"&half_day=" + encodeURIComponent( document.frm1.half_day.value ) + "&email=" + encodeURIComponent( document.frm1.email.value ) + "&phone=" + encodeURIComponent( document.frm1.phone.value ) + "¬es=" + encodeURIComponent( document.frm1.notes.value ) + "&price=" + encodeURIComponent( document.frm1.price.value ); poststr += "&extra_price=" + encodeURIComponent( document.frm1.extra_price.value ); poststr += "&customerAddress=" + encodeURIComponent( document.frm1.customerAddress.value ); poststr += "&customerName=" + encodeURIComponent( document.frm1.customerName.value ); poststr += "&is_driver=" + encodeURIComponent( getSelectValue(document.frm1.is_driver) ); poststr += "&adults=" + encodeURIComponent( document.frm1.adults.value ); poststr += "&children=" + encodeURIComponent( document.frm1.children.value ); poststr += "&babies=" + encodeURIComponent( document.frm1.babies.value ); poststr += "&how=" + encodeURIComponent( document.frm1.how.value ); poststr += "&how_other=" + encodeURIComponent( document.frm1.how_other.value ); poststr += "&pets=" + encodeURIComponent( getCheckedValue(document.frm1.pets) ); poststr += "&additional_drivers=" + encodeURIComponent( getSelectValue(document.frm1.additional_drivers) ); poststr += "&driver_name[1]=" + encodeURIComponent( document.frm1.driver_name_1.value ); poststr += "&driver_name[2]=" + encodeURIComponent( document.frm1.driver_name_2.value ); poststr += "&driver_name[3]=" + encodeURIComponent( document.frm1.driver_name_3.value ); poststr += "&driver_address[1]=" + encodeURIComponent( document.frm1.driver_address_1.value ); poststr += "&driver_address[2]=" + encodeURIComponent( document.frm1.driver_address_2.value ); poststr += "&driver_address[3]=" + encodeURIComponent( document.frm1.driver_address_3.value ); /* poststr += "&driver_birth[1]=" + encodeURIComponent( document.frm1.driver_birth_1.value ); poststr += "&driver_birth[2]=" + encodeURIComponent( document.frm1.driver_birth_2.value ); poststr += "&driver_birth[3]=" + encodeURIComponent( document.frm1.driver_birth_3.value ); //poststr += "&driver_licence_held[1]=" + encodeURIComponent( document.frm1.driver_licence_held_1.value ); //poststr += "&driver_licence_held[2]=" + encodeURIComponent( document.frm1.driver_licence_held_2.value ); //poststr += "&driver_licence_held[3]=" + encodeURIComponent( document.frm1.driver_licence_held_3.value ); //poststr += "&driver_licence_points[1]=" + encodeURIComponent( document.frm1.driver_licence_points_1.value ); //poststr += "&driver_licence_points[2]=" + encodeURIComponent( document.frm1.driver_licence_points_2.value ); //poststr += "&driver_licence_points[3]=" + encodeURIComponent( document.frm1.driver_licence_points_3.value ); poststr += "&driver_number_conviction[1]=" + encodeURIComponent( document.frm1.driver_number_conviction_1.value ); poststr += "&driver_number_conviction[2]=" + encodeURIComponent( document.frm1.driver_number_conviction_2.value ); poststr += "&driver_number_conviction[3]=" + encodeURIComponent( document.frm1.driver_number_conviction_3.value ); poststr += "&driver_driving_test[1]=" + encodeURIComponent( document.frm1.driver_driving_test_1.value ); poststr += "&driver_driving_test[2]=" + encodeURIComponent( document.frm1.driver_driving_test_2.value ); poststr += "&driver_driving_test[3]=" + encodeURIComponent( document.frm1.driver_driving_test_3.value ); poststr += "&driver_nationality[1]=" + encodeURIComponent( document.frm1.driver_nationality_1.value ); poststr += "&driver_nationality[2]=" + encodeURIComponent( document.frm1.driver_nationality_2.value ); poststr += "&driver_nationality[3]=" + encodeURIComponent( document.frm1.driver_nationality_3.value ); poststr += "&driver_occupation[1]=" + encodeURIComponent( document.frm1.driver_occupation_1.value ); poststr += "&driver_occupation[2]=" + encodeURIComponent( document.frm1.driver_occupation_2.value ); poststr += "&driver_occupation[3]=" + encodeURIComponent( document.frm1.driver_occupation_3.value ); poststr += "&driver_employer[1]=" + encodeURIComponent( document.frm1.driver_employer_1.value ); poststr += "&driver_employer[2]=" + encodeURIComponent( document.frm1.driver_employer_2.value ); poststr += "&driver_employer[3]=" + encodeURIComponent( document.frm1.driver_employer_3.value ); poststr += "&driver_employer_phone[1]=" + encodeURIComponent( document.frm1.driver_employer_phone_1.value ); poststr += "&driver_employer_phone[2]=" + encodeURIComponent( document.frm1.driver_employer_phone_2.value ); poststr += "&driver_employer_phone[3]=" + encodeURIComponent( document.frm1.driver_employer_phone_3.value ); poststr += "&driver_licence_number[1]=" + encodeURIComponent( document.frm1.driver_licence_number_1.value ); poststr += "&driver_licence_number[2]=" + encodeURIComponent( document.frm1.driver_licence_number_2.value ); poststr += "&driver_licence_number[3]=" + encodeURIComponent( document.frm1.driver_licence_number_3.value ); poststr += "&driver_refused_insurance[1]=" + encodeURIComponent( getRadioValue(document.frm1.driver_refused_insurance_1) ); poststr += "&driver_refused_insurance[2]=" + encodeURIComponent( getRadioValue(document.frm1.driver_refused_insurance_2) ); poststr += "&driver_refused_insurance[3]=" + encodeURIComponent( getRadioValue(document.frm1.driver_refused_insurance_3) ); poststr += "&driver_refused_insurance_yes[1]=" + encodeURIComponent( document.frm1.driver_refused_insurance_yes_1.value ); poststr += "&driver_refused_insurance_yes[2]=" + encodeURIComponent( document.frm1.driver_refused_insurance_yes_2.value ); poststr += "&driver_refused_insurance_yes[3]=" + encodeURIComponent( document.frm1.driver_refused_insurance_yes_3.value ); poststr += "&driver_number_accidents[1]=" + encodeURIComponent( document.frm1.driver_number_accidents_1.value ); poststr += "&driver_number_accidents[2]=" + encodeURIComponent( document.frm1.driver_number_accidents_2.value ); poststr += "&driver_number_accidents[3]=" + encodeURIComponent( document.frm1.driver_number_accidents_3.value ); poststr += "&driver_disabilities[1]=" + encodeURIComponent( getRadioValue(document.frm1.driver_disabilities_1) ); poststr += "&driver_disabilities[2]=" + encodeURIComponent( getRadioValue(document.frm1.driver_disabilities_2) ); poststr += "&driver_disabilities[3]=" + encodeURIComponent( getRadioValue(document.frm1.driver_disabilities_3) ); poststr += "&driver_disabilities_yes[1]=" + encodeURIComponent( document.frm1.driver_disabilities_yes_1.value ); poststr += "&driver_disabilities_yes[2]=" + encodeURIComponent( document.frm1.driver_disabilities_yes_2.value ); poststr += "&driver_disabilities_yes[3]=" + encodeURIComponent( document.frm1.driver_disabilities_yes_3.value ); */ poststr += "&european_insurance=" + encodeURIComponent( getRadioValue(document.frm1.european_insurance) ); poststr += "&collision_damage_waiver=" + encodeURIComponent( getRadioValue(document.frm1.collision_damage_waiver) ); poststr += "&food=" + encodeURIComponent( getCheckboxValue(document.frm1.food) ); poststr += "&shopping=" + encodeURIComponent( getCheckboxValue(document.frm1.shopping) ); poststr += "&dvd=" + encodeURIComponent( getCheckboxValue(document.frm1.dvd) ); poststr += "&duvets=" + encodeURIComponent( getCheckboxValue(document.frm1.duvets) ); poststr += "&duvets_sets=" + encodeURIComponent( document.frm1.duvets_sets.value ); poststr += "&bike_rack=" + encodeURIComponent( getCheckboxValue(document.frm1.bike_rack) ); poststr += "&sat_nav=" + encodeURIComponent( getCheckboxValue(document.frm1.sat_nav) ); poststr += "&selection_of_games=" + encodeURIComponent( getCheckboxValue(document.frm1.selection_of_games) ); poststr += "&picnic_rug=" + encodeURIComponent( getCheckboxValue(document.frm1.picnic_rug) ); poststr += "&camping_loo=" + encodeURIComponent( getCheckboxValue(document.frm1.camping_loo) ); poststr += "&solar_shower=" + encodeURIComponent( getCheckboxValue(document.frm1.solar_shower) ); poststr += "&sleeping_bag=" + encodeURIComponent( getCheckboxValue(document.frm1.sleeping_bag) ); poststr += "&sleeping_bag_count=" + encodeURIComponent( document.frm1.sleeping_bag_count.value ); poststr += "&camping_mat=" + encodeURIComponent( getCheckboxValue(document.frm1.camping_mat) ); poststr += "&camping_mat_count=" + encodeURIComponent( document.frm1.camping_mat_count.value ); poststr += "&towels=" + encodeURIComponent( getCheckboxValue(document.frm1.towels) ); poststr += "&towels_count=" + encodeURIComponent( document.frm1.towels_count.value ); poststr += "&promotion_code=" + encodeURIComponent( document.frm1.promotion_code.value ); poststr += "&terms=" + encodeURIComponent( getCheckboxValue(document.frm1.terms) ); poststr += "&mobile=" + encodeURIComponent( document.frm1.mobile.value ); poststr += "&insurance_exclusions=" + encodeURIComponent( getCheckboxValue(document.frm1.insurance_exclusions_check) ); poststr += "&transfer=" + encodeURIComponent( getRadioValue(document.frm1.transfer) ); poststr += "&awning=" + encodeURIComponent( getCheckboxValue(document.frm1.awning) ); ProcessingBooking1(); document.getElementById('AvailabilityCalendar1').innerHTML=''; abc_ajaxpage('/script2/load-bookingform.php?view=3&cid=1&'+poststr,'DateBookings1','get'); } } function getFieldValue(obj) { switch (getFieldType(obj)) { case 'checkbox': return getCheckboxValue(obj); break; case 'hidden': return getTextValue(obj); break; case 'text': return getTextValue(obj); break; case 'radio': return getRadioValue(obj); break; default: return getTextValue(obj); break; } } function getFieldType(obj) { return obj.type; } function getCheckboxValue(obj) { if (obj.length == undefined) { if (obj.checked) { return obj.value; } else { return ''; } } else { var val = []; for (var i in obj) { if (obj[i].checked) { val[obj[i].name] = obj[i].value; } } return val; } } function getTextValue(obj) { return obj.value; } function getSelectValue(obj) { return obj.options[obj.selectedIndex].value; } function getRadioValue(obj) { var radioLength = obj.length; //console.log(obj, radioLength); for (var i=0; i < radioLength; i++) { if (obj[i].checked) { return obj[i].value; } } return ''; } function TopMessageF1(){ document.getElementById('TopMessage1').innerHTML='Loading calendar...'; } function showDriverTables(obj) { var val = parseInt(obj.options[obj.selectedIndex].value); var header = document.getElementById('hideThis'); // console.log(val); if (val == 1) { // console.log('Hide all!!!'); for (i = 2; i <= 3; i++) { document.getElementById('driverData_' + i).style.display = 'none'; header.style.display = 'none'; } } else { for (i = 2; i <= 3; i++) { document.getElementById('driverData_' + i).style.display = 'none'; header.style.display = 'none'; } for (i = 2; i <= val; i++) { // console.log('Show '+i); document.getElementById('driverData_' + i).style.display = 'block'; header.style.display = 'block'; } } return true; } function showMainDriverTable(obj) { var val = parseInt(obj.options[obj.selectedIndex].value); if (val == 0) { document.getElementById('mainDriverTable').style.display = 'block'; } else { document.getElementById('mainDriverTable').style.display = 'none'; } return true; } function calculatePrice1(countDays){ var ElementsArr = getElementsByClassName( 'calculate', document.body ); var basicPrice=document.frm1.basePrice.value; var price=0; var extras=0; for ( var i = 0; i < ElementsArr.length; i++ ) { if (ElementsArr[i].type=="checkbox"&&ElementsArr[i].checked==true){ count=1; if (document.getElementById(ElementsArr[i].name+'_count')!==null){ count=parseInt(document.getElementById(ElementsArr[i].name+'_count').value); } if (document.getElementById(ElementsArr[i].name+'_sets')!==null){ count=parseInt(document.getElementById(ElementsArr[i].name+'_sets').value); } extras+=parseFloat(ElementsArr[i].title)*count; price=price+parseFloat(ElementsArr[i].title)*count; } if (ElementsArr[i].type=="select-one"&&ElementsArr[i].value>'0'){ count=parseInt(ElementsArr[i].value); price+=parseFloat(ElementsArr[i].title)*count; } if (ElementsArr[i].type=="radio"&&(ElementsArr[i].value=='1' || ElementsArr[i].value=='Yes')&&ElementsArr[i].checked==true){ if (ElementsArr[i].name!='pets'){ switch(ElementsArr[i].name){ case 'european_insurance': if (document.getElementById('collision_damage_waiveryes').checked==true){ insurancePrice=countDays*parseFloat(document.getElementById('collision_damage_waiveryes').title); } else { insurancePrice=0; } document.getElementById('insurancePriceStr').innerHTML=parseFloat(ElementsArr[i].title)+insurancePrice; if (parseFloat(document.getElementById('insurancePriceStr').innerHTML)<2){ //price+=parseFloat(ElementsArr[i].title)+insurancePrice; } break; case 'collision_damage_waiver': insurancePrice=parseFloat(document.getElementById('collision_damage_waiveryes').title); insurancePrice=0; document.getElementById('insurancePriceStr').innerHTML=insurancePrice+countDays*parseFloat(ElementsArr[i].title); price+=insurancePrice+countDays*parseFloat(ElementsArr[i].title); extras+=insurancePrice+countDays*parseFloat(ElementsArr[i].title); break; case 'insurance_exclusions': document.getElementById('exclusionsPriceStr').innerHTML=ElementsArr[i].title; //price+=parseFloat(ElementsArr[i].title); break; case 'transfer': document.getElementById('transfersPriceStr').innerHTML=ElementsArr[i].title; //price+=parseFloat(ElementsArr[i].title); break; } } else { price+=parseFloat(ElementsArr[i].title); extras+=parseFloat(ElementsArr[i].title); } } if (ElementsArr[i].type=="radio"&&(ElementsArr[i].value=='0' || ElementsArr[i].value=='No')&&ElementsArr[i].checked==true){ switch(ElementsArr[i].name){ case 'european_insurance': document.getElementById('insurancePriceStr').innerHTML=0; break; case 'collision_damage_waiver': document.getElementById('insurancePriceStr').innerHTML=0; break; case 'insurance_exclusions': document.getElementById('exclusionsPriceStr').innerHTML=0; break; case 'transfer': document.getElementById('transfersPriceStr').innerHTML=0; break; } } } document.getElementById('totalPriceStr').innerHTML=parseFloat(basicPrice)+price; document.getElementById('ExtrasPriceStr').innerHTML=extras; document.getElementById('extra_price').value=extras; document.getElementById('price').value=parseFloat(basicPrice)+price; } function getElementsByClassName( strClassName, obj ) { var ar = arguments[2] || new Array(); var re = new RegExp("\\b" + strClassName + "\\b", "g"); if ( re.test(obj.className) ) { ar.push( obj ); } for ( var i = 0; i < obj.childNodes.length; i++ ) getElementsByClassName( strClassName, obj.childNodes[i], ar ); return ar; } function trim(stringToTrim) { stringToTrim.replace('\n',''); return stringToTrim.replace(/^\s+|\s+$/g,""); } function pay(){ CL.Ajax.sendRequest('/script2/load-bookingform.php?ac=book&cid=1', function (result) { document.paypalFrm.custom.value = trim(result.responseText); document.paypalFrm.submit(); }); } function confirm(cid){ CL.Ajax.sendRequest('/script2/load-bookingform.php?ac=book&cid=1', function (result) { document.getElementById('DateBookings'+cid).innerHTML =result.responseText; }); } var CL = CL || {}; CL.Ajax = { XMLHttpFactories: [ function () {return new XMLHttpRequest()}, function () {return new ActiveXObject("Msxml2.XMLHTTP")}, function () {return new ActiveXObject("Msxml3.XMLHTTP")}, function () {return new ActiveXObject("Microsoft.XMLHTTP")} ], sendRequest: function (url, callback, postData) { var req = this.createXMLHTTPObject(); if (!req) { return; } var method = (postData) ? "POST" : "GET"; req.open(method, url, true); req.setRequestHeader('User-Agent', 'XMLHTTP/1.0'); req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); if (postData) { req.setRequestHeader('Content-type','application/x-www-form-urlencoded'); } req.onreadystatechange = function () { if (req.readyState != 4) { return; } if (req.status != 200 && req.status != 304) { // alert('HTTP error ' + req.status); return; } callback(req); } if (req.readyState == 4) { return; } req.send(postData); }, createXMLHTTPObject: function () { var xmlhttp = false; for (var i = 0; i < this.XMLHttpFactories.length; i++) { try { xmlhttp = this.XMLHttpFactories[i](); } catch (e) { continue; } break; } return xmlhttp; } }; loadCalendar1 = '
'; document.writeln(loadCalendar1);