// packages/car-rental/www/search.js.adp // @author (bjoern_kiesbye@web.de) // @creation-date 2009-01-07 // @cvs-id $Id: cr-clever-ajax.js.adp,v 1.43 2009/06/09 16:18:21 bjoern Exp $ /* Classes or JavaScript Objects to request/order/filter/display/ (organise) Search Results. */ /***************************************************************** * Option Objects * ****************************************************************/ function cr_customer (owner, title, first_names, last_name, name_postfix, street, postcode, street_number, city, country, telefon, mobile, fax , email, flight_number, hotel_name, comments, equipments_arr, selected_equips_arr) { this.owner = owner; this.title = title; this.first_names = first_names; this.last_name = last_name; this.name_postfix = name_postfix; this.street = street; this.street_number = street_number; this.postcode = postcode; this.city = city; this.country = country; this.telefon = telefon; this.mobile = mobile; this.fax = fax; this.email = email; this.flight_number = flight_number; this.hotel_name = hotel_name; this.comments = comments; this.selected_equips = selected_equips_arr; this.cc_holder = null; this.cc_number = null; this.cc_company = null; this.cc_series_code = null; this.cc_valid_month = null; this.cc_valid_year = null; this.emailValidP = new RegExp( "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$" , "i"); // this.ccNumberValidP = new RegExp("^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$"); this.cc_reset = function () { this.cc_holder = null; this.cc_number = null; this.cc_company = null; this.cc_series_code = null; this.cc_valid_till = null; }; this.reset = function () { this.title = null; this.first_names = null; this.last_name = null; this.name_postfix = null; this.street = null; this.postcode = null; this.city = null; this.country = '-1' ; this.telefon = null; this.mobile = null; this.fax = null; this.email = null; this.flight_airline = null; this.flight_number = null; this.hotel_name = null; this.comments = null; this.selected_equips = new Array(); this.cc_reset(); }; this.getSelectedEquipQuantity = function(equip_ref) { for (var i=0;i < this.selected_equips.length;i++) { if (this.selected_equips[i][0] == equip_ref) { return this.selected_equips[i][1] } } return ''; }; this.addUpDelEquipment = function(equip_ref, quantity) { // check if the equipment was selected previously var new_equip = null; for (var i=0;i < this.selected_equips.length;i++) { if (this.selected_equips[i][0] == equip_ref) { if (quantity.length == 0 || quantity.localeCompare("0") == 0) { // remove the equipment from the list this.selected_equips = this.selected_equips.slice(i, i); } else { // update quantity this.selected_equips[i][1] = quantity; } // if we are here equip_ref is either updated or deleted from this.selected_equips array // we can return return } } // in case we reached this point we have to add equip_ref and quantity to array of this.selected_equips if (quantity.length != 0 && quantity.localeCompare("0") != 0) { this.selected_equips[this.selected_equips.length] = new Array(equip_ref, quantity); } }; this.max_len = function (str, pmax_len) { var max_len = (pmax_len -1); var str_length = str.length; if(str_length <= max_len){ return true; }else{ return false; } }; this.showHideObject = function(objectId, pFlag){ var obj = getEBI(objectId); if(obj){ if(pFlag){ obj.style.display = "block"; }else{ obj.style.display = "none"; } } }; this.checkValues = function () { var allValidP = true; var cur_txt = getEBI('cr_customer_first_names_txt'); var cur_err = getEBI('cr_customer_first_names_err'); if (cur_txt.value != '' && this.max_len(cur_txt.value, 20) ) { this.first_names = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The First Names must be no longer than 20 Letters!' this.showHideObject('cr_customer_first_names_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_last_name_txt'); var cur_err = getEBI('cr_customer_last_name_err'); if (cur_txt.value != '' && this.max_len(cur_txt.value, 20) ) { this.last_name = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The Last Name must be no longer than 20 Letters!' this.showHideObject('cr_customer_last_name_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_title_txt'); var cur_err = getEBI('cr_customer_title_err'); if (this.max_len(cur_txt.value, 20) ) { this.title = cur_txt.value; } else { cur_err.innerHTML = 'The Title must be no longer than 20 Letters!' this.showHideObject('cr_customer_title_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_name_postfix_txt'); var cur_err = getEBI('cr_customer_name_postfix_err'); if (this.max_len(cur_txt.value, 20) ) { this.name_postfix = cur_txt.value; } else { cur_err.innerText = 'The Name Postfix must be no longer than 20 Letters!' this.showHideObject('cr_customer_name_postfix_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_street_txt'); var cur_err = getEBI('cr_customer_street_err'); var street_err = false; if (cur_txt.value != '' && this.max_len(cur_txt.value, 50) ) { this.street = cur_txt.value; cur_err.innerHTML = ''; street_err = false; } else { cur_err.innerHTML = 'The Street must be no longer than 50 Letters!' this.showHideObject('cr_customer_street_err', true); allValidP = false; street_err = false; } var cur_txt = getEBI('cr_customer_street_number_txt'); var cur_err = getEBI('cr_customer_street_err'); if (cur_txt.value != '' && this.max_len(cur_txt.value, 10) ) { this.street_number = cur_txt.value; if (!street_err) { cur_err.innerHTML = ''; } } else { cur_err.innerHTML = 'The Street No. must not be empty and no longer than 10 Letters!' this.showHideObject('cr_customer_street_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_postcode_txt'); var cur_err = getEBI('cr_customer_postcode_err'); if (cur_txt.value != '' && this.max_len(cur_txt.value, 7) ) { this.postcode = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The Postcode must be no longer than 7 Letters!'; this.showHideObject('cr_customer_postcode_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_city_txt'); var cur_err = getEBI('cr_customer_city_err'); if (cur_txt.value != '' ) { this.city = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'Please enter your City or Region of residence!'; this.showHideObject('cr_customer_city_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_country_txt'); var cur_err = getEBI('cr_customer_country_err'); if (cur_txt.value != '-1' ) { this.country = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'Please Select your Country of origin!'; this.showHideObject('cr_customer_country_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_telefon_txt'); var cur_err = getEBI('cr_customer_telefon_err'); if (cur_txt.value.length != 0 && this.max_len(cur_txt.value, 20 )) { this.telefon = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The Telefon No. can not be longer than 20 digits!'; this.showHideObject('cr_customer_telefon_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_mobile_txt'); var cur_err = getEBI('cr_customer_mobile_err'); if (this.max_len(cur_txt.value, 20 )) { this.mobile = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The Mobile No. can not be longer than 20 digits!'; this.showHideObject('cr_customer_mobile_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_comments_txt'); var cur_err = getEBI('cr_customer_comments_err'); if (this.max_len(cur_txt.value, 200 )) { this.comments = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The Comment can not be longer than 200 Letters!'; this.showHideObject('cr_customer_comments_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_email_txt'); var cur_txt_2 = getEBI('cr_customer_email_verify_txt'); var cur_err = getEBI('cr_customer_email_err'); if (this.emailValidP.test(cur_txt.value)) { if (cur_txt.value == cur_txt_2.value) { this.email = cur_txt.value; cur_err.innerHTML = ''; } else { cur_err.innerHTML = 'The Fields Email and Email verify must match!' ; this.showHideObject('cr_customer_email_err', true); allValidP = false; } } else { cur_err.innerHTML = 'The Email in Field Email, does not seem to be a valid Email address!' ; this.showHideObject('cr_customer_email_err', true); allValidP = false; } if (this.owner.selected_result_set.fromStation.atAirportP) { this.flight_airline = getEBI('cr_customer_flight_airline_txt').value; this.flight_number = getEBI('cr_customer_flight_number_txt').value; } else { this.hotel_name = getEBI('cr_customer_hotel_name_txt').value; } // get/update equipments var all_equips = this.owner.selected_result_set.equipments; var equip_quantity = null; for (var i=0;i < all_equips.length;i++) { equip_quantity = getEBI('cr_customer_equip_' + all_equips[i].code + '_txt').value; // add , del or update if equip was selected previously this.addUpDelEquipment(all_equips[i] , equip_quantity ); } // get cc data if (this.owner.selected_result_set.rateQualifier != "POSTPAID-EX") { var cur_txt = getEBI('cr_customer_cc_holder_txt'); var cur_err = getEBI('cr_customer_cc_holder_err'); if (cur_txt.value != '') { this.cc_holder = cur_txt.value; } else { cur_err.innerHTML = 'Please fill in Credit Card Holder.' ; this.showHideObject('cr_customer_cc_holder_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_cc_number_txt'); var cur_err = getEBI('cr_customer_cc_number_err'); //if (this.ccNumberValidP.test(cur_txt.value)) { if (1) { this.cc_number = cur_txt.value; } else { cur_err.innerHTML = 'The Credit Card Number, does not seem to be a valid Number, please check!' ; this.showHideObject('cr_customer_cc_number_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_cc_company_txt'); var cur_err = getEBI('cr_customer_cc_company_err'); if (cur_txt.value != '-1') { this.cc_company = cur_txt.value; } else { cur_err.innerHTML = 'Please Select Credit Card Company.' ; this.showHideObject('cr_customer_cc_company_err', true); allValidP = false; } var cur_txt = getEBI('cr_customer_cc_valid_month_txt'); var cur_txt2 = getEBI('cr_customer_cc_valid_year_txt'); this.cc_valid_month = cur_txt.value; this.cc_valid_year = cur_txt2.value; var cur_txt = getEBI('cr_customer_cc_series_code_txt'); var cur_err = getEBI('cr_customer_cc_series_code_err'); if (cur_txt.value != '' && cur_txt.value.length <= 4 ) { this.cc_series_code = cur_txt.value; } else { cur_err.innerHTML = 'Please enter the Series Code of your Credit Card, (up to 3 Alphanumeric Letters are allowed).'; this.showHideObject('cr_customer_cc_series_code_err', true); allValidP = false; } } //alert("allValidP=" + allValidP) return allValidP; }; this.display = function(reset_p) { if (reset_p == null || reset_p == true) this.reset(); var customer_html = '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += '

Tenant

'; customer_html += '
' customer_html += '
'; customer_html += ' '; customer_html += '
*
' customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; //customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; if (this.owner.selected_result_set.fromStation.atAirportP) { customer_html += '
'; //customer_html += '
'; customer_html += '
'; } else { customer_html += '
'; } customer_html += '
'; // equipments customer_html += '

Equipments:

'; customer_html += '
'; customer_html += '
'; var equips = this.owner.selected_result_set.equipments; for (var i=0;i < equips.length;i++) { customer_html += '
'; customer_html += '
'; //customer_html += '' + equips[i].name + ' ' + equips[i].price.amount + ' ' + equips[i].price.currency + ' (zZgl. Steuern ' + equips[i].price.taxIncludedP + ' )'; } var tabindex = 16 + i; customer_html += '

Notes:

'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '

CC Information:

'; if (this.owner.selected_result_set.rateQualifier != 'POSTPAID-EX') { customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
/
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
*
'; customer_html += '
'; customer_html += ' '; //customer_html += '
'; customer_html += '
'; } customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += ' '; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; customer_html += '
'; return customer_html; }; } function cr_order (result_set) { this.selected_result_set = result_set; // is set when a user selects a offer this.selected_equipments = null; this.customer = null; this.booking_id = null; // com procs this.tries = 0; this.req_xml = null; this.voucher_base = 'http://www.cartrawler.com/res/voucher.php?resid='; this.display = function() { var order_html = '
'; var hire_summery_html = '
'; hire_summery_html += '
'; hire_summery_html += '
'; hire_summery_html += '
'; hire_summery_html += ' Your Rental '; hire_summery_html += '
'; hire_summery_html += '
' hire_summery_html += '
'; hire_summery_html += '
'; var fromDT = this.selected_result_set.owner.travelDates.fromDateTime; hire_summery_html += ' From: ' + fromDT.toLocaleDateString() + ' ' + fromDT.getHours() + ':' + ((fromDT.getMinutes() + '').length == 1? "0" + fromDT.getMinutes() : fromDT.getMinutes()) + '
Rental: ' + this.selected_result_set.fromStation.country + ' - ' + this.selected_result_set.fromStation.name + '

'; var toDT = this.selected_result_set.owner.travelDates.toDateTime; hire_summery_html += ' Until: ' + toDT.toLocaleDateString() + ' ' + toDT.getHours() + ':' + ((toDT.getMinutes() + '').length == 1? "0" + toDT.getMinutes() : toDT.getMinutes()) + '
Fee: ' + this.selected_result_set.toStation.country + ' - ' + this.selected_result_set.toStation.name; hire_summery_html += '
'; hire_summery_html += '
'; var accomplishments_html = '
'; accomplishments_html += this.selected_result_set.displayCompact(); accomplishments_html += '
'; accomplishments_html += '
'; accomplishments_html += '
'; if (this.customer == null) this.customer = new cr_customer(this); var customer_html = this.customer.display(); order_html += hire_summery_html + accomplishments_html + customer_html + '
'; return order_html; }; this.displayOrderSuccessfull = function(pTitle, pMessage) { //alert("Thanks For Booking at Clever-Mietwagen.com"); //locale_alert("form_container" , "Thanks" , "Thanks For Booking at Clever-Mietwagen.com" , 50 , 50 ); var order_finished_html = ''; order_finished_html += '
'; order_finished_html += '
'; order_finished_html += '

