<?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 */
  require_once "/home/yallaf5/public_html/cmsAdmin/lib/viewer_functions.php";

  list($top_storiesRecords, $top_storiesMetaData) = getRecords(array(
    'tableName'   => 'top_stories',
	'perPage' => '5',  
  ));
?>
<!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" />
<META NAME="copyright" CONTENT="YallaF1 (c) 2009" />
<META NAME="keywords" CONTENT="motorsport, motor sport, gp, grand prix, formula 1, formula one, yallaf1, yalla f1, williams, ferrari, mclaren mercedes, force india, toyota, redbull, red bull, toro rosso, renault, brawngp, brawn gp, bmw sauber, scuderia, world championship, lewis hamilton, heiki koivalainen, kimi räikkönen, kimi raikkonen, felipe massa, robert kubica, nick heidfeld, fernando alonso, nelson piquet, timo glock, sébastien buemi, sebastien bourdais, mark webber, sebastian vettel, nico rosberg, kazuki nakajima, jenson button, rubens barrichello, silverstone, donington, hockenheim, nurgburgring, hungaroring, spa francochamps, monza, fuji, suzuka, interlagos, sao paulo, ayrton senna, bruno senna" />
<META NAME="description" CONTENT="YallaF1.com Daily Formula 1 News" />
<META NAME="language" CONTENT="English" />
<META NAME="author" CONTENT="Nigel Gordijk" />
<META NAME="revisit-after" CONTENT="30 days" />
<META NAME="document-classification" CONTENT="Design" />
<META NAME="document-rights" CONTENT="Copyrighted Work" />
<META NAME="document-type" CONTENT="Public" />
<META NAME="document-rating" CONTENT="General" />
<META NAME="document-distribution" CONTENT="Global" />

<META NAME="document-state" CONTENT="Static" />
<META HTTP-EQUIV="Content-Language" CONTENT="EN-GB" />
<TITLE>Formula 1 Slideshows and Videos from YallaF1</TITLE>
<LINK HREF="styles.css" REL="stylesheet" TYPE="text/css">
<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];}}
}
//-->
</SCRIPT>
<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=["right-column"]

//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>
 <SCRIPT LANGUAGE="javascript">
<!--



/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
//-->
</SCRIPT>
 </HEAD>

<BODY>

<DIV ALIGN="CENTER">
  <TABLE WIDTH="484" BORDER="0" CELLSPACING="0" CELLPADDING="0">
    <TR>
      <TD><?php $counter = 1; ?>
          <?php foreach ($top_storiesRecords as $record): ?>
          <?php if(($counter == 1) || (@$top_storiesData['page'] > 1)) : ?>
          <!-- TOP STORY -->
          <TABLE WIDTH="500" BORDER="0" CELLPADDING="0" CELLSPACING="0">
            <TR>
              <TD><?php foreach ($record['photos'] as $upload): ?>
                  <?php if ($upload['hasThumbnail']): ?>
                  <IMG SRC="<?php echo $upload['urlPath'] ?>" ALT="" WIDTH="<?php echo $upload['width'] ?>" HEIGHT="<?php echo $upload['height'] ?>" ALIGN="left" CLASS="imgTopBasePad" />
                  <?php elseif ($upload['isImage']): ?>
                  <IMG SRC="<?php echo $upload['urlPath'] ?>" ALT="" WIDTH="<?php echo $upload['width'] ?>" HEIGHT="<?php echo $upload['height'] ?>" ALIGN="left" CLASS="imgTopBasePad" />
                  <?php endif ?>              </TD>
            </TR>
            <TR>
              <TD><?php echo $record['wysiwyg_upload'] ?></TD>
            </TR>
            <TR>
              <TD><H1><A HREF="<?php echo $record['_link'] ?>" TARGET="_top"><?php echo $record['title'] ?></A></H1>
                  <P CLASS="pNoPad"><SPAN CLASS="span10px"><?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?> <BR />
                        <EM>Credit:  <?php echo $record['contributor'] ?></EM></SPAN></P>
                  <!-- For date formatting codes see: http://www.php.net/date -->
                  <P CLASS="p11px"><?php echo $record['introduction'] ?></P>
                <?php endforeach ?>
                  <!-- END TOP STORY -->
                  <TABLE WIDTH="484" BORDER="0" CELLSPACING="0" CELLPADDING="0">
                    <TR>
                      <TD><IMG SRC="images-cms/single-pixel.gif" WIDTH="500" HEIGHT="10"/></TD>
                    </TR>
                </TABLE></TD>
            </TR>
          </TABLE>
        <?php elseif(($counter > 1) && ($counter < 7)) : ?>
          <!-- NEXT TWO STORIES -->
          <TABLE WIDTH="484" BORDER="0" CELLSPACING="0" CELLPADDING="0">
            <TR>
              <TD CLASS="tdArticleIntroCellNoPad"><IMG SRC="images-cms/single-pixel.gif" WIDTH="482" HEIGHT="1"/></TD>
            </TR>
            <TR>
              <TD><IMG SRC="images-cms/single-pixel.gif" WIDTH="500" HEIGHT="10"/></TD>
            </TR>
          </TABLE>
        
        <?php foreach ($record['photos'] as $upload): ?>
          <TABLE WIDTH="500" BORDER="0" CELLPADDING="0" CELLSPACING="0">
		  <TR><TD><H2><A HREF="<?php echo $record['_link'] ?>" TARGET="_top"><?php echo $record['title'] ?></A></H2></TD></TR>
            <TR>
              <TD><?php echo $record['wysiwyg_upload'] ?></TD>
            </TR>
            <TR>
              <TD><?php if ($upload['hasThumbnail']): ?>
                  <IMG SRC="<?php echo $upload['thumbUrlPath'] ?>" WIDTH="<?php echo $upload['thumbWidth'] ?>" HEIGHT="<?php echo $upload['thumbHeight'] ?>" ALT="" ALIGN="left" CLASS="imgKeyline235" />
                  <?php endif ?>
                  <?php endforeach ?>
                  <P CLASS="pNoPad"><SPAN CLASS="span10px"><?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?> <BR />
                        <EM>Credit:  <?php echo $record['contributor'] ?></EM></SPAN></P>
                  <!-- For date formatting codes see: http://www.php.net/date -->
                  <P CLASS="p11px"><?php echo $record['introduction'] ?></P>
                <!-- END NEXT TWO STORIES --></TD>
            </TR>
          </TABLE>
        <?php elseif($counter > 7): ?>
          <!-- FIVE ARTICLES -->
          <!-- END FIVE ARTICLES -->
          <?php endif; ?>
          <?php $counter++ ?>
          <?php endforeach; ?>
      </TD>
    </TR>
    <TR>
      <TD><P CLASS="pMoreRightNoPad"><A HREF="stories.php" TARGET="_top">More Top Stories &raquo;</A></P></TD>
    </TR>
  </TABLE>
</DIV>
</BODY>
</HTML>
