<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/bikramyo/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load record from 'home-page'
  list($home_pageRecords, $home_pageMetaData) = getRecords(array(
    'tableName'   => 'home-page',
    'where'       => '', // load first record
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $home_pageRecord = @$home_pageRecords[0]; // get first record
  if (!$home_pageRecord) { dieWith404("Record not found!"); } // show error message if no record found

  list($promo_panelsRecords, $promo_panelsMetaData) = getRecords(array(
    'tableName'   => 'promo_panels',
    'limit'       => '3',
    'loadUploads' => true,
    'allowSearch' => false,
  ));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo htmlencode($home_pageRecord['title']) ?></title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>
</head>
<body>
<div id="navigation">
<?php require_once('_masthead.php'); ?>
</div>
<div align="center">
  <table width="1060" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td><img src="img/single-pixel.gif" width="60" height="156" /></td>
      <td><img src="img/single-pixel.gif" width="940" height="156" /></td>
      <td><img src="img/single-pixel.gif" width="60" height="156" /></td>
    </tr>
    <tr>
      <td colspan="3"><iframe src="http://www.nourishhotyoga.com/index-slideshow-cms0.php" frameborder="0" scrolling="no" width="1060" height="375"></iframe></td>
    </tr>
    <tr>
      <td><img src="img/single-pixel.gif" width="60" height="23" /></td>
      <td><img src="img/single-pixel.gif" width="940" height="20" /></td>
      <td><img src="img/single-pixel.gif" width="60" height="20" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><h1 class="homeHeading"><a href="<?php echo htmlencode($home_pageRecord['intro_link_address']) ?>"><?php echo htmlencode($home_pageRecord['intro_heading']) ?></a></h1>
      <div class="intro"><?php echo htmlencode($home_pageRecord['content']) ?></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><img src="img/single-pixel.gif" width="60" height="20" /></td>
      <td><img src="img/single-pixel.gif" width="940" height="10" /></td>
      <td><img src="img/single-pixel.gif" width="60" height="10" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">  
<TR>

<?php foreach ($promo_panelsRecords as $record): ?>
<TD>
<table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<?php foreach ($record['image'] as $index => $upload): ?>
<td width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" valign="baseline" background="<?php echo $upload['urlPath'] ?>" class="tdPromoInset">
<a href="<?php echo htmlencode($record['link']) ?>">
<img src="img/single-pixel.gif" alt="" width="293" height="192" border="0" />
</a>
</td>
<?php endforeach ?> 
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="img/single-pixel.gif" width="293" height="1" /></td>
<td><img src="img/single-pixel.gif" width="30" height="1" /></td>
</tr>
<tr>
<td><h2><a href="<?php echo htmlencode($record['link']) ?>"><?php echo htmlencode($record['title']) ?></a></h2>
<?php echo $record['content']; ?>
</td>
<td>&nbsp;</td>
</tr>
</table>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?></TR><TR><?php endif; ?>  
<?php endforeach; ?>  

</TR>  
</TABLE></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><?php require_once('_footer.php'); ?></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>
</body>
</html>