var language = 2; var last_price; var going_price; var last_going_price; var wayback_price; var last_wayback_price; var totalkm; var selected_cour ="EUR"; var meetingdatetime = new Date(); var formatted_datetime; var formatted_datetime2; var flight_number = ""; var need_wayback = "g"; var mrmt; var rmt; var created_date; var totalpassengers; var totalchildseat; var lastdirectiondisplay; var current_step; var st_loc_coord; var end_loc_coord; var start_point_name; var start_tam_adres; var start_airport; var stop_airport; var start_types; var bit_tam_adres; var end_point_name; var p_name; var p_surname; var p_gsm; var p_email; var p_email2; var p_note; var p_country; var payment_method; var rez_no = ""; var start_id; var st2_start_id; var start_label; var stop_id; var st2_stop_id; var stop_label; function calculate_price() { //window.alert(formatted_datetime2); if (totalkm.length == 0) { return; } else { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var res = xmlhttp.responseText.split("&+"); going_price = Math.ceil(res[0]); going_price_usd = Math.ceil(res[1]); going_price_eur = Math.ceil(res[2]); going_price_gbp = Math.ceil(res[3]); wayback_price = Math.ceil(res[4]); wayback_price_usd = Math.ceil(res[5]); wayback_price_eur = Math.ceil(res[6]); wayback_price_gbp = Math.ceil(res[7]); start_point_name = res[8]; end_point_name = res[9]; start_airport = res[10]; stop_airport = res[11]; //window.alert(end_point_name); if (selected_cour == "EUR") { last_going_price = (going_price_eur); } if (selected_cour == "USD") { last_going_price = (going_price_usd); } if (selected_cour == "GBP") { last_going_price = (going_price_gbp); } if (selected_cour == "TRY") { last_going_price = (going_price); } if (going_price == "0") { initMap("step_denied"); } else { //window.alert(start_airport); $('#all_search_area').block({ message: '

Loading...

', css: { border: '3px solid orange' } }); initMap(2); } } }; xmlhttp.open("POST", "/y/fiyat.php?kmm=" + totalkm + "&totalpassengers=" + totalpassengers + "&totalchildseat=" + totalchildseat + "&scoord=" + st_loc_coord + "&endcoord=" + end_loc_coord + "&need_wayback=" + need_wayback + "&selected_cour=" + selected_cour, true); xmlhttp.send(); } } //$.overlay.show('ajax'); var map; var geocoder; var infowindow; var origin_place_id; var destination_place_id; var travel_mode; var directionsService; var directionsDisplay; function initMap(step) { if (step == 1) { start_id = ""; stop_id = ""; geocoder = new google.maps.Geocoder; infowindow = new google.maps.InfoWindow; origin_place_id = null; destination_place_id = null; travel_mode = google.maps.TravelMode.DRIVING; map = new google.maps.Map(document.getElementById('dvMap'), { mapTypeControl:true, disableDefaultUI: true, zoomControl:true, provideRouteAlternatives : false, mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false, center: {lat: 36.897040, lng: 30.795472}, zoom: 7 }); geocoder = new google.maps.Geocoder; infowindow = new google.maps.InfoWindow; directionsService = new google.maps.DirectionsService; directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': true }); directionsDisplay.setMap(map); document.getElementById('all_map_box').style.display = "block"; call_step("step1"); google.maps.event.addListener(directionsDisplay, 'directions_changed', function() { lastdirectiondisplay = directionsDisplay; start_id = lastdirectiondisplay.directions.geocoded_waypoints[0].place_id; stop_id = lastdirectiondisplay.directions.geocoded_waypoints[1].place_id; //start_tam_adres = lastdirectiondisplay.directions.routes[0].legs[0].start_address; start_tam_adres = call_start_adress(); bit_tam_adres = lastdirectiondisplay.directions.routes[0].legs[0].end_address; bit_tam_adres = call_stop_adress(); //$.post( "/y/step2_html.php", { st_adres: start_tam_adres } ); totalkm = (Math.round(directionsDisplay.directions.routes[0].legs[0].distance.value / 1000)); st_loc_coord = directionsDisplay.directions.routes[0].legs[0].start_location; end_loc_coord = directionsDisplay.directions.routes[0].legs[0].end_location; //window.alert(JSON.stringify(start_types)); calculate_price(); }); } // Step1 Bitti if (step == 2) { totalpassengers = 0; totalchildseat = 0; meetingdatetime = null; flight_number = ""; //$('#dvMap').removeClass('hidden-xs'); call_step("step2"); } if (step == 3) { call_step("step3"); need_wayback = "g"; } if (step == 4) { p_name = ""; p_surname = ""; p_gsm = ""; p_email = ""; p_email2 = ""; p_note = ""; rmt = null; need_wayback = "g"; call_step("step4"); } if (step == 5) { p_name = ""; p_surname = ""; p_gsm = ""; p_email = ""; p_email2 = ""; p_note = ""; need_wayback = "g-d"; call_step("step5"); } if (step == 6) { call_step("step6"); } if (step == 7) { call_step("step7"); } if (step == 8) { call_step("step8"); } if (step == "step_denied") { call_step("step_denied"); } function abc() { var options = {componentRestrictions: {country: 'tr'}}; var origin_input = document.getElementById('origin-input'); var destination_input = document.getElementById('destination-input'); //var origin_autocomplete = new google.maps.places.Autocomplete(origin_input, options); //origin_autocomplete.bindTo('bounds', map); //var destination_autocomplete = new google.maps.places.Autocomplete(destination_input, options); //destination_autocomplete.bindTo('bounds', map); function expandViewportToFitPlace(map, place) { if (place.geometry.viewport) { map.fitBounds(place.geometry.viewport); } else { map.setCenter(place.geometry.location); map.setZoom(17); } } // document.getElementById("destination-input").addEventListener("focusout", function() { if (typeof place2 === 'undefined' || place2 === null) { // document.getElementById("destination-input").value = ""; // } // }); // origin_autocomplete.addListener('place_changed', function() { // place1 = origin_autocomplete.getPlace(); // window.alert(JSON.stringify(place1)); // if (!place1.geometry) { // window.alert("Autocomplete's returned place contains no geometry"); // document.getElementById("origin-input").value = ""; // return; // } // expandViewportToFitPlace(map, place1); // If the place has a geometry, store its place ID and route if we have // the other place ID // origin_place_id = place1.place_id; // route(origin_place_id, destination_place_id, travel_mode, // directionsService, directionsDisplay); // }); // destination_autocomplete.addListener('place_changed', function() { // place2 = destination_autocomplete.getPlace(); // if (!place2.geometry) { // window.alert("Autocomplete's returned place contains no geometry"); // return; // } // expandViewportToFitPlace(map, place2); // If the place has a geometry, store its place ID and route if we have // the other place ID // destination_place_id = place2.place_id; // route(origin_place_id, destination_place_id, travel_mode, // directionsService, directionsDisplay); // }); //route("ChIJnXxhjXeEwxQR-uhI2_zcfME","ChIJc55SWxN7wxQRBGO5VjXtExc" , travel_mode , new google.maps.DirectionsService , new google.maps.DirectionsRenderer({ 'draggable': true })); } // abc kapandı function call_step(step_request) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { //document.getElementById("total-input").innerHTML = xhttp.responseText; $("#total-input").html(xhttp.responseText); //alert(xhttp.responseText); abc(); }; }; //window.alert("last = " + start_tam_adres); if (start_tam_adres){ start_tam_adres = start_tam_adres.replace("&", "and"); }; if (bit_tam_adres){ bit_tam_adres = bit_tam_adres.replace("&", "and"); }; xhttp.open("POST", "/y/steps.php?step_request=" + step_request + "&start_point=" + start_point_name + "&start_airport=" + start_airport + "&bas_adres=" + start_tam_adres + "&end_point=" + end_point_name + "&stop_airport=" + stop_airport + "&bit_adres=" + bit_tam_adres + "&need_wayback=" + need_wayback + "&payment_method=" + payment_method + "&p_name=" + p_name + "&p_surname=" + p_surname + "&p_email2=" + p_email2 + "&p_gsm=" + p_gsm + "&p_note=" + p_note + "&rez_no=" + rez_no + "&start_id=" + start_id + "&stop_id=" + stop_id + "&lastdirectiondisplay=" + lastdirectiondisplay + "&meetingdatetime=" + meetingdatetime + "&formatted_datetime=" + formatted_datetime + "&flight_number=" + flight_number + "&totalpassengers=" + totalpassengers + "&totalchildseat=" + totalchildseat + "&going_price=" + last_going_price + "&selected_cour=" + selected_cour + "&formatted_datetime2=" + formatted_datetime2 + "&wayback_price=" + last_wayback_price + "&language=" + language, true); xhttp.send(); }; }; function call_start_adress() { if(current_step == 1) { return start_label; } else { if (start_label && st2_start_id == start_id) { return start_label; } else { start_label = null; return lastdirectiondisplay.directions.routes[0].legs[0].start_address; } } }; function call_stop_adress() { if(current_step == 1) { return stop_label; } else { if (stop_label && st2_stop_id == stop_id) { return stop_label; } else { stop_label = null; return lastdirectiondisplay.directions.routes[0].legs[0].end_address; } } }; function basla() { if (window.location.href == "https://www.antalyatransferclub.com/tr") { window.location.replace("https://www.antalyatransferclub.com"); }; if (document.getElementById('all_search_area')){ $('#all_search_area').block({ message: '

Loading...

', css: { border: '3px solid orange' } }); initMap(1); }; }; function select_message() { $.blockUI({ message: 'Select From List !!!', fadeIn: 700, fadeOut: 700, timeout: 2000, showOverlay: false, centerY: true, css: { width: '350px', top: '10px', left: '50%', right: '50%', border: 'none', padding: '5px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .9, color: 'orange' } }); }; function ex_lang() { if (language == 1) { return "tr"; }; if (language == 2) { return "en"; }; if (language == 3) { return "ru"; }; if (language == 4) { return "de"; }; };