﻿// JScript File
function escribeflash(origen, parametros, nombreswf, alto, ancho, id)
{
ide = id+'o';
ido = id+'e';

document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ ancho +'" height="'+ alto +'" id="'+ ido +'" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="' + origen + 'libre/online07/players/'+ nombreswf + parametros + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="play" value="true" />');
document.write('<param name="bgcolor" value="" />');
document.write('<embed name="'+ ide +'" width="'+ ancho + '" height="'+ alto +'" src="' + origen + 'libre/online07/players/'+ nombreswf + parametros + '" quality="high" bgcolor="#FFFFFF" play="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');

}

function escribeflashgalerias(origen, parametros, nombreswf, alto, ancho, id)
{
ide = id+'o';
ido = id+'e';
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ ancho +'" height="'+ alto +'" id="'+ ido +'" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="' + origen + 'templates/galerias/'+ nombreswf + '?file=datos.xml&folder=' + parametros + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="play" value="true" />');
document.write('<param name="bgcolor" value="" />');
document.write('<embed name="'+ ide +'" width="'+ ancho + '" height="'+ alto +'" src="' + origen + 'templates/galerias/'+ nombreswf + '?file=datos.xml&folder=' + parametros + '" quality="high" bgcolor="#FFFFFF" play="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');

}

function escribeflashcineguia(movie,width,height,xml, basepath)
 {    		
         if (basepath != '')
            {multipromo= basepath+'libre/online07/flashcineguia/cineguia.swf?FileIni='+basepath+'libre/online07/flashcineguia/config_' + movie + '.xml&FileInfo='+xml+'MediaConfig.xml';}
         else
            {multipromo= 'libre/online07/flashcineguia/cineguia.swf?FileIni=libre/online07/flashcineguia/config_' + movie + '.xml&FileInfo='+xml+'MediaConfig.xml';}

         document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width + '" height="'+ height + '" id="cineguiascroll" align="middle" VIEWASTEXT>');
         document.writeln('<param name="allowScriptAccess" value="always" />');
         document.writeln('<param name="movie" value="'+ multipromo+'" />');
         document.writeln('<param name="quality" value="high" />');
         document.writeln('<param name="bgcolor" value="#727C87" />');
         document.writeln('<embed src="'+ multipromo+'" quality="high" bgcolor="#727C87" width="'+ width + '" height="'+ height + '" name="cineguiascroll" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true"/>');
         document.writeln('</object>');
 }


function escribeflashenvivo(origen, parametros, nombreswf, alto, ancho, id)
{
ide = id+'o';
ido = id+'e';
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ ancho +'" height="'+ alto +'" id="'+ ido +'" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="http://gruporeforma.'+ site + '.com/libre/online07/envivo/' + nombreswf + '?' + parametros + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="play" value="true" />');
document.write('<param name="bgcolor" value="" />');
document.write('<embed name="'+ ide +'" width="'+ ancho + '" height="'+ alto +'" src="http://gruporeforma.'+ site + '.com/libre/online07/envivo/'+ nombreswf + '?' +  parametros + '" quality="high" bgcolor="#FFFFFF" play="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');

}

function creaMedioItem(titulo, imagenPromo, textObject,tipoMedio)
{
  this.imagenPromo=imagenPromo;
  this.textObject=textObject;
  this.titulo=titulo;
  this.tipoMedio=tipoMedio;
  return this;
}

