<?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/freegasEmail.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 = 'freegas.php?submitList=';
var arr = new Array('fullname','email','postalCode','mobilePhone','monthlyGas');
var arrRequired = new Array('fullname','email','postalCode','mobilePhone','monthlyGas');
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 = 'freegas.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 be entered to Win Free Gas for a Year*</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 Monthly Gas Cost?</th>
</tr>
<tr>
<td><input type="text" style="width:400px" id="monthlyGas" name="monthlyGas" value="<?= $_SESSION['registration']['customer']['monthlyGas'] ?>"></td>
</tr>
</table>
<br>
<input type="button" id="submitButton" value="Enter to Win Free Gas" 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>
<br>
<font style="font-weight:bold;font-size:18pt">
You are now entered to<br>Win Free Gas for a Year.
</font>
<br><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 <?= $dealerInfo[$_SESSION['registration']['selectedDealer']]['name'] ?>
is offering you the chance to win free gas
for a year. Register for a test drive on sale
day and you could find yourself with <font style="color:yellow;font-weight:bold">FREE
GAS FOR A WHOLE YEAR!</font>
<br>
<div style="width:400px;text-align:right;font-size:9pt">* $2,500 CDN in gas cards</div>
<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'); ?>