<?php
include_once('includes.php');
include_once('displayUtils.php');
$area = $dealerInfo[$_SESSION['registration']['selectedDealer']]['area'];
if(!isset($daaVehicles[$area])) $area = 'bc';
if(isset($_GET['submitList']))
{
unset($_SESSION['registration']['customer']);
foreach($_GET as $key => $val)
{
$_SESSION['registration']['customer'][$key] = $val;
}
$_SESSION['registration']['customer']['selectedVehicle'] = $_GET['submitList'];
?>
document.getElementById('emailFrame').src = 'http://ar.absoluteresults.com/greatestautosale2013/paymentEmail.php?regID=<?= urlencode(serialize($_SESSION['registration'])) ?>';
//document.getElementById('testDiv').innerHTML = '<?= ajaxHTML('http://ar.absoluteresults.com/rsvplexus/appointmentEmail.php?regID=' . urlencode(serialize($_SESSION['registration']))) ?>';
<?php
exit;
}
?>
<html>
<head>
<script src="scripts/ajax.js" language="javascript"></script>
<style>
.formTbl {height:100px}
.formTbl td,.formTbl th {font-family:arial;padding-right:20px;height:23px;text-align:left}
</style>
<script>
function viewVehicles()
{
var myPayment = document.getElementById('payment').value.replace(/\D/g, '' );
document.getElementById('vehiclesList').style.display = 'block';
}
var currentVehicle = '';
function submitList(vehicleButton)
{
currentVehicle = vehicleButton;
htmlStr = 'payment.php?submitList=' + vehicleButton;
var arr = new Array('firstname','lastname','email','postalCode','mobilePhone','payment');
var arrRequired = new Array('firstname','lastname','email','postalCode','mobilePhone','payment');
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(currentVehicle+'Button').value = 'Please wait...';
document.getElementById(currentVehicle+'Button').disabled = true;
ajax_do(htmlStr);
}
function emailSent()
{
if(document.getElementById('emailFrame').src != "")
{
alert('Thank you for your submission.\nPlease check your email for details.');
document.getElementById(currentVehicle+'Button').disabled = false;
document.getElementById(currentVehicle+'Button').value = 'Email Payment';
//parent.$.fancybox.close();
}
}
</script>
</head>
<body>
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<td style="vertical-align:top;width:350px">
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<th>First Name</th>
<td><input type="text" style="width:200px" id="firstname" name="firstname" value="<?= $_SESSION['registration']['customer']['firstname'] ?>"></td>
</tr>
<tr>
<th>Last Name</th>
<td><input type="text" style="width:200px" id="lastname" name="lastname" value="<?= $_SESSION['registration']['customer']['lastname'] ?>"></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/Zip Code</th>
<td><input type="text" style="width:200px" id="postalCode" name="postalCode" value="<?= $_SESSION['registration']['customer']['postalCode'] ?>"></td>
</tr>
</table>
</td>
<td style="font-size:15pt;vertical-align:top">
<table cellspacing="0" cellpadding="0">
<tr>
<td style="font-size:12pt" nowrap><b>What is your Current<br>Monthly Payment?</b></td>
</tr>
<tr>
<td style="padding-top:10px;vertical-align:middle"><input type="text" style="font-size:18pt;width:220px" id="payment"></td>
</tr>
</table>
</td>
</tr>
</table>
<br><br>
<div id="vehiclesList" style="overflow:auto;height:300px;display:block">
<table cellspacing="0" cellpadding="0" class="formTbl">
<?php foreach($daaVehicles[$area] as $vehicle => $info) { ?>
<tr>
<td><img src="images/vehicles/<?= $vehicle ?>.png"></td>
<td style="padding-left:50px;">
<table cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" style="font-size:15pt;padding-bottom:10px"><b><?= strtoupper($info['description']) ?></b></td>
</tr>
<!--
<tr>
<td style="vertical-align:top"><sup>FROM</sup></td>
<td style="font-size:40pt;font-weight:bold;color:#9e0000">$ <?= $info['payment'] ?></td>
<td style="vertical-align:bottom"><sup>BI-WEEKLY</sup></td>
</tr>
-->
<tr>
<td><input type="button" style="font-size:15pt" value="Email Payment" id="<?= $vehicle ?>Button" onClick="submitList('<?= $vehicle ?>')"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="padding:10px"><div style="border-top:1px solid #ccc;width:100%;height:1px"></div></td>
</tr>
<?php } ?>
</table>
</div><iframe id="emailFrame" height="0" width="0" frameborder="0" onload="emailSent()"></iframe>
</body>
</html>