<?
  /* Main include info */
  ini_set('include_path',"/usr/web/sites/tuve.tv/include/");
  include("site.inc");

  /* Assign the page title */
  $data[tpl]->assign("PAGE_TITLE","News");

  /* Main defines */
  $data[tpl]->define(array(index=>"index/index.html"));
  $data[tpl]->define(array(body=>"/topvideos.html"));

  //DoSession();

  if ($data['max'] == "") 
    $maxLim = 10;
  else
    $maxLim = $data['max'];

  $query  = "SELECT vid,thumb,artist,title,genre,classification,rating,count FROM videos WHERE classification != 7 ORDER BY count DESC LIMIT 0,$maxLim";
  $result = mysql_query($query);

  $classes = array('None','Music Video','TV','Anime/Toons','Movie','Documentary','Original');
  $ratings = array('None','G','PG','13+','MA','AD');

  for ($i=0;$i < $maxLim;$i++) {
    $vid   = mysql_result($result,$i,'vid');
    $thumb = mysql_result($result,$i,'thumb');
    $artist = mysql_result($result,$i,'artist');
    $title  = mysql_result($result,$i,'title');
    $genre  = mysql_result($result,$i,'genre');
    $count  = mysql_result($result,$i,'count');
    $vclass = mysql_result($result,$i,'classification');
    $rating = mysql_result($result,$i,'rating');
    $rows .= "<TR><TD><A HREF=\"/watch/$vid\"><IMG SRC=\"$thumb\" WIDTH=\"140\" HEIGHT=\"105\"></A></TD><TD VALIGN=\"TOP\">Artist: $artist<BR>Title: $title<BR>Genre: $genre<BR>Classification: $classes[$vclass]<BR>Rating: $ratings[$rating]<BR>Played: $count Times</TD></TR>\n";
    $rows .= "<TR><TD COLSPAN=\"5\"><HR></TD></TR>\n";
    }

  $data['tpl']->assign("ROWS",$rows);

  /* Parse and print */
  $data[tpl]->parse(BODY, array("body"));
  $data[tpl]->parse(INDEX, array("index"));
  $data[tpl]->FastPrint("INDEX");
?>
