<?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 = 'admin/lib/viewer_functions.php';
  $dirsToCheck = array('/hermes/bosoraweb105/b879/ipw.thundert/public_html/S2SMEDIA/pac/','','../','../../','../../../');
  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 records
  list($news_eventsRecords, $news_eventsMetaData) = getRecords(array(
    'tableName'   => 'news_events',
	 'perPage'     => '2',
  ));

?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'admin/lib/viewer_functions.php';
  $dirsToCheck = array('/hermes/bosoraweb105/b879/ipw.thundert/public_html/S2SMEDIA/pac/','','../','../../','../../../');
  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 records
  list($homepage_imageRecords, $homepage_imageMetaData) = getRecords(array(
    'tableName'   => 'homepage_image',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $homepage_imageRecord = @$homepage_imageRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$homepage_imageRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

?>

<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'admin/lib/viewer_functions.php';
  $dirsToCheck = array('/hermes/bosoraweb105/b879/ipw.thundert/public_html/S2SMEDIA/pac/','','../','../../','../../../');
  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 records
  list($tournament_resultsRecords, $tournament_resultsMetaData) = getRecords(array(
    'tableName'   => 'tournament_results',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
  ));
  $tournament_resultsRecord = @$tournament_resultsRecords[0]; // get first record

 
?>

<?PHP function textLimit($string, $length, $replacer = '...') 
{ 
if(strlen($string) > $length) 
return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer; 
 
return $string; 
} 
 
?>
<!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>Home of the TPA Athletics</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<link href="css/custom_calendar.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>


<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	/*width:200px;*/
	/*height:115px;*/
	/*z-index:1;*/
	left: -245px;
	top: -25px;
}

#apDiv2 {
	position:absolute;
	width:650px;
	text-align:right;
	/*height:115px;*/
	/*z-index:1;*/
	left: -70px;
	top: -84px;
}


-->
</style>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23534175-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>

<body onload="MM_preloadImages('images/menu_ov_r1_c1.gif','images/menu_ov_r1_c3.gif','images/menu_ov_r1_c5.gif','images/menu_ov_r1_c7.gif','images/menu_ov_r1_c9.gif','images/sn_tabs_ov_r1_c1.png','images/sn_tabs_ov_r1_c2.png')">
<div id="wrapper">
  <table width="900" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <th height="120" colspan="5" align="left" valign="top" scope="col" id="header"><?php include("includes/header.php"); ?></th>
    </tr>
    <tr>
      <th width="30" height="120" align="left" valign="top" scope="row" id="borderleft">&nbsp;</th>
      <th height="300" colspan="2" align="left" valign="top" bgcolor="#1F1F1F" scope="row"> <?php foreach ($homepage_imageRecord['content'] as $upload): ?>
         
            <img src="<?php echo $upload['urlPath'] ?>" width="840" alt="" />

        
      <?php endforeach ?></th>
      <th width="30" height="120" align="left" valign="top" id="borderright" scope="row">&nbsp;</th>
    </tr>
    <tr>
      <th width="30"  align="left" valign="top" scope="row" id="borderleft">&nbsp;</th>
      <th width="580" align="left" valign="top" bgcolor="#000000" id="main" scope="row"><div style="font-weight:normal; margin:20px 20px 16px 25px">
       <?php foreach ($news_eventsRecords as $record): ?>
      <div style="padding:15px; margin-bottom:20px; border-style:solid; border-color:#C13239; border-width:0px 0px 1px 0px">
       <b style="font-size:18px"><?php echo $record['title'] ?></b><br/>
      <span style="color:#C13239; font-size:14px; text-transform:uppercase"><?php echo date("M j", strtotime($record['date'])) ?></span><br/>
      
      <?php echo $record['content'] ?></div>
      <?php endforeach ?>
        <?php if (!$news_eventsRecords): ?>
      No News at this time<br/>
      <br/>
    <?php endif ?></div>
<div style="margin:20px 15px 20px 25px; text-align:center">  <?php if ($news_eventsMetaData['prevPage']): ?>
      <a href="<?php echo $news_eventsMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $news_eventsMetaData['page'] ?> of <?php echo $news_eventsMetaData['totalPages'] ?> -

    <?php if ($news_eventsMetaData['nextPage']): ?>
      <a href="<?php echo $news_eventsMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?></div>
</th>
      
      <th width="260" align="left" valign="top" bgcolor="#000000" id="main" scope="row"><?php include("includes/sidebar.php"); ?>
      </th>
      <th width="30" align="left" valign="top" scope="row" id="borderright">&nbsp;</th>
    </tr>
     <tr>
      <th width="30"  align="left" valign="top" scope="row" id="borderleft">&nbsp;</th>
      <th colspan="2" align="center" valign="top" bgcolor="#1F1F1F" id="footer" scope="row"><?php include("includes/footer.php"); ?></th>
      <th width="30" align="left" valign="top" scope="row" id="borderright">&nbsp;</th>
    </tr>
  </table>
</div>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</body>
</html>