MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/absoluteresultstechnologies.net/public_html/winaram/
File Upload :
Current < : /hermes/bosweb/b1705/absoluteresultstechnologies.net/public_html/winaram/form.php

<?php include_once('includes.php'); ?>
<?php
	include_once('displayUtils.php');
	$bbLink = 'http://xml.canadianblackbook.com/XMLWebServices/service?&account=absolute_xml&key=Dgje48Sw39&schemaVersion=3.0&';
	
	$lists = array('years','makes','models','trims','styles');
	
	if(isset($_GET['getList']))
	{
		$curKey = array_search($_GET['getList'],$lists);
 		
   		if($_GET['getList'] == 'years')
   		{
			$xml = simplexml_load_file($bbLink . 'command=' . $_GET['getList']);
   			$list = $xml->response->years->year;
   			
   			if($list == '') exit;
   		}
   		else if($_GET['getList'] == 'makes')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&command=' . $_GET['getList']);
			$list = $xml->response->makes->make;
   			if($list == '') exit;
		}
   		else if($_GET['getList'] == 'models')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&make=' . urlencode($_GET['make']) . '&command=' . $_GET['getList']);
			$list = $xml->response->models->model;
   			if($list == '') exit;
		}
   		else if($_GET['getList'] == 'trims')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&make=' . urlencode($_GET['make']) . '&model=' . urlencode($_GET['model']) . '&command=' . $_GET['getList']);
			$list = $xml->response->trims->trim;
		}
   		else if($_GET['getList'] == 'styles')
   		{
			$xml = simplexml_load_file($bbLink . 'year=' . $_GET['year'] . '&make=' . urlencode($_GET['make']) . '&model=' . urlencode($_GET['model']) . '&trim=' . urlencode($_GET['trim']) . '&command=' . $_GET['getList']);
			$list = $xml->response->styles->style;
		}
   		
   		$html = '<select id="' . $_GET['getList'] . '" name="' . $_GET['getList'] . '"' . ($curKey < (count($lists)-1) ? ' onChange="getList(\'' .  $lists[$curKey+1] . '\')"' : '') . '>';
   		
   		if(count($list) > 1) $html .= '<option value=""></option>';
   		if($list == '') $html .= '<option value="">None</option>';
   		
   		foreach($list as $item)
   		{
   			$html .= '<option value="' . $item . '">' . $item . '</option>';
   		}
   		$html .= '</select>';
   		?>
   		document.getElementById('<?= $_GET['getList'] ?>Div').innerHTML = '<?= ajaxHTML($html) ?>';
   		<?php
   		
   		for($i = ($curKey+1); $i < count($lists); $i++)
   		{
	   		?>
	   		document.getElementById('<?= $lists[$i] ?>Div').innerHTML = '';
	   		<?php
   		}
   		
   		if(($curKey < (count($lists)-1)) && count($list) == 1)
   		{
	   		?>
	   		getList('<?= $lists[$curKey+1]?>');
	   		<?php   			
   		}
   		
   		exit;
	}
	
	if(isset($_POST['rateVideo']))
	{
		unset($_SESSION['tradeup3q']);
		$_SESSION['tradeup3q'] = $_POST;		
		
	//	$xml = simplexml_load_file($bbLink . 'kilometers=' . ereg_replace("[^0-9]", "", $_SESSION['tradeup']['kilometers']) . '&year=' . $_SESSION['tradeup']['years'] . '&make=' . urlencode($_SESSION['tradeup']['makes']) . '&model=' . urlencode($_SESSION['tradeup']['models']) . '&trim=' . urlencode($_SESSION['tradeup']['trims']) . '&style=' . urlencode($_SESSION['tradeup']['styles']) . '&command=priceVehicle');
	//	$list = $xml->response->vehicles->vehicle->values;
	//	$_SESSION['tradeup']['values'] = get_object_vars ($list);
			
		header("location: form.php?p=tim");
		exit;		
	}
	
	if(isset($_POST['firstname']))
	{
		//unset($_SESSION['tradeup']);
		if(!$_SESSION['tradeup3q']) $_SESSION['tradeup3q'] = array();
		$_SESSION['tradeup'] = array_merge($_SESSION['tradeup3q'],$_POST);		
		$_SESSION['tradeup']['p'] = $_GET['p'];
		
		$xml = simplexml_load_file($bbLink . 'kilometers=' . ereg_replace("[^0-9]", "", $_SESSION['tradeup']['kilometers']) . '&year=' . $_SESSION['tradeup']['years'] . '&make=' . urlencode($_SESSION['tradeup']['makes']) . '&model=' . urlencode($_SESSION['tradeup']['models']) . '&trim=' . urlencode($_SESSION['tradeup']['trims']) . '&style=' . urlencode($_SESSION['tradeup']['styles']) . '&command=priceVehicle');
		$list = $xml->response->vehicles->vehicle->values;
		$_SESSION['tradeup']['values'] = get_object_vars ($list);
			
		header("location: success.php");
		exit;		
	}