'+pTitle+'

'; order_finished_html += '
'; order_finished_html += pMessage; order_finished_html += '
'; order_finished_html += '
'; order_finished_html += '
'; order_finished_html += '

Mietwagen Preisvergleich

'; order_finished_html += '
'; order_finished_html += '
'; order_finished_html += ' some text'; order_finished_html += '
'; order_finished_html += '
'; return order_finished_html; }; this.purchaseOffer = function () { // check personal information of customer if (!this.customer.checkValues()) return false; // as far as we can check, the data is in proper state // collect all information and submit them to the server var xmlDoc = getXMLDomObj(); var root_node = xmlDoc.createElement("OrderRQ"); // add order details var details_node = root_node.appendChild(xmlDoc.createElement("OrderDetails")); var cur_node = details_node.appendChild(xmlDoc.createElement("FromDateTime")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.owner.travelDates.getAjaxFrom())); cur_node = details_node.appendChild(xmlDoc.createElement("ToDateTime")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.owner.travelDates.getAjaxTo())); cur_node = details_node.appendChild(xmlDoc.createElement("FromStationId")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.fromStation.id)); cur_node = details_node.appendChild(xmlDoc.createElement("ToStationId")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.toStation.id)); car_node = details_node.appendChild(xmlDoc.createElement("Car")); car_node.setAttribute("Size" , this.selected_result_set.car_size_id); car_node.setAttribute("Type" , this.selected_result_set.car_type_id); car_node.setAttribute("Code" , this.selected_result_set.getLayoutByName('Code').value); car_node.setAttribute("assetNumber" , this.selected_result_set.assetNumber); car_node.setAttribute("Doors" , this.selected_result_set.getLayoutByName('Doors').value); car_node.setAttribute("Passengers" , this.selected_result_set.getLayoutByName('PassengerQuantity').value); car_node.setAttribute("Baggages" , this.selected_result_set.getLayoutByName('BaggageQuantity').value); car_node.setAttribute("TransmissionType" , this.selected_result_set.getLayoutByName('TransmissionType').value); car_node.setAttribute("AirConditionInd" , this.selected_result_set.getLayoutByName('AirConditionInd').value); // add selected equipments to car node var equips_node = car_node.appendChild(xmlDoc.createElement("Equipments")); for (var i=0; i < this.customer.selected_equips.length; i++) { var equip_node = equips_node.appendChild(xmlDoc.createElement("Equipment")); equip_node.setAttribute("Code" , this.customer.selected_equips[i][0].code); equip_node.setAttribute("Count" , this.customer.selected_equips[i][1]); cur_node = equip_node.appendChild(xmlDoc.createElement("Name")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.selected_equips[i][0].name)); cur_node = equip_node.appendChild(xmlDoc.createElement("price")); cur_node.setAttribute("IncludedP" , (this.customer.selected_equips[i][0].price.IncludedP ? 't' : 'f')); cur_node.setAttribute("taxIncludedP" , (this.customer.selected_equips[i][0].price.taxIncludedP ? 't' : 'f')); cur_node = cur_node.appendChild(xmlDoc.createElement("Amount")); cur_node.setAttribute("currency" , this.customer.selected_equips[i][0].price.currency); cur_node.appendChild(xmlDoc.createTextNode(this.customer.selected_equips[i][0].price.amount)); } // add coverages to details node var covs_node = details_node.appendChild(xmlDoc.createElement("Coverages")); for (var i=0; i < this.selected_result_set.coverages.length; i++) { var cov_node = covs_node.appendChild(xmlDoc.createElement("Coverage")); cov_node.setAttribute("Type" , this.selected_result_set.coverages[i].code); cur_node = cov_node.appendChild(xmlDoc.createElement("Name")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.coverages[i].name)); cur_node = cov_node.appendChild(xmlDoc.createElement("price")); cur_node.setAttribute("IncludedP" , (this.selected_result_set.coverages[i].price.IncludedP ? 't' : 'f')); cur_node.setAttribute("taxIncludedP" , (this.selected_result_set.coverages[i].price.taxIncludedP ? 't' : 'f')); cur_node = cur_node.appendChild(xmlDoc.createElement("Amount")); cur_node.setAttribute("currency" , this.selected_result_set.coverages[i].price.currency); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.coverages[i].price.amount)); } // add complete price var price_node = details_node.appendChild(xmlDoc.createElement("Price")); cur_node = price_node.appendChild(xmlDoc.createElement("Amount")); cur_node.setAttribute("currency" , this.selected_result_set.currency); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.price)); // add customer information var customer_node = root_node.appendChild(xmlDoc.createElement("Customer")); var cur_node = customer_node.appendChild(xmlDoc.createElement("Title")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.title)); cur_node = customer_node.appendChild(xmlDoc.createElement("FirstNames")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.first_names)); cur_node = customer_node.appendChild(xmlDoc.createElement("LastName")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.last_name)); cur_node = customer_node.appendChild(xmlDoc.createElement("NamePostfix")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.name_postfix)); cur_node = customer_node.appendChild(xmlDoc.createElement("Street")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.street)); cur_node = customer_node.appendChild(xmlDoc.createElement("StreetNumber")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.street_number)); cur_node = customer_node.appendChild(xmlDoc.createElement("Postcode")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.postcode)); cur_node = customer_node.appendChild(xmlDoc.createElement("City")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.city)); cur_node = customer_node.appendChild(xmlDoc.createElement("Telefon")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.telefon)); cur_node = customer_node.appendChild(xmlDoc.createElement("Mobile")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.mobile)); cur_node = customer_node.appendChild(xmlDoc.createElement("Email")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.email)); if (this.selected_result_set.fromStation.atAirportP) { cur_node = customer_node.appendChild(xmlDoc.createElement("FlightNumber")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.flight_number)); cur_node.setAttribute('AirlineCode' , this.customer.flight_airline); } else { cur_node = customer_node.appendChild(xmlDoc.createElement("HotelName")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.hotel_name)); } cur_node = customer_node.appendChild(xmlDoc.createElement("Comments")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.comments)); cur_node = customer_node.appendChild(xmlDoc.createElement("DriverAge")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.owner.driver_age)); cur_node = customer_node.appendChild(xmlDoc.createElement("Country")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.country)); cur_node = customer_node.appendChild(xmlDoc.createElement("Locale")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.owner.locale)); cur_node = customer_node.appendChild(xmlDoc.createElement("Currency")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.owner.isoCurrency)); //cc card information, if the raite is post paid leave CreditCard Tag empty var cc_node = root_node.appendChild(xmlDoc.createElement("CreditCard")); if (this.selected_result_set.rateQualifier != "POSTPAID-EX") { cur_node = cc_node.appendChild(xmlDoc.createElement("Holder")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.cc_holder)); cur_node = cc_node.appendChild(xmlDoc.createElement("Number")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.cc_number)); cur_node = cc_node.appendChild(xmlDoc.createElement("Company")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.cc_company)); cur_node = cc_node.appendChild(xmlDoc.createElement("ExpireDate")); cur_node.setAttribute("Month" , this.customer.cc_valid_month); cur_node.setAttribute("Year" , this.customer.cc_valid_year); cur_node = cc_node.appendChild(xmlDoc.createElement("SeriesCode")); cur_node.appendChild(xmlDoc.createTextNode(this.customer.cc_series_code)); } var ref_node = root_node.appendChild(xmlDoc.createElement("BookingReference")); cur_node = ref_node.appendChild(xmlDoc.createElement("Type")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.bookingReference.type)); cur_node = ref_node.appendChild(xmlDoc.createElement("Id")); cur_node.appendChild(xmlDoc.createTextNode(this.selected_result_set.bookingReference.id)); cur_node.setAttribute("context", this.selected_result_set.bookingReference.idContext); cur_node = ref_node.appendChild(xmlDoc.createElement("DateTime")); cur_node.appendChild(xmlDoc.createTextNode(escape(this.selected_result_set.bookingReference.dateTime))); cur_node = ref_node.appendChild(xmlDoc.createElement("URL")); cur_node.appendChild(xmlDoc.createTextNode(escape(this.selected_result_set.bookingReference.url))); var serializer = new XMLSerializer(); var xml = '' + serializer.serializeToString(root_node); //make request this.selected_result_set.owner.makeRequest(this.selected_result_set.owner.base_url + 'order.tcl' , 'POST', this.purchaseResponseSuccess , this.purchaseResponseError, this.purchaseResponseChange , 'xml=' + xml); }; this.onPurchaseResponseComplete = function (req) { var searchObj = this.selected_result_set.owner; var req_xml = this.req_xml = req.responseXML; // check for error var result_node = this.req_xml.getElementsByTagName('OrderRS'); var result_type = result_node[0].getAttribute('Type'); if (result_type == "error") { // may add better error handling for OrderRS // for wrong cc data, for example etc. var error_nodes = this.req_xml.getElementsByTagName('Error'); for (var i = 0; i < error_nodes.length; i++) { //alert("Error: " + error_nodes[i].childNodes[0].nodeValue); locale_alert("form_container" , "Error" , "Error: " + error_nodes[i].childNodes[0].nodeValue , 50 , 50 ); } return; } // Successfull order var conf_node = result_node[0].getElementsByTagName('Confirmation'); this.booking_id = conf_node[0].getAttribute('id'); // store information about successfull order in order object // and show success information var title = 'Thank you for your booking!'; var message = 'Ihre Daten wurden ins System uebertragen. Eine Buchungsbestaetigung wurde an ihre Emailadresse gesendet.

