<div id="footer-wrapper">

<div id="footer-top-section">

<div id="footer-top-left-section">

		<div id="footer-logo">
			<a href="indexs.php"><img src="<?php echo $_SESSION[root_path]; ?>custom/images/header-logo.png" alt="<?php include('seotitle.php'); ?>" border="none" /></a>
		</div>

		<div id="footer-map">
 			<?php include('mapurl.php'); ?> 
		</div>

</div>

		<div id="footer-address">
            <p>
            <?php include('address.php') ?><br />
           	<?php include('citystatezip.php') ?><br />
            <span class="phone-number"><?php include('phone.php'); ?></span>
			</p>
            
           <?php 
		   include('./hours.php');
		   include('open_sign.php'); 
		   ?>
		</div>
        
        
        		<div id="footer-hours">
				<p><strong>OUR HOURS:</strong><br />
                <?php  echo $hours; ?></p>
				</div>
        
</div><!-- end footer top-section -->



<div id="bottom-footer-sections">

<div id="footer-inside-wrapper">


<div id="left-section">

	<div id="powered-by">

	<a href="<?php echo $brand_website;?>" target="blank"><img src="<?php echo $brand_site_logo;?>" /></a>

	</div>

</div>

<div id="center-section">
<?php

	$qry1 = "Select * from social_networks where page_url>'' order by order_sequence";
	//echo $qry1;
	$result = mysql_query($qry1);
	//print_r(mysql_fetch_array($result));
	
	if(mysql_num_rows($result)<'1'){
		//no records found, do nothing
	} else {
		echo "<ul>";
		while($data=mysql_fetch_array($result)){
			if(!empty($data[icon_name])){
				$icon_image = "custom/images/icons/".$data[icon_name];
			}
			if(!empty($data[page_url])){
				$network_url = '<a href="' . $data[page_url] . '" target="blank"><img src="'.$icon_image.'"></a>';				
			} else {
				if(!empty($icon_image)){
				$network_url = '<img src="'.$icon_image.'">';
				} else {
					$network_url="";
				}
				
			}
			echo "<li>$network_url</li>";
		}
		echo "</ul>";
	}


?>

</div>

<div id="right-section">

<div id="footer-right">

<?php
	$query="select * from footer_links order by sequence, recordkey";
	$rt=mysql_query($query);


	//get number of rows in footer_links table so we know when last row is reached

	$numResults = mysql_num_rows($rt);

	$counter = 0;

	while($nt=mysql_fetch_array($rt)){

		$counter++;

		if(empty($nt[pageid])){

			//this should be a custom link
			$pos = strpos($nt[url],'www');
			if($pos !==false){
				$target=' target="blank"';
			} else {
				$target="";
			}
			$link = '<a href="'.$nt[url].'" '.$target.'>'.$nt[link_text].'</a>';
		} elseif($nt[pageid]=='1'){
			$link = '<a href="indexs.php">HOME</a>';
		} else {
			$qry = "select * from content where pageID='".$nt[pageid]."'";
			$rt2=mysql_query($qry);  
			while($nt2=mysql_fetch_array($rt2)){
				$permalink = $nt2[permalink];
				$alias = $nt2[alias];
				if(empty($alias)){
					$label = $nt2[pageTitle];
				} else {
					$label=$alias;
				}

				if(empty($permalink)){
					$url = "core.php?pageid=".$nt[pageid];
				} else {
					$url=$permalink;
				}
				$link = '<a href='.$url.'>'.$label.'</a>';
			}
		}

		echo $link;
		//if not on last record, add a pipe character between links
		if ($counter < $numResults) {
			echo " | ";
		}
	}
?>


    <?php echo "<p>Copyright&copy; ". date('Y') ; ?>

     All Rights Reserved. <a href="http://<?php include('webaddress.php') ?>"><?php include('webaddress.php') ?></a></p>


    </div>


</div>

</div>


</div><!-- end bottom-footer-sections-->
<div style="clear:both;"></div>
</div>