?>
<?php include_once('header.php'); ?>
<script src="scripts/ajax.js" language="javascript"></script>
<script>
	function getList(val)
	{
		year = '';
		make = '';
		model = '';
		trim = '';
		styleVal = '';
		if(document.getElementById('years') != undefined) year=document.getElementById('years').value;
		if(document.getElementById('makes') != undefined) make=document.getElementById('makes').value;
		if(document.getElementById('models') != undefined) model=document.getElementById('models').value;
		if(document.getElementById('trims') != undefined) trim=document.getElementById('trims').value;
		if(document.getElementById('styles') != undefined) styleVal=document.getElementById('styles').value;
		
		htmlStr = 'form.php?getList=' + val + '&year=' + year.replace(/&/,"%26") + '&make=' + make.replace(/&/,"%26") + '&model=' + model.replace(/&/,"%26") + '&trim=' + trim.replace(/&/,"%26") + '&style=' + styleVal.replace(/&/,"%26");
		//htmlStr = 'index.php?getList=' + val + '&year=' + year + '&make=' + make + '&model=' + model + '&trim=' + trim + '&style=' + styleVal;
		//alert(htmlStr);
		ajax_do(htmlStr);
	}
	
	function checkForm()
	{
		if(document.getElementById('firstname').value == "")
		{
			alert('Please tell us your first name.');
			return false;
		}
		else if(document.getElementById('lastname').value == "")
		{
			alert('Please tell us your last name.');
			return false;
		}
		else if(document.getElementById('mobile').value == "")
		{
			alert('Please tell us your mobile phone.');
			return false;
		}
		else if(document.getElementById('email').value == "")
		{
			alert('Please tell us your email address.');
			return false;
		}
		else if(document.getElementById('postalCode').value == "")
		{
			alert('Please tell us your Postal Code.');
			return false;
		}
		else if(false && document.getElementById('kilometers').value == "")
		{
			alert('Please tell us the kilometers of your trade in.');
			return false;
		}
		else if(false && (document.getElementById('styles') == undefined || document.getElementById('styles').value == ""))
		{
			alert('Please tell us information about your current vehicle.');
			return false;
		}
		else
		{
			return true;
		}
		
	}
</script>
<style>
	.formTbl td {padding-bottom:2px;height:25px}
	.formTbl td input {width:160px}
