<?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");
$tpl =& new HTML_Template_Sigma('.','./template/cache');

//$ARCHIVOS = array('wbc1.xml','wbc2.xml','wbc3.xml','wbc4.xml', 'wbc5.xml');
$colores == "";
//redireccionamientos.
$tpl->loadTemplateFile('nba_h2.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;
   // $tpl->setVariable('dep',   'National Football League (NFL)');
  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)
        {
        	$tpl->setVariable('dep',   $node->Liga);//       var_dump($node->RLSMVis);
          if($node->PriceRLSMVis != 'NADA' || $node->PriceMLSMLoc != 'NADA' ||
             $node->PriceRLSMLoc != 'NADA' || $node->PriceMLSMVis != 'NADA')
           {
              if ($colores == "#A6C2FF")
              {
                  $tpl->setVariable('colores', 'bgcolor="#A6C2FF"');
                  $colores = "";
              }
               else
               {
                 $tpl->setVariable('colores', 'bgcolor=""');
                 $colores = "#A6C2FF";
               }



               $tpl->setVariable('nu'  ,BlankSpace($node->Orden));
               $timegame = explode(":", $node->StartTime2Half);
               $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('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('tpml',       BlankSpace($node->SoloJCLoc));

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

                 // $tpl->setVariable('tv',      BlankSpace($node->PriceMLJCVis));
                 // $tpl->setVariable('jcmll',      BlankSpace($node->PriceMLJCLoc));

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

               //   $tpl->setVariable('jcv',        BlankSpace($node->TotalJC));
                  //$tpl->setVariable('jcl',        BlankSpace($node->PriceMLSMLoc));

                //  $tpl->setVariable('sjcv',       BlankSpace($node->RLSMVis));
                //  $tpl->setVariable('sjcl',       BlankSpace($node->RLSMLoc));

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

                /*$tpl->setVariable('tpm',       utf8_decode($node->TotalPM));
                  $tpl->setVariable('tsm',       utf8_decode($node->TotalSM));
                  $tpl->setVariable('tjc',       utf8_decode($node->TotalJC));

                  $registro++;
               */
               $tpl->parse('bloque2');
             }
        }//for.
       }//else
   }//is readable.
 }
$tpl->show();


?>