/
home
/
desid573
/
public_html
/
family
/
/home/desid573/public_html/family
mkdir
upload
Name
Size
Mode
Actions
assets/
-
0755
rm
eway-rapid-php-master/
-
0755
rm
invoice/
-
0755
rm
pdd/
-
0755
rm
10.php
1941
0644
edit
dl
rm
11.php
1176
0644
edit
dl
rm
22.php
9106
0644
edit
dl
rm
array.php
2173
0644
edit
dl
rm
a_name_address.php
959
0644
edit
dl
rm
brisbaneInvoice.php
11845
0644
edit
dl
rm
class.phpmailer.php
80046
0644
edit
dl
rm
class.pop3.php
10385
0644
edit
dl
rm
class.smtp.php
24586
0644
edit
dl
rm
completedReport.php
9286
0644
edit
dl
rm
confirmAll1.php
591
0644
edit
dl
rm
dispatch.php
877
0644
edit
dl
rm
driverInvoice.php
12148
0644
edit
dl
rm
driverlocation.php
14585
0644
edit
dl
rm
eCrypt.js
68424
0644
edit
dl
rm
edit.php
780
0644
edit
dl
rm
error_log
30478123
0644
edit
dl
rm
eway-rapid-php-master.zip
57270
0644
edit
dl
rm
eWay.php
42697
0644
edit
dl
rm
family-cab_small.jpg
98853
0644
edit
dl
rm
fatigue.php
2295
0644
edit
dl
rm
incident_report.php
0
0644
edit
dl
rm
index.php
200204
0644
edit
dl
rm
index1apr2019.php
92844
0644
edit
dl
rm
index3.php
60677
0644
edit
dl
rm
index4.php
91500
0644
edit
dl
rm
index15thMay.php
92640
0644
edit
dl
rm
indexJune10.php
93053
0644
edit
dl
rm
indextest.php
91391
0644
edit
dl
rm
indexTraffic.php
86040
0644
edit
dl
rm
index_preSydney.php
60350
0644
edit
dl
rm
index_sydney.php
74126
0644
edit
dl
rm
melbAuditReport.php
10458
0644
edit
dl
rm
melbreport.php
7758
0644
edit
dl
rm
monthly.php
12046
0644
edit
dl
rm
new.php
0
0644
edit
dl
rm
perthAuditReport.php
34918
0644
edit
dl
rm
perthReport.php
7757
0644
edit
dl
rm
postcodeArray.php
1014
0644
edit
dl
rm
postcodeReport.php
21015
0644
edit
dl
rm
pre-sydneyquote.php
39158
0644
edit
dl
rm
promo.php
765
0644
edit
dl
rm
qldDriverReport.php
8568
0644
edit
dl
rm
qldreport.php
7580
0644
edit
dl
rm
quote.php
52358
0644
edit
dl
rm
quote2.php
38831
0644
edit
dl
rm
quote_sydney.php
51912
0644
edit
dl
rm
report.php
10447
0644
edit
dl
rm
search.php
854
0644
edit
dl
rm
serialize.php
157
0644
edit
dl
rm
style.json
1014
0644
edit
dl
rm
summaryReport.php
10212
0644
edit
dl
rm
sydneydispatch.php
12177
0644
edit
dl
rm
sydneyreport.php
7758
0644
edit
dl
rm
table.php
5087
0644
edit
dl
rm
test.php
3851
0644
edit
dl
rm
thankyou.php
31498
0644
edit
dl
rm
tmrReport.php
2431
0644
edit
dl
rm
tmr_trips.php
11287
0644
edit
dl
rm
unserialize.php
571
0644
edit
dl
rm
Edit:
/home/desid573/public_html/family/index.php
(200204B)
<?php $invoice_ref = time().rand(10,5000); $dbhost = "localhost"; $dbuser = "desid573_famcab"; $dbpass = "C]+6wQySxov("; $dbname = "desid573_familycab"; $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname) or die($conn->connect_error); $qcon=mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); /*$query1 = "SELECT * FROM prices WHERE id=0"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $baseSyd = $row['base']; $kmSyd = $row['km']; $timeSyd = $row['time']; $largeSyd = $row['large_km']; $minSyd = $row['min']; $min_lateSyd = $row['min_late']; $query1 = "SELECT * FROM prices WHERE id=1"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $basePer = $row['base']; $kmPer = $row['km']; $timePer = $row['time']; $largePer = $row['large_km']; $minPer = $row['min']; $min_latePer = $row['min_late'];*/ /*$query = "SELECT * FROM alert_area WHERE id=1"; $result = mysqli_query($conn, $query); $row = mysqli_fetch_assoc($result); $poly = $row['array'];*/ $client_key = '4T7y1vuKPkdhRYUQdH6msueW9hqV2wpcwnSk0Qwxkvwf7TjQn40qymPW7IJb66gUC1w1505cDMkj9IR82juQEnIp4/8nd0nDhwYDSDoqROtNBWmkqtqYmF6F4qVGMUq3HpJrY3y2kdSljCFfWzWc7LIEn4G5XY2IZAPgAO5+mhwvYrricmqwLhqzV4FBUII5AwTvJZl4awrdul4vLWkS73vJuW/XrXHseGK/nqB3oSRluZ1jKp2qDgVTwrXYEbx4rwwS42X2w0C9tLKywxf27WD2CCK8ftSeQBimVqFI0r6VuRXFVaOn6SQTOD9V/TsCfPk5Zh6/PWcfapyVKS+l1w=='; ?> <!DOCTYPE html> <html lang="en"> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>FamilyCab Booking Page</title> <!-- Bootstrap --> <link async href="../assets/css/bootstrap.min.css" rel="stylesheet"> <!--<link async rel="stylesheet" href="assets/intlTelInput.css">--> <style> /** * Variables declared here can be overridden by consuming applications, with * the help of the `!default` flag. * * @example * // overriding $hoverColor * $hoverColor: rgba(red, 0.05); * * // overriding image path * $flagsImagePath: "images/"; * * // import the scss file after the overrides * @import "bower_component/intl-tel-input/src/css/intlTelInput"; */ .intl-tel-input { position: relative; display: inline-block; } .intl-tel-input * { box-sizing: border-box; -moz-box-sizing: border-box; } .intl-tel-input .hide { display: none; } .intl-tel-input .v-hide { visibility: hidden; } .intl-tel-input input, .intl-tel-input input[type=text], .intl-tel-input input[type=tel] { position: relative; z-index: 0; margin-top: 0 !important; margin-bottom: 0 !important; padding-right: 36px; margin-right: 0; } .intl-tel-input .flag-container { position: absolute; top: 0; bottom: 0; right: 0; padding: 1px; } .intl-tel-input .selected-flag { z-index: 1; position: relative; width: 36px; height: 100%; padding: 0 0 0 8px; } .intl-tel-input .selected-flag .iti-flag { position: absolute; top: 0; bottom: 0; margin: auto; } .intl-tel-input .selected-flag .iti-arrow { position: absolute; top: 50%; margin-top: -2px; right: 6px; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 4px solid #555; } .intl-tel-input .selected-flag .iti-arrow.up { border-top: none; border-bottom: 4px solid #555; } .intl-tel-input .country-list { position: absolute; z-index: 2; list-style: none; text-align: left; padding: 0; margin: 0 0 0 -1px; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); background-color: white; border: 1px solid #CCC; white-space: nowrap; max-height: 200px; overflow-y: scroll; } .intl-tel-input .country-list.dropup { bottom: 100%; margin-bottom: -1px; } .intl-tel-input .country-list .flag-box { display: inline-block; width: 20px; } @media (max-width: 500px) { .intl-tel-input .country-list { white-space: normal; } } .intl-tel-input .country-list .divider { padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid #CCC; } .intl-tel-input .country-list .country { padding: 5px 10px; } .intl-tel-input .country-list .country .dial-code { color: #999; } .intl-tel-input .country-list .country.highlight { background-color: rgba(0, 0, 0, 0.05); } .intl-tel-input .country-list .flag-box, .intl-tel-input .country-list .country-name, .intl-tel-input .country-list .dial-code { vertical-align: middle; } .intl-tel-input .country-list .flag-box, .intl-tel-input .country-list .country-name { margin-right: 6px; } .intl-tel-input.allow-dropdown input, .intl-tel-input.allow-dropdown input[type=text], .intl-tel-input.allow-dropdown input[type=tel], .intl-tel-input.separate-dial-code input, .intl-tel-input.separate-dial-code input[type=text], .intl-tel-input.separate-dial-code input[type=tel] { padding-right: 6px; padding-left: 52px; margin-left: 0; } .intl-tel-input.allow-dropdown .flag-container, .intl-tel-input.separate-dial-code .flag-container { right: auto; left: 0; } .intl-tel-input.allow-dropdown .selected-flag, .intl-tel-input.separate-dial-code .selected-flag { width: 46px; } .intl-tel-input.allow-dropdown .flag-container:hover { cursor: pointer; } .intl-tel-input.allow-dropdown .flag-container:hover .selected-flag { background-color: rgba(0, 0, 0, 0.05); } .intl-tel-input.allow-dropdown input[disabled] + .flag-container:hover, .intl-tel-input.allow-dropdown input[readonly] + .flag-container:hover { cursor: default; } .intl-tel-input.allow-dropdown input[disabled] + .flag-container:hover .selected-flag, .intl-tel-input.allow-dropdown input[readonly] + .flag-container:hover .selected-flag { background-color: transparent; } .intl-tel-input.separate-dial-code .selected-flag { background-color: rgba(0, 0, 0, 0.05); display: table; } .intl-tel-input.separate-dial-code .selected-dial-code { display: table-cell; vertical-align: middle; padding-left: 28px; } .intl-tel-input.separate-dial-code.iti-sdc-2 input, .intl-tel-input.separate-dial-code.iti-sdc-2 input[type=text], .intl-tel-input.separate-dial-code.iti-sdc-2 input[type=tel] { padding-left: 66px; } .intl-tel-input.separate-dial-code.iti-sdc-2 .selected-flag { width: 60px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 input, .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 input[type=text], .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 input[type=tel] { padding-left: 76px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 .selected-flag { width: 70px; } .intl-tel-input.separate-dial-code.iti-sdc-3 input, .intl-tel-input.separate-dial-code.iti-sdc-3 input[type=text], .intl-tel-input.separate-dial-code.iti-sdc-3 input[type=tel] { padding-left: 74px; } .intl-tel-input.separate-dial-code.iti-sdc-3 .selected-flag { width: 68px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 input, .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 input[type=text], .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 input[type=tel] { padding-left: 84px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 .selected-flag { width: 78px; } .intl-tel-input.separate-dial-code.iti-sdc-4 input, .intl-tel-input.separate-dial-code.iti-sdc-4 input[type=text], .intl-tel-input.separate-dial-code.iti-sdc-4 input[type=tel] { padding-left: 82px; } .intl-tel-input.separate-dial-code.iti-sdc-4 .selected-flag { width: 76px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 input, .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 input[type=text], .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 input[type=tel] { padding-left: 92px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 .selected-flag { width: 86px; } .intl-tel-input.separate-dial-code.iti-sdc-5 input, .intl-tel-input.separate-dial-code.iti-sdc-5 input[type=text], .intl-tel-input.separate-dial-code.iti-sdc-5 input[type=tel] { padding-left: 90px; } .intl-tel-input.separate-dial-code.iti-sdc-5 .selected-flag { width: 84px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 input, .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 input[type=text], .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 input[type=tel] { padding-left: 100px; } .intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 .selected-flag { width: 94px; } .intl-tel-input.iti-container { position: absolute; top: -1000px; left: -1000px; z-index: 1060; padding: 1px; } .intl-tel-input.iti-container:hover { cursor: pointer; } .iti-mobile .intl-tel-input.iti-container { top: 30px; bottom: 30px; left: 30px; right: 30px; position: fixed; } .iti-mobile .intl-tel-input .country-list { max-height: 100%; width: 100%; } .iti-mobile .intl-tel-input .country-list .country { padding: 10px 10px; line-height: 1.5em; } .iti-flag { width: 20px; } .iti-flag.be { width: 18px; } .iti-flag.ch { width: 15px; } .iti-flag.mc { width: 19px; } .iti-flag.ne { width: 18px; } .iti-flag.np { width: 13px; } .iti-flag.va { width: 15px; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .iti-flag { background-size: 5630px 15px; } } .iti-flag.ac { height: 10px; background-position: 0px 0px; } .iti-flag.ad { height: 14px; background-position: -22px 0px; } .iti-flag.ae { height: 10px; background-position: -44px 0px; } .iti-flag.af { height: 14px; background-position: -66px 0px; } .iti-flag.ag { height: 14px; background-position: -88px 0px; } .iti-flag.ai { height: 10px; background-position: -110px 0px; } .iti-flag.al { height: 15px; background-position: -132px 0px; } .iti-flag.am { height: 10px; background-position: -154px 0px; } .iti-flag.ao { height: 14px; background-position: -176px 0px; } .iti-flag.aq { height: 14px; background-position: -198px 0px; } .iti-flag.ar { height: 13px; background-position: -220px 0px; } .iti-flag.as { height: 10px; background-position: -242px 0px; } .iti-flag.at { height: 14px; background-position: -264px 0px; } .iti-flag.au { height: 10px; background-position: -286px 0px; } .iti-flag.aw { height: 14px; background-position: -308px 0px; } .iti-flag.ax { height: 13px; background-position: -330px 0px; } .iti-flag.az { height: 10px; background-position: -352px 0px; } .iti-flag.ba { height: 10px; background-position: -374px 0px; } .iti-flag.bb { height: 14px; background-position: -396px 0px; } .iti-flag.bd { height: 12px; background-position: -418px 0px; } .iti-flag.be { height: 15px; background-position: -440px 0px; } .iti-flag.bf { height: 14px; background-position: -460px 0px; } .iti-flag.bg { height: 12px; background-position: -482px 0px; } .iti-flag.bh { height: 12px; background-position: -504px 0px; } .iti-flag.bi { height: 12px; background-position: -526px 0px; } .iti-flag.bj { height: 14px; background-position: -548px 0px; } .iti-flag.bl { height: 14px; background-position: -570px 0px; } .iti-flag.bm { height: 10px; background-position: -592px 0px; } .iti-flag.bn { height: 10px; background-position: -614px 0px; } .iti-flag.bo { height: 14px; background-position: -636px 0px; } .iti-flag.bq { height: 14px; background-position: -658px 0px; } .iti-flag.br { height: 14px; background-position: -680px 0px; } .iti-flag.bs { height: 10px; background-position: -702px 0px; } .iti-flag.bt { height: 14px; background-position: -724px 0px; } .iti-flag.bv { height: 15px; background-position: -746px 0px; } .iti-flag.bw { height: 14px; background-position: -768px 0px; } .iti-flag.by { height: 10px; background-position: -790px 0px; } .iti-flag.bz { height: 14px; background-position: -812px 0px; } .iti-flag.ca { height: 10px; background-position: -834px 0px; } .iti-flag.cc { height: 10px; background-position: -856px 0px; } .iti-flag.cd { height: 15px; background-position: -878px 0px; } .iti-flag.cf { height: 14px; background-position: -900px 0px; } .iti-flag.cg { height: 14px; background-position: -922px 0px; } .iti-flag.ch { height: 15px; background-position: -944px 0px; } .iti-flag.ci { height: 14px; background-position: -961px 0px; } .iti-flag.ck { height: 10px; background-position: -983px 0px; } .iti-flag.cl { height: 14px; background-position: -1005px 0px; } .iti-flag.cm { height: 14px; background-position: -1027px 0px; } .iti-flag.cn { height: 14px; background-position: -1049px 0px; } .iti-flag.co { height: 14px; background-position: -1071px 0px; } .iti-flag.cp { height: 14px; background-position: -1093px 0px; } .iti-flag.cr { height: 12px; background-position: -1115px 0px; } .iti-flag.cu { height: 10px; background-position: -1137px 0px; } .iti-flag.cv { height: 12px; background-position: -1159px 0px; } .iti-flag.cw { height: 14px; background-position: -1181px 0px; } .iti-flag.cx { height: 10px; background-position: -1203px 0px; } .iti-flag.cy { height: 13px; background-position: -1225px 0px; } .iti-flag.cz { height: 14px; background-position: -1247px 0px; } .iti-flag.de { height: 12px; background-position: -1269px 0px; } .iti-flag.dg { height: 10px; background-position: -1291px 0px; } .iti-flag.dj { height: 14px; background-position: -1313px 0px; } .iti-flag.dk { height: 15px; background-position: -1335px 0px; } .iti-flag.dm { height: 10px; background-position: -1357px 0px; } .iti-flag.do { height: 13px; background-position: -1379px 0px; } .iti-flag.dz { height: 14px; background-position: -1401px 0px; } .iti-flag.ea { height: 14px; background-position: -1423px 0px; } .iti-flag.ec { height: 14px; background-position: -1445px 0px; } .iti-flag.ee { height: 13px; background-position: -1467px 0px; } .iti-flag.eg { height: 14px; background-position: -1489px 0px; } .iti-flag.eh { height: 10px; background-position: -1511px 0px; } .iti-flag.er { height: 10px; background-position: -1533px 0px; } .iti-flag.es { height: 14px; background-position: -1555px 0px; } .iti-flag.et { height: 10px; background-position: -1577px 0px; } .iti-flag.eu { height: 14px; background-position: -1599px 0px; } .iti-flag.fi { height: 12px; background-position: -1621px 0px; } .iti-flag.fj { height: 10px; background-position: -1643px 0px; } .iti-flag.fk { height: 10px; background-position: -1665px 0px; } .iti-flag.fm { height: 11px; background-position: -1687px 0px; } .iti-flag.fo { height: 15px; background-position: -1709px 0px; } .iti-flag.fr { height: 14px; background-position: -1731px 0px; } .iti-flag.ga { height: 15px; background-position: -1753px 0px; } .iti-flag.gb { height: 10px; background-position: -1775px 0px; } .iti-flag.gd { height: 12px; background-position: -1797px 0px; } .iti-flag.ge { height: 14px; background-position: -1819px 0px; } .iti-flag.gf { height: 14px; background-position: -1841px 0px; } .iti-flag.gg { height: 14px; background-position: -1863px 0px; } .iti-flag.gh { height: 14px; background-position: -1885px 0px; } .iti-flag.gi { height: 10px; background-position: -1907px 0px; } .iti-flag.gl { height: 14px; background-position: -1929px 0px; } .iti-flag.gm { height: 14px; background-position: -1951px 0px; } .iti-flag.gn { height: 14px; background-position: -1973px 0px; } .iti-flag.gp { height: 14px; background-position: -1995px 0px; } .iti-flag.gq { height: 14px; background-position: -2017px 0px; } .iti-flag.gr { height: 14px; background-position: -2039px 0px; } .iti-flag.gs { height: 10px; background-position: -2061px 0px; } .iti-flag.gt { height: 13px; background-position: -2083px 0px; } .iti-flag.gu { height: 11px; background-position: -2105px 0px; } .iti-flag.gw { height: 10px; background-position: -2127px 0px; } .iti-flag.gy { height: 12px; background-position: -2149px 0px; } .iti-flag.hk { height: 14px; background-position: -2171px 0px; } .iti-flag.hm { height: 10px; background-position: -2193px 0px; } .iti-flag.hn { height: 10px; background-position: -2215px 0px; } .iti-flag.hr { height: 10px; background-position: -2237px 0px; } .iti-flag.ht { height: 12px; background-position: -2259px 0px; } .iti-flag.hu { height: 10px; background-position: -2281px 0px; } .iti-flag.ic { height: 14px; background-position: -2303px 0px; } .iti-flag.id { height: 14px; background-position: -2325px 0px; } .iti-flag.ie { height: 10px; background-position: -2347px 0px; } .iti-flag.il { height: 15px; background-position: -2369px 0px; } .iti-flag.im { height: 10px; background-position: -2391px 0px; } .iti-flag.in { height: 14px; background-position: -2413px 0px; } .iti-flag.io { height: 10px; background-position: -2435px 0px; } .iti-flag.iq { height: 14px; background-position: -2457px 0px; } .iti-flag.ir { height: 12px; background-position: -2479px 0px; } .iti-flag.is { height: 15px; background-position: -2501px 0px; } .iti-flag.it { height: 14px; background-position: -2523px 0px; } .iti-flag.je { height: 12px; background-position: -2545px 0px; } .iti-flag.jm { height: 10px; background-position: -2567px 0px; } .iti-flag.jo { height: 10px; background-position: -2589px 0px; } .iti-flag.jp { height: 14px; background-position: -2611px 0px; } .iti-flag.ke { height: 14px; background-position: -2633px 0px; } .iti-flag.kg { height: 12px; background-position: -2655px 0px; } .iti-flag.kh { height: 13px; background-position: -2677px 0px; } .iti-flag.ki { height: 10px; background-position: -2699px 0px; } .iti-flag.km { height: 12px; background-position: -2721px 0px; } .iti-flag.kn { height: 14px; background-position: -2743px 0px; } .iti-flag.kp { height: 10px; background-position: -2765px 0px; } .iti-flag.kr { height: 14px; background-position: -2787px 0px; } .iti-flag.kw { height: 10px; background-position: -2809px 0px; } .iti-flag.ky { height: 10px; background-position: -2831px 0px; } .iti-flag.kz { height: 10px; background-position: -2853px 0px; } .iti-flag.la { height: 14px; background-position: -2875px 0px; } .iti-flag.lb { height: 14px; background-position: -2897px 0px; } .iti-flag.lc { height: 10px; background-position: -2919px 0px; } .iti-flag.li { height: 12px; background-position: -2941px 0px; } .iti-flag.lk { height: 10px; background-position: -2963px 0px; } .iti-flag.lr { height: 11px; background-position: -2985px 0px; } .iti-flag.ls { height: 14px; background-position: -3007px 0px; } .iti-flag.lt { height: 12px; background-position: -3029px 0px; } .iti-flag.lu { height: 12px; background-position: -3051px 0px; } .iti-flag.lv { height: 10px; background-position: -3073px 0px; } .iti-flag.ly { height: 10px; background-position: -3095px 0px; } .iti-flag.ma { height: 14px; background-position: -3117px 0px; } .iti-flag.mc { height: 15px; background-position: -3139px 0px; } .iti-flag.md { height: 10px; background-position: -3160px 0px; } .iti-flag.me { height: 10px; background-position: -3182px 0px; } .iti-flag.mf { height: 14px; background-position: -3204px 0px; } .iti-flag.mg { height: 14px; background-position: -3226px 0px; } .iti-flag.mh { height: 11px; background-position: -3248px 0px; } .iti-flag.mk { height: 10px; background-position: -3270px 0px; } .iti-flag.ml { height: 14px; background-position: -3292px 0px; } .iti-flag.mm { height: 14px; background-position: -3314px 0px; } .iti-flag.mn { height: 10px; background-position: -3336px 0px; } .iti-flag.mo { height: 14px; background-position: -3358px 0px; } .iti-flag.mp { height: 10px; background-position: -3380px 0px; } .iti-flag.mq { height: 14px; background-position: -3402px 0px; } .iti-flag.mr { height: 14px; background-position: -3424px 0px; } .iti-flag.ms { height: 10px; background-position: -3446px 0px; } .iti-flag.mt { height: 14px; background-position: -3468px 0px; } .iti-flag.mu { height: 14px; background-position: -3490px 0px; } .iti-flag.mv { height: 14px; background-position: -3512px 0px; } .iti-flag.mw { height: 14px; background-position: -3534px 0px; } .iti-flag.mx { height: 12px; background-position: -3556px 0px; } .iti-flag.my { height: 10px; background-position: -3578px 0px; } .iti-flag.mz { height: 14px; background-position: -3600px 0px; } .iti-flag.na { height: 14px; background-position: -3622px 0px; } .iti-flag.nc { height: 10px; background-position: -3644px 0px; } .iti-flag.ne { height: 15px; background-position: -3666px 0px; } .iti-flag.nf { height: 10px; background-position: -3686px 0px; } .iti-flag.ng { height: 10px; background-position: -3708px 0px; } .iti-flag.ni { height: 12px; background-position: -3730px 0px; } .iti-flag.nl { height: 14px; background-position: -3752px 0px; } .iti-flag.no { height: 15px; background-position: -3774px 0px; } .iti-flag.np { height: 15px; background-position: -3796px 0px; } .iti-flag.nr { height: 10px; background-position: -3811px 0px; } .iti-flag.nu { height: 10px; background-position: -3833px 0px; } .iti-flag.nz { height: 10px; background-position: -3855px 0px; } .iti-flag.om { height: 10px; background-position: -3877px 0px; } .iti-flag.pa { height: 14px; background-position: -3899px 0px; } .iti-flag.pe { height: 14px; background-position: -3921px 0px; } .iti-flag.pf { height: 14px; background-position: -3943px 0px; } .iti-flag.pg { height: 15px; background-position: -3965px 0px; } .iti-flag.ph { height: 10px; background-position: -3987px 0px; } .iti-flag.pk { height: 14px; background-position: -4009px 0px; } .iti-flag.pl { height: 13px; background-position: -4031px 0px; } .iti-flag.pm { height: 14px; background-position: -4053px 0px; } .iti-flag.pn { height: 10px; background-position: -4075px 0px; } .iti-flag.pr { height: 14px; background-position: -4097px 0px; } .iti-flag.ps { height: 10px; background-position: -4119px 0px; } .iti-flag.pt { height: 14px; background-position: -4141px 0px; } .iti-flag.pw { height: 13px; background-position: -4163px 0px; } .iti-flag.py { height: 11px; background-position: -4185px 0px; } .iti-flag.qa { height: 8px; background-position: -4207px 0px; } .iti-flag.re { height: 14px; background-position: -4229px 0px; } .iti-flag.ro { height: 14px; background-position: -4251px 0px; } .iti-flag.rs { height: 14px; background-position: -4273px 0px; } .iti-flag.ru { height: 14px; background-position: -4295px 0px; } .iti-flag.rw { height: 14px; background-position: -4317px 0px; } .iti-flag.sa { height: 14px; background-position: -4339px 0px; } .iti-flag.sb { height: 10px; background-position: -4361px 0px; } .iti-flag.sc { height: 10px; background-position: -4383px 0px; } .iti-flag.sd { height: 10px; background-position: -4405px 0px; } .iti-flag.se { height: 13px; background-position: -4427px 0px; } .iti-flag.sg { height: 14px; background-position: -4449px 0px; } .iti-flag.sh { height: 10px; background-position: -4471px 0px; } .iti-flag.si { height: 10px; background-position: -4493px 0px; } .iti-flag.sj { height: 15px; background-position: -4515px 0px; } .iti-flag.sk { height: 14px; background-position: -4537px 0px; } .iti-flag.sl { height: 14px; background-position: -4559px 0px; } .iti-flag.sm { height: 15px; background-position: -4581px 0px; } .iti-flag.sn { height: 14px; background-position: -4603px 0px; } .iti-flag.so { height: 14px; background-position: -4625px 0px; } .iti-flag.sr { height: 14px; background-position: -4647px 0px; } .iti-flag.ss { height: 10px; background-position: -4669px 0px; } .iti-flag.st { height: 10px; background-position: -4691px 0px; } .iti-flag.sv { height: 12px; background-position: -4713px 0px; } .iti-flag.sx { height: 14px; background-position: -4735px 0px; } .iti-flag.sy { height: 14px; background-position: -4757px 0px; } .iti-flag.sz { height: 14px; background-position: -4779px 0px; } .iti-flag.ta { height: 10px; background-position: -4801px 0px; } .iti-flag.tc { height: 10px; background-position: -4823px 0px; } .iti-flag.td { height: 14px; background-position: -4845px 0px; } .iti-flag.tf { height: 14px; background-position: -4867px 0px; } .iti-flag.tg { height: 13px; background-position: -4889px 0px; } .iti-flag.th { height: 14px; background-position: -4911px 0px; } .iti-flag.tj { height: 10px; background-position: -4933px 0px; } .iti-flag.tk { height: 10px; background-position: -4955px 0px; } .iti-flag.tl { height: 10px; background-position: -4977px 0px; } .iti-flag.tm { height: 14px; background-position: -4999px 0px; } .iti-flag.tn { height: 14px; background-position: -5021px 0px; } .iti-flag.to { height: 10px; background-position: -5043px 0px; } .iti-flag.tr { height: 14px; background-position: -5065px 0px; } .iti-flag.tt { height: 12px; background-position: -5087px 0px; } .iti-flag.tv { height: 10px; background-position: -5109px 0px; } .iti-flag.tw { height: 14px; background-position: -5131px 0px; } .iti-flag.tz { height: 14px; background-position: -5153px 0px; } .iti-flag.ua { height: 14px; background-position: -5175px 0px; } .iti-flag.ug { height: 14px; background-position: -5197px 0px; } .iti-flag.um { height: 11px; background-position: -5219px 0px; } .iti-flag.us { height: 11px; background-position: -5241px 0px; } .iti-flag.uy { height: 14px; background-position: -5263px 0px; } .iti-flag.uz { height: 10px; background-position: -5285px 0px; } .iti-flag.va { height: 15px; background-position: -5307px 0px; } .iti-flag.vc { height: 14px; background-position: -5324px 0px; } .iti-flag.ve { height: 14px; background-position: -5346px 0px; } .iti-flag.vg { height: 10px; background-position: -5368px 0px; } .iti-flag.vi { height: 14px; background-position: -5390px 0px; } .iti-flag.vn { height: 14px; background-position: -5412px 0px; } .iti-flag.vu { height: 12px; background-position: -5434px 0px; } .iti-flag.wf { height: 14px; background-position: -5456px 0px; } .iti-flag.ws { height: 10px; background-position: -5478px 0px; } .iti-flag.xk { height: 15px; background-position: -5500px 0px; } .iti-flag.ye { height: 14px; background-position: -5522px 0px; } .iti-flag.yt { height: 14px; background-position: -5544px 0px; } .iti-flag.za { height: 14px; background-position: -5566px 0px; } .iti-flag.zm { height: 14px; background-position: -5588px 0px; } .iti-flag.zw { height: 10px; background-position: -5610px 0px; } .iti-flag { width: 20px; height: 15px; box-shadow: 0px 0px 1px 0px #888; background-image: url("../img/flags.png"); background-repeat: no-repeat; background-color: #DBDBDB; background-position: 20px 0; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .iti-flag { background-image: url("../img/flags@2x.png"); } } .iti-flag.np { background-color: transparent; } </style> <!--<link async rel="stylesheet" href="assets/css/style.css" crossorigin="anonymous">--> <style> /*------------------------- Simple reset --------------------------*/ *{ margin:0; padding:0; } /*------------------------- General Styles --------------------------*/ html{ background-color:#eaf0f2; } body{ font:14px/1.4 'Arial', 'Helvetica', sans-serif; color: #5b6469; } a, a:visited { outline:none; color:#389dc1; } a:hover{ text-decoration:none; } section, footer, header, hgroup, aside{ display: block; } p{ margin-bottom:20px; } p:last-child{ margin-bottom: 0; } /*------------------------- The headings --------------------------*/ hgroup{ text-align: center; padding: 60px 0 48px; font-family: 'PT Serif', 'Cambria', serif; } hgroup h1{ color:#828e93; font-size:18px; font-weight: normal; } hgroup h2{ font-size:48px; } /*------------------------- The color buttons --------------------------*/ ul{ list-style:none; text-align:center; margin-bottom:48px; } ul li{ display: inline-block; margin: 0 8px; } ul li:hover{ opacity: 0.9; } ul li a{ color:#fff !important; text-decoration: none !important; font-size:15px; font-weight: bold; display: inline-block; padding:6px 14px; border-radius:3px; box-shadow: 1px 1px 1px rgba(0,0,0,0.1); } ul li:nth-child(1) a{ background-color: #6bb9e1; } ul li:nth-child(2) a{ background-color: #ec7164; } ul li:nth-child(3) a{ background-color: #6ad3c3; } /*------------------------- The content section --------------------------*/ #content{ background-color: #FFF; border-radius: 4px; padding: 40px; margin: 0 auto; max-width: 600px; position: relative; margin: 0 auto 100px; } /*------------------------- Inline help tip --------------------------*/ .help-tip{ position: absolute; top: 18px; right: 18px; text-align: center; background-color: #BCDBEA; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; line-height: 26px; cursor: default; } .help-tip:before{ content:'?'; font-weight: bold; color:#fff; } .help-tip:hover p{ display:block; transform-origin: 100% 0%; -webkit-animation: fadeIn 0.3s ease-in-out; animation: fadeIn 0.3s ease-in-out; } .help-tip p{ display: none; text-align: left; background-color: #1E2021; padding: 20px; width: 300px; position: absolute; border-radius: 3px; box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); right: -4px; color: #FFF; font-size: 13px; line-height: 1.4; } .help-tip p:before{ position: absolute; content: ''; width:0; height: 0; border:6px solid transparent; border-bottom-color:#1E2021; right:10px; top:-12px; } .help-tip p:after{ width:100%; height:40px; content:''; position: absolute; top:-40px; left:0; } @-webkit-keyframes fadeIn { 0% { opacity:0; transform: scale(0.6); } 100% { opacity:100%; transform: scale(1); } } @keyframes fadeIn { 0% { opacity:0; } 100% { opacity:100%; } } /*---------------------------- The Demo Footer -----------------------------*/ footer{ width: 770px; font: normal 16px Arial, Helvetica, sans-serif; padding: 15px 35px; position: fixed; bottom: 0; left: 50%; margin-left: -420px; background-color:#1f1f1f; background-image:linear-gradient(to bottom, #1f1f1f, #101010); border-radius:2px 2px 0 0; box-shadow: 0 -1px 4px rgba(0,0,0,0.4); z-index:1; } footer a.tz{ font-weight:normal; font-size:16px !important; text-decoration:none !important; display:block; margin-right: 300px; text-overflow:ellipsis; white-space: nowrap; color:#bfbfbf !important; z-index:1; } footer a.tz:before{ content: ''; background: url('http://cdn.tutorialzine.com/misc/enhance/v2_footer_bg.png') no-repeat 0 -53px; width: 138px; height: 20px; display: inline-block; position: relative; bottom: -3px; } footer .close{ position: absolute; cursor: pointer; width: 8px; height: 8px; background: url('http://cdn.tutorialzine.com/misc/enhance/v2_footer_bg.png') no-repeat 0 0px; top:10px; right:10px; z-index: 3; } footer #tzine-actions{ position: absolute; top: 8px; width: 500px; right: 50%; margin-right: -650px; text-align: right; z-index: 2; } footer #tzine-actions iframe{ display: inline-block; height: 21px; width: 95px; position: relative; float: left; margin-top: 11px; } @media (max-width: 1024px) { #bsaHolder, footer{ display:none;} } </style> <?php if($_GET['account']==1){echo "<link rel='stylesheet' href='../assets/css/jquery-ui.min.css' type='text/css' /> <link rel='stylesheet' href='https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css'>";}?> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> <style> #map { height:300px; } body{ background-color: #ffffff; } .iti-flag {background-image: url("../assets/flags.png");} .intl-tel-input{width: 100%;} @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .iti-flag {background-image: url("../assets/flags@2x.png");} } .intl-tel-input { display: table-cell; width: 100%; } .intl-tel-input .flag-container { z-index: 4; } .input-group .intl-tel-input .form-control { border-top-left-radius: 4px; border-top-right-radius: 0; border-bottom-left-radius: 4px; border-bottom-right-radius: 0; } .help-tip{ top: 0; } .help-tip:hover p{ z-index: 2; } .booking { display:none; } .lat_error_pickup, .lat2_error_pickup, .lat3_error_pickup, .lat4_error_pickup { display:none; color:#a94442; margin-bottom: 0px; margin-top: -5px; } .quotehidden { display: none; } .phone_error { display:none; color:#a94442; margin-bottom: 2px; margin-top: 5px; } .flight_time, .return_flight_time { display:none; color:#000000; margin-bottom: 1px; margin-top: 1px; } .invalidcc { display:none; color:#a94442; margin-bottom: 10px; margin-top: 5px; } .accountName { display:none; } .btn { background: #f26f18; padding-top:5px; padding-bottom:5px; } .btn-primary.active{ background: #000080; } .orangeButton:focus { background: #000080; } .btn-primary.active{ background: #000080; } .btn-primary.active:hover{ background: #000080; } .btn-primary.active:focus{ background: #000080; } .btn-success.active:focus{ background: #000080; } .btn:hover{ background: #000080; } .btn:focus{ background: #000080; } .blueButton { background: #000080; padding-top:5px; padding-bottom:5px; } .buttonText { //display: block; min-height: 20px; //background: #f26f18 ; color:#fff; font-weight:bold; } .ui-autocomplete{ z-index:50; background-color:#FFFFFF; } ul.ui-autocomplete li.ui-menu-item{text-align:left;} @media (max-width:980px) { .small-pad-top{padding-top:5px;} } @media (max-width: 768px) { .orangeButton{min-height: 30px; padding-top:2px; padding-bottom:2px;} .buttonText{font-size:11px; font-weight: normal; min-height: 15px;} } .bgloader { display: none; position: fixed; width: 100%; height: 100%; background-color:#f26f18; opacity : 0.4; z-index: 100; } .loader { display: none; position: fixed; left: 50%; top: 50%; z-index: 101; margin: -60px 0 0 -60px; border: 16px solid #f3f3f3; /* Light grey */ border-top: 16px solid #000080; /* Blue */ border-radius: 50%; width: 120px; height: 120px; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } /* The Modal (background) */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 100; /* Sit on top */ padding-top: 100px; /* Location of the box */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ } /* Modal Content */ .modal-content { background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888; width: 80%; } /* The Close Button */ .close { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; } .error-class { color:red; z-index:0; position:relative; display:block; text-align: left; } </style> <script type="text/javascript"> function setDecimal(input) { input.value = parseFloat(input.value).toFixed(2); } </script> </head> <body> <div class="loader"></div> <div class="bgloader"></div> <div id="myModal" class="modal"> <!-- Modal content --> <div class="modal-content"> <span class="close">×</span> <span id="modal-body"></span> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-xs-12 "> </div> </div> </div> <div class="container"> <form role="search" id="form1" onSubmit="myButton.disabled = true; $('#buttontext').text('Processing...'); return false;" method="POST" action="thankyou.php" data-eway-encrypt-key="<?=$client_key?>"> <input type="hidden" name="hidden_ref" value="<?=$invoice_ref?>"> <input type="hidden" id="job_city" name="job_city" value="perth"> <input type="hidden" id="lat1_value" name="lat1_value" value="" required data-validation="required"> <input type="hidden" id="lat2_value" name="lat2_value" value="" required data-validation="required"> <input type="hidden" id="lng1_value" name="lng1_value" value="" required data-validation="required"> <input type="hidden" id="lng2_value" name="lng2_value" value="" required data-validation="required"> <input type="hidden" id="lat3_value" name="lat3_value" value="" > <input type="hidden" id="lat4_value" name="lat4_value" value="" > <input type="hidden" id="lng3_value" name="lng3_value" value="" > <input type="hidden" id="lng4_value" name="lng4_value" value="" > <input type="hidden" id="account" name="account" value="<?=$_GET['account']?>"> <input type="hidden" id="km_est" name="km_est" value=""> <input type="hidden" id="time_est" name="time_est" value=""> <input type="hidden" id="return_km_est" name="return_km_est" value=""> <input type="hidden" id="return_time_est" name="return_time_est" value=""> <input type="hidden" id="onewayPrice" name="onewayPrice" value=""> <input type="hidden" id="returnPrice" name="returnPrice" value=""> <input type="hidden" id="promoCode" name="promoCode" value=""> <input type="hidden" id="promoValue" name="promoValue" value=""> <input type="hidden" id="intphone" name="intphone" value=""> <input type="hidden" id="admin" name="admin" value="<?=$_GET['admin']?>"> <input type="hidden" id="tollAmount" name="tollAmount" value="0"> <input type="hidden" id="tollDescription" name="tollDescription" value=""> <input type="hidden" id="returnTollAmount" name="returntollAmount" value="0"> <input type="hidden" id="returnTollDescription" name="returntollDescription" value=""> <div class="row quotehidden"> <div id="bookingType" class="btn-group col-xs-12 col-md-6" style="padding-bottom:10px;" data-toggle="buttons"> <label class="col-xs-6 col-md-3 btn btn-primary active"> <input type="radio" name="quoteType" id="quote" value="quote" autocomplete="off" checked>Quote </label> <label class="col-xs-6 col-md-3 btn btn-primary"> <input type="radio" name="quoteType" id="booking" value="booking" autocomplete="off">Booking </label> </div> </div> <div class="row"> <div id="journey" class="btn-group col-xs-12 col-md-6" style="margin-top: 10px; padding-bottom:10px;" data-toggle="buttons"> <label class="col-xs-6 col-md-3 btn btn-primary active"> <input type="radio" name="journeyType" id="oneway" value="oneway" autocomplete="off" checked>One Way </label> <label class="col-xs-6 col-md-3 btn btn-primary"> <input type="radio" name="journeyType" id="return" value="return" autocomplete="off">Return </label> </div> </div> <div class="row booking"> <div class="col-xs-6 col-md-3 no-padding newName"> <input type="text" required data-validation="required" class="form-control" placeholder="First Name" name="First_Name" id="First_Name"> </div> <div class="col-xs-6 col-md-3 no-padding newName"> <input type="text" required data-validation="required" class="form-control" placeholder="Last Name" name="Last_Name" id="Last_Name"> </div> </div> <div class="row"> <div class="col-xs-12 col-md-6 no-padding accountName"> <div class="form-group"> <div class="input-group"> <input type="text" data-validation="required" class="form-control" placeholder="Name" name="name" id="name"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> </div> </div> </div> </div> <div class="row booking" style="margin-top: 10px"> <div class="col-xs-12 col-md-6 no-padding"> <div class="form-group"> <div class="input-group"> <input type="tel" class="form-control" placeholder="Mobile Number" name="phone" id="phone"> <span class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span> </div></div> <div class="phone_error">Invalid phone number format</div> </div> </div> <div class="row booking" style="margin-top: 10px"> <div class="col-xs-12 col-md-6"> <div class="input-group"> <input type="email" class="form-control" name="email" id="email" placeholder="Email (optional)"> <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span> </div> </div> </div> <div class="row" style="margin-top: 10px"> <h4 style="margin-left:15px;">Pick Up Details</h4> </div> <div class="row" style="margin-top: 10px;"> <div class="btn-group col-xs-12 col-md-6" id="type1" data-toggle="buttons"> <label class="col-xs-6 col-md-3 btn btn-primary active"> <input type="radio" name="pickupType" id="search1" value="search1" autocomplete="off" checked>Search </label> <label class="col-xs-6 col-md-3 btn btn-primary"> <input type="radio" name="pickupType" id="airport1" value="airport1" autocomplete="off">Airport </label> </div> </div> <div class="row" style="margin-top: 10px;"> <span id="terminalsRow1"></span> </div> <div class="row" style="margin-top: 5px;"> <div id="searchDiv1" class="col-xs-12 col-md-6" > <div class="form-group"> <div class="input-group"> <input type="text" id="pickup" name="pickup" autocomplete="off" required class="form-control" placeholder="Pickup Address"> <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span> </div> <div class="lat_error_pickup col-xs-12 col-md-6"><br>Please select address from Google</div> </div> </div> </div> <div class="row" style="margin-top: 10px;"> <div class="btn-group col-xs-12 col-md-6" id="type2" data-toggle="buttons"> <label class="col-xs-6 col-md-3 btn btn-primary active"> <input type="radio" name="dropoffType" id="search2" value="search2" autocomplete="off" checked>Search </label> <label class="col-xs-6 col-md-3 btn btn-primary"> <input type="radio" name="dropoffType" id="airport2" value="airport2" autocomplete="off">Airport </label> </div> </div> <div class="row" style="margin-top: 10px;"> <span id="terminalsRow2"></span> </div> <div class="row" > <div id="searchDiv2" class="col-xs-12 col-md-6" > <div class="form-group"> <div class="input-group"> <input type="text" id="dropoff" name="dropoff" autocomplete="off" required class="form-control" placeholder="Drop off Address"> <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span> </div> </div> <div class="lat2_error_pickup"><br>Please select address from Google</div> </div> </div> <div class="row booking" style="margin-top: 10px"> <div class="col-xs-6 col-md-3"> <div class="form-group"> <div class='input-group date' id="date-group"> <input type="text" required class="form-control" name="date" id="date" placeholder="Date" autocomplete="off"> <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span> </div> </div> <div class="flight_time">  Flight Arrival Date</div> </div> <div class="col-xs-6 col-md-3"> <div class="form-group"> <div class="input-group bootstrap-timepicker timepicker"> <input id="time" type="text" name="time" required class="form-control input-small"> <span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span> </div> </div> <div class="flight_time">  Flight Arrival Time</div> </div> </div> <div class="pickup_div_t" style="margin-top: 0px;display:none;"> <div class="row"> <div class="col-xs-12 col-md-12 col-lg-12" style="margin-top:5px; margin-left:5px;" > We will track your flight number an adjust your pick up time accordingly.<br> Please select time for pickup after your flight arrives:  <br> (usually 20-30 mins for domestic, 45-60 mins for international)<br> </div> </div> <div class="row" style="margin-top:10px"> <div class="col-xs-12 col-md-3 col-lg-3 small-pad-top" > <div class="form-group"> <label for="pickup_time">Time after landing</label> <select class="form-control" id="pickup_time" name="pickup_time"> <option value="" selected hidden>Please select</option> <!--<option value="20">20 mins</option>--> <option value="30">30 mins</option> <option value="45">45 mins</option> <option value="60">60 mins</option> <option value="75">75 mins</option> </select> </div> </div> <div class="col-xs-12 col-md-3 col-lg-3 small-pad-top" > <div class="form-group"> <label for="flight_number">Flight Number</label> <div class="input-group"> <input type="text" id="flight_number" name="flight_number" value="N/A" autocomplete="off" class="form-control" placeholder="Flight Number"><span class="input-group-addon"><i class="glyphicon glyphicon-plane"></i></span> </div></div> </div> </div> </div> <div class="return_rows" style="display:none;"> <div class="row" style="margin-top: 10px"> <h4 style="margin-left:15px;">Return Details</h4> </div> <div class="row" style="margin-top: 10px;"> <div class="btn-group col-xs-12 col-md-6" id="type3" data-toggle="buttons"> <label class="col-xs-6 col-md-3 btn btn-primary active"> <input type="radio" name="returnPickupType" id="search3" value="search3" autocomplete="off" checked>Search </label> <label class="col-xs-6 col-md-3 btn btn-primary"> <input type="radio" name="returnPickupType" id="airport3" value="airport3" autocomplete="off">Airport </label> </div> </div> <div class="row" style="margin-top: 5px;"> <span id="terminalsRow3"></span> </div> <div class="row" style="padding-top: 5px;"> <div id="searchDiv3" class="col-xs-12 col-md-6" > <div class="form-group"><div class="input-group"><input type="text" id="return_pickup" name="return_pickup" autocomplete="off" class="form-control" placeholder="Return Pickup Address"><span class="input-group-addon glyphicon glyphicon-map-marker"></span> </div><div class="lat3_error_pickup"><br>Please select address from Google</div> </div></div> </div> <div class="row" style="margin-top: 10px;"> <div class="btn-group col-xs-12 col-md-6" id="type4" data-toggle="buttons"> <label class="col-xs-6 col-md-3 btn btn-primary active"> <input type="radio" name="returnDropoffType" id="search4" value="search4" autocomplete="off" checked>Search </label> <label class="col-xs-6 col-md-3 btn btn-primary"> <input type="radio" name="returnDropoffType" id="airport4" value="airport4" autocomplete="off">Airport </label> </div> </div> <div class="row" style="margin-top: 5px;"> <span id="terminalsRow4"></span> </div> <div class="row" style="margin-top: 5px;"> <div id="searchDiv4" class="col-xs-12 col-md-6"> <div class="form-group"><div class="input-group"><input type="text" id="return_dropoff" name="return_dropoff" autocomplete="off" class="form-control" placeholder="Drop off Address"><span class="input-group-addon glyphicon glyphicon-map-marker"></span> </div><div class="lat4_error_pickup"><br>Please select address from Google</div> </div></div> </div> <div class="row booking" style="margin-top: 10px"> <div class="col-xs-6 col-md-3"> <div class="form-group"> <div class='input-group date'> <input type="text" required class="datepicker form-control" name="return_date" id="return_date" placeholder="Return Date"> <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span> </div> </div> <div class="return_flight_time">  Flight Arrival Date</div> </div> <div class="col-xs-6 col-md-3"> <div class="form-group"> <div class="input-group bootstrap-timepicker timepicker"> <input id="return_time" type="text" name="return_time" required class="form-control input-small"> <span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span> </div> </div> <div class="return_flight_time">  Flight Arrival Time</div> </div> </div> <div class="return_pickup_div_t" style="margin-top: 0px;display:none;"> <div class="row"> <div class="col-xs-12 col-md-12 col-lg-12" style="margin-top:5px; margin-left:5px;" > We will track your flight number an adjust your pick up time accordingly.<br> Please select time for pickup after your flight arrives:  <br> (usually 20-30 mins for domestic, 45-60 mins for international)<br> </div> </div> <div class="row" style="margin-top:10px"> <div class="col-xs-12 col-md-3 col-lg-3 small-pad-top" > <div class="form-group"> <label for="pickup_time">Time after landing</label> <select class="form-control" id="return_pickup_time" name="return_pickup_time"> <option value="" selected hidden>Please select</option> <!--<option value="20">20 mins</option>--> <option value="30">30 mins</option> <option value="45">45 mins</option> <option value="60">60 mins</option> <option value="75">75 mins</option> </select> </div> </div> <div class="col-xs-12 col-md-3 col-lg-3 small-pad-top" > <div class="form-group"> <label for="flight_number">Flight Number</label> <div class="input-group"> <input type="text" id="return_flight_number" name="return_flight_number" value="N/A" autocomplete="off" class="form-control" placeholder="Flight Number"><span class="input-group-addon"><i class="glyphicon glyphicon-plane"></i></span> </div></div> </div> </div> </div> </div> <div class="other_rows"> <div class="row" style="margin-top: 10px"> <h4 style="margin-left:15px;">Passenger Details</h4> </div> <div class="row" > <div class="col-xs-12 col-md-6"> <div class="row" style="margin-top: 10px"> <div class="col-xs-10 col-md-10"> Total Number of Passengers including Children <br> </div> <div class="col-xs-2 col-md-1"> <select id="passenger_count" name="passenger_count"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> </select> </div> </div> <div class="row" style="margin-top: 10px"> <div class="col-xs-10 col-md-10"> Number of children requiring rearward facing car seats / capsule <span class="help-tip"><p>Rearward Facing child seats are a legal requirement in Western Australia between birth and 6 months. Our rearward facing seats can be used up to 36 months.</p></span><br></div> <div class="col-xs-2 col-md-1"> <select id="car_seat" name="car_seat"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </div></div> <div class="row" style="margin-top: 10px"> <div class="col-xs-10 col-md-10"> Number of children requiring forward facing car seats <span class="help-tip"><p>Forward Facing child seats are a legal requirement in Western Australia between 6 months and 4 years. Our forward facing seats can be used up to 8 years.</p></span><br></div> <div class="col-xs-2 col-md-1"> <select id="ff_count" name="ff_count"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </div></div> <div class="row" style="margin-top: 10px"> <div class="col-xs-10 col-md-10"> Number of children requiring booster seats <span class="help-tip"><p>Booster seats are the minimun legal requirement between 4-7 years. Our forward facing seats can be used up to 8 years but if your child is used to having a booster seat you can select this option.</p></span><br></div> <div class="col-xs-2 col-md-1"> <select id="booster_count" name="booster_count"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> </select> </div></div> </div></div> <div class="row booking" style="margin-top: 10px"> <div class="col-xs-12 col-md-6"> Describe your luggage<br><textarea placeholder="eg: 3 large suitcases and 2 carry on / 2 large suitcases and a pram" style="width:100%;height:70px;" name="luggage" id="luggage" class="form-control"></textarea> </div></div> </div> <div class="row booking" style="margin-top: 10px"> <h4 style="margin-left:15px;">Payment Details</h4> </div> <div class="newName booking"> <div class="row" style="margin-top: 10px"> <div class="col-xs-12 col-md-6"> <div class="input-group"> <input type="tel" required class=" form-control" id="card" placeholder="Credit Card Number" maxlength="20" autocomplete="off" name="card" maxlength="20" onblur=" cc_number_saved = this.value; this.value = this.value.replace(/[^\d]/g, ''); if(!checkLuhn(this.value)) { this.placeholder='Invalid Credit Card Number'; this.style='background:#FF0000'; this.value = ''; } else { this.placeholder='Credit Card Number'; this.style='background:#FFFFFF'; var card_no = document.getElementById('EWAY_CARDNUMBER'); var card_string = this.value.replace(' ', ''); card_no.value = card_string; } " onfocus=" // restore saved string if(this.value != cc_number_saved) this.value = cc_number_saved;"> <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span> </div> <input type="hidden" required class=" form-control" id="EWAY_CARDNUMBER" placeholder="Credit Card Number" maxlength="20" autocomplete="off" name="EWAY_CARDNUMBER" data-eway-encrypt-name="EWAY_CARDNUMBER" maxlength="20"> <div class="invalidcc">Invalid Card Number</div></div></div> <div class="row" style="margin-top: 10px"> <div class="col-xs-5 col-md-2"> <input class="form-control" type="tel" required id="cvn" placeholder="CVC" maxlength="4" autocomplete="off" name="cvn" data-eway-encrypt-name="cvn" onblur="var card_cvn = document.getElementById('EWAY_CARDCVN'); card_cvn.value = this.value;"> <input class="form-control" type="hidden" required id="EWAY_CARDCVN" placeholder="CVC" maxlength="4" autocomplete="off" name="EWAY_CARDCVN" data-eway-encrypt-name="EWAY_CARDCVN"> </div> <div class="col-xs-7 col-md-4" style="margin-top: 5px"> <span id="dd" class="pull-right" > <select id="EWAY_CARDEXPIRYMONTH" name="EWAY_CARDEXPIRYMONTH"> <option value="" selected hidden>Month</option> <option value="01">Jan</option> <option value="02">Feb</option> <option value="03">Mar</option> <option value="04">Apr</option> <option value="05">May</option> <option value="06">Jun</option> <option value="07">Jul</option> <option value="08">Aug</option> <option value="09">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select id="EWAY_CARDEXPIRYYEAR" name="EWAY_CARDEXPIRYYEAR"> <option value="" selected hidden>Year</option> <option value="26">2026</option> <option value="27">2027</option> <option value="28">2028</option> <option value="29">2029</option> <option value="30">2030</option> <option value="31">2031</option> <option value="32">2032</option> <option value="33">2033</option> <option value="34">2034</option> </select> </span> </div> </div> </div> <div class="row" style="margin-top: 10px"> <div class="col-xs-12 col-md-6 accountName"> <input type="text" id="token" name="token" autocomplete="off" class="form-control" placeholder="Token"> </div> </div> <div class="row" style="margin-top: 10px"> <div class="col-xs-6 col-md-3"> <h4 >Quote </h4> </div> <div class="col-xs-6 col-md-3 no-padding"> </div> </div> <div class="row" style="margin-top: 10px"> <div class="col-xs-12 col-md-6"> <h5><span id="tripdesc">One Way</span>: $<span id="totalPrice"><strong>0</strong></span></h5> <span id="onewayAdd" style="display:none;"></span> <div class="return_rows" style="display:none;"><h5 >Return Journey: $<span id="totalPrice2"><strong>0</strong></span></h5> <div id="returnAdd" style="display:none;"></div> <h5 >Total (First + Return): $<span id="totalPrice3"><strong>0</strong></span></h5></div> <span id="sydneySpan" style="font-size:12px; display:none;">This fare has an additional $1.10 levy</span> <button style="margin-top: 10px" type="button" onclick="return false;" name="quoteButton" class="btn btn-primary btn-block" id="quoteButton"><span id="quoteButtonText" >Get Quote</span></button> </div> <div class="col-xs-6 col-md-3 no-padding" style="display:none"> <input type="text" class="form-control col-xs-3 col-md-2" placeholder="Promo Code" name="promo_code" id="promo_code"> <br> <button type="button" onclick="return false;" name="promoButton" style="background: #FFFFFF;padding-top:5px; padding-bottom:5px;" class="btn-block" id="promoButton"><span id="promoText" style="display: block; color: #000000;">Check</span></button> </div> </div> <div class="row" style="margin-top: 10px"> <div class="col-xs-12 col-md-6 "> <button type="button" data-toggle="button" aria-pressed="false" name="myButton" class="btn btn-primary btn-block" id="myButton"><span id="buttontext">Make Booking</span></button> </div> </div> <div class="row" style="margin-top: 10px"> <div class="col-xs-12 col-md-6"> <div id="map"></div> </div> </div> </form> <script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"></script> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script type="text/javascript" src="https://desidrivers.com.au/assets/js/bootstrap.min.js"></script> <!-- Bootstrap Date-Picker Plugin --> <? if($_GET['account']==1){echo "<script type='text/javascript' src='assets/jquery-ui.js'></script>";}?> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/> <link type="text/css" href="https://desidrivers.com.au/family/assets/css/bootstrap-timepicker.min.css" /> <script type="text/javascript" src="https://desidrivers.com.au/family/assets/js/bootstrap-timepicker.min.js"></script> <!--<script type="text/javascript" src="https://desidrivers.com.au/family/assets/intlTelInput.js"></script>--> <script type="text/javascript"> /* * International Telephone Input v12.1.15 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ // wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js (function(factory) { if (typeof define === "function" && define.amd) { define([ "jquery" ], function($) { factory($, window, document); }); } else if (typeof module === "object" && module.exports) { module.exports = factory(require("jquery"), window, document); } else { factory(jQuery, window, document); } })(function($, window, document, undefined) { "use strict"; // these vars persist through all instances of the plugin var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling defaults = { // whether or not to allow the dropdown allowDropdown: true, // if there is just a dial code in the input: remove it on blur, and re-add it on focus autoHideDialCode: true, // add a placeholder in the input with an example number for the selected country autoPlaceholder: "polite", // modify the auto placeholder customPlaceholder: null, // append menu to a specific element dropdownContainer: "", // don't display these countries excludeCountries: [], // format the input value during initialisation and on setNumber formatOnDisplay: true, // geoIp lookup function geoIpLookup: null, // inject a hidden input with this name, and on submit, populate it with the result of getNumber hiddenInput: "", // initial country initialCountry: "", // don't insert international dial codes nationalMode: true, // display only these countries onlyCountries: [], // number type to use for placeholders placeholderNumberType: "MOBILE", // the countries at the top of the list. defaults to united states and united kingdom preferredCountries: [ "us", "gb" ], // display the country dial code next to the selected flag so it's not part of the typed number separateDialCode: false, // specify the path to the libphonenumber script to enable validation/formatting utilsScript: "" }, keys = { UP: 38, DOWN: 40, ENTER: 13, ESC: 27, PLUS: 43, A: 65, Z: 90, SPACE: 32, TAB: 9 }, // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ]; // keep track of if the window.load event has fired as impossible to check after the fact $(window).on("load", function() { // UPDATE: use a public static field so we can fudge it in the tests $.fn[pluginName].windowLoaded = true; }); function Plugin(element, options) { this.telInput = $(element); this.options = $.extend({}, defaults, options); // event namespace this.ns = "." + pluginName + id++; // Chrome, FF, Safari, IE9+ this.isGoodBrowser = Boolean(element.setSelectionRange); this.hadInitialPlaceholder = Boolean($(element).attr("placeholder")); } Plugin.prototype = { _init: function() { // if in nationalMode, disable options relating to dial codes if (this.options.nationalMode) { this.options.autoHideDialCode = false; } // if separateDialCode then doesn't make sense to A) insert dial code into input (autoHideDialCode), and B) display national numbers (because we're displaying the country dial code next to them) if (this.options.separateDialCode) { this.options.autoHideDialCode = this.options.nationalMode = false; } // we cannot just test screen size as some smartphones/website meta tags will report desktop resolutions // Note: for some reason jasmine breaks if you put this in the main Plugin function with the rest of these declarations // Note: to target Android Mobiles (and not Tablets), we must find "Android" and "Mobile" this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); if (this.isMobile) { // trigger the mobile dropdown css $("body").addClass("iti-mobile"); // on mobile, we want a full screen dropdown, so we must append it to the body if (!this.options.dropdownContainer) { this.options.dropdownContainer = "body"; } } // we return these deferred objects from the _init() call so they can be watched, and then we resolve them when each specific request returns // Note: again, jasmine breaks when I put these in the Plugin function this.autoCountryDeferred = new $.Deferred(); this.utilsScriptDeferred = new $.Deferred(); // in various situations there could be no country selected initially, but we need to be able to assume this variable exists this.selectedCountryData = {}; // process all the data: onlyCountries, excludeCountries, preferredCountries etc this._processCountryData(); // generate the markup this._generateMarkup(); // set the initial state of the input value and the selected flag this._setInitialState(); // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click this._initListeners(); // utils script, and auto country this._initRequests(); // return the deferreds return [ this.autoCountryDeferred, this.utilsScriptDeferred ]; }, /******************** * PRIVATE METHODS ********************/ // prepare all of the country data, including onlyCountries, excludeCountries and preferredCountries options _processCountryData: function() { // process onlyCountries or excludeCountries array if present this._processAllCountries(); // process the countryCodes map this._processCountryCodes(); // process the preferredCountries this._processPreferredCountries(); }, // add a country code to this.countryCodes _addCountryCode: function(iso2, dialCode, priority) { if (!(dialCode in this.countryCodes)) { this.countryCodes[dialCode] = []; } var index = priority || 0; this.countryCodes[dialCode][index] = iso2; }, // process onlyCountries or excludeCountries array if present _processAllCountries: function() { if (this.options.onlyCountries.length) { var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) { return country.toLowerCase(); }); this.countries = allCountries.filter(function(country) { return lowerCaseOnlyCountries.indexOf(country.iso2) > -1; }); } else if (this.options.excludeCountries.length) { var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) { return country.toLowerCase(); }); this.countries = allCountries.filter(function(country) { return lowerCaseExcludeCountries.indexOf(country.iso2) === -1; }); } else { this.countries = allCountries; } }, // process the countryCodes map _processCountryCodes: function() { this.countryCodes = {}; for (var i = 0; i < this.countries.length; i++) { var c = this.countries[i]; this._addCountryCode(c.iso2, c.dialCode, c.priority); // area codes if (c.areaCodes) { for (var j = 0; j < c.areaCodes.length; j++) { // full dial code is country code + dial code this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]); } } } }, // process preferred countries - iterate through the preferences, fetching the country data for each one _processPreferredCountries: function() { this.preferredCountries = []; for (var i = 0; i < this.options.preferredCountries.length; i++) { var countryCode = this.options.preferredCountries[i].toLowerCase(), countryData = this._getCountryData(countryCode, false, true); if (countryData) { this.preferredCountries.push(countryData); } } }, // generate all of the markup for the plugin: the selected flag overlay, and the dropdown _generateMarkup: function() { // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can easily put the plugin in an inconsistent state e.g. the wrong flag selected for the autocompleted number, which on submit could mean the wrong number is saved (esp in nationalMode) this.telInput.attr("autocomplete", "off"); // containers (mostly for positioning) var parentClass = "intl-tel-input"; if (this.options.allowDropdown) { parentClass += " allow-dropdown"; } if (this.options.separateDialCode) { parentClass += " separate-dial-code"; } this.telInput.wrap($("<div>", { "class": parentClass })); this.flagsContainer = $("<div>", { "class": "flag-container" }).insertBefore(this.telInput); // currently selected flag (displayed to left of input) var selectedFlag = $("<div>", { "class": "selected-flag" }); selectedFlag.appendTo(this.flagsContainer); this.selectedFlagInner = $("<div>", { "class": "iti-flag" }).appendTo(selectedFlag); if (this.options.separateDialCode) { this.selectedDialCode = $("<div>", { "class": "selected-dial-code" }).appendTo(selectedFlag); } if (this.options.allowDropdown) { // make element focusable and tab naviagable selectedFlag.attr("tabindex", "0"); // CSS triangle $("<div>", { "class": "iti-arrow" }).appendTo(selectedFlag); // country dropdown: preferred countries, then divider, then all countries this.countryList = $("<ul>", { "class": "country-list hide" }); if (this.preferredCountries.length) { this._appendListItems(this.preferredCountries, "preferred"); $("<li>", { "class": "divider" }).appendTo(this.countryList); } this._appendListItems(this.countries, ""); // this is useful in lots of places this.countryListItems = this.countryList.children(".country"); // create dropdownContainer markup if (this.options.dropdownContainer) { this.dropdown = $("<div>", { "class": "intl-tel-input iti-container" }).append(this.countryList); } else { this.countryList.appendTo(this.flagsContainer); } } else { // a little hack so we don't break anything this.countryListItems = $(); } if (this.options.hiddenInput) { this.hiddenInput = $("<input>", { type: "hidden", name: this.options.hiddenInput }).insertBefore(this.telInput); } }, // add a country <li> to the countryList <ul> container _appendListItems: function(countries, className) { // we create so many DOM elements, it is faster to build a temp string // and then add everything to the DOM in one go at the end var tmp = ""; // for each country for (var i = 0; i < countries.length; i++) { var c = countries[i]; // open the list item tmp += "<li class='country " + className + "' data-dial-code='" + c.dialCode + "' data-country-code='" + c.iso2 + "'>"; // add the flag tmp += "<div class='flag-box'><div class='iti-flag " + c.iso2 + "'></div></div>"; // and the country name and dial code tmp += "<span class='country-name'>" + c.name + "</span>"; tmp += "<span class='dial-code'>+" + c.dialCode + "</span>"; // close the list item tmp += "</li>"; } this.countryList.append(tmp); }, // set the initial state of the input value and the selected flag by: // 1. extracting a dial code from the given number // 2. using explicit initialCountry // 3. picking the first preferred country // 4. picking the first country _setInitialState: function() { var val = this.telInput.val(); // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the flag, else fall back to the default country // UPDATE: actually we do want to set the flag for a regionlessNanp in one situation: if we're in nationalMode and there's no initialCountry - otherwise we lose the +1 and we're left with an invalid number if (this._getDialCode(val) && (!this._isRegionlessNanp(val) || this.options.nationalMode && !this.options.initialCountry)) { this._updateFlagFromNumber(val); } else if (this.options.initialCountry !== "auto") { // see if we should select a flag if (this.options.initialCountry) { this._setFlag(this.options.initialCountry.toLowerCase()); } else { // no dial code and no initialCountry, so default to first in list this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; if (!val) { this._setFlag(this.defaultCountry); } } // if empty and no nationalMode and no autoHideDialCode then insert the default dial code if (!val && !this.options.nationalMode && !this.options.autoHideDialCode && !this.options.separateDialCode) { this.telInput.val("+" + this.selectedCountryData.dialCode); } } // NOTE: if initialCountry is set to auto, that will be handled separately // format if (val) { // this wont be run after _updateDialCode as that's only called if no val this._updateValFromNumber(val); } }, // initialise the main event listeners: input keyup, and click selected flag _initListeners: function() { this._initKeyListeners(); if (this.options.autoHideDialCode) { this._initFocusListeners(); } if (this.options.allowDropdown) { this._initDropdownListeners(); } if (this.hiddenInput) { this._initHiddenInputListener(); } }, // update hidden input on form submit _initHiddenInputListener: function() { var that = this; var form = this.telInput.closest("form"); if (form.length) { form.submit(function() { that.hiddenInput.val(that.getNumber()); }); } }, // initialise the dropdown listeners _initDropdownListeners: function() { var that = this; // hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again var label = this.telInput.closest("label"); if (label.length) { label.on("click" + this.ns, function(e) { // if the dropdown is closed, then focus the input, else ignore the click if (that.countryList.hasClass("hide")) { that.telInput.focus(); } else { e.preventDefault(); } }); } // toggle country dropdown on click var selectedFlag = this.selectedFlagInner.parent(); selectedFlag.on("click" + this.ns, function(e) { // only intercept this event if we're opening the dropdown // else let it bubble up to the top ("click-off-to-close" listener) // we cannot just stopPropagation as it may be needed to close another instance if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) { that._showDropdown(); } }); // open dropdown list if currently focused this.flagsContainer.on("keydown" + that.ns, function(e) { var isDropdownHidden = that.countryList.hasClass("hide"); if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) { // prevent form from being submitted if "ENTER" was pressed e.preventDefault(); // prevent event from being handled again by document e.stopPropagation(); that._showDropdown(); } // allow navigation from dropdown to input on TAB if (e.which == keys.TAB) { that._closeDropdown(); } }); }, // init many requests: utils script / geo ip lookup _initRequests: function() { var that = this; // if the user has specified the path to the utils script, fetch it on window.load, else resolve if (this.options.utilsScript) { // if the plugin is being initialised after the window.load event has already been fired if ($.fn[pluginName].windowLoaded) { $.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred); } else { // wait until the load event so we don't block any other requests e.g. the flags image $(window).on("load", function() { $.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred); }); } } else { this.utilsScriptDeferred.resolve(); } if (this.options.initialCountry === "auto") { this._loadAutoCountry(); } else { this.autoCountryDeferred.resolve(); } }, // perform the geo ip lookup _loadAutoCountry: function() { var that = this; // 3 options: // 1) already loaded (we're done) // 2) not already started loading (start) // 3) already started loading (do nothing - just wait for loading callback to fire) if ($.fn[pluginName].autoCountry) { this.handleAutoCountry(); } else if (!$.fn[pluginName].startedLoadingAutoCountry) { // don't do this twice! $.fn[pluginName].startedLoadingAutoCountry = true; if (typeof this.options.geoIpLookup === "function") { this.options.geoIpLookup(function(countryCode) { $.fn[pluginName].autoCountry = countryCode.toLowerCase(); // tell all instances the auto country is ready // TODO: this should just be the current instances // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight away (e.g. if they have already done the geo ip lookup somewhere else). Using setTimeout means that the current thread of execution will finish before executing this, which allows the plugin to finish initialising. setTimeout(function() { $(".intl-tel-input input").intlTelInput("handleAutoCountry"); }); }); } } }, // initialize any key listeners _initKeyListeners: function() { var that = this; // update flag on keyup // (keep this listener separate otherwise the setTimeout breaks all the tests) this.telInput.on("keyup" + this.ns, function() { if (that._updateFlagFromNumber(that.telInput.val())) { that._triggerCountryChange(); } }); // update flag on cut/paste events (now supported in all major browsers) this.telInput.on("cut" + this.ns + " paste" + this.ns, function() { // hack because "paste" event is fired before input is updated setTimeout(function() { if (that._updateFlagFromNumber(that.telInput.val())) { that._triggerCountryChange(); } }); }); }, // adhere to the input's maxlength attr _cap: function(number) { var max = this.telInput.attr("maxlength"); return max && number.length > max ? number.substr(0, max) : number; }, // listen for mousedown, focus and blur _initFocusListeners: function() { var that = this; // mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click this.telInput.on("mousedown" + this.ns, function(e) { if (!that.telInput.is(":focus") && !that.telInput.val()) { e.preventDefault(); // but this also cancels the focus, so we must trigger that manually that.telInput.focus(); } }); // on focus: if empty, insert the dial code for the currently selected flag this.telInput.on("focus" + this.ns, function(e) { if (!that.telInput.val() && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) { // insert the dial code that.telInput.val("+" + that.selectedCountryData.dialCode); // after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one that.telInput.one("keypress.plus" + that.ns, function(e) { if (e.which == keys.PLUS) { that.telInput.val(""); } }); // after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that setTimeout(function() { var input = that.telInput[0]; if (that.isGoodBrowser) { var len = that.telInput.val().length; input.setSelectionRange(len, len); } }); } }); // on blur or form submit: if just a dial code then remove it var form = this.telInput.prop("form"); if (form) { $(form).on("submit" + this.ns, function() { that._removeEmptyDialCode(); }); } this.telInput.on("blur" + this.ns, function() { that._removeEmptyDialCode(); }); }, _removeEmptyDialCode: function() { var value = this.telInput.val(), startsPlus = value.charAt(0) == "+"; if (startsPlus) { var numeric = this._getNumeric(value); // if just a plus, or if just a dial code if (!numeric || this.selectedCountryData.dialCode == numeric) { this.telInput.val(""); } } // remove the keypress listener we added on focus this.telInput.off("keypress.plus" + this.ns); }, // extract the numeric digits from the given string _getNumeric: function(s) { return s.replace(/\D/g, ""); }, // show the dropdown _showDropdown: function() { this._setDropdownPosition(); // update highlighting and scroll to active list item var activeListItem = this.countryList.children(".active"); if (activeListItem.length) { this._highlightListItem(activeListItem); this._scrollTo(activeListItem); } // bind all the dropdown-related listeners: mouseover, click, click-off, keydown this._bindDropdownListeners(); // update the arrow this.selectedFlagInner.children(".iti-arrow").addClass("up"); this.telInput.trigger("open:countrydropdown"); }, // decide where to position dropdown (depends on position within viewport, and scroll) _setDropdownPosition: function() { var that = this; if (this.options.dropdownContainer) { this.dropdown.appendTo(this.options.dropdownContainer); } // show the menu and grab the dropdown height this.dropdownHeight = this.countryList.removeClass("hide").outerHeight(); if (!this.isMobile) { var pos = this.telInput.offset(), inputTop = pos.top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom) dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop; // by default, the dropdown will be below the input. If we want to position it above the input, we add the dropup class. this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove); // if dropdownContainer is enabled, calculate postion if (this.options.dropdownContainer) { // by default the dropdown will be directly over the input because it's not in the flow. If we want to position it below, we need to add some extra top value. var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight(); // calculate placement this.dropdown.css({ top: inputTop + extraTop, left: pos.left }); // close menu on window scroll $(window).on("scroll" + this.ns, function() { that._closeDropdown(); }); } } }, // we only bind dropdown listeners when the dropdown is open _bindDropdownListeners: function() { var that = this; // when mouse over a list item, just highlight that one // we add the class "highlight", so if they hit "enter" we know which one to select this.countryList.on("mouseover" + this.ns, ".country", function(e) { that._highlightListItem($(this)); }); // listen for country selection this.countryList.on("click" + this.ns, ".country", function(e) { that._selectListItem($(this)); }); // click off to close // (except when this initial opening click is bubbling up) // we cannot just stopPropagation as it may be needed to close another instance var isOpening = true; $("html").on("click" + this.ns, function(e) { if (!isOpening) { that._closeDropdown(); } isOpening = false; }); // listen for up/down scrolling, enter to select, or letters to jump to country name. // use keydown as keypress doesn't fire for non-char keys and we want to catch if they // just hit down and hold it to scroll down (no keyup event). // listen on the document because that's where key events are triggered if no input has focus var query = "", queryTimer = null; $(document).on("keydown" + this.ns, function(e) { // prevent down key from scrolling the whole page, // and enter key from submitting a form etc e.preventDefault(); if (e.which == keys.UP || e.which == keys.DOWN) { // up and down to navigate that._handleUpDownKey(e.which); } else if (e.which == keys.ENTER) { // enter to select that._handleEnterKey(); } else if (e.which == keys.ESC) { // esc to close that._closeDropdown(); } else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) { // upper case letters (note: keyup/keydown only return upper case letters) // jump to countries that start with the query string if (queryTimer) { clearTimeout(queryTimer); } query += String.fromCharCode(e.which); that._searchForCountry(query); // if the timer hits 1 second, reset the query queryTimer = setTimeout(function() { query = ""; }, 1e3); } }); }, // highlight the next/prev item in the list (and ensure it is visible) _handleUpDownKey: function(key) { var current = this.countryList.children(".highlight").first(); var next = key == keys.UP ? current.prev() : current.next(); if (next.length) { // skip the divider if (next.hasClass("divider")) { next = key == keys.UP ? next.prev() : next.next(); } this._highlightListItem(next); this._scrollTo(next); } }, // select the currently highlighted item _handleEnterKey: function() { var currentCountry = this.countryList.children(".highlight").first(); if (currentCountry.length) { this._selectListItem(currentCountry); } }, // find the first list item whose name starts with the query string _searchForCountry: function(query) { for (var i = 0; i < this.countries.length; i++) { if (this._startsWith(this.countries[i].name, query)) { var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred"); // update highlighting and scroll this._highlightListItem(listItem); this._scrollTo(listItem, true); break; } } }, // check if (uppercase) string a starts with string b _startsWith: function(a, b) { return a.substr(0, b.length).toUpperCase() == b; }, // update the input's value to the given val (format first if possible) // NOTE: this is called from _setInitialState, handleUtils and setNumber _updateValFromNumber: function(number) { if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) { var format = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) != "+") ? intlTelInputUtils.numberFormat.NATIONAL : intlTelInputUtils.numberFormat.INTERNATIONAL; number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); } number = this._beforeSetNumber(number); this.telInput.val(number); }, // check if need to select a new flag based on the given number // Note: called from _setInitialState, keyup handler, setNumber _updateFlagFromNumber: function(number) { // if we're in nationalMode and we already have US/Canada selected, make sure the number starts with a +1 so _getDialCode will be able to extract the area code // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit if (number && this.options.nationalMode && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") { if (number.charAt(0) != "1") { number = "1" + number; } number = "+" + number; } // try and extract valid dial code from input var dialCode = this._getDialCode(number), countryCode = null, numeric = this._getNumeric(number); if (dialCode) { // check if one of the matching countries is already selected var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = $.inArray(this.selectedCountryData.iso2, countryCodes) > -1, // check if the given number contains a NANP area code i.e. the only dialCode that could be extracted was +1 (instead of say +1204) and the actual number's length is >=4 isNanpAreaCode = dialCode == "+1" && numeric.length >= 4, nanpSelected = this.selectedCountryData.dialCode == "1"; // only update the flag if: // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp) // AND // B) either a matching country is not already selected OR the number contains a NANP area code (ensure the flag is set to the first matching country) if (!(nanpSelected && this._isRegionlessNanp(numeric)) && (!alreadySelected || isNanpAreaCode)) { // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first non-empty index for (var j = 0; j < countryCodes.length; j++) { if (countryCodes[j]) { countryCode = countryCodes[j]; break; } } } } else if (number.charAt(0) == "+" && numeric.length) { // invalid dial code, so empty // Note: use getNumeric here because the number has not been formatted yet, so could contain bad chars countryCode = ""; } else if (!number || number == "+") { // empty, or just a plus, so default countryCode = this.defaultCountry; } if (countryCode !== null) { return this._setFlag(countryCode); } return false; }, // check if the given number is a regionless NANP number (expects the number to contain an international dial code) _isRegionlessNanp: function(number) { var numeric = this._getNumeric(number); if (numeric.charAt(0) == "1") { var areaCode = numeric.substr(1, 3); return $.inArray(areaCode, regionlessNanpNumbers) > -1; } return false; }, // remove highlighting from other list items and highlight the given item _highlightListItem: function(listItem) { this.countryListItems.removeClass("highlight"); listItem.addClass("highlight"); }, // find the country data for the given country code // the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array _getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) { var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; for (var i = 0; i < countryList.length; i++) { if (countryList[i].iso2 == countryCode) { return countryList[i]; } } if (allowFail) { return null; } else { throw new Error("No country data for '" + countryCode + "'"); } }, // select the given flag, update the placeholder and the active list item // Note: called from _setInitialState, _updateFlagFromNumber, _selectListItem, setCountry _setFlag: function(countryCode) { var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; // do this first as it will throw an error and stop if countryCode is invalid this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; // update the defaultCountry - we only need the iso2 from now on, so just store that if (this.selectedCountryData.iso2) { this.defaultCountry = this.selectedCountryData.iso2; } this.selectedFlagInner.attr("class", "iti-flag " + countryCode); // update the selected country's title attribute var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown"; this.selectedFlagInner.parent().attr("title", title); if (this.options.separateDialCode) { var dialCode = this.selectedCountryData.dialCode ? "+" + this.selectedCountryData.dialCode : "", parent = this.telInput.parent(); if (prevCountry.dialCode) { parent.removeClass("iti-sdc-" + (prevCountry.dialCode.length + 1)); } if (dialCode) { parent.addClass("iti-sdc-" + dialCode.length); } this.selectedDialCode.text(dialCode); } // and the input's placeholder this._updatePlaceholder(); // update the active list item this.countryListItems.removeClass("active"); if (countryCode) { this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active"); } // return if the flag has changed or not return prevCountry.iso2 !== countryCode; }, // update the input placeholder to an example number from the currently selected country _updatePlaceholder: function() { var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && (this.options.autoPlaceholder === true || this.options.autoPlaceholder === "polite"); if (window.intlTelInputUtils && shouldSetPlaceholder) { var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType], placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; placeholder = this._beforeSetNumber(placeholder); if (typeof this.options.customPlaceholder === "function") { placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); } this.telInput.attr("placeholder", placeholder); } }, // called when the user selects a list item from the dropdown _selectListItem: function(listItem) { // update selected flag and active list item var flagChanged = this._setFlag(listItem.attr("data-country-code")); this._closeDropdown(); this._updateDialCode(listItem.attr("data-dial-code"), true); // focus the input this.telInput.focus(); // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto inserting dial code), who try to put the cursor at the beginning the first time if (this.isGoodBrowser) { var len = this.telInput.val().length; this.telInput[0].setSelectionRange(len, len); } if (flagChanged) { this._triggerCountryChange(); } }, // close the dropdown and unbind any listeners _closeDropdown: function() { this.countryList.addClass("hide"); // update the arrow this.selectedFlagInner.children(".iti-arrow").removeClass("up"); // unbind key events $(document).off(this.ns); // unbind click-off-to-close $("html").off(this.ns); // unbind hover and click listeners this.countryList.off(this.ns); // remove menu from container if (this.options.dropdownContainer) { if (!this.isMobile) { $(window).off("scroll" + this.ns); } this.dropdown.detach(); } this.telInput.trigger("close:countrydropdown"); }, // check if an element is visible within it's container, else scroll until it is _scrollTo: function(element, middle) { var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2; if (elementTop < containerTop) { // scroll up if (middle) { newScrollTop -= middleOffset; } container.scrollTop(newScrollTop); } else if (elementBottom > containerBottom) { // scroll down if (middle) { newScrollTop += middleOffset; } var heightDifference = containerHeight - elementHeight; container.scrollTop(newScrollTop - heightDifference); } }, // replace any existing dial code with the new one // Note: called from _selectListItem and setCountry _updateDialCode: function(newDialCode, hasSelectedListItem) { var inputVal = this.telInput.val(), newNumber; // save having to pass this every time newDialCode = "+" + newDialCode; if (inputVal.charAt(0) == "+") { // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not) var prevDialCode = this._getDialCode(inputVal); if (prevDialCode) { // current number contains a valid dial code, so replace it newNumber = inputVal.replace(prevDialCode, newDialCode); } else { // current number contains an invalid dial code, so ditch it // (no way to determine where the invalid dial code ends and the rest of the number begins) newNumber = newDialCode; } } else if (this.options.nationalMode || this.options.separateDialCode) { // don't do anything return; } else { // nationalMode is disabled if (inputVal) { // there is an existing value with no dial code: prefix the new dial code newNumber = newDialCode + inputVal; } else if (hasSelectedListItem || !this.options.autoHideDialCode) { // no existing value and either they've just selected a list item, or autoHideDialCode is disabled: insert new dial code newNumber = newDialCode; } else { return; } } this.telInput.val(newNumber); }, // try and extract a valid international dial code from a full telephone number // Note: returns the raw string inc plus character and any whitespace/dots etc _getDialCode: function(number) { var dialCode = ""; // only interested in international numbers (starting with a plus) if (number.charAt(0) == "+") { var numericChars = ""; // iterate over chars for (var i = 0; i < number.length; i++) { var c = number.charAt(i); // if char is number if ($.isNumeric(c)) { numericChars += c; // if current numericChars make a valid dial code if (this.countryCodes[numericChars]) { // store the actual raw string (useful for matching later) dialCode = number.substr(0, i + 1); } // longest dial code is 4 chars if (numericChars.length == 4) { break; } } } } return dialCode; }, // get the input val, adding the dial code if separateDialCode is enabled _getFullNumber: function() { var val = $.trim(this.telInput.val()), dialCode = this.selectedCountryData.dialCode, prefix, numericVal = this._getNumeric(val), // normalized means ensure starts with a 1, so we can match against the full dial code normalizedVal = numericVal.charAt(0) == "1" ? numericVal : "1" + numericVal; if (this.options.separateDialCode) { prefix = "+" + dialCode; } else if (val.charAt(0) != "+" && val.charAt(0) != "1" && dialCode && dialCode.charAt(0) == "1" && dialCode.length == 4 && dialCode != normalizedVal.substr(0, 4)) { // if the user has entered a national NANP number, then ensure it includes the full dial code / area code prefix = dialCode.substr(1); } else { prefix = ""; } return prefix + val; }, // remove the dial code if separateDialCode is enabled _beforeSetNumber: function(number) { if (this.options.separateDialCode) { var dialCode = this._getDialCode(number); if (dialCode) { // US dialCode is "+1", which is what we want // CA dialCode is "+1 123", which is wrong - should be "+1" (as it has multiple area codes) // AS dialCode is "+1 684", which is what we want // Solution: if the country has area codes, then revert to just the dial code if (this.selectedCountryData.areaCodes !== null) { dialCode = "+" + this.selectedCountryData.dialCode; } // a lot of numbers will have a space separating the dial code and the main number, and some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get rid of it // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length; number = number.substr(start); } } return this._cap(number); }, // trigger the 'countrychange' event _triggerCountryChange: function() { this.telInput.trigger("countrychange", this.selectedCountryData); }, /************************** * SECRET PUBLIC METHODS **************************/ // this is called when the geoip call returns handleAutoCountry: function() { if (this.options.initialCountry === "auto") { // we must set this even if there is an initial val in the input: in case the initial val is invalid and they delete it - they should see their auto country this.defaultCountry = $.fn[pluginName].autoCountry; // if there's no initial value in the input, then update the flag if (!this.telInput.val()) { this.setCountry(this.defaultCountry); } this.autoCountryDeferred.resolve(); } }, // this is called when the utils request completes handleUtils: function() { // if the request was successful if (window.intlTelInputUtils) { // if there's an initial value in the input, then format it if (this.telInput.val()) { this._updateValFromNumber(this.telInput.val()); } this._updatePlaceholder(); } this.utilsScriptDeferred.resolve(); }, /******************** * PUBLIC METHODS ********************/ // remove plugin destroy: function() { if (this.allowDropdown) { // make sure the dropdown is closed (and unbind listeners) this._closeDropdown(); // click event to open dropdown this.selectedFlagInner.parent().off(this.ns); // label click hack this.telInput.closest("label").off(this.ns); } // unbind submit event handler on form if (this.options.autoHideDialCode) { var form = this.telInput.prop("form"); if (form) { $(form).off(this.ns); } } // unbind all events: key events, and focus/blur events if autoHideDialCode=true this.telInput.off(this.ns); // remove markup (but leave the original input) var container = this.telInput.parent(); container.before(this.telInput).remove(); }, // get the extension from the current number getExtension: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2); } return ""; }, // format the number to the given format getNumber: function(format) { if (window.intlTelInputUtils) { return intlTelInputUtils.formatNumber(this._getFullNumber(), this.selectedCountryData.iso2, format); } return ""; }, // get the type of the entered number e.g. landline/mobile getNumberType: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2); } return -99; }, // get the country data for the currently selected flag getSelectedCountryData: function() { return this.selectedCountryData; }, // get the validation error getValidationError: function() { if (window.intlTelInputUtils) { return intlTelInputUtils.getValidationError(this._getFullNumber(), this.selectedCountryData.iso2); } return -99; }, // validate the input val - assumes the global function isValidNumber (from utilsScript) isValidNumber: function() { var val = $.trim(this._getFullNumber()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : ""; return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null; }, // update the selected flag, and update the input val accordingly setCountry: function(countryCode) { countryCode = countryCode.toLowerCase(); // check if already selected if (!this.selectedFlagInner.hasClass(countryCode)) { this._setFlag(countryCode); this._updateDialCode(this.selectedCountryData.dialCode, false); this._triggerCountryChange(); } }, // set the input value and update the flag setNumber: function(number) { // we must update the flag first, which updates this.selectedCountryData, which is used for formatting the number before displaying it var flagChanged = this._updateFlagFromNumber(number); this._updateValFromNumber(number); if (flagChanged) { this._triggerCountryChange(); } }, // set the placeholder number typ setPlaceholderNumberType: function(type) { this.options.placeholderNumberType = type; this._updatePlaceholder(); } }; // using https://github.com/jquery-boilerplate/jquery-boilerplate/wiki/Extending-jQuery-Boilerplate // (adapted to allow public functions) $.fn[pluginName] = function(options) { var args = arguments; // Is the first parameter an object (options), or was omitted, // instantiate a new instance of the plugin. if (options === undefined || typeof options === "object") { // collect all of the deferred objects for all instances created with this selector var deferreds = []; this.each(function() { if (!$.data(this, "plugin_" + pluginName)) { var instance = new Plugin(this, options); var instanceDeferreds = instance._init(); // we now have 2 deffereds: 1 for auto country, 1 for utils script deferreds.push(instanceDeferreds[0]); deferreds.push(instanceDeferreds[1]); $.data(this, "plugin_" + pluginName, instance); } }); // return the promise from the "master" deferred object that tracks all the others return $.when.apply(null, deferreds); } else if (typeof options === "string" && options[0] !== "_") { // If the first parameter is a string and it doesn't start // with an underscore or "contains" the `init`-function, // treat this as a call to a public method. // Cache the method call to make it possible to return a value var returns; this.each(function() { var instance = $.data(this, "plugin_" + pluginName); // Tests that there's already a plugin-instance // and checks that the requested public method exists if (instance instanceof Plugin && typeof instance[options] === "function") { // Call the method of our plugin instance, // and pass it the supplied arguments. returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1)); } // Allow instances to be destroyed via the 'destroy' method if (options === "destroy") { $.data(this, "plugin_" + pluginName, null); } }); // If the earlier cached method gives a value back return the value, // otherwise return this to preserve chainability. return returns !== undefined ? returns : this; } }; /******************** * STATIC METHODS ********************/ // get the country data object $.fn[pluginName].getCountryData = function() { return allCountries; }; // load the utils script $.fn[pluginName].loadUtils = function(path, utilsScriptDeferred) { if (!$.fn[pluginName].loadedUtilsScript) { // don't do this twice! (dont just check if window.intlTelInputUtils exists as if init plugin multiple times in quick succession, it may not have finished loading yet) $.fn[pluginName].loadedUtilsScript = true; // dont use $.getScript as it prevents caching $.ajax({ type: "GET", url: path, complete: function() { // tell all instances that the utils request is complete $(".intl-tel-input input").intlTelInput("handleUtils"); }, dataType: "script", cache: true }); } else if (utilsScriptDeferred) { utilsScriptDeferred.resolve(); } }; // default options $.fn[pluginName].defaults = defaults; // version $.fn[pluginName].version = "12.1.15"; // Array of country objects for the flag dropdown. // Here is the criteria for the plugin to support a given country/territory // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml // Each country array has the following information: // [ // Country name, // iso2 code, // International dial code, // Order (if >1 country with same dial code), // Area codes // ] var allCountries = [ [ "Afghanistan (افغانستان)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (الجزائر)", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain (البحرين)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2 ], [ "Cocos (Keeling) Islands", "cc", "61", 1 ], [ "Colombia", "co", "57" ], [ "Comoros (جزر القمر)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (مصر)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1 ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (ایران)", "ir", "98" ], [ "Iraq (العراق)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2 ], [ "Israel (ישראל)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3 ], [ "Jordan (الأردن)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (الكويت)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (لبنان)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (ليبيا)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Macedonia (FYROM) (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (موريتانيا)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1 ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1664" ], [ "Morocco (المغرب)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1670" ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (عُمان)", "om", "968" ], [ "Pakistan (پاکستان)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (فلسطين)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (قطر)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1869" ], [ "Saint Lucia", "lc", "1758" ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1784" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (المملكة العربية السعودية)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1721" ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (جنوب السودان)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්රී ලංකාව)", "lk", "94" ], [ "Sudan (السودان)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1 ], [ "Swaziland", "sz", "268" ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (سوريا)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1868" ], [ "Tunisia (تونس)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1649" ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1340" ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (الإمارات العربية المتحدة)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1 ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (الصحراء الغربية)", "eh", "212", 1 ], [ "Yemen (اليمن)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1 ] ]; // loop over all of the countries above for (var i = 0; i < allCountries.length; i++) { var c = allCountries[i]; allCountries[i] = { name: c[0], iso2: c[1], dialCode: c[2], priority: c[3] || 0, areaCodes: c[4] || null }; } }); </script> <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script> <!--<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>--> <script type="text/javascript"> $("#phone").intlTelInput({ //allowDropdown: true, autoHideDialCode: true, // autoPlaceholder: "off", //dropdownContainer: "body", // excludeCountries: ["us"], formatOnDisplay: true, geoIpLookup: function(callback) { $.get("http://ipinfo.io", function() {}, "jsonp").always(function(resp) { var countryCode = (resp && resp.country) ? resp.country : ""; callback(countryCode); }); }, initialCountry: "au", nationalMode: false, // onlyCountries: ['us', 'gb', 'ch', 'ca', 'do'], placeholderNumberType: "Mobile", preferredCountries: ['au', 'nz', 'gb', 'cn', 'id'], separateDialCode: true, utilsScript: "assets/utils.js" }); input_credit_card = function(jQinp) { var format_and_pos = function(input, char, backspace) { var start = 0; var end = 0; var pos = 0; var value = input.value; if (char !== false) { start = input.selectionStart; end = input.selectionEnd; if (backspace && start > 0) // handle backspace onkeydown { start--; if (value[start] == " ") { start--; } } // To be able to replace the selection if there is one value = value.substring(0, start) + char + value.substring(end); pos = start + char.length; // caret position } var d = 0; // digit count var dd = 0; // total var gi = 0; // group index var newV = ""; var groups = /^\D*3[47]/.test(value) ? // check for American Express [4, 6, 5] : [4, 4, 4, 4]; for (var i = 0; i < value.length; i++) { if (/\D/.test(value[i])) { if (start > i) { pos--; } } else { if (d === groups[gi]) { newV += " "; d = 0; gi++; if (start >= i) { pos++; } } newV += value[i]; d++; dd++; } if (d === groups[gi] && groups.length === gi + 1) // max length { break; } } input.value = newV; if (char !== false) { input.setSelectionRange(pos, pos); } }; jQinp.keypress(function(e) { var code = e.charCode || e.keyCode || e.which; // Check for tab and arrow keys (needed in Firefox) if (code !== 9 && (code < 37 || code > 40) && // and CTRL+C / CTRL+V !(e.ctrlKey && (code === 99 || code === 118))) { e.preventDefault(); var char = String.fromCharCode(code); // if the character is non-digit // -> return false (the character is not inserted) if (/\D/.test(char)) { return false; } format_and_pos(this, char); } }). keydown(function(e) // backspace doesn't fire the keypress event { if (e.keyCode === 8 || e.keyCode === 46) // backspace or delete { e.preventDefault(); format_and_pos(this, '', this.selectionStart === this.selectionEnd); } }). on('paste', function() { // A timeout is needed to get the new value pasted setTimeout(function() { format_and_pos(jQinp[0], ''); }, 50); }). blur(function() // reformat onblur just in case (optional) { format_and_pos(this, false); }); }; input_credit_card($('#card')); var booking_submit = false; var airport_pickup = false; var return_airport_pickup = false; var price1 = 0; var discount = 1; var setCity = ""; var tollArray = null; var returnTollArray = null; var airportPoly = null; var parent = this; var mapStyle; var locations; var terminals; // Get the modal var modal = document.getElementById("myModal"); // Get the button that opens the modal var btn = document.getElementById("myBtn"); // Get the <span> element that closes the modal var span = document.getElementsByClassName("close")[0]; var quoteCheck = "<?=$_GET["quote"]?>"; var map = null ; pickUp = null ; dropOff = null; return_pickUp = null; return_dropOff= null; var directionsDisplay = null ; var directionsDisplay_return = null; var directionsService = null ; var lineArray = new Array(); var returnLineArray = new Array(); var geocoder = null; var marker1 = null; var marker2 = null; var marker3 = null; var marker4 = null; var oneway_directions_set = 0; var return_directions_set = 0; var pickupState = ""; var dropoffState = ""; var returnPickupState = ""; var returnDropoffState = ""; var googleRoute = ""; var googleReturnRoute = ""; var lastClicked = ""; $.getJSON("style.json", function(json) { //console.log(json); // this will show the info it in firebug console mapStyle = json; }); $(document).ready(function(){ getPoly(); if(quoteCheck != "1") { $('input[name="quoteType"][value="booking"]').click(); } $('#termPerth1').hide(); $('#termSyd1').hide(); $('#searchDiv1').show(); $('#termPerth2').hide(); $('#termSyd2').hide(); $('#searchDiv2').show(); $('#termPerth3').hide(); $('#termSyd3').hide(); $('#searchDiv3').show(); $('#termPerth4').hide(); $('#termSyd4').hide(); $('#searchDiv4').show(); if($('#account').val() == 1){ $('.newName').hide(); $('.accountName').show(); $("#First_Name, #Last_Name, #EWAY_CARDNUMBER, #EWAY_CARDCVN").removeAttr('required'); $("#name").attr('required', 'required'); $(function() { $("#name").autocomplete({ source: 'search.php', minLength: 1 }); }); } $("#name").on("blur", function(){ var id = $("#name").val(); var data = 'name=' + id; $.ajax({ type: "POST", url: "a_name_address.php", data: data, dataType: 'json', success: function (data) { $("#phone").val(data.mobile); $("#email").val(data.email); $("#token").val(data.token); if($("#phone").intlTelInput("isValidNumber") == true) { var intlNumber = $("#phone").intlTelInput("getNumber"); $('#intphone').val( intlNumber ); } else { $('#intphone').val( data.mobile ); } } // success }); // ajax }); }) var datesDis = ["25/12/2022", "26/12/2022"] var date_input=$("#date, #return_date"); //our date input has the name "date" var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body"; date_input.datepicker({ startDate: new Date(), format: 'd M, yyyy', container: container, todayHighlight: true, autoclose: true, datesDisabled: datesDis, onSelect: function () { $("#form1").valid(); } }) $('#time, #return_time').timepicker(); $("#return_pickup, #return_dropoff, #return_date, #return_time").removeAttr('required'); $("#journey").change(function(){ var radioValue = $("input[name='journeyType']:checked").val(); if(radioValue == 'oneway'){ $(".return_rows").hide(); $("#tripdesc").text("One Way"); $("#return_pickup, #return_dropoff, #return_date, #return_time").removeAttr('required'); } if(radioValue=='return'){ $(".return_rows").show(); $("#tripdesc").text("First Journey"); $("#return_pickup, #return_dropoff, #return_date, #return_time").attr('required', 'required'); } }) $("#time").on('blur', function() { console.log("fired"); if($("#date").val() != "") { directions(); } }) $("#type1").change(function(){ var radioValue = $("input[name='pickupType']:checked").val(); if(radioValue == 'airport1'){ $("#pickup").attr('readonly', true); getTerminals("#pickup", setCity); } else if(radioValue=='search1'){ checkCity(); $("#pickup").attr('readonly', false); removeTerminals("#pickup"); $('#pickup').val(""); $(".pickup_div_t, .flight_time").hide(); } }) $("#type2").change(function(){ var radioValue = $("input[name='dropoffType']:checked").val(); if(radioValue == 'airport2'){ $("#dropoff").attr('readonly', true); getTerminals("#dropoff", setCity); } else if(radioValue=='search2') { checkCity(); $("#dropoff").attr('readonly', false); removeTerminals("#dropoff"); } }) $("#type3").change(function(){ var radioValue = $("input[name='returnPickupType']:checked").val(); if(radioValue == 'airport3'){ $("#return_pickup").attr('readonly', true); getTerminals("#return_pickup", setCity); } else if(radioValue == 'search3') { checkCity(); $("#return_pickup").attr('readonly', false); removeTerminals("#return_pickup"); $('#return_pickup').val(""); $(".return_pickup_div_t, .return_flight_time").hide(); } }) $("#type4").change(function(){ var radioValue = $("input[name='returnDropoffType']:checked").val(); if(radioValue == 'airport4'){ $("#return_dropoff").attr('readonly', true); getTerminals("#return_dropoff", setCity); } else if(radioValue == 'search4'){ checkCity(); $("#return_dropoff").attr('readonly', false); removeTerminals("#return_dropoff"); } }) $('#promoButton').on('click', function () { console.log(discount); var dataString = "promo=" + $('#promo_code').val(); $.ajax({ type: "POST", url: "promo.php", data: dataString, dataType: 'json', success: function (data) { console.log(data); if(data.response == "no"){ $('#promoButton').attr('style', 'background:#FF0000;padding-top:5px; padding-bottom:5px;'); $('#promoButton').text("Incorrect"); $('#promoCode').val(""); $('#promoValue').val(""); discount = 1; } else { if(data.expired == "") { $('#promoButton').attr('style', 'background: #00FF00;padding-top:5px; padding-bottom:5px;'); $('#promoButton').text("Valid!"); $('#promoCode').val(data.code); $('#promoValue').val(data.value); discount = data.value; console.log(discount); distance(true); console.log($('#promoCode').val()); } else { $('#promoButton').attr('style', 'background:#FF0000;padding-top:5px; padding-bottom:5px;'); $('#promoButton').text("Invalid!"); $('#promoCode').val(""); $('#promoValue').val(""); discount = 1; } } } }) }) $('#lat1_value').on('change', function () { $('.lat_error_pickup').hide(); }) function checkCity() { if($('#pickup').val() == "" && $('#dropoff').val() == "" && $('#return_pickup').val() == "" && $('#return_dropoff').val() == "") { console.log("setCity to zero called"); setCity = ""; initAutocomplete(); } } $('#pickup').on('change', function () { checkCity(); $("#lat1_value").val(''); $("#lng1_value").val(''); $('.lat_error_pickup').hide(); $('#totalPrice').text( "" ); oneway_directions_set = 0; if(marker1 != null) { marker1.setMap(null); marker1 = null; } directionsDisplay.setDirections({routes: []}); }) $('#dropoff').on('change', function () { checkCity(); $("#lat2_value").val(''); $("#lng2_value").val(''); $('.lat2_error_pickup').hide(); $('#totalPrice').text( "" ); oneway_directions_set = 0; if(marker2 != null) { marker2.setMap(null); marker2 = null; } directionsDisplay.setDirections({routes: []}); }) $('#lat2_value').on('change', function () { $('.lat2_error_pickup').hide(); }) $('#return_pickup').on('blur', function () { $(this).delay(2000).queue(function() { }) }) $('#return_pickup').on('change', function () { checkCity(); $("#lat3_value").val(''); $("#lng3_value").val(''); $('#totalPrice2').text( "" ); $('.lat3_error_pickup').hide(); return_directions_set = 0; if(marker3 != null) { marker3.setMap(null); marker3 = null; } directionsDisplay_return.setDirections({routes: []}); }) $('#lat3_value').on('change', function () { $('.lat3_error_pickup').hide(); }) $('#return_dropoff').on('blur', function () { $(this).delay(2000).queue(function() { }) }) $('#return_dropoff').on('change', function () { checkCity(); $("#lat4_value").val(''); $("#lng4_value").val(''); $('.lat4_error_pickup').hide(); $('#totalPrice2').text( "" ); return_directions_set = 0; if(marker4 != null) { marker4.setMap(null); marker4 = null; } directionsDisplay_return.setDirections({routes: []}); }) $('#lat4_value').on('change', function () { $('.lat4_error_pickup').hide(); }) $('#pickup, #dropoff, .datepicker, .timepicker, #first_name, #phone, #email').on('blur', function () { $('#totalPrice').text(""); }) $('#passenger_count, #car_seat, #ff_count, #booster_count').on('change', function() { $('#totalPrice').text(""); $('#totalPrice2').text(""); $('#totalPrice3').text(""); $('#onewayPrice').val(""); $('#returnPrice').val(''); }) $('#return_pickup, #return_dropoff, .datepicker, .timepicker, #email, #luggage, #passenger_count, #car_seat, #ff_count, #booster_count, #onewayPrice, #returnPrice, #EWAY_CARDNUMBER, #EWAY_CARDCVN, #EWAY_CARDEXPIRYMONTH, #EWAY_CARDEXPIRYYEAR, #luggage').on('blur', function () { $('#totalPrice2').text(""); $('#totalPrice3').text(""); }) $('#quoteButton').on("click", function () { if ($('#lat1_value').val() == "") { $(".lat_error_pickup").show(); return; } else if ($('#lat2_value').val() == "") { $(".lat2_error_pickup").show(); return; } else if ($('#lat3_value').val() == "" && $("input[name='journeyType']:checked").val() == "Return") { $(".lat3_error_pickup").show(); return; } else if ($('#lat4_value').val() == "" && $("input[name='journeyType']:checked").val() == "Return") { $(".lat4_error_pickup").show(); return; } else { $(".loader, .bgloader").show(); distance(); } }) span.onclick = function() { modal.style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } jQuery.validator.setDefaults({ success: "valid", modules: 'html5, logic, security', onfocusout: function(element) { // "eager" validation this.element(element); }, highlight: function(element) { $(element).closest('.form-group').addClass('has-error'); }, unhighlight: function(element) { $(element).closest('.form-group').removeClass('has-error'); }, errorElement: 'span', errorClass: 'help-block', errorPlacement: function(error, element) { if(element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } }, submitHandler: function(form) { $("#card, #cvn").val(""); $(".loader, .bgloader").show(); eCrypt.submitForm(); }, invalidHandler: function(event, validator) { this.onsubmit = null; }, }); $('#booking').on("click", function() { var pickup = $("#pickup").val(); $(".booking").show(); $("#pickup").val(pickup); }) $('#quote').on("click", function() { $(".booking").hide(); }) $('#myButton').on("click", function () { $("#job_city").val(setCity); var radioValue = $("input[name='quoteType']:checked").val(); if(radioValue == "quote") { $('input[name="quoteType"][value="booking"]').click(); return; } var phoneCheck = $("#phone").val(); if(phoneCheck == "") { $(".phone_error").show(); var offset = $("#phone").offset(); $('html, body').animate({ scrollTop: offset.top - 20, scrollLeft: offset.left }); } else { $("#form1").validate(); if($("#form1").valid() == true) { if($('#onewayPrice').val() == "") { $('#buttontext').text("Getting Quote..."); $(".loader, .bgloader").show(); booking_submit = true; distance(); // distance().done(function () { // if($('#onewayPrice').val() != "") { // if($("input[name='journeyType']:checked").val() == "return") { // if($('#returnPrice').val() == "") { // distance().done(function () { // if($('#returnPrice').val() != "") { // $(".loader, .bgloader").show(); // $( "#form1" ).submit(); // } else { // alert("Form incomplete"); // $('#buttontext').text("Make Booking"); // } // }) // } else { // $(".loader, .bgloader").show(); // $( "#form1" ).submit(); // } // } else { // $(".loader, .bgloader").show(); // $( "#form1" ).submit(); // } // } else { // $(".loader, .bgloader").hide(); // alert("Form incomplete"); // $('#buttontext').text("Make Booking"); // } // }) } else { $(".loader, .bgloader").show(); $( "#form1" ).submit(); } } else { $('#buttontext').text("Incomplete fields.."); var input = $('.has-error:first'); var offset = input.offset(); $('html, body').animate({ scrollTop: offset.top - 20, scrollLeft: offset.left }); setTimeout(function() { $('#buttontext').text("Make Booking"); }, 2000); } } }) $('#phone').on('change', function () { if($("#phone").intlTelInput("isValidNumber") == true) { var intlNumber = $("#phone").intlTelInput("getNumber"); $('#intphone').val( intlNumber ); $('.phone_error').hide(); return true;; } else { $("#phone").val(""); $('.phone_error').show(); return false;; } }) function initMap() { if(map == null) { map = new google.maps.Map(document.getElementById('map'), { zoom: 12, center: {lat: -31.9535959, lng: 115.8570118}, styles: mapStyle }); } geocoder = new google.maps.Geocoder(); map.addListener("tilesloaded", function() { fitBounds(); }); directionsService = new google.maps.DirectionsService; directionsDisplay = new google.maps.DirectionsRenderer; directionsDisplay.setOptions({ suppressMarkers: true}); directionsDisplay_return = new google.maps.DirectionsRenderer; directionsDisplay_return.setOptions({ suppressMarkers: true }); directionsDisplay.setMap(map); directionsDisplay_return.setMap(map); } function calculateAndDisplayRoute(directionsService, directionsDisplay) { if($('#lat1_value').val() != "" && $('#lat2_value').val() != "") { console.log(setCity); if(setCity == "sydney") { var date = $("#date").val(); var time = $("#time").val(); if(date != "") { var timeUTC = getTimeUTC(date, time); console.log(timeUTC); var json = { origin: $('#lat1_value').val()+","+$('#lng1_value').val(), destination: $('#lat2_value').val()+","+$('#lng2_value').val(), travelMode: google.maps.TravelMode.DRIVING, drivingOptions: {departureTime: timeUTC, trafficModel: 'bestguess'}}; } else { json = { origin: $('#lat1_value').val()+","+$('#lng1_value').val(), destination: $('#lat2_value').val()+","+$('#lng2_value').val(), travelMode: google.maps.TravelMode.DRIVING}; } } else { json = { origin: $('#lat1_value').val()+","+$('#lng1_value').val(), destination: $('#lat2_value').val()+","+$('#lng2_value').val(), travelMode: google.maps.TravelMode.DRIVING }; } directionsService.route(json, function(response, status) { if (status === google.maps.DirectionsStatus.OK) { //directionsDisplay.setDirections({routes: []}); directionsDisplay.setDirections(response); googleRoute = response; lineArray = new Array; var steps = response.routes[0].legs[0].steps; for(var i=0; i<steps.length; i++) { if(containsWord(steps[i].instructions.toLowerCase(), 'toll road')) { var line = steps[i].polyline.points; lineArray.push({route: line, text: steps[i].instructions.toLowerCase()}); } } var dist = response.routes[0].legs[0].distance.value; $('#km_est').val(parseFloat(dist/1000).toFixed(0)); var dur = response.routes[0].legs[0].duration.value; $('#time_est').val(parseFloat(dur/60).toFixed(0)); var dur_traffic = response.routes[0].legs[0].duration_in_traffic.value; if(dur_traffic != null) { $('#time_est').val(parseFloat(dur_traffic/60).toFixed(0)); } oneway_directions_set = 1; } else { //window.alert('Directions request failed due to ' + status); } }); } } function calculateAndDisplayRoute_return(directionsService, directionsDisplay) { if(return_directions_set != 1){ if($('#lat3_value').val() != "" && $('#lat4_value').val() != "") { directionsService.route({ origin: $('#lat3_value').val()+","+$('#lng3_value').val(), destination: $('#lat4_value').val()+","+$('#lng4_value').val(), travelMode: google.maps.TravelMode.DRIVING }, function(response, status) { if (status === google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); googleReturnRoute = response; returnLineArray = new Array; var steps = response.routes[0].legs[0].steps; for(var i=0; i<steps.length; i++) { if(containsWord(steps[i].instructions.toLowerCase(), 'toll road')) { var line = steps[i].polyline.points; returnLineArray.push({route: line, text: steps[i].instructions.toLowerCase()}); } } var dist = response.routes[0].legs[0].distance.value; var dur = response.routes[0].legs[0].duration.value; $('#return_km_est').val(parseFloat(dist/1000).toFixed(0)); $('#return_time_est').val(parseFloat(dur/60).toFixed(0)); return_directions_set = 1; } else { //window.alert('Directions request failed due to ' + status); } }); } } } function fitBounds() { if(oneway_directions_set == 1 && return_directions_set == 1) { var bounds = new google.maps.LatLngBounds(); if(marker1 != null) { bounds.extend(marker1.getPosition()); } if(marker2 != null) { bounds.extend(marker2.getPosition()); } if(marker3 != null) { bounds.extend(marker3.getPosition()); } if(marker4 != null) { bounds.extend(marker4.getPosition()); } map.fitBounds(bounds); } } function containsWord(string, word) { return new RegExp('(?:[^.\w]|^|^\\W+)' + word + '(?:[^.\w]|\\W(?=\\W+|$)|$)').test(string); } function getTolls(lineArray, priceData, returnTrip) { if(lineArray.length > 0) { if(pickupState == "") { if(setCity == "sydney") { pickupState = "NSW"; } else if(setCity == "melbourne") { pickupState = "VIC"; } else if(setCity == "queensland") { pickupState = "QLD"; } } $(".loader, .bgloader").show(); $.ajax({ type: "POST", url: "../tollster/11.php", data: {state: pickupState, lineArray: [lineArray]}, dataType: 'json', success: function (data) { console.log(data); if(data.status == "OK") { $(".loader, .bgloader").hide(); var tollsData = data.data[0].tolls; var funcTolls = 0; var tollsDesc = ""; for (var i = 0; i < tollsData.length; i++) { funcTolls = funcTolls + + tollsData[i].cost; tollsDesc = tollsDesc + "$" + parseFloat(tollsData[i].cost).toFixed(2) + " " + tollsData[i].name + "\r\n"; } if(returnTrip) { returnTollArray = {"cost": funcTolls, "description": tollsDesc}; $('#returnTollAmount').val(funcTolls); $('#returnTollDecription').val(tollsDesc); postPrice(priceData, true); } else { tollArray = {"cost": funcTolls, "description": tollsDesc}; $('#tollAmount').val(tollArray.cost); $('#tollDescription').val(tollArray.description); postPrice(priceData, false); } } } }) } else { postPrice(priceData, returnTrip); } } // function computeTotalDistance(result, returnTrip) { // var dfrd1 = $.Deferred(); //var total = 0; //var myroute = result.routes[0]; //var totalTolls=0; //var funcTolls = 0; //var tollsDesc = ""; //var returnTollDesc = ""; //for (var i = 0; i < myroute.legs.length; i++) { ////console.log(myroute.legs[i].steps); //for(var j=0;j<myroute.legs[i].steps.length;j++){ ////console.log(myroute.legs[i].steps[j].instructions); //if(containsWord(myroute.legs[i].steps[j].instructions.toLowerCase(), 'toll road')){ //totalTolls+=1; //} //} // //total += myroute.legs[i].distance.value; //} //total = total / 1000; ////console.log(total + ' km'); ////console.log("tolls: " + totalTolls); //if(totalTolls > 0) { // if(returnTrip != "yes") { // var pickup = $('#lat1_value').val()+","+$('#lng1_value').val(); // var dropoff = $('#lat2_value').val()+","+$('#lng2_value').val(); // tolls = 0; // } else { // var pickup = $('#lat3_value').val()+","+$('#lng3_value').val(); // var dropoff = $('#lat4_value').val()+","+$('#lng4_value').val(); // return_tolls = 0; // } // if(pickup != "," + dropoff != ",") { // $(".loader, .bgloader").show(); // $.ajax({ // type: "POST", // url: "../tollster/11.php", // data: {pickup: pickup, dropoff: dropoff, alternatives: "false", pickupState: pickupState, dropoffState: dropoffState, directions: JSON.stringify(result)}, // dataType: 'json', // success: function (data) { // console.log(data); // if(data.status == "OK") { // $(".loader, .bgloader").hide(); // var tollsData = data.tolls[0]; // for (var i = 0; i < tollsData.length; i++) { // funcTolls = funcTolls + + tollsData[i].cost; // tollsDesc = tollsDesc + "$" + parseFloat(tollsData[i].cost).toFixed(2) + " " + tollsData[i].name + "\r\n"; // } // if(returnTrip == "yes") { // return_tolls = funcTolls; // $('#returnTollAmount').val(return_tolls); // $('#returnTollDecription').val(tollsDesc); // } else { // tolls = funcTolls; // $('#tollAmount').val(tolls); // $('#tollDescription').val(tollsDesc); // } // dfrd1.resolve(); // } else { // dfrd1.resolve(); // } // } // }) //} //} else { // dfrd1.resolve(); //} //return dfrd1.promise(); // } function getTimeUTC(date, time) { var split = date.split(" "); var day = split[0]; var monthText = split[1].replace(",", ""); //var monthArray = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"]; //var month = monthArray.indexOf(monthText); var year = split[2]; var time_split = time.split(" "); var colon_split = time_split[0].split(":"); var hour = colon_split[0]; var min = colon_split[1]; var ampm = time_split[1]; if(ampm == "PM" && hour != "12") { var hour_int = parseInt(hour); hour = hour_int + 12 } if(ampm == "AM" && hour == "12") { hour = 0; } timezone = "GMT+0800"; if(setCity == "sydney" || setCity == "melbourne" || setCity == "canberra") { timezone = "GMT+1000"; } else if(setCity == "queensland") { timezone = "GMT+1000"; } var newDate = new Date(monthText + " " + day + " " + year + " " + hour + ":" + min + ":00 " + timezone); return newDate; } function setMarker(input, lat, lng) { if(input == "#pickup") { marker1 = new google.maps.Marker({map: map, position: {lat: lat, lng: lng}, icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|e67717'}); } else if (input == "#dropoff") { marker2 = new google.maps.Marker({map: map, position: {lat: lat, lng: lng}, icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|e67717'}); } else if(input == "#return_pickup") { marker3 = new google.maps.Marker({map: map, position: {lat: lat, lng: lng}, icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|23327d'}); } else if(input == "#return_dropoff") { marker4 = new google.maps.Marker({map: map, position: {lat: lat, lng: lng}, icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|23327d'}); } map.setCenter({lat: lat, lng: lng}); map.setZoom(12); directions(); } // This example displays an address form, using the autocomplete feature // of the Google Places API to help users fill in the information. var placeSearch, dropoff , pickup ; function initAutocomplete() { var perthBounds = new google.maps.LatLngBounds(new google.maps.LatLng(-32.787777, 115.556739), new google.maps.LatLng(-31.159266, 116.545509)); var sydBounds = new google.maps.LatLngBounds(new google.maps.LatLng(-34.102452, 150.203400), new google.maps.LatLng(-33.560598, 151.418768)); var melBounds = new google.maps.LatLngBounds(new google.maps.LatLng(-38.578357, 144.619531), new google.maps.LatLng(-37.568481, 145.576100)); var brisBounds = new google.maps.LatLngBounds(new google.maps.LatLng(-28.335180, 151.615935), new google.maps.LatLng(-26.249000, 154.189780)); var canbBounds = new google.maps.LatLngBounds(new google.maps.LatLng(-35.514542, 149.338580), new google.maps.LatLng(-35.118423, 148.854229)); if(setCity=="perth"){ var use = {types: ['geocode','establishment'], fields: ["name", "geometry.location", "place_id", "formatted_address"], componentRestrictions:{country:"au"}, bounds: perthBounds, strictBounds: true, fields: ["name", "geometry.location", "place_id", "formatted_address", "address_components"]}; } else if(setCity=="sydney") { var use = {types: ['geocode','establishment'], fields: ["name", "geometry.location", "place_id", "formatted_address"], componentRestrictions:{country:"au"}, bounds: sydBounds, strictBounds: true, fields: ["name", "geometry.location", "place_id", "formatted_address", "address_components"]}; } else if(setCity=="melbourne") { var use = {types: ['geocode','establishment'], fields: ["name", "geometry.location", "place_id", "formatted_address"], componentRestrictions:{country:"au"}, bounds: melBounds, strictBounds: true, fields: ["name", "geometry.location", "place_id", "formatted_address", "address_components"]}; } else if(setCity=="queensland") { var use = {types: ['geocode','establishment'], fields: ["name", "geometry.location", "place_id", "formatted_address"], componentRestrictions:{country:"au"}, bounds: brisBounds, strictBounds: true, fields: ["name", "geometry.location", "place_id", "formatted_address", "address_components"]}; } else { var use = {types: ['geocode','establishment'], fields: ["name", "geometry.location", "place_id", "formatted_address", "address_components"], componentRestrictions:{country:"au"}}; } console.log(use); pickup = new google.maps.places.Autocomplete((document.getElementById('pickup')),use); pickup.addListener('place_changed', function() { for (var i = 0; i < pickup.getPlace().address_components.length; i++) { var addressType = pickup.getPlace().address_components[i].types[0]; if(addressType == "administrative_area_level_1") { pickupState = pickup.getPlace().address_components[i].short_name; } } var check = checkLocation(pickup.getPlace().geometry.location, setCity); if(check !== false) { map.setZoom(12); map.setCenter(pickup.getPlace().geometry.location); $('#lat1_value').val(pickup.getPlace().geometry.location.lat()); $('#lng1_value').val(pickup.getPlace().geometry.location.lng()) .trigger('change'); setMarker("#pickup", pickup.getPlace().geometry.location.lat(), pickup.getPlace().geometry.location.lng()); console.log(check); console.log(check.city); setCity = check.city; initAutocomplete(); if(check.airport == 1) { alert("please select terminal"); $('input[name="pickupType"][value="airport1"]').click(); } } else { alert("not to that location"); $("#pickup").val(""); } }); dropoff = new google.maps.places.Autocomplete((document.getElementById('dropoff')),use); dropoff.addListener('place_changed', function() { for (var i = 0; i < dropoff.getPlace().address_components.length; i++) { var addressType = dropoff.getPlace().address_components[i].types[0]; if(addressType == "administrative_area_level_1") { dropoffState = dropoff.getPlace().address_components[i].short_name; } } var check = checkLocation(dropoff.getPlace().geometry.location, setCity); if(check !== false) { map.setZoom(12); map.setCenter(dropoff.getPlace().geometry.location); $('#lat2_value').val(dropoff.getPlace().geometry.location.lat()); $('#lng2_value').val(dropoff.getPlace().geometry.location.lng()) .trigger('change'); setMarker("#dropoff", dropoff.getPlace().geometry.location.lat(), dropoff.getPlace().geometry.location.lng()); setCity = check.city; initAutocomplete(); if(check.airport == 1) { alert("please select terminal"); $('input[name="dropoffType"][value="airport2"]').click(); } } else { alert("not to that location"); $("#dropoff").val(""); } }); return_pickup = new google.maps.places.Autocomplete((document.getElementById('return_pickup')),use); return_pickup.addListener('place_changed', function() { for (var i = 0; i < return_pickup.getPlace().address_components.length; i++) { var addressType = return_pickup.getPlace().address_components[i].types[0]; if(addressType == "administrative_area_level_1") { pickupState = return_pickup.getPlace().address_components[i].short_name; } } var check = checkLocation(return_pickup.getPlace().geometry.location, setCity); if(check !== false) { map.setZoom(12); map.setCenter(return_pickup.getPlace().geometry.location); $('#lat3_value').val(return_pickup.getPlace().geometry.location.lat()); $('#lng3_value').val(return_pickup.getPlace().geometry.location.lng()) .trigger('change'); setMarker("#return_pickup", return_pickup.getPlace().geometry.location.lat(), return_pickup.getPlace().geometry.location.lng()); setCity = check.city; initAutocomplete(); if(check.airport == 1) { alert("please select terminal"); $('input[name="returnPickupType"][value="airport3"]').click(); } } else { alert("not to that location"); $("#return_pickup").val(""); } }); return_dropoff = new google.maps.places.Autocomplete((document.getElementById('return_dropoff')),use); return_dropoff.addListener('place_changed', function() { for (var i = 0; i < return_dropoff.getPlace().address_components.length; i++) { var addressType = return_dropoff.getPlace().address_components[i].types[0]; if(addressType == "administrative_area_level_1") { pickupState = return_dropoff.getPlace().address_components[i].short_name; } } var check = checkLocation(return_dropoff.getPlace().geometry.location, setCity); if(check !== false) { map.setZoom(12); map.setCenter(return_dropoff.getPlace().geometry.location); $('#lat4_value').val(return_dropoff.getPlace().geometry.location.lat()); $('#lng4_value').val(return_dropoff.getPlace().geometry.location.lng()) .trigger('change'); setMarker("#return_dropoff", return_dropoff.getPlace().geometry.location.lat(), return_dropoff.getPlace().geometry.location.lng()); setCity = check.city; initAutocomplete(); if(check.airport == 1) { alert("please select terminal"); $('input[name="returnDropffType"][value="airport4"]').click(); } } else { alert("not to that location"); $("#return_dropoff").val(""); } }); initMap(); } function timeCheck(time) { var hours = Number(time.match(/^(\d+)/)[1]); var minutes = Number(time.match(/:(\d+)/)[1]); var AMPM = time.match(/\s(.*)$/)[1]; if(AMPM == "PM" && hours<12){ hours = hours+12}; if(AMPM == "AM" && hours==12){ hours = hours-12}; //console.log(hours); return hours; } function postPrice(data, return_booking) { var radioValue = $("#cityType").val(); if(return_booking == true) { var returnQuote = data.total; var toll1 = 0; var toll2 = 0; if(returnTollArray != null) { toll2 = returnTollArray.cost; var toll_string = " + tolls"; } else { var toll_string = ""; } $('#returnPrice').val( parseFloat(returnQuote).toFixed(2) ); var price = parseFloat(returnQuote).toFixed(2); var levy = data.levy; var levy_string = ""; if(levy != "0") { levy_string = " inc. $" + parseFloat(levy).toFixed(2) + " levy"; } $('#totalPrice2').text(price + levy_string + toll_string); console.log($('#onewayPrice').val()); var total = parseFloat(returnQuote) + parseFloat($('#onewayPrice').val()); if(tollArray != null) { toll1 = tollArray.cost; } var total_tolls = toll1 + toll2; if(total_tolls > 0) { var toll_string = " + $" + parseFloat(total_tolls).toFixed(2) + " tolls"; } else { var toll_string = ""; } var additional = data.additional; console.log(additional); if(additional != "") { $('#returnAdd').text(additional) $('#returnAdd').show(); } $('#totalPrice3').text( parseFloat(total).toFixed(2) + toll_string); if(booking_submit == true) { $(".loader, .bgloader").show(); $( "#form1" ).submit(); } } else { var onewayQuote = data.total; var price = parseFloat(onewayQuote).toFixed(2); var levy = data.levy; var levy_string = ""; if(levy != "0") { levy_string = " inc. $" + parseFloat(levy).toFixed(2) + " levy"; } if(tollArray != null) { console.log(tollArray); var toll_string = "+ tolls"; } else { var toll_string = ""; } var additional = data.additional; console.log(additional); if(additional != "") { $('#onewayAdd').text(additional) $('#onewayAdd').show(); } $('#onewayPrice').val( parseFloat(onewayQuote).toFixed(2) ); $('#totalPrice').text( parseFloat(onewayQuote).toFixed(2) + levy_string + toll_string ); if($("input[name='journeyType']:checked").val() != "return" && booking_submit == true) { $(".loader, .bgloader").show(); $( "#form1" ).submit(); } } } function dateformat(date) { var dateNoComma = date.replace(",", ""); var dateSplit = dateNoComma.split(" "); var day = dateSplit[0]; if(day.length == 1) { day = "0" + day; } var year = dateSplit[2]; var monthArray = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04", "May": "05", "Jun": "06", "Jul": "07", "Aug": "08", "Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12"}; var month = monthArray[dateSplit[1]]; var string = year + "-" + month + "-" + day; return string; } function distance() { var returnBooking = false; if($("input[name='journeyType']:checked").val() == "return") { returnBooking = true; } var bookingtime = timeCheck($('#time').val()); var bookingdate = dateformat($('#date').val()); var pass = $('#passenger_count').val(); var rf = $('#car_seat').val(); var ff = $('#ff_count').val(); var boost = $('#booster_count').val(); var seats = parseFloat(rf) + parseFloat(ff) + parseFloat(boost); var dataString = {city: setCity, km: $("#km_est").val(), duration: $("#time_est").val(), pax: pass, seats: seats, time: bookingtime, date: bookingdate, airport: airport_pickup}; console.log(dataString); $.ajax({ type: "POST", url: "../familyPrice.php", data: dataString, async: true, dataType: 'json', success: function (data) { $(".loader, .bgloader").hide(); console.log(data); response = data; if(setCity != "perth") { console.log("sent to tolls"); getTolls(lineArray, response, false); if(returnBooking) { returnBookingGet(); } } else { postPrice(response, false); if(returnBooking) { returnBookingGet(); } } }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); $(".loader, .bgloader").hide(); } }) //console.log(onewayData); function returnBookingGet() { var pickup = $('#lat3_value').val()+","+$('#lng3_value').val(); var dropoff = $('#lat4_value').val()+","+$('#lng4_value').val(); var bookingtime = timeCheck($('#return_time').val()); var bookingdate = dateformat($('#return_date').val()); $(".loader, .bgloader").show(); var dataString = {city: setCity, km: $("#return_km_est").val(), duration: $("#return_time_est").val(), pax: pass, seats: seats, time: bookingtime, date: bookingdate, airport: return_airport_pickup}; console.log(dataString); $.ajax({ type: "POST", url: "../familyPrice.php", data: dataString, async: true, dataType: 'json', success: function (data) { $(".loader, .bgloader").hide(); console.log(data); response = data; if(setCity != "perth") { getTolls(returnLineArray, response, true); } else { postPrice(response, true); } }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); $(".loader, .bgloader").hide(); } }) } } function directions() { if($('#lat1_value').val() != "" && $('#lat2_value').val() != "") { calculateAndDisplayRoute(directionsService, directionsDisplay); } if($('#lat3_value').val() != "" && $('#lat4_value').val() != "") { calculateAndDisplayRoute_return(directionsService, directionsDisplay_return); } } function isNumber(obj) { return !isNaN(parseFloat(obj)) } function checkLuhn(input) { var sum = 0; var numdigits = input.length; var parity = numdigits % 2; for(var i=0; i < numdigits; i++) { var digit = parseInt(input.charAt(i)) if(i % 2 == parity) digit *= 2; if(digit > 9) digit -= 9; sum += digit; } return (sum % 10) == 0; } function unpackLatlng(latlngarray) { var paths = []; for (var i = 0; i < latlngarray.length; i++) { paths.push(new google.maps.LatLng(latlngarray[i][0], latlngarray[i][1])); } //console.dir(paths); return paths } function checkPoint(array, point) { var coordsArray = array; var coords = unpackLatlng(coordsArray); var poly = new google.maps.Polygon({ paths: coords, }); //poly.setMap(map); if(google.maps.geometry.poly.containsLocation(point, poly) == true) { return true; } else { return false; } } function checkLocation(point, city) { for(var i=0; i < locations.length; i++) { if(city != "") { if(locations[i].city == city) { if(checkPoint(locations[i].array, point)) { return {city: locations[i].city, airport: locations[i].airport}; } } } else { if(checkPoint(locations[i].array, point)) { return {city: locations[i].city, airport: locations[i].airport}; } } } return false; } function setCityFromButton(city) { modal.style.display = "none"; setCity = city; initAutocomplete(); getTerminals(lastClicked, city); } function setTerminal(id, i) { var cityArray = terminals[setCity]; $(id).val(cityArray[i].name); if(id == "#pickup") { $("#lat1_value").val(cityArray[i].lat); $("#lng1_value").val(cityArray[i].long); } else if(id == "#dropoff") { $("#lat2_value").val(cityArray[i].lat); $("#lng2_value").val(cityArray[i].long); } else if(id == "#return_pickup") { $("#lat3_value").val(cityArray[i].lat); $("#lng3_value").val(cityArray[i].long); } else if(id == "#return_dropoff") { $("#lat4_value").val(cityArray[i].lat); $("#lng4_value").val(cityArray[i].long); } setMarker(id, parseFloat(cityArray[i].lat), parseFloat(cityArray[i].long)); } function removeTerminals(id) { var row; if(id == "#pickup") { airport_pickup = false; row = "#terminalsRow1"; } else if(id == "#dropoff") { row = "#terminalsRow2"; } else if(id == "#return_pickup") { return_airport_pickup = false; row = "#terminalsRow3"; } else if(id == "#return_dropoff") { row = "#terminalsRow4"; } $(id).val(""); $(row).html(""); } function getTerminals(id, city) { if(city == "") { lastClicked = id; modal.style.display = "block"; return; } var row; if(id == "#pickup") { airport_pickup = true; if($("#flight_number").val() == "N/A") { $("#flight_number").val(''); } if(quoteCheck != "1") { $(".pickup_div_t, .flight_time").show(); $("#flight_number, #pickup_time").attr('required', 'required'); } document.getElementsByName('time')[0].placeholder='Flight Arrival Time'; row = "#terminalsRow1"; } else if(id == "#dropoff") { row = "#terminalsRow2"; } else if(id == "#return_pickup") { return_airport_pickup = true; if($("#return_flight_number").val() == "N/A") { $("#return_flight_number").val(''); } if(quoteCheck != "1") { $(".return_pickup_div_t, .return_flight_time").show(); $("#return_flight_number, #return_pickup_time").attr('required', 'required'); } document.getElementsByName('return_time')[0].placeholder='Flight Arrival Time'; row = "#terminalsRow3"; } else if(id == "#return_dropoff") { row = "#terminalsRow4"; } var cityArray = terminals[city]; $(row).html(""); var col = 12 / cityArray.length; var html = '<div class="btn-group col-xs-12 col-md-6" data-toggle="buttons">'; for(var i = 0; i < cityArray.length; i++) { var x = i + 1; html += '<label onclick="setTerminal(`' + id + '`, `' + i + '`);" class="col-xs-' + col + ' btn btn-primary"><input type="radio" id="t' + x + '" value="t' + x + '" autocomplete="off">' + cityArray[i].buttonLabel + '</label>'; } html += '</div>'; $(row).html(html); } function getPoly() { $.ajax({ type: "GET", url: "array.php", dataType: 'json', success: function (data) { console.log(data.areas); locations = data.areas; var cities = new Array(); for(i = 0; i < data.areas.length; i++) { var str = data.areas[i].city; str = str.toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase(); }); if(jQuery.inArray(str, cities) === -1) { cities.push(str); } } cities.sort(); var html = ""; for(i = 0; i < cities.length; i++) { html += "<div style='margin-top: 10px;' class='row'><div class='col-xs-12 text-center'><div class='col-xs-3'></div><button class='btn btn-primary col-xs-6' onclick='setCityFromButton(`" + cities[i].toLowerCase() + "`)'>" + cities[i] + "</button><div class='col-xs-3'></div></div></div>"; } $("#modal-body").html(html); terminals = data.terminals; /*for(var i=0; i < data.length; i++) { var coordsArray = data[i].array; var coords = unpackLatlng(coordsArray); var poly = new google.maps.Polygon({ paths: coords, strokeColor: '#0000FF', strokeOpacity: 0.8, strokeWeight: 1, fillColor: '#0000FF', fillOpacity: 0.1 }); poly.setMap(map); }*/ } }) } </script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDUMedFP8nXhHL-T54w37TPhj4oj0dl-6c&libraries=places,geometry&callback=initAutocomplete" async defer></script> <script> //submitHandler: function(form) { // $(".loader, .bgloader").show(); // eCrypt.submitForm(); // }, //invalidHandler: function(event, validator) { // this.onsubmit = null; // }, </script> </body> </html>
Save
cmd:
run