﻿var AC_FL_RunContent = 0; 
var DetectFlashVer = 0; 


var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 115;
        
function include_dom(script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
}
        // Function to allow one JavaScript file to be included by another.
// Copyright (C) 2006 www.cryer.co.uk
function IncludeJavaScript(jsFile)
{
  //document.write('<script type="text/javascript" src="' + jsFile + '"></script>'); 
  document.write(unescape("%3Cscript src='" + jsFile + "' type='text/javascript'%3E%3C/script%3E"));
}
// IncludeJavaScript('scripts/LETio_RunActiveContent.js');
// IncludeJavaScript('scripts/LETio_ActiveX.js');
  IncludeJavaScript('http://www.letio.com/mp/v1.0/LETio_RunActiveContent.js');
  IncludeJavaScript('http://www.letio.com/mp/v1.0/LETio_ActiveX.js');
  
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  IncludeJavaScript( gaJsHost + "google-analytics.com/ga.js");
// include_dom('http://www.letio.com/mp/v1.0/LETio_RunActiveContent.js');
//  include_dom('http://www.letio.com/mp/v1.0/LETio_ActiveX.js');


var LETioTrackers=new Array();
function getLETioTracker(StationTrackerCode)
{
   if(LETioTrackers[StationTrackerCode]==null)
   {
      LETioTrackers[StationTrackerCode] = _gat._getTracker(StationTrackerCode);
      LETioTrackers[StationTrackerCode]._initData();
      LETioTrackers[StationTrackerCode]._setSessionTimeout("18000");
   }
   return LETioTrackers[StationTrackerCode];      
}
function StationTracker(StationTrackerCode,section)
{
   var LETioTracker= getLETioTracker(StationTrackerCode);
   LETioTracker._trackPageview(section);      
}
function EventTracker(StationTrackerCode,category, action, opt_label, opt_value)
{
   var LETioTracker= getLETioTracker(StationTrackerCode);
   LETioTracker._trackEvent(category, action, opt_label, opt_value)
}


var LETio_winRef=null;
function LETio_flotante(width,height,url)
{
	try {LETio_winRef.close()} catch (e) {}
	LETio_winRef = window.open(url, 
             'LETioWindow', 'status=no,toolbar=no,scrollbars=no,titlebar=yes,menubar=no,resizable=yes,'+
		     'width='+width+',height='+height+',directories=no,location=no,top=50,left=100');
}

function LETio_RadioPlayer(idPlayer, URLStream)
{
   document.write(getText_LETio_RadioPlayer(idPlayer, URLStream));   
}


function LETio_divLETioRadioPlayer(divLETioPlayer,idPlayer, URLStream)
{    
   var obj=document.getElementById(divLETioPlayer);
   obj.innerHTML = getText_LETio_RadioPlayer(idPlayer, URLStream);
   obj=null;    
}

function getText_LETio_RadioPlayer(idPlayer, URLStream)
{
return AC_AX_RunContent( 'id',idPlayer,'style','LEFT: 0px; TOP: 0px','type',
'application/x-mplayer2','height','49','standby','Loading Microsoft Windows Media Player components...',
'width','350','align','baseline','border','0','classid','CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95',
'name','MediaPlayer','viewastext','VIEWASTEXT',
'autostart','1','audiostream','-1','autosize','0','animationatstart','0','allowscan','-1',
'allowchangedisplaysize','-1','autorewind','0','balance','0','baseurl','',
'bufferingtime','0','captioningid','','clicktoplay','0','cursortype','0',
'currentposition','-1','currentmarker','0','defaultframe','datawindow',
'displaybackcolor','0','displayforecolor','16777215','displaymode','0','displaysize','4',
'enabled','-1','enablecontextmenu','0','enablepositioncontrols','-1','enablefullscreencontrols','0',
'enabletracker','-1',
'filename',URLStream,
'invokeurls','-1','language','-1','mute','0','playcount','1','previewmode','0',
'rate','1','samilang','','samistyle','','samifilename','','selectionstart','-1','selectionend','-1',
'sendopenstatechangeevents','-1','sendwarningevents','-1','senderrorevents','-1',
'sendkeyboardevents','0','sendmouseclickevents','0','sendmousemoveevents','0',
'sendplaystatechangeevents','1','showcaptioning','0','showcontrols','1',
'showaudiocontrols','1','showdisplay','0','showgotobar','0','showpositioncontrols','1',
'showstatusbar','-1','showtracker','0','transparentatstart','0','videoborderwidth','0','videobordercolor','0','videoborder3d','0',
'volume','1','windowlessvideo','0' ); //end AC code
}

function LETio_microRadio(left,top,width,height,idPlayer,station,autoplay)
{
   document.write(getText_LETio_microRadio(left,top,width,height,idPlayer,station,autoplay));
 //   AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','100','height','22','src','button1','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','button1' ); //end AC code
}


