<?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('nba_normal.htm');
$tpl->setVariable('fecha', date("d/m/Y"));
$colores = "";
//$res = LoadConfiguration();
$archivo = $_GET['file'];//"caf.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 == "#FFCB97")
              {
                  $tpl->setVariable('colores', 'bgcolor=""');
                  $colores = "";
              }
               else
               {
                 $tpl->setVariable('colores', 'bgcolor="#FFCB97"');
                 $colores = "#FFCB97";
               }


               $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('dep',   $node->Liga);
                  $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('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('sjcv',       utf8_decode(BlankSpace($node->SoloJCVis)));
                  $tpl->setVariable('sjcl',       utf8_decode(BlankSpace($node->SoloJCLoc)));

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

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

                  $tpl->setVariable('sh1v',       utf8_decode(BlankSpace($node->SoloPMVis)));
                  $tpl->setVariable('sh1l',       utf8_decode(BlankSpace($node->SoloPMLoc)));

                  $tpl->setVariable('h2mlv',     utf8_decode(BlankSpace($node->PriceMLSMVis)));
                  $tpl->setVariable('h2mll',     utf8_decode(BlankSpace($node->PriceMLSMLoc)));

                  $tpl->setVariable('h2rlv',     utf8_decode(BlankSpace($node->RLSMVis)));
                  $tpl->setVariable('h2rll',     utf8_decode(BlankSpace($node->RLSMVis)));

                  $tpl->setVariable('sh2v',       utf8_decode(BlankSpace($node->SoloSMVis)));
                  $tpl->setVariable('sh2l',       utf8_decode(BlankSpace($node->SoloSMLoc)));

                  $tpl->setVariable('tpmv',       utf8_decode(BlankSpace($node->TotalPM)));
                  $tpl->setVariable('jcv',       utf8_decode(BlankSpace($node->TotalJC)));
                  //$registro++;

               $tpl->parse('bloque2');

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




?>