<?php include_once('includes.php'); ?>
<?php
if(isset($_GET['submitList']))
{
foreach($_GET as $key => $val)
{
$_SESSION['registration']['customer'][$key] = $val;
}
?>
document.getElementById('emailFrame').src = 'http://ar.absoluteresults.com/digital2013/preapproveEmail.php?regID=<?= urlencode(serialize($_SESSION['registration'])) ?>';
<?php
exit;
}
$_SESSION['offers'][$currentPage]['complete'] = true;
?>
<?php include_once('header.php'); ?>
<script src="scripts/ajax.js" language="javascript"></script>
<script>
function submitList()
{
htmlStr = 'preapprove.php?submitList=';
var arr = new Array('fullname','email','postalCode','mobilePhone');
var arrRequired = new Array('fullname','email','postalCode','mobilePhone');
for (var i = 0; i < arrRequired.length; i++)
{
if(document.getElementById(arrRequired[i]).value == "")
{
alert('Please complete all the required fields to see your offer.\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 true;
}
function emailSent()
{
if(document.getElementById('emailFrame').src != "")
{
document.getElementById('submitButton').value = 'Get Pre-Approved';
document.getElementById('submitButton').disabled = false;
}
}
</script>
<style>
.formTbl th,.formTbl td {text-align:left;padding-right:10px}
</style>
<table cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<td style="width:530px;padding:20px 0px 0px 40px;font-size:15pt;text-align:left;vertical-align:top">
<font style="font-weight:bold;font-size:18pt">Fill out the information below<br>to initiate the online credit application.</font>
<br><br>
<form method="POST">
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<th>First & Last Name</th>
<td><input type="text" style="width:200px" id="fullname" name="fullname" value="<?= $_SESSION['registration']['customer']['fullname'] ?>"></td>
</tr>
<tr>
<th>Email</th>
<td><input type="text" style="width:200px" id="email" name="email" value="<?= $_SESSION['registration']['customer']['email'] ?>"></td>
</tr>
<tr>
<th>Mobile Phone</th>
<td><input type="text" style="width:200px" id="mobilePhone" name="mobilePhone" value="<?= $_SESSION['registration']['customer']['mobilePhone'] ?>"></td>
</tr>
<tr>
<th>Postal Code</th>
<td><input type="text" style="width:200px" id="postalCode" name="postalCode" value="<?= $_SESSION['registration']['customer']['postalCode'] ?>"></td>
</tr>
<tr>
<td colspan="2" style="padding-top:20px">
<input type="button" id="submitButton" onClick="if(submitList()) window.open('<?= $dealerInfo[$_SESSION['registration']['selectedDealer']]['preapproval'] ?>');" value="Get Pre-Approved" style="font-weight:bold;font-size:16pt;background-color:#efd23b;width:330px">
</td>
</tr>
</table>
</form>
<br>
<?php if($nextOffer != "") { ?>
<div style="font-size:12pt"><i>Want another offer?</i></div>
<a href="<?= $nextOffer ?>.php"><img src="images/<?= $nextOffer ?>Button.png" border="0"></a>
<?php } ?>
</td>
<td style="color:white;padding-top:50px;text-align:left;font-size:15pt;vertical-align:top">
As a Convenience, many customers are
getting pre-approved for a new vehicle
before they start shopping. Fill out the
information on the left to receive your
pre-approval form.
<br><br>
<img src="images/<?= $currentPage ?>Image.png">
</td>
</tr>
</table>
<iframe id="emailFrame" height="0" width="0" frameborder="0" onload="emailSent()"></iframe>
<?php include_once('footer.php'); ?>