<?php
include_once('includes.php');
include_once('displayUtils.php');
if(isset($_GET['submitList']))
{
unset($_SESSION['registration']['customer']);
foreach($_GET as $key => $val)
{
$_SESSION['registration']['customer'][$key] = $val;
}
?>
document.getElementById('emailFrame').src = 'https://ar.absoluteresults.com/rsvplexus/appointmentEmail.php?regID=<?= urlencode(serialize($_SESSION['registration'])) ?>';
document.getElementById('dealerEmailFrame').src = 'https://ar.absoluteresults.com/rsvplexus/dealerEmail.php?regID=<?= urlencode(serialize($_SESSION['registration'])) ?>';
document.getElementById('testDiv').innerHTML = '';
<?php
exit;
}
?>
<html>
<head>
<script src="scripts/ajax.js" language="javascript"></script>
<script>
function submitList()
{
htmlStr = 'appointment.php?submitList=';
var arr = new Array('firstname','lastname','email','mobilePhone','postalCode','nextVehicleModel','dateRange');
for (var i = 0; i < arr.length; i++)
{
if(document.getElementById(arr[i]).value == "")
{
alert('Please complete all the fields to get your bonus coupon.\nThank you.');
return false;
}
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.');
document.getElementById('submitButton').disabled = false;
document.getElementById('submitButton').value = 'Submit';
parent.$.fancybox.close();
}
}
</script>
<style>
.formTbl {height:100px}
.formTbl td,.formTbl th {font-family:arial;padding-right:20px;height:23px;text-align:left}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<td colspan="2" style="padding-bottom:20px;font-size:11pt">
<b>Register to get a Special Gift with your Test Drive.</b>
<br>
Begin by filling out the form below.
</td>
</tr>
<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 Code</th>
<td><input type="text" style="width:200px" id="postalCode" name="postalCode" value="<?= $_SESSION['registration']['customer']['postalCode'] ?>"></td>
</tr>
</table>
</td>
<td style="vertical-align:top;">
<table cellspacing="0" cellpadding="0" class="formTbl">
<tr>
<th>What vehicle are you interested in?</th>
</tr>
<tr>
<td style=""><input type="text" id="nextVehicleModel" name="nextVehicleModel" style="width:200px"></td>
</tr>
<tr>
<th>When are you in the market?</th>
</tr>
<tr>
<td>
<select id="dateRange" name="dateRange">
<option></option>
<option value="0 - 3 Months">0 - 3 Months</option>
<option value="4 - 6 Months">4 - 6 Months</option>
<option value="6+ Months">6+ Months</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br><br>
<center>
<input type="button" id="submitButton" style="font-size:20pt;padding:10px;" value="Submit" onClick="submitList()">
</center>
<iframe id="emailFrame" height="0" width="0" frameborder="0" onload="emailSent()"></iframe>
<iframe id="dealerEmailFrame" height="0" width="0" frameborder="0"></iframe>
<div id="testDiv"></div>
</body>
</html>