<?php
ob_start();
// session_start();
header("Expires: Mon, 20 Mar 1998 12:01:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

 require_once("Sigma.php");
// require_once("dispatcher.php");
// mb_http_output('UTF-8');
$tpl =& new HTML_Template_Sigma('.','./template/cache');

//$ARCHIVOS = array('wbc1.xml','wbc2.xml','wbc3.xml','wbc4.xml', 'wbc5.xml');

//redireccionamientos.
$tpl->loadTemplateFile('___nfl.htm');
$tpl->setVariable('fecha', date("d/m/Y"));
$colores = "";
//$res = LoadConfiguration();
$archivo = $_GET['file'];//"bc.xml";
if (file_exists($archivo))
{
  //$tpl->setVariable('link','wbc.php?arch='.$archivo);
   //60;

  if(is_readable($archivo))
  {
    //$reloj = GetTimeRemaining($res,'WBC');
   if (!$myxml=simplexml_load_file($archivo))
        echo 'Error al Cargar Archivo XML';
       else
       {

        foreach($myxml as $node)
        {
              if ($colores == "grey")
              {
                  $tpl->setVariable('colores', '');
                  $colores = "";
              }
               else
               {
                 $tpl->setVariable('colores', ' class="grey"');
                 $colores = "grey";
               }


              $tpl->setVariable('nu'  ,BlankSpace($node->Orden));
              // $tpl->setVariable('dep',   'NFL');
              $tpl->setVariable('dep',   $node->Liga);

               $timegame = explode(":", $node->TimeGame);
               $hora = $timegame[0].':'.$timegame[1];
               //$meridian = $timegame[2];
               if($timegame[2] == 'p.' || $timegame[2] == 'P.')
                 $meridian = 'PM';
               elseif($timegame[2] == 'a.' || $timegame[2] == 'A.')
                 $meridian = 'AM';
               else
                 $meridian = $timegame[2];

                  $tpl->setVariable('hora',$hora);
                  $tpl->setVariable('espa',$meridian);
                  $tpl->setVariable('vId',$node->VisTeam);

                  $tpl->setVariable('eq_visitante',   $node->EquipoVisitante);
                  $tpl->setVariable('lId', $node->LocTeam);
                  $tpl->setVariable('eq_local',   ($node->EquipoLocal));

                 $tpl->setVariable('h1mlv',      utf8_decode(BlankSpace($node->PriceMLPMVis)));
                  $tpl->setVariable('h1mll',      utf8_decode(BlankSpace($node->PriceMLPMLoc)));

                  $tpl->setVariable('h1rlv',      utf8_decode(BlankSpace($node->RLPMVis)));
                  $tpl->setVariable('h1rll',      utf8_decode(BlankSpace($node->RLPMLoc)));

                  $tpl->setVariable('tpmv',       utf8_decode(BlankSpace($node->TotalPM)));

                  $tpl->setVariable('jcmlv',      utf8_decode(BlankSpace($node->PriceMLJCVis)));
                  $tpl->setVariable('jcmll',      utf8_decode(BlankSpace($node->PriceMLJCLoc)));

                  $tpl->setVariable('jcrlv',      utf8_decode(BlankSpace($node->RLJCVis)));
                  $tpl->setVariable('jcrll',      utf8_decode(BlankSpace($node->RLJCLoc)));

                  $tpl->setVariable('jcv',        utf8_decode(BlankSpace($node->TotalJC)));

                  $tpl->setVariable('sjcv',       utf8_decode(BlankSpace($node->TotalSoloJCVis)));
                  $tpl->setVariable('sjcl',       utf8_decode(BlankSpace($node->TotalSoloJCLoc)));

                  $tpl->setVariable('sh1v',       utf8_decode(BlankSpace($node->PricePCJCVis)));
                  $tpl->setVariable('sh1l',       utf8_decode(BlankSpace($node->PricePCJCLoc)));

				 //Periodos
                  $tpl->setVariable('q1rlv',      BlankSpace(utf8_decode($node->RLPPVis.' '.$node->PriceRLPPVis)));
                  $tpl->setVariable('q1rll',      BlankSpace(utf8_decode($node->RLPPLoc.' '.$node->PriceRLPPLoc)));

                  $tpl->setVariable('q1mlv',      BlankSpace(utf8_decode($node->PriceMLPPVis)));
                  $tpl->setVariable('q1mll',      BlankSpace(utf8_decode($node->PriceMLPPLoc)));

                  $tpl->setVariable('tq1',        BlankSpace(utf8_decode($node->TotalPP)));

                  $tpl->setVariable('q2rlv',      BlankSpace(utf8_decode($node->RLSPVis.' '.$node->PriceRLSPVis)));
                  $tpl->setVariable('q2rll',      BlankSpace(utf8_decode($node->RLSPLoc.' '.$node->PriceRLSPLoc)));

                  $tpl->setVariable('q2mlv',      BlankSpace(utf8_decode($node->PriceMLSPVis)));
                  $tpl->setVariable('q2mll',      BlankSpace(utf8_decode($node->PriceMLSPLoc)));

                  $tpl->setVariable('tq2',        BlankSpace(utf8_decode($node->TotalSP)));

                  $tpl->setVariable('q3rlv',      BlankSpace(utf8_decode($node->RLTPVis.' '.$node->PriceRLTPVis)));
                  $tpl->setVariable('q3rll',      BlankSpace(utf8_decode($node->RLTPLoc.' '.$node->PriceRLTPLoc)));

                  $tpl->setVariable('q3mlv',      BlankSpace(utf8_decode($node->PriceMLTPVis)));
                  $tpl->setVariable('q3mll',      BlankSpace(utf8_decode($node->PriceMLTPLoc)));

                  $tpl->setVariable('tq3',        BlankSpace(utf8_decode($node->TotalTP)));

                 $tpl->setVariable('q4rlv',       BlankSpace(utf8_decode($node->RLCPVis.' '.$node->PriceRLCPVis)));
                 $tpl->setVariable('q4rll',       BlankSpace(utf8_decode($node->RLCPLoc.' '.$node->PriceRLCPLoc)));

                 $tpl->setVariable('q4mlv',       BlankSpace(utf8_decode($node->PriceMLCPVis)));
                 $tpl->setVariable('q4mll',       BlankSpace(utf8_decode($node->PriceMLCPLoc)));

                 $tpl->setVariable('tq4',         BlankSpace(utf8_decode($node->TotalCP)));
				 
				 //Segunda mitad
                  $tpl->setVariable('smmlv',      utf8_decode(BlankSpace($node->PriceMLSMVis)));
                  $tpl->setVariable('smmll',      utf8_decode(BlankSpace($node->PriceMLSMLoc)));

                  $tpl->setVariable('rlsmv',      utf8_decode(BlankSpace($node->RLSMVis)).' '.utf8_decode(BlankSpace($node->PriceRLSMVis)));
                  $tpl->setVariable('rlsml',      utf8_decode(BlankSpace($node->RLSMLoc)).' '.utf8_decode(BlankSpace($node->PriceRLSMLoc)));

                  $tpl->setVariable('tv',       utf8_decode(BlankSpace($node->TotalSM)));

                  $tpl->setVariable('tsv',      utf8_decode(BlankSpace($node->TotalSoloSMVis)));
                  $tpl->setVariable('tsl',      utf8_decode(BlankSpace($node->TotalSoloSMLoc)));

				 
               //$tpl->parse('bloque2');


               $tpl->parse('bloque2');

        }//for.
       }//else
   }//is readable.
 }
$tpl->show();

?>