<?php include_once('includes.php'); ?>
<?php
if(isset($_GET['submitList']))
{
//unset($_SESSION['registration']['customer']);
foreach($_GET as $key => $val)
{
$_SESSION['registration']['customer'][$key] = $val;
}
?>
document.getElementById('emailFrame').src = 'http://ar.absoluteresults.com/digital2013/paymentEmail.php?regID=<?= urlencode(serialize($_SESSION['registration'])) ?>';
<?php
exit;
}
if(isset($_GET['complete'])) $_SESSION['offers'][$currentPage]['complete'] = true;
?>
<?php include_once('header.php'); ?>
<script src="scripts/ajax.js" language="javascript"></script>
<script>
function submitList()
{
htmlStr = 'payment.php?submitList=';
var arrRequired = new Array('fullname','email','postalCode','mobilePhone','currentPayment');
var arr = new Array('fullname','email','postalCode','mobilePhone','currentPayment');
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);
}
function emailSent()
{
if(document.getElementById('emailFrame').src != "")
{
//alert('Thank you for your submission.\nPlease check your email for details.');
location.href = 'payment.php?complete';
//document.getElementById('submitButton').disabled = false;
//document.getElementById('submitButton').value = 'See Offer';
}
}
</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">
<?php if(!isset($_GET['complete'])) { ?>
<font style="font-weight:bold;font-size:18pt">Fill out the information below<br>to see what vehicles you can get for the<br>same monthly payment!*</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="height:20px"></td></tr>
</table>
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<th>What is your Current Monthly Payment?</th>
</tr>
<tr>
<td><input type="text" style="width:400px" id="currentPayment" name="currentPayment" value="<?= $_SESSION['registration']['customer']['currentPayment'] ?>"></td>
</tr>
</table>
<br>
<input type="button" id="submitButton" value="See the Options" onClick="submitList()" style="font-weight:bold;font-size:16pt;background-color:#efd23b;width:330px">
</form>
<?php } else { ?>
<font style="font-weight:bold;font-size:25pt">
Thank You.
</font>
<br>
<font style="font-weight:bold;font-size:15pt">
Here are the results.
</font>
<br>
<br>
<div style="height:180px" id="vehiclesList">
<script type="text/javascript" src="scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="scripts/jquery.carouFredSel-6.2.1.js"></script>
<div id="carousel">
<?php
$currentPayment = preg_replace("/[^0-9]/","",$_SESSION['registration']['customer']['currentPayment']);
$noMatch = true;
foreach($daaVehicles[$area] as $vehicle => $info)
{
if($info['payment'] > 100 & (($info['payment'] * 26)/12) > $currentPayment) continue;
$noMatch = false;
?>
<div style="padding-bottom:10px">
<table cellspacing="0" cellpadding="0" style="background-color:white;padding:10px;border:1px solid #838383;width:460px;height:180px">
<tr>
<td><img src="images/vehicles/<?= $vehicle ?>.png"></td>
<td style="padding-left:30px;">
<table cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" style="font-size:15pt;padding-bottom:10px"><b><?= strtoupper($info['description']) ?></b></td>
</tr>
<tr>
<td colspan="2" style="vertical-align:top"><sup>FROM</sup></td>
</tr>
<tr>
<td style="font-size:40pt;font-weight:bold;color:#9e0000">$<?= $info['payment'] ?></td>
<td style="vertical-align:bottom;padding-left:10px"><sup>BI-WEEKLY</sup></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?php } ?>
<?php if($noMatch) { ?>
<div style="color:red"><i>No matches found.</i></div>
<?php } ?>
</div>
<div class="prev" id="carousel_prev" onMouseOver="this.style.cursor='pointer'" style="position:relative;top:-200px;left:445px"><img src="images/upButton.png" border="0"></div>
<div class="next" id="carousel_next" onMouseOver="this.style.cursor='pointer'" style="position:relative;top:-75px;left:445px"><img src="images/downButton.png" border="0"></div>
</div>
<script>
$(document).ready(function() {
// Using custom configuration
$("#carousel").carouFredSel({
items : 1,
direction : "down",
circular : true,
infinite : true,
auto : false,
prev : {
button : "#carousel_prev",
key : "left"
},
next : {
button : "#carousel_next",
key : "right"
}
});
});
</script>
<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 } ?>
<?php } ?>
</td>
<td style="color:white;padding-top:50px;text-align:left;font-size:15pt;vertical-align:top">
Right now the high value of used vehicles
and amazing discounts on new trucks
means we are able to offer many customers
a brand new Ram Truck at the exact
same payment they are making on their
old vehicle. Simply fill out the form to see if
you qualify!
<br><br>
<div style="width:400px;text-align:right;font-size:9pt">* Terms and conditions apply. OAC</div>
<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'); ?>