<?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");
 mb_http_output('UTF-8');
 $tpl =& new HTML_Template_Sigma('.','./template/cache');
 $tpl->loadTemplateFile('mlb.htm');
 $file = $_GET['file'];

  $colores = "";
  $tpl->setVariable('fecha', date("d/m/Y"));
if(file_exists($file) && is_readable($file))
{
  if (!$myxml=simplexml_load_file($file))
   echo 'Error al Cargar Archivo XML';
  else
  {

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

        $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('nu'  ,BlankSpace($node->Orden));

           $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',   utf8_decode(BlankSpace($node->EquipoLocal)));
           $tpl->setVariable('ml_vjc',     utf8_decode(BlankSpace($node->PriceMLJCVis)));

           $tpl->setVariable('ml_ljc',     utf8_decode(BlankSpace($node->PriceMLJCLoc)));
           $tpl->setVariable('rl_vjc',     utf8_decode(BlankSpace($node->RLJCVis)));

           $tpl->setVariable('rl_ljc',     utf8_decode(BlankSpace($node->RLJCLoc)));
           $tpl->setVariable('srl_vjc',    utf8_decode(BlankSpace($node->SRLJCVis)));

           $tpl->setVariable('srl_ljc',    utf8_decode(BlankSpace($node->SRLJCLoc)));
           $tpl->setVariable('ml_vpm',     utf8_decode(BlankSpace($node->PriceMLPMVis)));

           $tpl->setVariable('ml_lpm',     utf8_decode(BlankSpace($node->PriceMLPMLoc)));


           $tpl->setVariable('rl_pmv',     utf8_decode(BlankSpace($node->RLPMVis)));
           $tpl->setVariable('rl_pml',     utf8_decode(BlankSpace($node->RLPMLoc)));

           $tpl->setVariable('ml_vfp',     utf8_decode(BlankSpace($node->PriceMLPPVis)));
           $tpl->setVariable('ml_lfp',     utf8_decode(BlankSpace($node->PriceMLPPLoc)));

           $tpl->setVariable('pitcher_v',   utf8_decode(BlankSpace($node->VisPitcher)));
           $tpl->setVariable('pitcher_l',   utf8_decode(BlankSpace($node->LocPitcher)));

           $tpl->setVariable('pcv',   utf8_decode(BlankSpace($node->PricePCJCVis)));
           $tpl->setVariable('pcl',   utf8_decode(BlankSpace($node->PricePCJCLoc)));

           $tpl->setVariable('tv',   utf8_decode(BlankSpace($node->PriceMLPMVis)));
           $tpl->setVariable('tl',   utf8_decode(BlankSpace($node->PriceSINOJCVis)));

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

           $tpl->setVariable('tsv',   utf8_decode(BlankSpace($node->TotalSoloPMVis)));
           $tpl->setVariable('tsl',   utf8_decode(BlankSpace($node->TotalSoloPMLoc)));

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

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

           $tpl->setVariable('cvs',   utf8_decode(BlankSpace($node->TotalSoloJCVis)));
           $tpl->setVariable('cls',   utf8_decode(BlankSpace($node->TotalSoloJCLoc)));

           $tpl->setVariable('srl_vfp',   utf8_decode(BlankSpace($node->SRLJCVis)));
           $tpl->setVariable('srl_lfp',   utf8_decode(BlankSpace($node->SRLJCLoc)));
		 
		 //Ponches Si No
           $tpl->setVariable('mly',        utf8_decode(BlankSpace($node->PriceSIJC)));
           $tpl->setVariable('mln',        utf8_decode(BlankSpace($node->PriceNOJC)));

           $tpl->setVariable('ml2y',       utf8_decode(BlankSpace($node->PriceSI2JC)));
           $tpl->setVariable('ml2n',       utf8_decode(BlankSpace($node->PriceNO2JC)));

           $tpl->setVariable('pitvis',     utf8_decode(BlankSpace($node->VisPitcher)));
           $tpl->setVariable('pitloc',     utf8_decode(BlankSpace($node->LocPitcher)));

           $tpl->setVariable('tsv',        utf8_decode(BlankSpace($node->VisPitcherValue)));
           $tpl->setVariable('tsl',        utf8_decode(BlankSpace($node->LocPitcherValue)));

        $tpl->parse('bloque1');

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

?>