</style>
<center>
<table cellspacing="0" cellpadding="0">
	<tr>
		<td style="padding-left:40px;text-align:left;">
			<center>
			<div style="color:white;background-color:#000;padding-top:10px;text-align:left;">
				<br>
				<form method="POST" onSubmit="return checkForm()">
	<?php if($_GET['p'] == 'win') { ?>	
					<!--<font style="font-size:15pt"><b><center>YOU HAVE A <font style="color:yellow">1 IN 500 CHANCE </font>TO WIN A 2013 RAM!</b></font> Fill in your info below and come in to test drive the new <b><i>2013 RAM</b></i> to enter!</center><br> -->

					<font style="font-size:15pt"><b><center>ENTER TO WIN A 2013 RAM!</b></font><br>Fill in your info below and come in to test drive the new <b><i>2013 RAM</b></i> to enter!<br>
<font style="color:yellow">(Estimated chances to win: 1 in 5000)</font></center><br>
	
	<?php } else if($_GET['p'] == '3q') { ?>	
					<font style="font-size:15pt"><b><center>GET A <font style="color:yellow">TIM HORTON'S </font>GIFT CARD!</b></font> Watch the RAM video and answer the 3 questions below!</center><br>
	<?php } ?>					
					<table cellspacing="0" cellpadding="0" style="width:100%">
						<tr>
	<?php if($_GET['p'] == 'win') { ?>	
							<td style="padding:5px 0px;width:350px;">
								<table cellspacing="0" cellpadding="0" class="formTbl">
									<tr>
										<td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center">Pick a day for your test drive!</td>
									</tr>									
									<tr>
										<td style="white-space:nowrap;color:#FFF;"></td>
									</tr>
									<tr>
										<td style="font-size:15pt;font-weight:bold">
											<center>
											APRIL  
											<select name="testDriveDate" style="font-size:15pt">
												<option value=""></option>
			<?php for($i=15;$i<=30;$i++) { ?>
												<option value="<?= $i ?>"><?= $i ?></option>
			<?php } ?>
												<option value="Do Not Know">Don't Know Yet</option>
											</select>
											 2013
											</center>
										</td>
									</tr>
								</table>	
							</td>
	<?php } ?>			
	<?php if($_GET['p'] == '3q') { ?>	
							<td style="padding:5px 0px;width:400px;">
									<video width="380" controls autoplay>
									   <source src="video/ram.mp4" type="video/mp4">
									   <source src="video/ram.webm" type="video/webm">
									  <a href="http://youtu.be/IMxwGkwJWzw" target="_blank"><img src="http://img.youtube.com/vi/IMxwGkwJWzw/0.jpg" border="0"></a>
									 </video> 
							</td>
							<td style="padding:5px 0px;width:380px;">
								<table cellspacing="0" cellpadding="0" class="formTbl">

									<!--<tr>
										<td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:white;font-weight:bold;text-align:center"><b>Answer <font style="color:yellow">3 Little Questions</font> <br>to get your Tim Horton's Gift Card!</b></td>
									</tr> -->

									<tr>
										<td style="white-space:nowrap;color:#FFF;">Tell us what you are driving now!</td>
									</tr>
									<tr>
										<td><input type="text" id="models" name="models" style="width:300px" value="<?= $_SESSION['tradeup']['models'] ?>"></td>
									</tr>
									<tr>
										<td style="white-space:nowrap;color:#FFF;">Rate our Video</td>
									</tr>
									<tr>
										<td>
											<select name="rateVideo" style="font-size:15pt">
												<option value=""></option>
			<?php for($i=1;$i<=10;$i++) { ?>
												<option value="<?= $i ?>"><?= ($i == 10 ? '10 - Best' : $i) ?></option>
			<?php } ?>
											</select>
										</td>
									</tr>
									<!--
									<tr>
										<td style="color:#fff;">What do you love about the RAM?</td>
									</tr>
									<tr>
										<td><input type="text" id="loveRAM" style="width:400px" name="loveRAM" value="<?= $_SESSION['tradeup']['loveRAM'] ?>"></td>
									</tr>
									-->
									<tr>
										<td style="color:#fff;">How soon would you like to upgrade<br>your vehicle?</td>
									</tr>
									<tr>
										<td>
											<select name="dateRange" style="font-size:15pt">
												<option value=""></option>
												<option value="0 - 3 Months">0 - 3 months</option>
												<option value="3 - 6 Months">3 - 6 months</option>
												<option value="6 - 12 Months">6 - 12 months</option>
												<option value="12+ Months">12+ months</option>
											</select>
										</td>
									</tr>
								</table>	
							</td>
	<?php } ?>			
	<?php if($_GET['p'] != '3q') { ?>					

							<td style="padding:5px 0px;width:300px;">
								<table cellspacing="0" cellpadding="0" class="formTbl">
								<tr>
	<?php if($_GET['p'] == 'tim') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:14pt;color:yellow;font-weight:bold;text-align:center">Thanks for watching our video.<br><br>Tell us who you are so we can give you a Tim's Card<br></td><?php } ?>
	<?php if($_GET['p'] == 'win') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:14pt;color:yellow;font-weight:bold;text-align:center">Your registration info!<br></td><?php } ?>
	<?php if($_GET['p'] == '') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:14pt;color:yellow;font-weight:bold;text-align:center">Your registration info!<br></td><?php } ?>

									</tr> 
									<tr>
										<td style="width:100px; color:#FFF;padding:4px 0;">First Name</td>
										<td><input type="text" id="firstname" name="firstname" value="<?= $_SESSION['tradeup']['firstname'] ?>"></td>
									</tr>
									<tr>
										<td style="color:#fff;padding:4px 0;">Last Name</td>
										<td><input type="text" id="lastname" name="lastname" value="<?= $_SESSION['tradeup']['lastname'] ?>"></td>
									</tr>
									<tr>
										<td style="color:#fff;padding:2px 0;">Mobile Phone  <a style="font-size: 8px; color: #AD9A84;float: right;margin-right: 4px;text-decoration: none; outline: none;" href="#" onClick="alert('You agree to receive text messages and other future promotional communications.')">* disclaimer</a></td>
										<td><input type="text" id="mobile" name="mobile" value="<?= $_SESSION['tradeup']['mobile'] ?>"></td>
									</tr>
									<tr>
									<td style="color:#fff;padding:4px 0;">Email</td>
										<td><input type="text" id="email" name="email" value="<?= $_SESSION['tradeup']['email'] ?>"></td>
									</tr>
									<tr>
										<td style="color:#fff;padding:4px 0;">Postal Code</td>
										<td><input type="text" id="postalCode" name="postalCode" value="<?= $_SESSION['tradeup']['postalCode'] ?>"></td>
									</tr>
								</table>	
							</td>
	<?php } ?>							
	<?php if(!isset($_GET['p'])) { ?>	
							<td style="padding:5px 10px;padding-bottom:10px;width:250px;background-color:#222">
								<table cellspacing="0" cellpadding="0" class="formTbl" style="width:100%">
									<tr>
										<td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center"><b>What are you driving?</b>
											<br>
											<font style="color:#777;font-size:9pt">Canadian Black Book appraisal</font>
										</td>
									</tr>
									<tr>
										<td style="width:50px; color:#fff;">Year</td>
										<td style=""><div id="yearsDiv" style="display:inline"></div></td>
									</tr>
									<tr>
										<td style="color:#fff;">Make</td>
										<td><div id="makesDiv" style="display:inline"></div></td>
									</tr>
									<tr>
										<td style="color:#fff;">Model</td>
										<td><div id="modelsDiv" style="display:inline"></div></td>
									</tr>
									<tr>
										<td style="color:#fff;">Trim</td>
										<td><div id="trimsDiv" style="display:inline"></div></td>
									</tr>
									<tr>
										<td style="color:#fff;">Style</td>
										<td><div id="stylesDiv" style="display:inline"></div></td>
									</tr>
									<tr>
										<td style="color:#fff;">KM</td>
										<td><input type="text" style="width:100px" id="kilometers" name="kilometers" value="<?= $_SESSION['tradeup']['kilometers'] ?>"></td>
									</tr>
								</table>	
							</td>
	<?php } ?>			
							<td style="padding:5px 15px;width:250px;vertical-align:top">
								<!--
								<table cellspacing="0" cellpadding="0" class="formTbl">
									<tr>
										<td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center"><b>When are you in-market for your next vehicle?</b></td>
									</tr>
									<tr>
										<td colspan="2" style="padding-bottom:2px;font-size:11pt;vertical-align:bottom; color:#fff;"><center>
											<select name="dateRange" style="font-size:18pt">
												<option></option>
												<option value="0-3 Months">0-3 Months</option>
												<option value="3-6 Months">3-6 Months</option>
												<option value="6-12 Months">6-12 Months</option>
												<option value="12 Months+">12 Months+</option>
											</select>
										</td>
									</tr>
								</table>	
								<br><br>
								-->
								<table cellspacing="0" cellpadding="0">
									<tr>

	<?php if($_GET['p'] == 'win') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center"><b>Our Test Drive Location</b></td><?php } ?>
	<?php if($_GET['p'] == '3q') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center"><b>Our Location</b></td><?php } ?>
	<?php if($_GET['p'] == 'tim') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center"><b>Our Location</b></td><?php } ?>
	<?php if($_GET['p'] == '') { ?><td colspan="2" style="height:60px;padding-bottom:5px;font-size:16pt;color:yellow;font-weight:bold;text-align:center"><b>Our Appraisal Location</b></td><?php } ?>

									</tr>
									<tr>
										<td style="text-align:center;color:white">
											<font style="font-size:15pt;font-family:verdana;color:white;font-weight:bold;"><?= strtoupper($dealerInfo[$selectedDealer]['name']) ?></font>
											<br>
											<font style="font-size:13pt;color:#ddd"><?= $dealerInfo[$selectedDealer]['address'] ?></font>			
											<br>
											<font style="font-size:13pt;color:#ddd"><a href="http://<?= $dealerInfo[$selectedDealer]['website'] ?>" target="_blank"><?= $dealerInfo[$selectedDealer]['website'] ?></a></font>			
											<br>
											<font style="font-size:13pt;color:#EB2443;font-weight: bold;"><?= $dealerInfo[$selectedDealer]['code'] ?></font>			
		
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td  colspan="3" style="padding-top:20px;">
								<center>
									<input type="image" src="images/registerNow.png">
									<br><br>
									<a href="index.php">Back to Home</a>
								</center>
							</td>
						</tr>
					</table>			
				</form>
			</div>
			</center>
		</td>
	</tr>
</table>
</center>
<?php
	if(!isset($_SESSION['webhit']))
	{
		$_SESSION['webhit'] = true;
?>
		<iframe height="0" width="0" src="http://ar.absoluteresults.com/misc/webHits.php?url=<?= str_replace(array('www.'),'',$_SERVER['HTTP_HOST']);	?>&dealer=<?= $_SESSION['tradeup']['selectedDealer'] ?>&eventID=<?= $dealerInfo[$_SESSION['tradeup']['selectedDealer']]['eventID'] ?>" frameborder="0"></iframe>  
<?php
	}
?>		
<script>
	getList('years');
</script>
<?php include_once('footer.php'); ?>