<?php
include_once('includes.php');
if($_SESSION['registration']['selectedDealer'] != "")
{
header('location: saveTruck.php');
exit;
}
if(isset($_GET['submitList']))
{
unset($_SESSION['registration']['customer']);
foreach($_GET as $key => $val)
{
$_SESSION['registration']['customer'][$key] = $val;
}
$dealer = file_get_contents('http://ar.absoluteresults.com/digital0913/latlng.php?pc=' . str_replace(' ','',$_GET['postalCode']));
if(isset($dealerInfo[$dealer]))
{
//$_SESSION['registration']['selectedDealer'] = $dealer;
?>
location.href='http://<?= $dealer ?>';
<?php
}
else
{
?>
alert('Invalid Postal Code');
<?php
}
exit;
}
unset($_SESSION['registration']);
include_once('header.php');
?>
<script src="scripts/ajax.js" language="javascript"></script>
<script>
function submitList()
{
htmlStr = 'index.php?submitList=';
var arr = new Array('postalCode');
var arrRequired = new Array('postalCode');
for (var i = 0; i < arrRequired.length; i++)
{
if(document.getElementById(arrRequired[i]).value == "")
{
alert('Please tell us your postal code to see our offers.\nThank you.');
return false;
}
}
for (var i = 0; i < arr.length; i++)
{
var temp = '';
if(document.getElementById(arr[i]) != undefined) temp=encodeURIComponent(document.getElementById(arr[i]).value);
htmlStr = htmlStr + '&' + arr[i] + '=' + temp;
}
//document.getElementById('submitButton').value = 'Please wait...';
//document.getElementById('submitButton').disabled = true;
ajax_do(htmlStr);
return false;
}
</script>
<div class="container" style="background-color:#163359;padding:10px">
<form method="POST" style="margin:0px" onSubmit="return submitList();">
<div class="sixteen columns" style="background-color:#efefef;">
<div style="padding:20px">
<center>
<label for="postalCode" style="font-size:1.5em;margin-bottom:10px">Please tell us your Postal Code to get started.</label>
<input type="text" id="postalCode" name="postalCode">
<input type="submit" id="submitButton" value="Get Started" style="font-weight:bold;font-size:1.5em;background-color:#efd23b;width:220px;margin-top:10px">
</center>
</div>
</div>
</form>
</div>
<div class="container" style="background-color:#ddd;padding:10px">
<center>
<img src="images/chryslerLogo.png" class="scale-with-grid">
</center>
</div>
<?php include_once('footer.php'); ?>