Hier koennen sie sich die '; message += 'Buchungsbestaetigung herunterladen.'; message += '
Bitte drucken Sie sich die Buchungsbestaetigung aus, und legen Sie diese zusammen mit ihrer Kreditkarte, bei der Abholung des Fahrzeugs vor.'; var content = this.displayOrderSuccessfull(title, message); var container = getEBI('left'); container.innerHTML = content; }; this.purchaseResponseSuccess = function () { // var pointer = this.selected_result_set.owner; var pointer = this; // only if req shows "loaded" if (pointer.req.readyState == 4) { // only if "OK" if (pointer.req.status == 200) { pointer.order.onPurchaseResponseComplete( pointer.req ); } else { pointer.order.onError( pointer.req.status ); } } }; this.purchaseResponseError = function () { //alert('Error'); locale_alert("form_container" , "Purchase Response" , "Error" , 50 , 50 ); }; this.purchaseResponseChange = function () { var pointer = this.selected_result_set.owner; // only if req shows "loaded" if (pointer.req.readyState == 4) { // only if "OK" if (pointer.req.status == 200) { pointer.onPurchaseResponseComplete( pointer.req ); } else { pointer.onError( pointer.req.status ); } } }; } function cr_option (id, value, name, icon) { this.selected = false; this.id = id; this.value = null; this.name = name; this.icon = icon; } function cr_property (name, key) { this.name = name; this.key = key; } function cr_equip_price (amount, currency, taxIncludedP, IncludedP) { this.amount = amount; this.currency = currency; // 3 letter iso code this.taxIncludedP = taxIncludedP; // boolean weather tax is alread included in amount, or not. this.IncludedP = IncludedP; // boolean weather the amount is already included in the complete amount of the offer, this equipment price belongs to, or not. } function cr_equipment (code, name, amount, currency, taxIncludedP , IncludedP ) { this.code = code; this.name = name; this.price = new cr_equip_price(amount, currency, taxIncludedP, IncludedP); } function cr_bookingReference (type, id, idContext, dateTime, url) { this.type = type; this.id = id; this.idContext = idContext; this.dateTime = dateTime; // a simple date time string , not a TravelDateTime object. this.url = url; } function cr_layout (name, value) { this.name = name; this.value = value; } function cr_ota_code (code, name) { this.name = name; this.code = code; } function cr_filter (name, key, subKey, index) { this.name = name; this.key = key; this.subKey = subKey; this.index = index; } function cr_contract_details (title , terms_arr) { this.title = title; this.terms = terms_arr; } function cr_station (id, name, address , atAirportP , street, postcode, city, country, telephone) { this.id = id; this.name = name; this.address = address; this.atAirportP = atAirportP; this.street = street; this.postcode = postcode; this.city = city; this.country = country; this.telephone = telephone; this.req = null; this.processReqChange = function() { // only if req shows "loaded" if (this.req.readyState == 4) { // only if "OK" if (this.req.status == 200){ this.onComplete( this.req ); } else { this.onError( this.req.status ); } loading_effect(false,""); } }; this.conn_error = function () { //alert("Conn Error!"); locale_alert("form_container" , "Connection Error" , "Conn Error!", 50 , 50 ); }; this.onErr = function () {}; this.onComp = function () {}; this.onComplete = null; this.onErorr = null; this.parseXML = function (req) { var req_xml = this.req_xml = req.responseXML; // check for error var result_node = this.req_xml.getElementsByTagName('ContractDetails'); var result_type = result_node[0].getAttribute('Type'); if (result_type == "error") {} }; } /**************************************************************** * cr_car_result_set Objectwith functions and sub objects * ****************************************************************/ function cr_car_result_set (price_num, currency_str, car_type_int, car_type_name_str, description_str, picture_url_str, ota_codes_arr, equipments_arr,suplier_id_str, supplier_name_str, supplier_icon_str, bookingReference_obj, layouts_arr, coverages_arr, from_station_obj, to_station_obj, owner_obj, doors_str, assetNumber_str, car_size_int, promotionCode_str, rateQualifier_str) { this.owner = owner_obj; // backref to the search object this.id = null; // display information this.price = price_num; this.currency = currency_str; this.promotionCode = promotionCode_str; this.rateQualifier = rateQualifier_str; this.car_type_id = car_type_int; this.car_size_id = car_size_int; this.car_type_name = car_type_name_str; this.assetNumber = assetNumber_str; this.description = description_str; this.picture_url = picture_url_str; this.ota_codes = ota_codes_arr; // Array of ota code arrayes (pairs of code and group code) this.equipments = equipments_arr; // Array of equipment objects this.layouts = layouts_arr; // Array of layout objects (like aircondition, transmission type etc.) this.coverages = coverages_arr; // Array of cr_equipment objects (extras coverd in rate) this.doors = doors_str; this.supplier_id = suplier_id_str; this.supplier_name = supplier_name_str; this.supplier_icon = supplier_icon_str; this.fromStation = from_station_obj; this.toStation = to_station_obj; // technical information this.bookingReference = bookingReference_obj; // a bookingReference object holding information necessary to with this.contractDetails = null; // request on demand this.contractDetailsSummary = null; /******** Communication functions and variables **************************************************************************************************************/ this.req = null; this.serializer = null; // functions this.processReqChange = function() { // only if req shows "loaded" if (this.req.readyState == 4) { // only if "OK" if (this.req.status == 200){ this.onComplete( this.req ); } else { this.onError( this.req.status ); } //this.loading_effect(false,""); } }; this.conn_error = function () { //alert("Conn Error!"); locale_alert("form_container" , "Connection Error" , "Conn Error!", 50 , 50 ); }; this.onErr = function () {}; this.onComp = function () {}; this.onComplete = null; this.onErorr = null; this.parseXML = function (req) { var req_xml = this.req_xml = req.responseXML; var util = this.owner; // check for error var result_node = this.req_xml.getElementsByTagName('ContractDetailsRS'); var result_type = result_node[0].getAttribute('Type'); if (result_type == "error") { //this.locale_wait("", false); //this.locale_notice("Details error" , true); return; } // get summaries sum_arr = this.contractDetailsSummary = new Array(); var sum_node = this.req_xml.getElementsByTagName('Summaries'); var group_nodes = sum_node[0].getElementsByTagName('Group'); for (var i=0;i < group_nodes.length;i++) { sum_arr[i] = new cr_contract_details(group_nodes[i].getAttribute("Title") , new Array()); var term_nodes = group_nodes[i].getElementsByTagName("Term"); for (var j=0;j < term_nodes.length;j++) { sum_arr[i].terms[j] = util.getTextFromNode(term_nodes[j]); } } // get all terms details_arr = this.contractDetails = new Array(); var details_node = this.req_xml.getElementsByTagName('AllDetails'); var group_nodes = details_node[0].getElementsByTagName('Group'); for (var i=0;i < group_nodes.length;i++) { details_arr[i] = new cr_contract_details(group_nodes[i].getAttribute("Title") , new Array()); var term_nodes = group_nodes[i].getElementsByTagName("Term"); for (var j=0;j < term_nodes.length;j++) { details_arr[i].terms[j] = util.getTextFromNode(term_nodes[j]); } } // create contract details // than update display this.updateDisplayContractDetails(); //alert("price" + this.price); locale_alert("form_container" , "Price" , "price" + this.price, 50 , 50 ); this.updateDisplayContractDetails(); }; this.createXML = function () { var xmlDoc = getXMLDomObj(); var root_node = xmlDoc.createElement("ContractDetailsRQ"); // add order details var customer_node = root_node.appendChild(xmlDoc.createElement("Customer")); var cur_node = customer_node.appendChild(xmlDoc.createElement("Locale")); cur_node.appendChild(xmlDoc.createTextNode(this.owner.locale)); var cur_node = customer_node.appendChild(xmlDoc.createElement("Currency")); cur_node.appendChild(xmlDoc.createTextNode(this.owner.isoCurrency)); var details_node = root_node.appendChild(xmlDoc.createElement("OfferDetails")); var cur_node = details_node.appendChild(xmlDoc.createElement("FromDateTime")); cur_node.appendChild(xmlDoc.createTextNode(this.owner.travelDates.getAjaxFrom())); cur_node = details_node.appendChild(xmlDoc.createElement("ToDateTime")); cur_node.appendChild(xmlDoc.createTextNode(this.owner.travelDates.getAjaxTo())); cur_node = details_node.appendChild(xmlDoc.createElement("FromStationId")); cur_node.appendChild(xmlDoc.createTextNode(this.fromStation.id)); cur_node = details_node.appendChild(xmlDoc.createElement("ToStationId")); cur_node.appendChild(xmlDoc.createTextNode(this.toStation.id)); var ref_node = root_node.appendChild(xmlDoc.createElement("BookingReference")); cur_node = ref_node.appendChild(xmlDoc.createElement("Type")); cur_node.appendChild(xmlDoc.createTextNode(this.bookingReference.type)); cur_node = ref_node.appendChild(xmlDoc.createElement("Id")); cur_node.appendChild(xmlDoc.createTextNode(this.bookingReference.id)); cur_node.setAttribute("context", this.bookingReference.idContext); cur_node = ref_node.appendChild(xmlDoc.createElement("DateTime")); cur_node.appendChild(xmlDoc.createTextNode(escape(this.bookingReference.dateTime))); cur_node = ref_node.appendChild(xmlDoc.createElement("URL")); cur_node.appendChild(xmlDoc.createTextNode(escape(this.bookingReference.url))); if (this.owner.serializer == null) { this.owner.serializer = new XMLSerializer(); } var xml = '' + this.owner.serializer.serializeToString(root_node); return xml; }; this.getContractDetails = function () { // Set loading/wait msg // this.locale_wait // //alert ("hello" + this.price); var url = this.owner.base_url + "get-contract-details" var xml = this.createXML(); this.owner.makeRequest(url , 'POST' , this.parseXML, this.conn_error, this.processReqChange , 'xml=' + xml, this); }; /******** Communication functions and variables End **************************************************************************************************************/ //function (otherObj , whichProp) {}; this.compare = function cr_car_result_set_compare (otherObj , wichKey, wichSubKey, wichIndex) { // compares this.whichProp(erty) with otherObj.whichProp(erty) // returns < 0 if this.whichProp(erty) is smaler than otherObj.whichProp(erty) // returns 0 if this.whichProp(erty) is equal to otherObj.whichProp(erty) // returns > 0 if this.whichProp(erty) is greater than otherObj.whichProp(erty) if (wichSubKey == null || wichSubKey == 'null') { switch (wichKey) { case "price" : { if (this.price < otherObj.price) { return -1; } else if (this.price == otherObj.price) { return 0; } else if (this.price > otherObj.price) { return 1; } break; } case "car_type" : { if (this.car_type_id < otherObj.car_type_id) { //alert("this = " + this.car_type_id + " , other = " + otherObj.car_type_id + "<"); return -1; } else if (this.car_type_id == otherObj.car_type_id) { //alert("this = " + this.car_type_id + " , other = " + otherObj.car_type_id + "="); return 0; } else if (this.car_type_id > otherObj.car_type_id) { //alert("this = " + this.car_type_id + " , other = " + otherObj.car_type_id + ">"); return 1; } break; } case "supplier" : { //alert("supplier " + wichKey); if (this.supplier.name < otherObj.supplier.name ) { return -1; } else if (this.supplier.name > otherObj.supplier.name ) { return 1; } else { return 0; } break; } } } else { if (wichKey == "coverage") { switch (wichSubKey) { case "price" : { if (this.coverages[wichIndex].price.amount < otherObj.coverages[wichIndex].price.amount) { return -1; } else if (this.coverages[wichIndex].price.amount = otherObj.coverages[wichIndex].price.amount) { return 0; } else if (this.coverages[wichIndex].price.amount > otherObj.coverages[wichIndex].price.amount) { return 1; } break; } case "name" : { if (this.coverages[wichIndex].name < otherObj.coverages[wichIndex].name) { return -1; } else if (this.coverages[wichIndex].name > otherObj.coverages[wichIndex].name) { return 1; } else { // they must be equal return 0; } break; } case "code" : { if (this.coverages[wichIndex].code < otherObj.coverages[wichIndex].code) { return -1; } else if (this.coverages[wichIndex].code > otherObj.coverages[wichIndex].code) { return 1; } else { // they must be equal return 0; } break; } } } else if (wichKey == "equipment") { switch (wichSubKey) { case "price" : { if (this.getEquipmentByCode(wichIndex).price.amount < otherObj.getEquipmentByCode(wichIndex).price.amount) { return -1; } else if (this.getEquipmentByCode(wichIndex).price.amount = otherObj.getEquipmentByCode(wichIndex).price.amount) { return 0; } else if (this.getEquipmentByCode(wichIndex).price.amount > otherObj.getEquipmentByCode(wichIndex).price.amount) { return 1; } break; } case "name" : { if (this.equipments[wichIndex].name < otherObj.equipments[wichIndex].name) { return -1; } else if (this.equipments[wichIndex].name > otherObj.equipments[wichIndex].name) { return 1; } else { // they must be equal return 0; } break; } case "code" : { if (this.coverages[wichIndex].code < otherObj.coverages[wichIndex].code) { return -1; } else if (this.coverages[wichIndex].code > otherObj.coverages[wichIndex].code) { return 1; } else { // they must be equal return 0; } break; } } } else if (wichKey == "layout") { if (this.getLayoutByName(wichSubKey).value < otherObj.getLayoutByName(wichSubKey).value ) { return -1; } else if (this.getLayoutByName(wichSubKey).value > otherObj.getLayoutByName(wichSubKey).value ) { return 1; } else { return 0; } } } }; this.getLayoutByName = function (name) { for (var i = 0; i < this.layouts.length; i++) { if (this.layouts[i].name == name) { return this.layouts[i]; } } return new cr_layout("" , ""); }; this.getEquipmentByCode = function (code) { for (var i = 0; i < this.equipments.length; i++) { if (this.equipments[i].code == code) { return this.equipments[i]; } } return new cr_equipment("" , "" , 99999, "EUR" , false, false); }; this.getOtaSizeNameByCode = function(code) { for (var i=0;i < otaSizeCodes.length; i++) { if (code == otaSizeCodes[i].code) return otaSizeCodes[i].name; } return ""; }; this.get_property_value = function (whichProp) { switch (whichProp) { case "price": return this.price; break; case "currency": return this.currency; break; case "car_type_id": return this.car_type_id; break; case "description": return this.price; break; case "ota_codes": return this.price; break; case "supplier_id": return this.supplier_id; break; case "supplier_name": return this.supplier_name; break; default: return null; } }; this.getProperties = function () { // first property in array is default property on return new Array (new cr_property("Price" , "price") , new cr_property("Currency" , "currency") , new cr_property("Car Size" , "car_type") , new cr_property("Description" ,"description") , new cr_property("OTA Codes" , "ota_codes") , new cr_property("Supplier" , "supplier_id") , new cr_property("Supplier Name", "supplier_name")); }; this.matchFilterP = function(filter) { // size , code , transmission type, price categoryies, passengers, bags if (filter.key == "passengers") { if (filter.subKey == "-1" || filter.subKey <= this.getLayoutByName("PassengerQuantity").value) { return true; } else { return false; } } else if (filter.key == "baggages") { // may use a key here for Baggages if (filter.subKey == "-1" || filter.subKey <= this.getLayoutByName("BaggageQuantity").value) { return true; } else { return false; } } else if (filter.key == "baggages") { // may use a key here for Baggages if (filter.subKey == "-1" || filter.subKey == this.getLayoutByName("Baggages").value) { return true; } else { return false; } } else if (filter.key == "type") { if (this.car_type_id == parseInt(filter.subKey) || parseInt(filter.subKey) == -1) { return true; } else { return false; } } else if (filter.key == "size") { if (this.car_size_id == parseInt(filter.subKey) || parseInt(filter.subKey) == -1 ) { return true; } else { return false; } } else if (filter.key == "code") { if (filter.subKey == "-1" || filter.subKey == this.getLayoutByName("Code").value) { return true; } else { return false; } } else if (filter.key == "TransmissionType") { if (filter.subKey == "-1" || filter.subKey == this.getLayoutByName("TransmissionType").value) { return true; } else { return false; } } // filter not found return false return false; }; this.display = function() { var result_set_html = '
'; result_set_html += '
'; result_set_html += '
'; /*result_set_html += '
'; result_set_html += this.id+1; result_set_html += '
';*/ result_set_html += '
'; result_set_html += this.car_type_name; result_set_html += '
'; result_set_html += '
'; result_set_html += 'Size: ' + this.getOtaSizeNameByCode(this.car_size_id); // result_set_html += ' '; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; /*for (var i = 0; i < this.layouts.length; i++) { var code = ""; if(this.layouts[i].name == "Code"){ code = this.layouts[i].value; } result_set_html += code; }*/ result_set_html += '
'; //this.car_type_id //this.description //this.currency result_set_html += '
'; result_set_html += '
'; for (var i = 0; i < this.layouts.length; i++) { var air=""; var transmission=""; var passengers = ""; var baggage = ""; var code = ""; for (var i = 0; i < this.layouts.length; i++) { if (this.layouts[i].name == "AirConditionInd") { if(this.layouts[i].value == "true"){ air = 'aircondition.png '; //alert("air = " + air ); } } if (this.layouts[i].name == "TransmissionType") { if(this.layouts[i].value == "Automatic") { transmission = 'transmission_a.png '; } else { transmission = 'transmission_m.png '; } } if (this.layouts[i].name == "PassengerQuantity") { passengers = 'persons_'+this.layouts[i].value+'.png '; } if (this.layouts[i].name == "BaggageQuantity") { baggage = 'package_'+this.layouts[i].value+'.png '; } if(this.layouts[i].name == "Code"){ code = this.layouts[i].value; } } //alert(air + transmission + passengers); result_set_html += air+transmission+passengers+baggage; result_set_html += '
'; result_set_html += '
'+code+'
'; result_set_html += '
'; result_set_html += '
'+this.price+' '+this.currency+'
'; // coverages result_set_html += '
'; result_set_html += '
Included in price
'; //result_set_html += '
Name
'; //result_set_html += '
Preis
'; //result_set_html += '
Inclusive
'; //result_set_html += '
zZgl. Steuern
'; //result_set_html += '
'; var price_currency = ""; for (var i = 0; i < this.coverages.length; i++) { if (this.coverages[i].price.amount != "-1") { price_currency = this.coverages[i].price.amount + this.coverages[i].price.currency; } else { price_currency = "k.A."; } //result_set_html += '
' + this.coverages[i].name + '
' + price_currency + '
'; result_set_html += '
' + this.coverages[i].name + '
'; /*if (this.coverages[i].price.IncludedP) { result_set_html += '
'; } else { result_set_html += '
'; } if (this.coverages[i].price.taxIncludedP) { result_set_html += '
'; } else { result_set_html += '
'; }*/ //result_set_html += '
'; } //result_set_html += '
' +this.displayContractDetails() + '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += '  '; result_set_html += ' Details'; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += ' '; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += ' '; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; result_set_html += '
'; return result_set_html; } }; this.displayCompact = function(){ var result_set_html = '
'; result_set_html += '
'; result_set_html += '
'; /*result_set_html += '
'; result_set_html += this.id+1; result_set_html += '
';*/ result_set_html += '
'; result_set_html += this.car_type_name; result_set_html += '
'; result_set_html += '
'; result_set_html += '  '; result_set_html += ' Details'; result_set_html += '
'; result_set_html += '
'; //result_set_html += 'Size: ' + this.getOtaSizeNameByCode(this.car_size_id); result_set_html += this.price+' €'; result_set_html += '
'; result_set_html += '
'; result_set_html += ''; result_set_html += '
'; result_set_html += '
'; return result_set_html; } }; this.displayContractDetails = function () { if (this.contractDetails == null) return ""; var result_set_details_html = ''; for (var i=0; i < this.contractDetailsSummary.length;i++) { result_set_details_html += '
' + this.contractDetailsSummary[i].title + '
'; result_set_details_html += '
'; var terms = this.contractDetailsSummary[i].terms; for (var j=0;j < terms.length;j++) { result_set_details_html += '
' + terms[j] + '
'; result_set_details_html += '
'; } } for (var i=0; i < this.contractDetails.length;i++) { result_set_details_html += '
' + this.contractDetails[i].title + '
'; var terms = this.contractDetails[i].terms; for (var j=0;j < terms.length;j++) { result_set_details_html += '
' + terms[j] + '
'; result_set_details_html += '
'; } } return result_set_details_html; }; this.showDetails = function (showP) { var btn = getEBI('arrow_'+this.id); var obj = getEBI('det_'+this.id); if(showP){ if (this.contractDetails == null) this.getContractDetails(); obj.style.display = "block"; btn.innerHTML = ' Details'; }else{ obj.style.display = "none"; btn.innerHTML = ' Details'; } }; this.showDetailsCompact = function(showP){ var btn = getEBI('arrow_'+this.id); var obj = getEBI('det_compact_'+this.id); if(showP){ if (this.contractDetails == null) this.getContractDetails(); obj.style.display = "block"; btn.innerHTML = ' Details'; }else{ obj.style.display = "none"; btn.innerHTML = ' Details'; } }; this.updateDisplayContractDetails = function() { //alert(this.displayContractDetails()); getEBI("contract_details_" + this.id).innerHTML = this.displayContractDetails(); }; this.constructor = function () { //https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Functions_and_function_scope/arguments // using the arguments array to initialise the dynamic amount, depending on the result type (car, accommodation), of locale properties (variables). for (var i=0; i < arguments.length; i++) { // may use this to initialise this.ota_codes } }; } /******************************** * cr_goup object * ********************************/ function cr_group(PropVal, default_flat_p, max_results, sortBy , sortDescending, owner) { this.owner = owner; // the cr_search object that owns this group this.property_value = PropVal; this.default_flat_p = default_flat_p; this.max_results = max_results; this.result_sets = new Array(); this.sortByProperty = null; this.matchFilters = new Array(); // matchFilters is a Array of filters , all result_sets of this group must match all filter criterias, the Array will be empty on creation filters can be added or removed dynamicly // matchFilters are usualy different from the filters used for sorting this.filters = null; this.sortBy = sortBy; this.subSortBy = null; this.sortIndex = null; this.sortDescending = sortDescending; // true/false this.currentPage = 1; this.collectFilters = function () { // first create standart filter for price var filters = new Array(); filters[0] = new cr_filter("Price" , "price" , null , null); filters[1] = new cr_filter("Car Size" , "car_type" , null , null); // eqipments price var equip_codes = new Array(); for (var j = 0; j < this.result_sets.length; j++ ) { var equips = this.result_sets[j].equipments; for (var i = 0; i < equips.length; i++) { if (!this.owner.arrayExists(equip_codes, equips[i].code)) { //filters[i + 2] = new cr_filter(equips[i].name , "equipments", "price" , equips[i].code); equip_codes.push(equips[i].code); } } } this.filters = filters; }; this.addMatchFilter = function (whichFilter , allResultSets) { // first check if its a filter which has a variable subKey which has to be updated var filters = this.matchFilters; var updatedP = false; for (var i=0; i < filters.length;i++) { if (filters[i].key == whichFilter.key ) { filters[i].subKey = whichFilter.subKey; updatedP = true; } } if (!updatedP) { // filter dosent exist yet add it this.matchFilters[this.matchFilters.length] = whichFilter; } this.updateResultSets(allResultSets); this.resortGroup(this.sortBy, this.subSortBy, this.index); }; this.removeMatchFilter = function (whichFilter , allResultSets) { var filters = this.matchFilters; for (var i=0; i < filters.length;i++) { if (filters[i].key == whichFilter.key ) { this.matchFilters = filters.slice(i,i); } } this.updateResultSets(allResultSets); this.resortGroup(this.sortBy, this.subSortBy, this.index); }; this.updateResultSets = function(allResultSets) { var newResultSets = new Array(); var filters = this.matchFilters; var match = false; for (var i=0;i < allResultSets.length;i++) { match = false; for (var j=0;j < filters.length;j++ ) { match = allResultSets[i].matchFilterP(filters[j]); if (!match) { break; } } if (match) { // add result_set newResultSets[newResultSets.length] = allResultSets[i]; } } this.result_sets = newResultSets; }; this.display = function (flat_p, page_number) { // if flat_p is true show all results var group_html = '
'; if (flat_p) { //group_html += this.display_inflate(page_number); group_html += this.display_status(this.property_value); } else { //group_html += this.display_deflate(page_number); group_html += this.display_status(this.property_value); } group_html += this.display_content(flat_p, page_number); group_html += ''; // later may add pagination here group_html += '
'; return group_html; }; this.display_status = function (group_property){ var group_html = '
' ; group_html += '
'; group_html += '
'; group_html += this.display_status_content(); group_html += '
'; group_html += '
'; group_html += '
'; return group_html; }; this.display_status_content = function (){ var group_html = '
' + this.result_sets.length + ' Deals! Page ' + this.currentPage + ' of ' + ((this.result_sets.length % this.max_results) != 0 ? Math.round((this.result_sets.length / this.max_results)) + 1 : Math.round((this.result_sets.length / this.max_results)) ) + ' Pages
'; if (this.result_sets.length > 0) { group_html += '
' + this.result_sets[0].fromStation.name; if (this.result_sets[0].fromStation.atAirportP == true) { // in future add airport code group_html += ' (' + } group_html += '
'; } return group_html; }; this.display_inflate = function (page_number) { var group_html = '
'; group_html += this.display_content(true, page_number); return group_html; }; this.display_deflate = function (page_number) { var group_html = '
'; group_html += this.display_content(false, page_number); return group_html; }; this.deflate = function() { var this_div = document.getElementById('group_' + this.property_value); this_div.innerHTML = this.display_deflate(1); }; this.inflate = function() { var this_div = document.getElementById('group_' + this.property_value); this_div.innerHTML = this.display_inflate(1); }; this.display_content = function (flat_p, page_number) { var group_html = '
'; if (this.result_sets == 0) { group_html += '

No Results

'; } else { if (flat_p) { var start = (page_number - 1) * this.max_results; var end = start + this.max_results - 1; end = (end > (this.result_sets.length - 1) ? (this.result_sets.length - 1) : end); } else { var start = 0; var end = 0 } group_html += '
'; // add sort by links var sort_by_html = '
'; for (var i=0; i < this.filters.length; i++ ) { sort_by_html += '
'; if(i == 4){// add separator to make two tablines sort_by_html += '
'; } if (i < (this.filters.length - 1)) { sort_by_html += ''; } } sort_by_html += "
"; group_html += sort_by_html; for (var i=start; i <= end; i++) { if (i == start) { //group_html += '
Headline
'; } group_html += this.result_sets[i].display(); if (i == end) { if (this.max_results < this.result_sets.length) { // add group pagination var page_count = this.result_sets.length / this.max_results; var page_count_rounded = parseInt('' + page_count); page_count = (page_count > page_count_rounded ? page_count_rounded + 1 : page_count); var page_links = ''; for (j = 1;j <= page_count;j++) { page_links += '' + j + ''; if (j
'; } group_html += '
'; //group_html += '
Bottom Line
'; } } } group_html += '
'; return group_html; }; this.showGroupPage = function (page_number) { this.currentPage = page_number; var group_name = "group_" + this.PropVal; var results_div = document.getElementById(group_name); var status_div = document.getElementById('status_filter_' + this.property_value); var group_html = ""; //status_div.innerHTML = this.display_status_content(); status_div.innerHTML = this.display_status(); /*if (!results_div) { return false; } */ var flat_p = true; if (flat_p) { var start = (page_number - 1) * this.max_results; var end = start + this.max_results - 1; end = (end > (this.result_sets.length - 1) ? (this.result_sets.length - 1) : end); } else { var start = 0; var end = 0 } // add sort by links var sort_by_html = '
'; for (var i=0; i < this.filters.length; i++ ) { //sort_by_html += '' + this.filters[i].name + ''; sort_by_html += '
'; if(i == 4){// add separator to make two tablines sort_by_html += '
'; } if (i < (this.filters.length - 1)) { sort_by_html += " "; } } sort_by_html += "
"; group_html += sort_by_html; for (i=start; i <= end; i++) { group_html += this.result_sets[i].display(); if (i == end) { if (this.max_results < this.result_sets.length) { // add group pagination var page_count = this.result_sets.length / this.max_results; var page_count_rounded = parseInt('' + page_count); page_count = (page_count > page_count_rounded ? page_count_rounded + 1 : page_count); var page_links = ''; for (j = 1;j <= page_count;j++) { page_links += '' + j + ''; if (j
'; } } } results_div.innerHTML = group_html; hightLightTab("img_"+this.sortBy+"_desc", "img_"+this.sortBy+"_asc", "tab_"+this.sortBy+"_left", "tab_"+this.sortBy+"_middle", "tab_"+this.sortBy+"_right",true, this.descending); }; this.resortGroup = function(sortBy, subSortBy, index) { if (sortBy == this.sortBy && this.subSortBy == subSortBy && this.sortIndex == index) { // if the same sort option is clicked the second time switch sort direction this.descending = !this.descending; } this.sortBy = sortBy; this.subSortBy = subSortBy; this.sortIndex = index; this.result_sets = this.owner.sort(this.result_sets, this.sortBy, this.descending, this.subSortBy, this.sortIndex); this.showGroupPage(this.currentPage); }; } /************************************************************ * cr_car_search Objectwith functions and sub objects * ************************************************************/ function cr_car_search (travelDates,car_types, result_div_id, driver_age, locale_str, isoCurrency , filters_div_id , search_div_id, ajaxSearchKeyStr ) { this.objName = function () {return "cr_car_search";}; this.travelDates = travelDates; var month; var hour; var minute; var day; this.from_minute = ( (minute = (travelDates.fromDateTime.getMinutes() + "")).length == 1 ? ("0" + minute) : minute); this.from_hour = ( (hour = (travelDates.fromDateTime.getHours() + "")).length == 1 ? ("0" + hour) : hour); this.from_day = ( (day = (travelDates.fromDateTime.getUTCDate() +"")).length == 1 ? ("0" + day) : day); this.from_month = ( (month = ( (travelDates.fromDateTime.getMonth() + 1) + "")).length == 1 ? ("0" + month) : month); this.from_year = travelDates.fromDateTime.getFullYear(); this.to_minute = ( (minute = (travelDates.toDateTime.getMinutes() + "")).length == 1 ? ("0" + minute) : minute); this.to_hour = ( (hour = (travelDates.toDateTime.getHours() + "")).length == 1 ? ("0" + hour) : hour); this.to_day = ( (day = (travelDates.toDateTime.getUTCDate() +"")).length == 1 ? ("0" + day) : day); this.to_month = ( (month = ( (travelDates.toDateTime.getMonth() + 1) + "")).length == 1 ? ("0" + month) : month); this.to_year = travelDates.toDateTime.getFullYear(); this.from_id = null; this.from_type = null; this.to_id = null; this.to_type = null; this.base_url = 'https://www.clever-mietwagen.de:/car-rental/ajax/'; this.host_url = 'https://www.clever-mietwagen.de:'; this.driver_age = driver_age; this.locale = locale_str; this.isoCurrency = isoCurrency; //this.check_hire_dates = cr_check_hire_dates; this.car_types = new Array(new cr_option('cr_cartypes', 1 , 'Normal Car', '')); this.select_car_types = new Array(new cr_option('cr_cartypes', 1 , 'Normal Car', '')); //this.allCommonOptions = new Array(new cr_option('cr_price', null , 'Price', '') , new cr_option('cr_cartypes', 1 , 'Normal Car', '')); // first is default property this.allProperties = new Array (new cr_property("Price" , "price") , new cr_property("Currency" , "currency") , new cr_property("Car Size" , "car_type_id") , new cr_property("Description" ,"description") , new cr_property("OTA Codes" , "ota_codes") , new cr_property("Supplier" , "supplier_id") , new cr_property("Supplier Name", "supplier_name")); this.sortBy = this.allProperties[0]; this.sortDescending = false; // html properties this.div_id = result_div_id; /* currently the id of the div in which the results should be displayed later may add a reference to the Dom Object for direct (quicker) access */ this.filters_div_id = filters_div_id; this.search_div_id = search_div_id; this.noPictureURL = 'https://www.clever-mietwagen.de:/'; this.max_groups = 10; // display not more groups than max_groups on one page (ignore if groups are flated or only best result is shown) this.max_group_results = 10; // dynamic properties this.result_sets_orig = Array(); // plain array of all result sets this.result_sets_grouped_sorted = Array(); // current grouping and sorting of result sets. this.allStations = Array(); // Array of all station objects // order object this.order = null; // auto load info this.ajaxSearchKey = ajaxSearchKeyStr; this.ajaxSearchLoadedP = false; this.getOrder = function (bookingReferenceId) { var result_set = null; for (var i = 0; i < this.result_sets_orig.length;i++) { if (this.result_sets_orig[i].bookingReference.id == bookingReferenceId) { result_set = this.result_sets_orig[i]; } } if (result_set != null) { if (this.order != null) { this.order.selected_result_set = result_set; } else { this.order = new cr_order(result_set); } } return this.order; }; this.showHideObject = function(objectId, pFlag){ var obj = document.getElementById(objectId); if(obj){ if(pFlag){ obj.style.display = "block"; }else{ obj.style.display = "none"; } } }; this.selectOffer = function (bookingReferenceId) { var order = this.getOrder(bookingReferenceId); if (order == null ) { //alert("No valid result set!"); locale_alert("form_container" , "Error" , "No valid result set!", 50 , 50 ); return false; } this.displayOrderPage(); this.showHideObject(this.search_div_id, false); return false; }; this.purchaseOffer = function () { this.order.purchaseOffer(); }; this.showDetails = function (setId, showP) { var set = this.getResultSetById(setId); if(set != null) set.showDetails(showP); }; this.showDetailsCompact = function (setId, showP) { var set = this.getResultSetById(setId); if(set != null) set.showDetailsCompact(showP); }; // functions /* a function which takes an array of objects (to sort), and a string defining whichProperty to compare, using the array elements property (function) compare, to compare a element to a nother element, the whichProperty string is passed to the compare function of the elements. returns a new array with elements in sorted order */ this.sort = function (arr_to_sort, propertyKey, descending, subPropertyKey, index) { var run = true; while(run) { arr_to_sort = this.shellSort(arr_to_sort, propertyKey, descending, subPropertyKey, index); run = false; for (var i = 0; i < (arr_to_sort.length - 1); i++) { if (descending == false) { if (arr_to_sort[i] > arr_to_sort[i+1]) { run = true; break; } } else { if (arr_to_sort[i] > arr_to_sort[i+1]) { run = true; break; } } } } return arr_to_sort; }; this.shellSort = function (arr_to_sort, propertyKey, descending, subPropertyKey, index) { var last_loop = false; for (var dist=Math.round(arr_to_sort.length/2);dist >= 1;dist = Math.round(dist/2) ) { for (var i=0; i < (arr_to_sort.length - dist); i++ ) { var comp = arr_to_sort[i].compare(arr_to_sort[i + dist] , propertyKey, subPropertyKey, index); if (descending == false) { if(comp == 1) { var cache = arr_to_sort[i]; arr_to_sort[i] = arr_to_sort[i + dist]; arr_to_sort[i + dist] = cache; } } else { if(comp == -1) { var cache = arr_to_sort[i]; arr_to_sort[i] = arr_to_sort[i + dist]; arr_to_sort[i + dist] = cache; } } } if (last_loop == true) { break; } else if (dist == 1) { dist = 2; last_loop = true; } } return arr_to_sort; }; /* A function which gets whichPropertyToGroup passed, and returns an array of arraies where the inner arraies hold a group of elements, the result has at least one group (inner array), the common group which applies to all ungroupable elements, holding all elements, if no valid grouping is specified (which may be wanted). function grouping (whichPropertyToGroup) uses this.result_sets_orig as src array */ this.grouping = function (whichProp) { var result = new Array(); // add a group object with own sort compare function //var group_values = new Array(cr_group(null)); var group_values = new Array(new cr_group(null, true , this.max_group_results, this.sortBy.key, false , this)); var cur_prop_val = null; var match = false; // finding all group values for (var i=0;i < this.result_sets_orig.length;i++) { cur_prop_val = this.result_sets_orig[i].get_property_value(whichProp); match = false; for (var j=0;j < group_values.length;j++) { // may add the property comparing fuction here if (cur_prop_val == group_values[j].property_value) { match = true; group_values[j].result_sets[group_values[j].result_sets.length] = this.result_sets_orig[i]; break; } } if (!match) { group_values[group_values.length] = cr_group(cur_prop_val); group_values[group_values.length - 1].result_sets[group_values[group_values.length - 1].result_sets.length] = this.result_sets_orig[i]; } match = false; } for (var i = 0; i < group_values.length; i++ ) { group_values[i].collectFilters(); } return group_values; }; this.addRemoveMatchFilterFromGroup = function (groupID, whichFilter, checkedP) { // may change groupID to current group var group = this.getGroupByID(groupID); //var group_props = group.Properties; if (checkedP) { // add property group.addMatchFilter(whichFilter, this.result_sets_orig); } else { // remove property group.removeMatchFilter(whichFilter, this.result_sets_orig); } }; this.init_result_sets = function () {/* do a request and init result_sets*/}; this.sort_result_sets = function (whichProp) {}; this.sort_group = function (groupID, key, subKey, index) { /* sort the elements of a group*/ var group = this.getGroupByID(groupID); this.sort(group.result_sets , group.sortBy, group.descending, subKey, index); }; // request vars and functions this.req = null; this.onComplete = null; this.onError = null; this.makeRequest = function (url, meth, onComp, onErr, processReqChange , xmlToSend, pointer) { if (meth != "POST") meth = "GET"; if (pointer == null) pointer = this; if (processReqChange == null) processReqChange = pointer.processReqChange; pointer.onComplete = onComp; pointer.onError = onErr; // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { //this.req = new XMLHttpRequest(); //this.req.onreadystatechange = function () { pointer.processReqChange() }; pointer.req = new XMLHttpRequest(); pointer.req.onreadystatechange = function () { pointer.processReqChange() }; if (xmlToSend == null) { pointer.req.open("GET", url, true); // pointer.req.send(null); //this.req.open("GET", url, true); // //this.req.send(); } else { pointer.req.open("POST", url, true); // pointer.req.setRequestHeader('content-type', 'application/x-www-form-urlencoded'); pointer.req.send(xmlToSend); } // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { pointer.req = new ActiveXObject("Microsoft.XMLHTTP"); if (pointer.req) { pointer.req.onreadystatechange = function () { pointer.processReqChange() }; if (xmlToSend == null) { pointer.req.open('GET', url, true); pointer.req.send(); } else { pointer.req.open("POST", url, true); // pointer.req.setRequestHeader('content-type', 'text/xml'); pointer.req.send(xmlToSend); } } } }; this.processReqChange = function() { // only if req shows "loaded" if (this.req.readyState == 4) { // only if "OK" if (this.req.status == 200){ this.onComplete( this.req ); } else { this.onError( this.req.status ); } loading_effect(false,""); window.location.hash = "heading_top";//redirects to top of page, first result } }; this.getTextFromNode = function (node) { if (node.hasChildNodes()) { return node.childNodes[0].nodeValue; } else { return ""; } }; this.req_xml = null; this.parseXML = function (req) { var req_xml = this.req_xml = req.responseXML; // check for error var result_node = this.req_xml.getElementsByTagName('SearchResults'); var result_type = result_node[0].getAttribute('Type'); if (result_type == "error") { var error_nodes = this.req_xml.getElementsByTagName('Error'); for (var i = 0; i < error_nodes.length; i++) { //alert("Error: " + error_nodes[i].childNodes[0].nodeValue); locale_alert("form_container" , "Error" , "Error: " + error_nodes[i].childNodes[0].nodeValue, 50 , 50 ); } return; } //alert ("req_xml = " + req_xml); //var result_nodes = this.req_xml.childNodes[0].childNodes; var result_nodes = this.req_xml.getElementsByTagName('SearchResult'); var type_node = null; var suppl_node = null; var price_node = null; var equipemt_nodes = null; var layout_nodes = null; var equipment_node = null; var cache_node = null; var coverage_nodes = null; var booking_node = null; var station_node = null; var charges_node = null; for (var i = 0; i < result_nodes.length; i++) { cur_set = new cr_car_result_set(0, '', 0, '', '', '', null, '', '', '', ''); cur_set.owner = this; cur_set.id = result_nodes[i].getAttribute('resultId'); type_node = result_nodes[i].getElementsByTagName('Type'); cur_set.car_type_id = parseInt(type_node[0].getAttribute('type')); cur_set.car_size_id = parseInt(type_node[0].getAttribute('size')); cur_set.assetNumber = type_node[0].getAttribute('assetNumber'); cur_set.doors = type_node[0].getAttribute('Doors'); cur_set.car_type_name = type_node[0].getElementsByTagName('Name')[0].childNodes[0].nodeValue; cur_set.description = type_node[0].getElementsByTagName('Description')[0].childNodes[0].nodeValue; if (type_node[0].getElementsByTagName('Picture')[0].hasChildNodes()) { cur_set.picture_url = type_node[0].getElementsByTagName('Picture')[0].childNodes[0].nodeValue; } else { cur_set.picture_url = this.noPictureURL; } // seting up equipments equipment_nodes = type_node[0].getElementsByTagName('Equipment'); var code = null; var name = null; var amount = null; var currency = null; var tax_included = null; var included = null; var equipment_arr = new Array(); for (var j = 0; j < equipment_nodes.length; j++ ) { code = equipment_nodes[j].getAttribute('Code'); cache_node = equipment_nodes[j].getElementsByTagName('Name'); name = this.getTextFromNode(cache_node[0]); cache_node = equipment_nodes[j].getElementsByTagName('price'); if (cache_node[0].getAttribute('IncludedP') == "t") { included = true; } else { included = false; } if (cache_node[0].getAttribute('TaxIncludedP') == "t") { tax_included = true; } else { tax_included = false; } cache_node = cache_node[0].getElementsByTagName('Amount'); currency = cache_node[0].getAttribute('currency'); amount = this.getTextFromNode(cache_node[0]); var equip_obj = new cr_equipment(code , name, amount, currency, tax_included, included); equipment_arr[j] = equip_obj; } cur_set.equipments = equipment_arr; // layouts cur_set.layouts = new Array(); layout_nodes = result_nodes[i].getElementsByTagName('Layout'); for (var j = 0; j < layout_nodes.length; j++) { cur_set.layouts[j] = new cr_layout(layout_nodes[j].getAttribute('Name') , this.getTextFromNode(layout_nodes[j])); } // coverages coverage_nodes = result_nodes[i].getElementsByTagName('Coverage'); cur_set.coverages = new Array(); for (var j = 0; j < coverage_nodes.length; j++) { code = coverage_nodes[j].getAttribute('Type'); cache_node = coverage_nodes[j].getElementsByTagName('Name'); name = this.getTextFromNode(cache_node[0]); cache_node = coverage_nodes[j].getElementsByTagName('price'); //code = coverage_nodes[j].getAttribute('Type'); //name = this.getTextFromNode(coverage_nodes[j]); if (cache_node[0].getAttribute('IncludedP') == "true") { included = true; } else { included = false; } if (cache_node[0].getAttribute('TaxIncludedP') == "true") { tax_included = true; } else { tax_included = false; } cache_node = cache_node[0].getElementsByTagName('Amount'); currency = cache_node[0].getAttribute('currency'); amount = this.getTextFromNode(cache_node[0]); cur_set.coverages[j] = new cr_equipment(code, name , amount, currency,tax_included, included); } // charges , not all just ratequalifier and promocod yet charges_node = result_nodes[i].getElementsByTagName('Charges'); cur_set.rateQualifier = charges_node[0].getAttribute('RateQualifier'); cur_set.romotionCode = charges_node[0].getAttribute('PromotionCode'); // booking references var booking_obj = new cr_bookingReference(null,null,null,null,null); booking_node = result_nodes[i].getElementsByTagName('BookingReference'); cache_node = booking_node[0].getElementsByTagName('Type'); booking_obj.type = this.getTextFromNode(cache_node[0]); cache_node = booking_node[0].getElementsByTagName('ID'); booking_obj.idContext = cache_node[0].getAttribute('Context'); booking_obj.id = this.getTextFromNode(cache_node[0]); cache_node = booking_node[0].getElementsByTagName('DateTime'); booking_obj.dateTime = this.getTextFromNode(cache_node[0]); cache_node = booking_node[0].getElementsByTagName('URL'); booking_obj.url = this.getTextFromNode(cache_node[0]); cur_set.bookingReference = booking_obj; //alert('booking reference = ' + cur_set.bookingReference.type + '| ' + cur_set.bookingReference.id + '| ' + cur_set.bookingReference.idContext + ' ' + cur_set.bookingReference.dateTime + ' ' + cur_set.bookingReference.url); // supplier information suppl_node = result_nodes[i].getElementsByTagName('Supplier'); cur_set.supplier_id = suppl_node[0].getAttribute('id'); if ( suppl_node[0].getElementsByTagName('name')[0].hasChildNodes()) { cur_set.supplier_name = suppl_node[0].getElementsByTagName('name')[0].childNodes[0].nodeValue; } else { cur_set.supplier_name = ""; } cur_set.supplier_icon = suppl_node[0].getElementsByTagName('icon')[0].childNodes[0].nodeValue; // Get from station station_node = suppl_node[0].getElementsByTagName('FromStation'); var station_id = station_node[0].getAttribute('code'); var locale_station_id = station_node[0].getAttribute('station_id'); // check if station already exists from_station = this.getStationByID(station_id); if (from_station == null) { // get all station information and create a new station object var atAirportP = (station_node[0].getAttribute('atAirportP') == "1" ? true : false ); var station_name = this.getTextFromNode(station_node[0].getElementsByTagName('Name')[0]); var station_addr = this.getTextFromNode(station_node[0].getElementsByTagName('Address')[0]); from_station = new cr_station(station_id, station_name, station_addr, atAirportP); // Get station Details //var url = this.base_url + "get-station-details?cr_id=" + this.from_id + "&cr_id_type=" + this.from_type + "&cr_locale=" + this.locale; //this.makeRequest(url , 'GET' , from_station.parseXML, from_station.conn_error, from_station.processReqChange ); } cur_set.fromStation = from_station; // Get to Station station_node = suppl_node[0].getElementsByTagName('ToStation'); var station_id = station_node[0].getAttribute('code'); // check if station already exists to_station = this.getStationByID(station_id); if (to_station == null) { // get all station information and create a new station object var atAirportP = (station_node[0].getAttribute('atAirportP') == "1" ? true : false ); var station_name = this.getTextFromNode(station_node[0].getElementsByTagName('Name')[0]); var station_addr = this.getTextFromNode(station_node[0].getElementsByTagName('Address')[0]); to_station = new cr_station(station_id, station_name, station_addr, atAirportP); // Get station Details //var url = this.base_url + "get-station-details?cr_id=" + this.to_id + "&cr_id_type=" + this.to_type + "&cr_locale=" + this.locale; //this.makeRequest(url , 'GET' , to_station.parseXML, to_station.conn_error, to_station.processReqChange ); } cur_set.toStation = to_station; price_node = result_nodes[i].getElementsByTagName('Price'); cur_set.currency = price_node[0].getAttribute('currency'); cur_set.price = price_node[0].childNodes[0].nodeValue; this.result_sets_orig[i] = cur_set; } this.result_sets_grouped_sorted = this.grouping('init'); this.sort(this.result_sets_grouped_sorted[0].result_sets , this.sortBy.key, false); this.display(1); }; this.conn_error = function () { //alert("Conn Error!"); locale_alert("form_container" , "Error" , "Conn Error!", 50 , 50 ); }; this.init = function () { // request results from server if (document.getElementById("cr_from_station_id").value != "-1" && document.getElementById("cr_from_station_id").value != "") { var from_id = document.getElementById("cr_from_station_id").value; var from_type = "station"; } else if (document.getElementById("cr_from_foreigen_id").value != "-1") { var from_id = document.getElementById("cr_from_foreigen_id").value; var from_type = "foreigen"; } else if (document.getElementById("ac_region_id").value != "-1") { var from_id = document.getElementById("ac_region_id").value; var from_type = "region"; } else if (document.getElementById("ac_state_id").value != "-1") { var from_id = document.getElementById("ac_state_id").value; var from_type = "state"; } else if (document.getElementById("ac_country_id").value != "-1") { var from_id = document.getElementById("ac_country_id").value; var from_type = "country"; } else { var from_id = "-1"; var from_type = "none"; } var to_id = from_id; var to_type = from_type; this.from_id = from_id; this.from_type = from_type; this.to_id = to_id; this.to_type = to_type; this.client_country = getEBI("cr_ref_country_code").value; //alert("this.ajaxSearchKey.length=" + this.ajaxSearchKey.length + " this.ajaxSearchLoadedP=" + this.ajaxSearchLoadedP); /*if () { var url = this.base_url + 'get-cached-results'; var url_search = '?ajax_search_key=' + this.ajaxSearchKey; this.ajaxSearchLoaded = true; } else { */ var url = this.base_url + 'get-search-results'; //var url = 'http://www.clever-mietwagen.clever-devel.com/car-rental/example-search-ajax-xml'; var url_search = '?cr_from_date.day=' + this.from_day; url_search += '&cr_from_date.month=' + this.from_month; url_search += '&cr_from_date.year=' + this.from_year; url_search += '&cr_from_date.hour=' + this.from_hour; url_search += '&cr_from_date.minute=' + this.from_minute; url_search += '&cr_to_date.day=' + this.to_day; url_search += '&cr_to_date.month=' + this.to_month; url_search += '&cr_to_date.year=' + this.to_year; url_search += '&cr_to_date.hour=' + this.to_hour; url_search += '&cr_to_date.minute=' + this.to_minute; url_search += '&cr_client_country=' + this.client_country; url_search += '&cr_from_id=' + this.from_id + '&cr_from_id_type=' + this.from_type; url_search += '&cr_to_id=' + this.to_id + '&cr_to_id_type=' + this.to_type; url_search += '&cr_iso_currency=' + this.isoCurrency; url_search += '&cr_prefs=' + ''; url_search += '&cr_car_size=' + '1'; url_search += '&cr_locale=' + this.locale; for (var i = 0; i < this.select_car_types.length;i++) { if (this.select_car_types[i].selected) { url_search += '&cr_car_types=' + this.select_car_types[i].car_type_id; } } //} // Check if we are already on a secured (ssl) connection if (window.location.protocol != 'https:') { getEBI("cr_search_form").submit(); } else { this.makeRequest(url + url_search , 'GET' , this.parseXML, this.conn_error, this.processReqChange ); loading_effect(true,"Loading..."); } }; this.getCountryOptions = function () { // create apeace of option html var options = '\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ '; return options; }; this.display = function (page_number) { // add togeather peaces of html, each enclosed into a div, where each div displays one group // loop through all groups and add a div for each var groups = this.result_sets_grouped_sorted; //var create_group_html = this.displayGroupCreateHTML(); var create_group_html = ""; var all_results_html = create_group_html + '
'; var start = ((page_number - 1) * this.max_groups); var end = (start + this.max_groups - 1); end = (end > (groups.length - 1) ? (groups.length - 1) : end ); for (var i=start;i<=end;i++) { all_results_html += groups[i].display(groups[i].default_flat_p , page_number); } all_results_html += '
'; // trigger after onSearchResults onSearchResults(); document.getElementById(this.div_id).innerHTML = all_results_html; this.display_filters(); }; this.displayGroupCreateHTML = function () { var group_create_html = '
Group Results by this criteria.
'; // inclusivs var all_results = this.result_sets_orig; var coverages = new Array(); var coverage_codes = new Array(); for (var i = 0; i < all_results.length;i++) { var cur_coverages = all_results[i].coverages; for (var j = 0; j < cur_coverages.length;j++) { if (!this.arrayExists(coverage_codes , cur_coverages[j].code)) { coverages[coverages.length] = cur_coverages[j]; coverage_codes[coverage_codes.length] = cur_coverages[j].code; } } } /* var cov_html = '
'; cov_html += '
Offers with this Inclusivs only:
'; cov_html += '
'; //alert ("cov len =" + coverages.length ); for (var i = 0; i < coverages.length; i++) { cov_html += '
'+coverages[i].name + '
'; cov_html += '
'; } cov_html += '
' */ var equipments = new Array(); var equip_codes = new Array(); for (var i = 0; i < all_results.length;i++) { var cur_equipments = all_results[i].equipments; for (var j = 0; j < cur_equipments.length;j++) { if (!this.arrayExists(equip_codes , cur_equipments[j].code)) { equipments[equipments.length] = cur_equipments[j]; equip_codes[equip_codes.length] = cur_equipments[j].code; } } } /* var equip_html = '
'; equip_html += '
Offers wich have these extras available:
'; equip_html += '
'; //alert ("equip len =" + equipments.length ); for (var i = 0; i < equipments.length; i++) { equip_html += '
'+equipments[i].name + '
'; equip_html += '
'; } equip_html += '
' */ var layout_html = '
'; layout_html += '
Passengers:
'; layout_html += '
'; layout_html += '
'; layout_html += '
'; layout_html += '
Baggage quantity:
'; layout_html += '
'; layout_html += '
'; layout_html += '
'; layout_html += '
Car Type:
'; layout_html += '
'; layout_html += '
'; layout_html += '
'; layout_html += '
'; //group_create_html += cov_html + equip_html + layout_html; group_create_html += layout_html; group_create_html += '
'; return group_create_html; }; this.displayOrderPage = function () { // set order div var order_html = '
'; order_html += this.order.display(); order_html += '
'; // get display div; document.getElementById(this.div_id).innerHTML = order_html; document.getElementById("right").style.display = "none"; document.getElementById("cr_customer_country_txt").value = this.client_country; }; this.newGroup = function () { // get the information for group creation from the form fields var orig_result_sets = this.result_sets_orig; var passenger_count = parseInt(document.getElementsByID(layout_baggages)); var bag_count = parseInt(document.getElementsByID(layout_passengers)); var equip_crt = new Array(); var cov_crt = new Array(); var equips_dom = document.getElementsByID(equip_check); for (var i = 0 ; i < equips_dom.length; i++) { if (equips_dom[i].checked) { equip_crt.pusch(equips_dom.value); } } var cov_dom = document.getElementsByID(cov_check); for (var i = 0 ; i < cov_dom.length; i++) { if (cov_dom[i].checked) { cov_crt.pusch(cov_dom.value); } } var group_result_sets = new Array(); var new_group = new cr_group(null, true , this.max_group_results, this.sortBy.key, false , this); this.filterGroupResultsPassenger(orig_result_sets, group_result_sets, passenger_count); this.filterGroupResultsBaggages(group_result_sets, bag_count); this.filterGroupResultsEquipments(group_results, equip_crt); this.filterGroupResultsCoverages(group_results, cov_crt); // create a group and a result set array filtered by this criteria. // may create the result set first so in case it is empty no group object is created. var group_name = 'Group '; var PropVal = 'group'; }; this.getGroupByProperty = function (PropVal) { var groups = this.result_sets_grouped_sorted; var check_prop = "null"; var check_prop_2 = "undefined"; if (check_prop == PropVal) { PropVal = null; } else if (check_prop_2 == PropVal) { PropVal = undefined; } for (var j=0;j < groups.length;j++) { // may add the property comparing fuction here if (PropVal == groups[j].property_value) { return groups[j]; } } }; this.getGroupByID = function (PropVal) { return this.getGroupByProperty(PropVal); }; this.getStationByID = function (id) { var station = null; for (var i = 0; i < this.allStations.length; i++) { if (this.allStations[i].id == id) { station = this.allStations[i]; break; } } return station; }; this.getResultSetById = function (setId) { for (var i=0;i this.fromDateTime.getTime()) { return true; } else { return false; } } this.check24Hours = function () { var now = new Date(); var nowPlus24 = new Date(now.getFullYear(),now.getMonth(),now.getDate()); if (this.fromDateTime.getTime() < (Date.now() + 86400000)) { return false; } else { return true; } } this.init = function() { if (this.FromToCheck() && this.check24Hours() ) { this.valid = true; } }; this.init(); } function getXMLDomObj () { try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } catch(e) { try //Firefox, Mozilla, Opera, etc. { xmlDoc=document.implementation.createDocument("","",null); } catch(e) {alert(e.message)} } return xmlDoc; } function getEBI(id) { return document.getElementById(id); } /** IS SNIFFER *******************************************************************************************************/ // Ultimate client-side JavaScript client sniff. Version 3.03 // (C) Netscape Communications 1999. Permission granted to reuse and distribute. // Revised 17 May 99 to add is.nav5up and is.ie5up (see below). // Revised 21 Nov 00 to add is.gecko and is.ie5_5 Also Changed is.nav5 and is.nav5up to is.nav6 and is.nav6up // Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, // correct Opera 5 detection // add support for winME and win2k // synch with browser-type-oo.js // Revised 26 Mar 01 to correct Opera detection // Revised 02 Oct 01 to add IE6 detection // Everything you always wanted to know about your JavaScript client // but were afraid to ask ... "Is" is the constructor function for "is" object, // which has properties indicating: // (1) browser vendor: // is.nav, is.ie, is.opera, is.hotjava, is.webtv, is.TVNavigator, is.AOLTV // (2) browser version number: // is.major (integer indicating major version number: 2, 3, 4 ...) // is.minor (float indicating full version number: 2.02, 3.01, 4.04 ...) // (3) browser vendor AND major version number // is.nav2, is.nav3, is.nav4, is.nav4up, is.nav6, is.nav6up, is.gecko, is.ie3, // is.ie4, is.ie4up, is.ie5, is.ie5up, is.ie5_5, is.ie5_5up, is.ie6, is.ie6up, is.hotjava3, is.hotjava3up // (4) JavaScript version number: // is.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...) // (5) OS platform and version: // is.win, is.win16, is.win32, is.win31, is.win95, is.winnt, is.win98, is.winme, is.win2k // is.os2 // is.mac, is.mac68k, is.macppc // is.unix // is.sun, is.sun4, is.sun5, is.suni86 // is.irix, is.irix5, is.irix6 // is.hpux, is.hpux9, is.hpux10 // is.aix, is.aix1, is.aix2, is.aix3, is.aix4 // is.linux, is.sco, is.unixware, is.mpras, is.reliant // is.dec, is.sinix, is.freebsd, is.bsd // is.vms // // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html // for detailed lists of userAgent strings. // // Note: you don't want your Nav4 or IE4 code to "turn off" or // stop working when Nav5 and IE5 (or later) are released, so // in conditional code forks, use is.nav4up ("Nav4 or greater") // and is.ie4up ("IE4 or greater") instead of is.nav4 or is.ie4 // to check version in code which you want to work on future // versions. function Is () { // convert all characters to lowercase to simplify testing var agt=navigator.userAgent.toLowerCase(); // *** BROWSER VERSION *** // Note: On IE5, these return 4, so use is.ie5up to detect IE5. this.major = parseInt(navigator.appVersion); this.minor = parseFloat(navigator.appVersion); // Note: Opera and WebTV spoof Navigator. We do strict client detection. // If you want to allow spoofing, take out the tests for opera and webtv. this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); this.nav2 = (this.nav && (this.major == 2)); this.nav3 = (this.nav && (this.major == 3)); this.nav4 = (this.nav && (this.major == 4)); this.nav4up = (this.nav && (this.major >= 4)); this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) ); this.nav6 = (this.nav && (this.major == 5)); this.nav6up = (this.nav && (this.major >= 5)); this.gecko = (agt.indexOf('gecko') != -1); this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); this.ie3 = (this.ie && (this.major < 4)); this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) ); this.ie4up = (this.ie && (this.major >= 4)); this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1)); this.ie5up = (this.ie && !this.ie3 && !this.ie4); this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5); this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) ); this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5); // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser // or if this is the first browser window opened. Thus the // variables is.aol, is.aol3, and is.aol4 aren't 100% reliable. this.aol = (agt.indexOf("aol") != -1); this.aol3 = (this.aol && this.ie3); this.aol4 = (this.aol && this.ie4); this.aol5 = (agt.indexOf("aol 5") != -1); this.aol6 = (agt.indexOf("aol 6") != -1); this.opera = (agt.indexOf("opera") != -1); this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1); this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1); this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1); this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4); this.webtv = (agt.indexOf("webtv") != -1); this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); this.AOLTV = this.TVNavigator; this.hotjava = (agt.indexOf("hotjava") != -1); this.hotjava3 = (this.hotjava && (this.major == 3)); this.hotjava3up = (this.hotjava && (this.major >= 3)); // *** JAVASCRIPT VERSION CHECK *** if (this.nav2 || this.ie3) this.js = 1.0; else if (this.nav3) this.js = 1.1; else if (this.opera5up) this.js = 1.3; else if (this.opera) this.js = 1.1; else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2; else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3; else if (this.hotjava3up) this.js = 1.4; else if (this.nav6 || this.gecko) this.js = 1.5; // NOTE: In the future, update this code when newer versions of JS // are released. For now, we try to provide some upward compatibility // so that future versions of Nav and IE will show they are at // *least* JS 1.x capable. Always check for JS version compatibility // with > or >=. else if (this.nav6up) this.js = 1.5; // note ie5up on mac is 1.4 else if (this.ie5up) this.js = 1.3 // HACK: no idea for other browsers; always check for JS version with > or >= else this.js = 0.0; // *** PLATFORM *** this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all // Win32, so you can't distinguish between Win95 and WinNT. this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); // is this a 16 bit compiled version? this.win16 = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1) ); this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1)); // NOTE: Reliable detection of Win98 may not be possible. It appears that: // - On Nav 4.x and before you'll get plain "Windows" in userAgent. // - On Mercury client, the 32-bit version will return "Win98", but // the 16-bit version running on Win98 will still return "Win95". this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); this.win32 = (this.win95 || this.winnt || this.win98 || ((this.major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)); this.winme = ((agt.indexOf("win 9x 4.90")!=-1)); this.win2k = ((agt.indexOf("windows nt 5.0")!=-1)); this.os2 = ((agt.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (agt.indexOf("ibm-webexplorer")!=-1)); this.mac = (agt.indexOf("mac")!=-1); // hack ie5 js version for mac if (this.mac && this.ie5up) this.js = 1.4; this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1))); this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1))); this.sun = (agt.indexOf("sunos")!=-1); this.sun4 = (agt.indexOf("sunos 4")!=-1); this.sun5 = (agt.indexOf("sunos 5")!=-1); this.suni86= (this.sun && (agt.indexOf("i86")!=-1)); this.irix = (agt.indexOf("irix") !=-1); // SGI this.irix5 = (agt.indexOf("irix 5") !=-1); this.irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1)); this.hpux = (agt.indexOf("hp-ux")!=-1); this.hpux9 = (this.hpux && (agt.indexOf("09.")!=-1)); this.hpux10= (this.hpux && (agt.indexOf("10.")!=-1)); this.aix = (agt.indexOf("aix") !=-1); // IBM this.aix1 = (agt.indexOf("aix 1") !=-1); this.aix2 = (agt.indexOf("aix 2") !=-1); this.aix3 = (agt.indexOf("aix 3") !=-1); this.aix4 = (agt.indexOf("aix 4") !=-1); this.linux = (agt.indexOf("inux")!=-1); this.sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1); this.unixware = (agt.indexOf("unix_system_v")!=-1); this.mpras = (agt.indexOf("ncr")!=-1); this.reliant = (agt.indexOf("reliantunix")!=-1); this.dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); this.sinix = (agt.indexOf("sinix")!=-1); this.freebsd = (agt.indexOf("freebsd")!=-1); this.bsd = (agt.indexOf("bsd")!=-1); this.unix = ((agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux || this.sco ||this.unixware || this.mpras || this.reliant || this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd); this.vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1)); } /* CALENDAR FUNCTIONS *****************************************************************************************************/ var names = new makeArray0('Januar','February','March','April','Mai','June','July','August','September','October','November','December'); var days = new makeArray0(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); var dow = new makeArray0('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); var calendar_year = 0; var calendar_month = 0; var calendar_fiering_id = ''; var calendar_month_year_id = ''; var calendar_text_id = ''; var calendar_window_id = ''; var calendar_move_left = 0; var calendar_move_top = 0; function Calendar(Month,Year,month_year_id,day_id,window_id) { var output = ''; output += '
'; output += ''; output += '
'; output += '
'; firstDay = new Date(Year,Month,1); startDay = firstDay.getDay(); if (((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0)) days[1] = 29; else days[1] = 28; output += ''; for (i=0; i<7; i++) output += ''; var column = 0; var lastMonth = Month - 1; if (lastMonth == -1) lastMonth = 11; for (i=0; i'; for (i=1; i<=days[Month]; i++, column++) { output += ''; column = -1; } } if (column > 0) { for (i=1; column<7; i++, column++) output += '
' + dow[i] +'<\/td>'; output += '<\/tr>
' + '' + i + '<\/a>' +'<\/td>'; if (column == 6) { output += '<\/tr>
' + i + '<\/td>'; } output += '<\/tr><\/table><\/form><\/td><\/tr><\/table>'; return output; } function changeDay(day) { day = day + ''; if (day.length == 1) { day = "0" + day; } var month = parseInt(document.Cal.Month.options[document.Cal.Month.selectedIndex].value); month += 1; if (month < 10) { month = "0" + month; } var year = document.Cal.Year.options[document.Cal.Year.selectedIndex].value + ''; document.getElementById(calendar_text_id).value = day + "." + month + "." + year; //document.getElementById(calendar_month_year_id).onchange(); //document.getElementById(calendar_day_id).value = day; closeFloatingError(); } function changeMonth() { calendar_month = parseInt(document.Cal.Month.options[document.Cal.Month.selectedIndex].value) + 1; var ihtml = Calendar(document.Cal.Month.options[document.Cal.Month.selectedIndex].value + '' , calendar_year, calendar_month_year_id, null, calendar_window_id); displayFloatingCalendar( calendar_window_id, calendar_fiering_id, "Calendar", "300", "300", calendar_move_left, calendar_move_top, ihtml,"","cr_from_date.month_year_img"); //document.getElementById(calendar_window_id).innerHTML } function changeYear() { calendar_year = parseInt(document.Cal.Year.options[document.Cal.Year.selectedIndex].value); var ihtml = Calendar((calendar_month -1 ) , calendar_year, calendar_text_id, null, calendar_window_id); displayFloatingCalendar( calendar_window_id, calendar_fiering_id, "Calendar", "300", "300", calendar_move_left, calendar_move_top, ihtml,"","cr_from_date.month_year_img"); } function makeArray0() { for (i = 0; i'; document.getElementById("cr_from_date_id_div").innerHTML = newselect; } else { document.getElementById("cr_from_date.day").innerHTML = newoptions; } document.getElementById("cr_from_date.day").value = old_day; //enable_form(document.getElementById(form_id)); } function update_to_days (form_id) { // disable_form(document.getElementById(form_id)); /*var newoptions = ac_getDays(document.getElementById("cr_to_date.month_year").options[document.getElementById("cr_to_date.month_year").options.selectedIndex].value, "noxml"); var old_day = document.getElementById("cr_to_date.day").value; if (is.ie) { var newselect = ''; document.getElementById("cr_to_date_id_div").innerHTML = newselect; } else { document.getElementById("cr_to_date.day").innerHTML = newoptions; } document.getElementById("cr_to_date.day").value = old_day;*/ //enable_form(document.getElementById("form_id")); } function ac_getDays(month_year,returnAs){ req = false; // For Safari, Firefox, and other non-MS browsers if (window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch (e) { req = false; } } else if (window.ActiveXObject) { // For Internet Explorer on Windows try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { req = false; } } } req.open("POST", "/hotel/get-days.tcl", false); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); var encoded = ""; encoded = "month_year=" + escape(month_year); req.send(encoded); if (req.status != 200) { //alert("There was a communications error: " + req.responseText); locale_alert("form_container" , "Error" , "There was a communications error: " + req.responseText, 50 , 50 ); return; } else { if (returnAs == "xml") { return xml = req.responseXML; } else { return req.responseText; } } } function open_calendar(date , fiering_id, text_id , window_id , move_left, move_top, pCalendarIcon) { /* var month_year_ar = document.getElementById(month_year_id).value.split("|"); var Month = parseInt(month_year_ar[0]); if (Month == 0) { Month = parseInt(month_year_ar[0].replace('0','')); } var Year = parseInt(month_year_ar[1]); */ if (date == null) date = new Date(); calendar_year = date.getFullYear(); calendar_month = date.getMonth() + 1; calendar_fiering_id = fiering_id; //calendar_month_year_id = month_year_id; calendar_text_id = text_id; calendar_window_id = window_id; calendar_move_left = move_left; calendar_move_top = move_top; var Year = date.getFullYear(); var Month = date.getMonth() + 1; var ihtml = Calendar((Month -1), Year, text_id, null, window_id); displayFloatingCalendar("windowerror", fiering_id, "Calendar", "300", "300", calendar_move_left, calendar_move_top, ihtml, "" , pCalendarIcon); return false; } // Ultimate client-side JavaScript client sniff. Version 3.03 // (C) Netscape Communications 1999. Permission granted to reuse and distribute. // Revised 17 May 99 to add is.nav5up and is.ie5up (see below). // Revised 21 Nov 00 to add is.gecko and is.ie5_5 Also Changed is.nav5 and is.nav5up to is.nav6 and is.nav6up // Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, // correct Opera 5 detection // add support for winME and win2k // synch with browser-type-oo.js // Revised 26 Mar 01 to correct Opera detection // Revised 02 Oct 01 to add IE6 detection // Everything you always wanted to know about your JavaScript client // but were afraid to ask ... "Is" is the constructor function for "is" object, // which has properties indicating: // (1) browser vendor: // is.nav, is.ie, is.opera, is.hotjava, is.webtv, is.TVNavigator, is.AOLTV // (2) browser version number: // is.major (integer indicating major version number: 2, 3, 4 ...) // is.minor (float indicating full version number: 2.02, 3.01, 4.04 ...) // (3) browser vendor AND major version number // is.nav2, is.nav3, is.nav4, is.nav4up, is.nav6, is.nav6up, is.gecko, is.ie3, // is.ie4, is.ie4up, is.ie5, is.ie5up, is.ie5_5, is.ie5_5up, is.ie6, is.ie6up, is.hotjava3, is.hotjava3up // (4) JavaScript version number: // is.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...) // (5) OS platform and version: // is.win, is.win16, is.win32, is.win31, is.win95, is.winnt, is.win98, is.winme, is.win2k // is.os2 // is.mac, is.mac68k, is.macppc // is.unix // is.sun, is.sun4, is.sun5, is.suni86 // is.irix, is.irix5, is.irix6 // is.hpux, is.hpux9, is.hpux10 // is.aix, is.aix1, is.aix2, is.aix3, is.aix4 // is.linux, is.sco, is.unixware, is.mpras, is.reliant // is.dec, is.sinix, is.freebsd, is.bsd // is.vms // // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html // for detailed lists of userAgent strings. // // Note: you don't want your Nav4 or IE4 code to "turn off" or // stop working when Nav5 and IE5 (or later) are released, so // in conditional code forks, use is.nav4up ("Nav4 or greater") // and is.ie4up ("IE4 or greater") instead of is.nav4 or is.ie4 // to check version in code which you want to work on future // versions. function Is () { // convert all characters to lowercase to simplify testing var agt=navigator.userAgent.toLowerCase(); // *** BROWSER VERSION *** // Note: On IE5, these return 4, so use is.ie5up to detect IE5. this.major = parseInt(navigator.appVersion); this.minor = parseFloat(navigator.appVersion); // Note: Opera and WebTV spoof Navigator. We do strict client detection. // If you want to allow spoofing, take out the tests for opera and webtv. this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); this.nav2 = (this.nav && (this.major == 2)); this.nav3 = (this.nav && (this.major == 3)); this.nav4 = (this.nav && (this.major == 4)); this.nav4up = (this.nav && (this.major >= 4)); this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) ); this.nav6 = (this.nav && (this.major == 5)); this.nav6up = (this.nav && (this.major >= 5)); this.gecko = (agt.indexOf('gecko') != -1); this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); this.ie3 = (this.ie && (this.major < 4)); this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) ); this.ie4up = (this.ie && (this.major >= 4)); this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1)); this.ie5up = (this.ie && !this.ie3 && !this.ie4); this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5); this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) ); this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5); // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser // or if this is the first browser window opened. Thus the // variables is.aol, is.aol3, and is.aol4 aren't 100% reliable. this.aol = (agt.indexOf("aol") != -1); this.aol3 = (this.aol && this.ie3); this.aol4 = (this.aol && this.ie4); this.aol5 = (agt.indexOf("aol 5") != -1); this.aol6 = (agt.indexOf("aol 6") != -1); this.opera = (agt.indexOf("opera") != -1); this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1); this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1); this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1); this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4); this.webtv = (agt.indexOf("webtv") != -1); this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); this.AOLTV = this.TVNavigator; this.hotjava = (agt.indexOf("hotjava") != -1); this.hotjava3 = (this.hotjava && (this.major == 3)); this.hotjava3up = (this.hotjava && (this.major >= 3)); // *** JAVASCRIPT VERSION CHECK *** if (this.nav2 || this.ie3) this.js = 1.0; else if (this.nav3) this.js = 1.1; else if (this.opera5up) this.js = 1.3; else if (this.opera) this.js = 1.1; else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2; else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3; else if (this.hotjava3up) this.js = 1.4; else if (this.nav6 || this.gecko) this.js = 1.5; // NOTE: In the future, update this code when newer versions of JS // are released. For now, we try to provide some upward compatibility // so that future versions of Nav and IE will show they are at // *least* JS 1.x capable. Always check for JS version compatibility // with > or >=. else if (this.nav6up) this.js = 1.5; // note ie5up on mac is 1.4 else if (this.ie5up) this.js = 1.3 // HACK: no idea for other browsers; always check for JS version with > or >= else this.js = 0.0; // *** PLATFORM *** this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all // Win32, so you can't distinguish between Win95 and WinNT. this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); // is this a 16 bit compiled version? this.win16 = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1) ); this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1)); // NOTE: Reliable detection of Win98 may not be possible. It appears that: // - On Nav 4.x and before you'll get plain "Windows" in userAgent. // - On Mercury client, the 32-bit version will return "Win98", but // the 16-bit version running on Win98 will still return "Win95". this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); this.win32 = (this.win95 || this.winnt || this.win98 || ((this.major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)); this.winme = ((agt.indexOf("win 9x 4.90")!=-1)); this.win2k = ((agt.indexOf("windows nt 5.0")!=-1)); this.os2 = ((agt.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (agt.indexOf("ibm-webexplorer")!=-1)); this.mac = (agt.indexOf("mac")!=-1); // hack ie5 js version for mac if (this.mac && this.ie5up) this.js = 1.4; this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1))); this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1))); this.sun = (agt.indexOf("sunos")!=-1); this.sun4 = (agt.indexOf("sunos 4")!=-1); this.sun5 = (agt.indexOf("sunos 5")!=-1); this.suni86= (this.sun && (agt.indexOf("i86")!=-1)); this.irix = (agt.indexOf("irix") !=-1); // SGI this.irix5 = (agt.indexOf("irix 5") !=-1); this.irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1)); this.hpux = (agt.indexOf("hp-ux")!=-1); this.hpux9 = (this.hpux && (agt.indexOf("09.")!=-1)); this.hpux10= (this.hpux && (agt.indexOf("10.")!=-1)); this.aix = (agt.indexOf("aix") !=-1); // IBM this.aix1 = (agt.indexOf("aix 1") !=-1); this.aix2 = (agt.indexOf("aix 2") !=-1); this.aix3 = (agt.indexOf("aix 3") !=-1); this.aix4 = (agt.indexOf("aix 4") !=-1); this.linux = (agt.indexOf("inux")!=-1); this.sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1); this.unixware = (agt.indexOf("unix_system_v")!=-1); this.mpras = (agt.indexOf("ncr")!=-1); this.reliant = (agt.indexOf("reliantunix")!=-1); this.dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); this.sinix = (agt.indexOf("sinix")!=-1); this.freebsd = (agt.indexOf("freebsd")!=-1); this.bsd = (agt.indexOf("bsd")!=-1); this.unix = ((agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux || this.sco ||this.unixware || this.mpras || this.reliant || this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd); this.vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1)); } var ota_category_codes = new Array( new cr_ota_code(1 , 'Auto') , new cr_ota_code(2 , 'Kleintransporter') , new cr_ota_code(3 , 'Geländewagen') , new cr_ota_code(4 , 'Cabrio') , new cr_ota_code(5 , 'LKW') , new cr_ota_code(6 , 'Motorrad') , new cr_ota_code(7 , 'Limousine') , new cr_ota_code(8 , 'Kombi') , new cr_ota_code(9 , 'Offener Kleintansporter') , new cr_ota_code(10 , 'Wohnmobil') , new cr_ota_code(11 , 'Geländefahrzeug') , new cr_ota_code(12 , 'Camper') , new cr_ota_code(13 , 'Sportwagen') , new cr_ota_code(14 , 'Spezialfahrzeug') , new cr_ota_code(15 , 'Pickup mit Extrasitzplatz im Fahrerhaus') , new cr_ota_code(16 , 'Pickup mit Standardfahrerhaus') , new cr_ota_code(17 , 'Spezialangebot') , new cr_ota_code(18 , 'Coupé') , new cr_ota_code(19 , 'Mehrzweckfahrzeug') , new cr_ota_code(20 , 'Zweirad') , new cr_ota_code(21 , 'Roadster') , new cr_ota_code(22 , 'Kombifahrzeug') , new cr_ota_code(23 , 'Lieferwagen') ); var otaSizeCodes = new Array( new cr_ota_code( 1 , 'Mini') , new cr_ota_code( 3 , 'Economy' ) , new cr_ota_code(4 , 'Compact') , new cr_ota_code( 6 , 'Intermediate') , new cr_ota_code( 7 , 'Standart' ) , new cr_ota_code( 8 , 'Full Size' ) , new cr_ota_code( 9 , 'Luxury' ) , new cr_ota_code( 10 , 'Premium') , new cr_ota_code( 11 , 'Mini Van') , new cr_ota_code( 12 , '12 Passenger Van') , new cr_ota_code( 24 , 'Exotic'));