<?php
//$APIKEY = $_GET['apikey'];
if(empty($APIKEY)){$APIKEY = $_GET['apikey'];}
	//Lennox.com Product API URL for Product Categories
	//LIVE PROMO API URL - will return promo ONLY IF one is currently active
	$api_url = "http://lennox.com/api/v1/" . $APIKEY . "/promotions/";
	
	//FOR TESTING ONLY - will always return promo info
	$api_url = "http://lennox.com/api/v1/" . $APIKEY . "/promotions/";
//http://lennox.com/api/v1/8A0QHTd/promotions/

	//use the handy SimpleXML file loader
	$xml = simplexml_load_file($api_url);
	//SimpleXML will either return FALSE is unsuccessful
	//or an XML object if successful.
	if ($xml) {

		if ($xml->Promotion) {
			$promo = $xml->Promotion;
			
?>

                        <div id="Promo">
<?			if ($promo->Page->Headline): ?>					
                                <h1><?=$promo->Page->Headline?></h1>
<?			endif; ?>
<?			if ($promo->Page->Image): ?>
                                <img src="<?=$promo->Page->Image?>" alt=""><br />
<?			endif; ?>

<?			if ($promo->Page->Body): ?>
								<?=$promo->Page->Body?>
<?			endif; ?>								
<?			if ($promo->Page->Details): ?>
                                <?=$promo->Page->Details?>
<?			endif; ?>                            
<?			if ($promo->Page->Disclaimer): ?>
                                <?=$promo->Page->Disclaimer?>
<?			endif; ?>                            
                        </div>
<?php
	} else { 
	//IF NO PROMO
?>
	<center><h1>No Current Promos - check back soon!</h1></center>
	<!--<h1>Consumer Promotion coming March 26, 2012!</h1>
<p>Receive up to <strong>$2,200</strong> in rebates on a qualifying heating and cooling system. Individual unit rebates will also be available.
Click on the Energy Calculator on the right to determine your annual savings when you install a high-efficiency heating and cooling system.
You may also qualify for rebates through your local utility provider.
Check back with us on March 26th for complete details of the Lennox Consumer Promotion.
</p>

<p>Click on the Energy Calculator on the right to determine your annual savings when you install a high-efficiency heating and cooling system.
<br /><br />
You may also qualify for rebates through your local utility provider.
</p>-->
<?php
	}	// if xml->PROMOTIONS
} else {
	echo "There has been an error retrieving the XML.";
	exit();
}
?>
<div style="min-height:620px;"></div>