function creaButtonMedio(parent,myPosition)
{
  this.image=document.getElementById('medioImagen_' + myPosition);
  this.span=document.getElementById('medioTitulo_' + myPosition);
  
  this.spanTipoMedio=document.getElementById('medioTipoMedio_' + myPosition);
  
  this.parent=parent;
  this.image.parent=this;          
  this.span.parent=this;
  
  
  this.myPosition=myPosition;
  this.myItem=this.parent.mediosItems[this.myPosition];
  
  this.image.onclick= changingMyItem;
  this.span.onclick= changingMyItem;
  if (this.spanTipoMedio!=null) 
    {
      this.spanTipoMedio.parent=this;
      this.spanTipoMedio.onclick=changingMyItem;
    }
  
  function changingMyItem()
  {          
   var itemTemporal= this.parent.myItem;           
   this.parent.myItem=this.parent.parent.itemSelected;    
   this.parent.image.src=this.parent.myItem.imagenPromo;           
   this.parent.span.innerHTML=this.parent.myItem.titulo;
   if (this.parent.spanTipoMedio!=null)
    this.parent.spanTipoMedio.innerHTML=this.parent.myItem.tipoMedio;
   this.parent.parent.itemSelected=itemTemporal;
   
   this.parent.parent.titulo.innerHTML='•' + itemTemporal.titulo;
   if (this.parent.parent.tipoMedio!=null)
    this.parent.parent.tipoMedio.innerHTML= '&#160;' + itemTemporal.tipoMedio;
   creaObjectFlash(this.parent.parent.screen,itemTemporal.textObject, itemTemporal.tipoMedio);
   
   itemTemporal=null;
  }
  return this;
}

function creaMedios(template)
{
  this.screen=document.getElementById("medioScreen");          
  this.titulo=document.getElementById("medioTitulo");  
  this.tipoMedio=document.getElementById("medioTipoMedio");  
  this.mediosItems= new Array();
  this.mediosImages= new Array();
  this.itemSelected=null;
  this.template=template;
  this.creaMedio=function(titulo,imagenPromo,textObject,tipoMedio)
  {     
    this.mediosItems.push(new creaMedioItem(titulo,imagenPromo,textObject,tipoMedio))
    if (this.itemSelected==null)            
      this.itemSelected=this.mediosItems[this.mediosItems.length-1];
  }

  this.creaButton= function (myPosition)
  {
    this.mediosImages.push(new creaButtonMedio(this, myPosition));
  }
  return this;
}

function creaObjectFlash(obj,textObject)
{
    obj.innerHTML=replaceTextosObject(textObject,false);
}

function escribefirsttime(textObject)
{
     document.write(replaceTextosObject(textObject,true));
}

function replaceTextosObject(textObject,firsttime)
{
    returnstring="";
    if ((dominio.indexOf('.com') != -1) || (textObject.indexOf('http://www.youtube.com/') != -1)) 
    {     
        returnstring= textObject;
    }
    else
    {        
        siteactual = dominio + '/stageenlineagc';        
        if(textObject.indexOf('www.elnorte.com') >= 0)
        {
            returnstring= textObject.replace(/www.elnorte.com/g,siteactual);
        }  
        if(textObject.indexOf('www.reforma.com') >= 0)
        {
            returnstring= textObject.replace(/www.reforma.com/g,siteactual);
        }
        if(textObject.indexOf('www.mural.com') >= 0)
        {
            returnstring= textObject.replace(/www.mural.com/g,siteactual);
        }
        if(textObject.indexOf('www.palabra.com') >= 0)
        {
            returnstring= textObject.replace(/www.palabra.com/g,siteactual);
        }
    }   
    if (!firsttime && (textObject.indexOf('http://www.youtube.com/') == -1))
        returnstring= returnstring.replace(/PlayMedia=0/g,'PlayMedia=1');
        
    return returnstring;
}

function medios(fotoid)//activar medio
            {
                
	            var fotoid = parseInt(fotoid);
                 if (document.getElementById)		
		            {
                    if ((ArrayAudio[fotoid]["tipomedio"]==2) || (ArrayAudio[fotoid]["tipomedio"]==1))
                    {
                      t1=reemplazaorigen(ArrayAudio[fotoid]["path_audio"]);
                      t1=t1.replace(/PlayMedia=0/g,'PlayMedia=1');
                    }
                    else
                    {
                      t1 = ArrayAudio[fotoid]["path_audio"];
                    }
                    
		                document.getElementById("medio1").innerHTML =  t1;		  
		            }
            }