function LETio_divLETioPlayer(divLETioPlayer,divLETioUpdateFlash,left,top,width,height,idPlayer,station,autoplay)
{
    //var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(true) //hasRightVersion)
	{
	   var obj=document.getElementById(divLETioPlayer);
       obj.innerHTML = getText_LETio_microRadio(left,top,width,height,idPlayer,station,autoplay);
       var obj2=document.getElementById(divLETioUpdateFlash);
       obj2.innerHTML="";
       obj2.style.visibility = "hidden";
    }
    else
    {
	   var obj=document.getElementById(divLETioPlayer);
       obj.innerHTML = '';
       var obj2=document.getElementById(divLETioUpdateFlash);
       obj2.style.visibility="visible";
    }
    obj=null;    
    obj2=null;    
}
function getText_LETio_microRadio(left,top,width,height,idPlayer,station,autoplay)
{
    var flashvars="gs="+station+"&ap="+autoplay;
    return getText_LETio_microRadio_private(left,top,width,height,idPlayer,flashvars);
}      
function LETio_divLP(divLP,divUF,left,top,width,height,idPlayer,flashvars)
{
    //var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(DetectFlashVer) //hasRightVersion)
	{
	   var obj=document.getElementById(divLP);
	   var HTMLcode=getText_LETio_microRadio_private(left,top,width,height,idPlayer,flashvars);
       obj.innerHTML = HTMLcode;
 //      eval("divLP.innerHTML='" +HTMLcode + "'");
 //      obj.insertAdjacentHTML('afterBegin', HTMLcode);
//       var oNewItem = document.createElement("div");	
//       oNewItem.innerHTML=HTMLcode;
//       document.appendChild(oNewItem);
   
       var obj2=document.getElementById(divUF);
       obj2.innerHTML="";       
       obj2.style.visibility = "hidden";
    }
    else
    {
	   var obj=document.getElementById(divLP);
       obj.innerHTML = '';
       var obj2=document.getElementById(divUF);
       obj2.style.visibility="visible";
    }
    obj=null;    
    obj2=null;    
}     
function getText_LETio_microRadio_private(left,top,width,height,idPlayer,flashvars)
{
  var codplayer=
  AC_FL_RunContent( 
    'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
    'WIDTH',width,
    'HEIGHT',height,
    'src','http://www.letio.com/mp/microRadio',    
    'movie','http://www.letio.com/mp/microRadio',            
    'allowScriptAccess','always',
    'name',idPlayer,        
    'id',idPlayer,    
    'pluginspage','http://www.macromedia.com/go/getflashplayer',    
    'quality','best',
    'flashvars',flashvars ,  
    //'bgcolor',#FFFFFF,
    'WMODE','transparent',
 //   'allowfullscreen','true',
    'bgcolor','#000000'
    );
  if(top=='' || left=='')
    return codplayer;
  var retorno=
    "<div style='top:"+top+"px; left:"+left+"px; width:"+width+"px; height:"+height+"px; position:absolute; display:block; '>"
  + codplayer
  + "</div>";
  return retorno;
 //   AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','100','height','22','src','button1','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','button1' ); //end AC code
}
 
 
    var LETioaudiowinRef=null;
    function LETio_popup_player(width,height,url)
    {
	     try {LETioaudiowinRef.close()} catch (e) {}
	     LETioaudiowinRef = window.open(url, 
             'LETioAudioWindow', 'status=no,toolbar=no,scrollbars=no,titlebar=yes,menubar=no,resizable=yes,'+
		     'width='+width+',height='+height+',directories=no,location=no,top=50,left=200');
    } 
      

    function getFlashMovie(movieName) {
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];
    }
    
    /*
function getFlashMovie(movieName)
{
  if (window.document[movieName])
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName];
  }
  else
  {
    return document.getElementById(movieName);
  }
}
*/
    function jsPlay(idPlayer,flashvars) {
        // call same method at flash ExternalInterface callback
  //      var o=document.getElementById(idPlayer);
          var o=getFlashMovie(idPlayer);//.jsPlay(flashvars));
          o.jsPlay(flashvars);
  //      alert(o.id);
        
  //      var obj=getFlashMovie(idPlayer);
 //       if(typeof(obj) != "undefined"))          
  //          obj.jsPlay(flashvars);
 //       else
 //           alert("No encuentro la movie con ese name");
    }
    
 /*
     var audiowinRef=null;
    function player_flotante(width,height,url)
    {
    try{
        var obj=document.getElementById("divPlayer");
        obj.innerHTML="<br>"; } catch (e) {}
	try {audiowinRef.close()} catch (e) {}
	audiowinRef = window.open(url, 
                     'audioWindow', 'status=no,toolbar=no,scrollbars=no,titlebar=yes,menubar=no,resizable=yes,'+
		     'width='+width+',height='+height+',directories=no,location=no,top=50,left=200');
    }
    function player_embedded(width,height,url)
    {
	var obj=document.getElementById("divPlayer");
	try {audiowinRef.close()} catch (e) {}
	obj.innerHTML=	
           "<iframe id='frameplayer' width="+width+" height="+height+" scrolling='no' frameborder='0'  ALLOWTRANSPARENCY='true'>"+
           "</iframe>"; 	
	var obj2=document.getElementById("frameplayer");
	obj2.src=url;
    }
 */
