var DHTML = (document.getElementById || document.all || document.layers);
/************************************
 * OBTENER DOMINIO DEL SITIO        *
 ************************************/
dominio = document.domain.toLowerCase();
pUrl = document.location.href.toLowerCase();
var site ;
var developer=false;
//var dominio = "www.elnorte.com";
if (dominio.indexOf('.com') < 0) {
    pathBotonesMMMC = 'http://'+ dominio + '/stageenlineagc/';
    pathBotonesMMEM = 'http://'+ dominio + '/stageenlinea/';
    site = 'stageenlinea'}
else {
    if (dominio.indexOf('busquedas') != -1){
	    site = dominio.replace("www.","");
	    site = site.replace("gruporeforma.","");
	    site = site.replace("envivo.","");
	    site = site.replace(".com","");}
    else if (pUrl.indexOf('elnorte') != -1)
	    site = 'elnorte';
    else if (pUrl.indexOf('reforma') != -1)
	    site = 'reforma';
    else if (pUrl.indexOf('mural') != -1)
	    site = 'mural';
    else if (pUrl.indexOf('palabra') != -1)
	    site='palabra'
    else
        {
	    site = 'elnorte'; //PONERLO EN ELNORTE CUANDO YA NO ESTE EN DESARROLLO
	    developer=true;
	    }
    pathBotonesMMMC = 'http://www.' +site + '.com/';
    pathBotonesMMEM = pathBotonesMMMC;}
//alert(site);
/************************************
 * OBTENER FECHA (PARA (S)HTML'S)   *
 ************************************/
function fecha(){
meses = new Array ('Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic');
dateVar = new Date();
document.write(dateVar.getDate() + '-' + meses[dateVar.getMonth()] + '-' + dateVar.getFullYear())
}
/************************************
 * IDENTIFICAR PLATAFORMA Y BROWSER *
 ************************************/
var navUA = navigator.userAgent.toLowerCase();
var tipoBrowser;
var tipoPlataforma;
if (navUA.indexOf('msie') != -1)
	tipoBrowser = 'explorer';
else if (navUA.indexOf('netscape') != -1)
	tipoBrowser = 'netscape';
else if (navUA.indexOf('firefox') != -1)
	tipoBrowser = 'firefox';
else if (navUA.indexOf('safari') != -1)
	tipoBrowser = 'safari';
if (navUA.indexOf('windows') != -1)
	tipoPlataforma = 'windows';
else
	tipoPlataforma = 'mac';
//alert('tipoBrowser: '+tipoBrowser+'\ntipoPlataforma: '+tipoPlataforma);
/****************************
 * FUNCIONES PARA MENU      *
 ****************************/
var pathXml = 'http://' + document.domain + '/';
if (pathXml.indexOf('.com') == -1)
	pathXml = pathXml + 'stageenlineagc/';
pathXml = pathXml + 'libre/online/menu/';
function getObj(name)
{
	if (document.getElementById)
		this.obj = document.getElementById(name);
	else if (document.all)
		this.obj = document.all[name];
	else if (document.layers)
		this.obj = document.layers[name];
	return this.obj;
}
function resizeFlash1()
{
	if (!DHTML) return;
	var x = getObj('menuO');
	x.height=400;
	x = getObj('menuE');
	if(!(x==null))x.height=400;
}
function resizeFlash2()
{
	if (!DHTML) return;
	var x = getObj('menuO');
	x.height=23;
	x = getObj('menuE');
	if(!(x==null))x.height=23;
}
/****************************
 * FUNCIONES PARA IFRAME    *
 ****************************/
function resize_iFrame(iframe_name, lessH){
	if (navigator.userAgent.indexOf('MSIE') != -1)
		height = document.body.offsetHeight;
	else if (navigator.userAgent.indexOf('Mozilla/') != -1)
		height = document.documentElement.clientHeight;
	var objIframe = getObj(iframe_name)
	objIframe.height=height - lessH
}
/****************************
 * FUNCIONES PARA FECHA     *
 ****************************/
function MostrarFechaActual()  
{  var nombre_mes = new Array("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic")

	var hoy_es = new Date()
	dia_mes = hoy_es.getDate()
	mes = hoy_es.getMonth() + 1
	anyo = hoy_es.getYear()

     if (anyo < 100)
     {  anyo = '19' + anyo }

	else 

     if ( ( anyo > 100 ) && ( anyo < 999 ) ) 
     {  var cadena_anyo = new String(anyo) ; anyo = '20' + cadena_anyo.substring(1,3) }

	document.write(dia_mes + "-" + nombre_mes[mes - 1] + "-" + anyo)    
 }
/****************************
 * FUNCIONES PARA COOKIES   *
 ****************************/
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();}
	else 
		expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	var clave = unescape(document.cookie.substring(offset, endstr));
	return clave.toLowerCase();
}
function Get_Cookie(name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) 
	{    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}
/****************************
 * FUNCIONES PARA VENTANAS  *
 ****************************/
function herramienta(direccion)
{
LeftPosition = (screen.width) ? (screen.width-800)/2 : 0; 
TopPosition = (screen.height) ? (screen.height-400)/2 : 0;
window.open(direccion,'pagina','top=' + TopPosition + ',left=' + LeftPosition + ',width=800,height=400,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
}

function herramientascroll(direccion)
{
	LeftPosition = (screen.width)  ? (screen.width-800)/2  : 0; 
	TopPosition  = (screen.height) ? (screen.height-400)/2 : 0;
	window.open(direccion,'pagina','top=' + TopPosition + ',left=' + LeftPosition + ',width=800,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no');
}

function OpenFNZoom(direccion,orientacion)
{
    if (orientacion==0)
	{
		LeftPosition = (screen.width)  ? (screen.width-740)/2  : 0; 
		TopPosition  = (screen.height) ? (screen.height-467)/2 : 0;
		window.open(direccion,'pagina','top=' + TopPosition + ',left=' + LeftPosition + ',width=700,height=467,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
	}
	else
	{
	    LeftPosition = (screen.width)  ? (screen.width-328)/2  : 0; 
		TopPosition  = (screen.height) ? (screen.height-494)/2 : 0;
		window.open(direccion,'pagina','top=' + TopPosition + ',left=' + LeftPosition + ',width=328,height=494,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
	}
}

/****************************
 * FUNCIONES PARA ANUNCIOS  *
 ****************************/
_version=11;
if (navigator.userAgent.indexOf('Mozilla/3') != -1){
_version=10;} 

var oas='http://anuncios.gruporeforma.com/RealMedia/ads/';
var RN = new String (Math.random());
var RNS = RN.substring (2, 11); 

function DisplayAds(pagina, position, width, height)
{
    //sitepage = 'palabra.com/'
	var oaspage= sitepage + pagina +'/1' + RNS + '@' + position;
	var foto = baseURL.search('foto');
	var opi = baseURL.search('opinion');
	var indica = baseURL.search('indicador');
	var imganuncio = '';	
		if (_version < 11){
		    
		    document.write ('<A HREF="' + oas + 'click_nx.cgi/'+ oaspage + '" TARGET="_top" ><IMG SRC="' + oas + 'adstream_nx.cgi/' + oaspage + '" BORDER="0" WIDTH="' + width + '" HEIGHT="' + height + '"></a>');}
		else{
			document.write ('<'+'SCRIPT LANGUAGE="JavaScript1.1" SRC="' + oas + 'adstream_jx.cgi/' + oaspage + '">');
			document.write ('\<\!-- --\>');
			document.write ('\<\/SCRIPT\>');
			document.write ('\<\!-- --\>');
		    }
}
/************************************
 * PLECA CONECTAR / DESCONECTAR      *
 ************************************/
function textosLogon(ligaMiCajon,imagenMiCajon,imagenPix){
	var hola = 'http://www.' + site  + '.com/' + 'libre/acceso/registro/perfil.asp';
	nivelcobro = 2;
	var grcuser = Get_Cookie('cusuarioss');		
	if (grcuser != null){
	    document.write('<a href=' + hola + '><span class="argris13"><strong>Hola, <u>'+ grcuser.substr(0,11) +'</u></strong></span></a>&#160;|');		
	    document.write('<a href="' + ligaMiCajon + '"><img height="22" width="30" align="absMiddle" border="0" src="'+imagenMiCajon+'"><span class="argris12">mi cajón</span></a>');		
	}
	else
	    document.write('<img height="1" width="30" align="absMiddle" border="0" src="'+imagenPix+'">');
}

function plecaLogon(){    
	if ((site != 'elnorte') && (site != 'reforma') && (site != 'mural') && (site != 'palabra'))
	    siteTl = '/stageenlinea/';	
	else siteTl = 'http://www.' + site  + '.com/';
	var ayuda = 'http://www.' + site  + '.com/' + 'libre/acceso/ayuda';
	var conectar = 'http://www.' + site  + '.com/' + 'libre/acceso/acceso.htm';
	var desconectar = 'http://www.' + site  + '.com/' + 'libre/acceso/logout.asp';
	nivelcobro = 2;
	var grcuser = Get_Cookie('cusuarioss');
	if (grcuser == null){
        document.write('<a href=' + conectar + '><img height="20" width="108" border="0" src="' + siteTl + 'Libre/Online07/Sociales/imagenes/comunes/pestana_conectar.gif" /></a>');        
	}
	else {
		document.write('<a href=' + desconectar + '><img height="20" width="108" border="0" src="' + siteTl + 'Libre/Online07/Sociales/imagenes/comunes/pestana_desconectar.gif" /></a>');
	}
}

/************************************
 * LIGA DEL BUSCADOR                *
 ************************************/
 function caractEspec(strr)
{ 
 myStrr = new String(strr);
 myStrr = myStrr.replace(/[á]/g,'&aacute;');
 myStrr = myStrr.replace(/[é]/g,'&eacute;');
 myStrr = myStrr.replace(/[í]/g,'&iacute;');
 myStrr = myStrr.replace(/[ó]/g,'&oacute;');
 myStrr = myStrr.replace(/[ú]/g,'&uacute;');
 myStrr = myStrr.replace(/[Á]/g,'&Aacute;');
 myStrr = myStrr.replace(/[É]/g,'&Eacute;');
 myStrr = myStrr.replace(/[Í]/g,'&Iacute;');
 myStrr = myStrr.replace(/[Ó]/g,'&Oacute;');
 myStrr = myStrr.replace(/[Ú]/g,'&Uacute;');
 myStrr = myStrr.replace(/[ñ]/g,'&ntilde;');
 myStrr = myStrr.replace(/[Ñ]/g,'&Ntilde;');
 myStrr = myStrr.replace(/[ë]/g,'&euml;');
 myStrr = myStrr.replace(/[Ë]/g,'&Euml;');
 myStrr = myStrr.replace(/[ü]/g,'&uuml;');
 myStrr = myStrr.replace(/[Ü]/g,'&Uuml;');
 myStrr = myStrr.replace(/[*]/g,'');
 myStrr = myStrr.replace(/[-]/g,'');
 myStrr = myStrr.replace(/[+]/g,'');
 myStrr = myStrr.replace(/[|]/g,'');
 myStrr = myStrr.replace(/[!]/g,'');
 myStrr = myStrr.replace(/[(]/g,'');
 myStrr = myStrr.replace(/[)]/g,'');
 myStrr = myStrr.replace(/[{]/g,'');
 myStrr = myStrr.replace(/[}]/g,'');
 myStrr = myStrr.replace(/[<]/g,'');
 myStrr = myStrr.replace(/[>]/g,'');
 myStrr = myStrr.replace(/[:]/g,'');
 myStrr = myStrr.replace(/[?]/g,'');
 myStrr = myStrr.replace(/[~]/g,'');
 myStrr = myStrr.replace(/[#]/g,'');
 myStrr = myStrr.replace(/[\\]/g,'');
 myStrr = myStrr.replace(/[\^]/g,'');
 myStrr = myStrr.replace(/[\[]/g,'');
 myStrr = myStrr.replace(/[\]]/g,'');
 return myStrr;
}

 function trimBuscador(s)
	{		
		return s.replace(/\s/gi,"");
	}
function ligaBuscador() 
{   
    if (document.buscador.radio[0].checked) //busqueda en el site
    {
      if (trimBuscador(document.buscador.strbusqueda.value)=="") 
       {
        alert("Introduzca lo que desea buscar");
        return false;
       }
        if (site=='elnorte')
	        ligabusquedaSuburbanas = 'http://busquedas.gruporeforma.com/suburbanasNte/Pages/BuscaFotoGal.aspx';
        else if (site=='reforma')
	        ligabusquedaSuburbanas = 'http://busquedas.gruporeforma.com/suburbanasRef/Pages/BuscaFotoGal.aspx';
        else if (site=='mural')
	        ligabusquedaSuburbanas = 'http://busquedas.gruporeforma.com/suburbanasMur/Pages/BuscaFotoGal.aspx';
        else if (site=='palabra')
	        ligabusquedaSuburbanas = 'http://busquedas.gruporeforma.com/suburbanasPal/Pages/BuscaFotoGal.aspx';
	    else
	        ligabusquedaSuburbanas = 'http://busquedas.gruporeforma.com/suburbanasNte/Pages/BuscaFotoGal.aspx';
       
      document.buscador.strbusqueda.value=caractEspec(document.buscador.strbusqueda.value);
      document.buscador.action = ligabusquedaSuburbanas;
     }
    else //busqueda en google
      {
      document.buscador.method="GET";
      document.buscador.q.value=document.buscador.strbusqueda.value;
      document.buscador.action ="http://www." + site + ".com/google/default.asp";
      }
    return true;
}              
/************************************
 * PARA USO EN SUBURBANAS           *
 ************************************/
function swithimage(obj)
	{
		obj.src= (obj.src.search("_on")!=-1)?obj.src.replace("_on","_off"):obj.src.replace("_off","_on");	
	}

/************************************
 * VALIDA CLICK DERECHO			    *
 ************************************/
if ((site == 'elnorte') || (site == 'palabra'))
	am = "Derechos Reservados ©\nEditora el Sol, S.A. de C.V.";
else
	am = "Derechos Reservados ©\nC.I.C.S.A";
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}

if (dominio.indexOf('.com') != -1){
	document.onmousedown = nrc;
	if (document.layers) window.captureEvents(Event.MOUSEDOWN);
	if (bNS && bV<5) window.onmousedown = nrc;
}
/****************CODIGO PARA EL FUNCIONAMIENTO DE FOTOS PRINCIPALES***********************************/
       function creaItemFotos(id,path,pie,alt,zoom,fotografo,linkzoom,orientacion,categoriaid,idfotoarchivo,idcoleccion)
       {
        this.id=id;
        this.path=path;
        this.pie=pie;
        this.alt=alt;
        this.zoom=zoom;        
        this.fotografo=fotografo;
        this.linkzoom=linkzoom
        this.orientacion=orientacion;
        this.categoriaid=categoriaid
        this.idfotoarchivo=idfotoarchivo;
        this.idcoleccion=idcoleccion;
        return this;
       }
       
       function creaFotos()
       {
        this.foto=document.images["fotoPrinc"]
        this.pie=document.getElementById("pieFotoPrinc");
        this.controles= document.getElementById("ctrlFotoPrinc");
        if (this.controles!=null)
            this.controles.parent=this;
        this.itemsFotos = new Array();
        this.index=null;
        //this.timer=null;        
        this.creaItem= function(id,path,pie,alt,zoom,fotografo,linkzoom,orientacion,categoriaid,idfotoarchivo,idcoleccion)
        {
            this.itemsFotos.push(new creaItemFotos(id,path,pie,alt,zoom,fotografo,linkzoom,orientacion,categoriaid,idfotoarchivo,idcoleccion));
        }
        
        this.doFototienda=function(idfotoarchivo,idcoleccion)
        {
            infoagregar(idcoleccion,idfotoarchivo);            
        }
        this.doZoom=function(obj)
        {            
            //alert(obj.zoom);
        }
        
        this.selectedFoto=function(s)
        {
           //window.clearInterval(this.timer);
            this.index=(s=="+")?((this.index<this.itemsFotos.length-1)?this.index+1:0):((this.index>0)?this.index-1:this.itemsFotos.length-1);
            this.llenaInfo();
           // this.timer=window.setTimeout("this.showFoto()",30000);
        }
        
        this.llenaInfo=function()
        {
            this.foto.src=this.itemsFotos[this.index].path;
            this.foto.alt=this.itemsFotos[this.index].alt;
            this.pie.innerHTML=this.itemsFotos[this.index].pie;
            
            var ctrlFototienda="";
            var ctrlZoom="";
            var ctrlFlechas="";
            var colspan=0;
            
            stribusqpalabra = document.domain.toLowerCase();
            if (stribusqpalabra.indexOf("palabra")==-1)
            {
                if (this.itemsFotos[this.index].idcoleccion>0 && this.itemsFotos[this.index].idfotoarchivo>0)
                {
                    ctrlFototienda='<td><img src="' + pathImagesFT + 'FTcarrito.gif" width="29" height="18" border="0" style="cursor:pointer;" onclick="objFotos.doFototienda('+ this.itemsFotos[this.index].idfotoarchivo + ',' + this.itemsFotos[this.index].idcoleccion + ');"/></td>';
                    colspan++;
                }
            }           
            if (this.itemsFotos.length>1)
            {
                ctrlFlechas= '<td><img src="' + pathImagesFT + 'FTflechaIzq.gif" width="15" height="18" border="0" style="cursor:pointer;" onclick="objFotos.selectedFoto(&quot;-&quot;);" /></td>' +
                             '<td><img src="' + pathImagesFT + 'FTline.gif" width="1" height="18" border="0" /></td>' +
                             '<td><img src="' + pathImagesFT + 'FTflechaDer.gif" width="15" height="18" border="0" style="cursor:pointer;" onclick="objFotos.selectedFoto(&quot;+&quot;);"/></td>';
                colspan+=3;              
            }           
                     
            if (this.itemsFotos[this.index].zoom!="")
            {
                //ctrlZoom='<td><img src="' + pathImagesFT + 'FTlupa.gif" width="21" height="18" border="0" style="cursor:pointer;" onclick="objFotos.doZoom(' + this.itemsFotos[this.index] + ');"/></td>';
                ctrlZoom='<td>' + 
                         '<a href=javascript:herramienta(&quot;' + this.itemsFotos[this.index].linkzoom
                         //'<a href=javascript:OpenFNZoom(&quot;' + this.itemsFotos[this.index].linkzoom
                                          + 'PathImagen=' + this.itemsFotos[this.index].zoom 
                                          + '&fuenteAutor=' + escape(this.itemsFotos[this.index].fotografo)
                                          + '&Orientacion=' + this.itemsFotos[this.index].orientacion
                                          + '&categoria=' + this.itemsFotos[this.index].categoriaid + '&quot;);>' + 
                         '<img src="' + pathImagesFT + 'FTlupa.gif" width="21" height="18" border="0"/>' + 
                         '</a>' +
                         '</td>';
                colspan++;
            }
                            
            if (ctrlFototienda!="")
                if (ctrlZoom!="" || ctrlFlechas!="")
                    {
                        ctrlFototienda+='<td><img src="' + pathImagesFT + 'FTline.gif" width="1" height="18" border="0" /></td>';
                        colspan++;
                    }
            if (ctrlFlechas!="")
                if (ctrlZoom!="")
                    {
                        ctrlFlechas+='<td><img src="' + pathImagesFT + 'FTline.gif" width="1" height="18" border="0" /></td>';
                        colspan++;
                    }
            
            if (ctrlFototienda!="" || ctrlFlechas!="" || ctrlZoom!="")
            {
            this.controles.innerHTML='<table cellpadding="0" cellspacing="0" border="0" height="20" bordercolor="aqua">' + 
                                        '<tr>' + 
                                            '<td bgcolor="#000000" colspan="9"><img src="' + pathImagesFT + 'pix.gif" width="1" height="1" border="0" /></td>' +
                                        '</tr>' +
                                        '<tr>' + 
                                            '<td bgcolor="#000000"><img src="' + pathImagesFT + 'pix.gif" width="1" height="18" border="0" /></td>' +
                                            ctrlFototienda +
                                           // ctrlFlechas +
                                            ctrlZoom +
                                            '<td bgcolor="#000000"><img src="' + pathImagesFT + 'pix.gif" width="1" height="18" border="0"/></td>' +
                                        '</tr>' +
                                        '<tr>' +
                                            '<td bgcolor="#000000"  colspan="9"><img src="' + pathImagesFT + 'pix.gif" width="1" height="1" border="0" /></td>' +
                                        '</tr>' +
                                     '</table>';
            }
            //this.alt=this.itemsFotos.alt;
            //this.zoom=this.itemsFotos.zoom;
            //this.orientacion=this.itemsFotos.orientacion;
        }
        
        this.showFoto= function()
        {
           if (this.itemsFotos.length>0)
           {
            this.index=(this.index==null)?0:(this.index<(this.itemsFotos.length-1))?this.index+1:0;
            //window.status= this.index  + ">" + (this.itemsFotos.length-1);
            this.llenaInfo();
            if (this.itemsFotos.length>0)
            {
                //this.timer=window.setTimeout("this.showFoto()",30000);
            }
           }
        }
        return this;
       }    
     var textoPieAnterior="";
     function showCreditos(id,pie)
     {
        objSpan=document.getElementById(id);
        textoPieAnterior=objSpan.innerHTML;
        objSpan.innerHTML=pie;
        objSpan=null;
     }
    
     function hideCreditos(id)
     {
        objSpan=document.getElementById(id);
        objSpan.innerHTML=textoPieAnterior;
        objSpan=null;
     }
 /****************CODIGO PARA MOSTRAR COLUMNAS ZONA 3 DE PORTADAS***********************************/
  function creaInfoColumnas(titulo, texto, imagen, liga)
  {
    this.titulo=titulo;
    this.texto=texto;
    this.imagen=imagen;
    this.liga=liga;
    return this;
  }
  
  function creaColumna(index)
  {
    this.titulo=document.getElementById("columna_" + index + "_titulo");
    this.descripcion=document.getElementById("columna_" + index + "_descripcion");
    this.imagen=document.images["columna_" + index + "_imagen"];    
    this.ligatitulo=document.getElementById("columna_" + index + "_ligaTitulo");
    this.ligaimagen=document.getElementById("columna_" + index + "_ligaImagen");
    return this;
  }
  
  function creaColumnas()
  {
    this.columnas= new Array();
    this.itemsColumnas = new Array();
    this.index0=0;
    this.index1=0;
    this.creaItem = function(titulo, texto, imagen, liga)
    {
         this.itemsColumnas.push(new creaInfoColumnas(titulo, texto, imagen, liga));
    }
    
    this.initColumnas=function()
    {
        if (this.itemsColumnas.length>0) 
         {
            this.columnas.push(new creaColumna(1));
         }
        if (this.itemsColumnas.length>1) this.columnas.push(new creaColumna(2));
    }
    
    this.randomIndex=function()
    {        
        var random_number=Math.floor(Math.random()*this.itemsColumnas.length);
        return random_number;
    }
    
    this.texto=function(texto,liga)
    {
        var t1="";
        var numcaracteres=0;
        if (this.columnas.length>1)
            numcaracteres=140;            
        else
            numcaracteres=290;
        if (texto.length > numcaracteres)
        {
            t1= texto.substring(0,numcaracteres);            
            t1=t1.substring(0,t1.lastIndexOf(" ")) + "...<a href='" + liga + "'><span class='arrojo14'><b> más</b></span></a>";
        }
        else
            t1=texto;
        return t1;
    }
    
    this.showColumnas=function(s)
    {
        var indexLocal;
        if (this.columnas.length>0)
        {
            if (this.itemsColumnas.length>2)
            {
                do
                {
                    indexLocal= this.randomIndex()
                }
                while (this.index0==indexLocal || this.index1==indexLocal)
                this.index0=indexLocal;
            }
            else
            {
                this.index0=0;
            }
            
             if (this.columnas[0].ligatitulo!=null)
                this.columnas[0].ligatitulo.href=this.itemsColumnas[this.index0].liga;
             if (this.columnas[0].ligaimagen!=null)
                this.columnas[0].ligaimagen.href=this.itemsColumnas[this.index0].liga;
            this.columnas[0].titulo.innerHTML=this.itemsColumnas[this.index0].titulo;
            this.columnas[0].descripcion.innerHTML=this.texto(this.itemsColumnas[this.index0].texto, this.itemsColumnas[this.index0].liga);
            
            this.columnas[0].imagen.src=this.itemsColumnas[this.index0].imagen;
            //this.index=(s=="+")?((this.index<this.itemsColumnas.length-1)?this.index+1:0):((this.index>0)?this.index-1:this.itemsFotos.length-1);            
        }        
        if (this.columnas.length>1)
        {
            if (this.itemsColumnas.length>2)
            {
                do
                {
                    indexLocal= this.randomIndex()
                }
                while (this.index0==indexLocal || this.index1==indexLocal)
                this.index1=indexLocal;
            }
            else
            {
                this.index1=1;
            }
            if (this.columnas[1].ligatitulo!=null)
                this.columnas[1].ligatitulo.href=this.itemsColumnas[this.index1].liga;
            if (this.columnas[1].ligaimagen!=null)
                this.columnas[1].ligaimagen.href=this.itemsColumnas[this.index1].liga;
            this.columnas[1].titulo.innerHTML=this.itemsColumnas[this.index1].titulo;
            this.columnas[1].descripcion.innerHTML=this.texto(this.itemsColumnas[this.index1].texto, this.itemsColumnas[this.index1].liga);
            
            this.columnas[1].imagen.src=this.itemsColumnas[this.index1].imagen;
            
            //this.index=(s=="+")?((this.index<this.itemsColumnas.length-1)?this.index+1:0):((this.index>0)?this.index-1:this.itemsFotos.length-1);
        }
    }    
    return this;
  }
  
  
  /**********************FUNCIONES PARA CUMPLEAÑOS EN PORTADA PRINCIPAL*******************/
    function creainfoCumples(foto, nombre, fecha)
    {
        this.foto=foto;
        this.nombre=nombre;
        this.fecha=fecha;
        return this;
    }
    
    function creaCumple(index)
    {
        this.foto=document.images["cumple_foto_" + index];
        this.span=document.getElementById("cumple_span_" + index);
        return this;
    }
    
    function creaCumples()
    {
        this.itemsCumples = new Array();
        this.cumples= new Array();
        this.index=0;
        
        this.creaitem= function(foto, nombre, fecha)
        {
            this.itemsCumples.push(new creainfoCumples(foto, nombre, fecha));            
        }
        
        this.initCumples=function()
        {
            for (var xcumple=1; xcumple<5;xcumple++)
            {
                this.cumples.push(new creaCumple(xcumple));
            }
        }
        
        this.showCumples=function(s)
        {
             var executa=true;
             if (this.index!=0)
                {
                    if (s=="+") 
                        {
                        if (this.index < this.itemsCumples.length)
                            this.index=(this.index - this.cumples.length)+ 1;
                        else
                            executa=false;
                        }
                    else  
                       {
                        if (this.index-this.cumples.length > 0)
                            this.index=(this.index - this.cumples.length)-1;
                        else
                            executa=false;
                       }
                }             
            if (executa)
            {   
                window.status="";         
                for (var xcumple=0;xcumple<this.cumples.length;xcumple++)
                {
//                    window.status+= this.index + ",";
                    if (this.itemsCumples[this.index].foto!="")
                        this.cumples[xcumple].foto.src=this.itemsCumples[this.index].foto;
                    else
                        this.cumples[xcumple].foto.src="../Libre/Online07/Sociales/imagenes/comunes/pix.gif";
                    this.cumples[xcumple].span.innerHTML=this.itemsCumples[this.index].fecha + "<br>" + this.itemsCumples[this.index].nombre;
                    this.index++;
                }
            }
        }
        return this;
    }
    
    function creaCumple2()
    {
        this.arrImages= new Array();
        this.foto=document.images["cumple2_imagen"];
        this.index=0;
        
        this.creaItemCumple2= function (src)
        {
            this.arrImages.push(src)
        }
        
        this.showCumple2=function(s)
        {
           if (this.arrImages.length>0)
           {
            this.index=(s=="+")?((this.index+1>this.arrImages.length-1)?0:this.index+1):((this.index-1<0)?this.arrImages.length-1:this.index-1);
            this.foto.src=this.arrImages[this.index];
           }
        }
        
        this.randomIndex=function()
        {
           if (this.arrImages.length>0)
           {
            var random_number=Math.floor(Math.random()*this.arrImages.length);
            this.foto.src=this.arrImages[random_number];
           }
        }
        return this;
    }
    
/**************************FUNCTION PARA CORRER FLASH MULTIPROMO SUBURBANAS*****************************************************/
function runFlash(movie,width,height,fileini,fileinfo){
         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="multipromo" align="top" VIEWASTEXT>');
         document.writeln('<param name="allowScriptAccess" value="always" />');
         document.writeln('<param name="movie" value="'+ movie+'?FileIni='+ fileini + '&amp;FileInfo='+ fileinfo +'" />');
         document.writeln('<param name="quality" value="high" />');
         document.writeln('<param name="bgcolor" value="#ffffff" />');         
         document.writeln('<embed src="'+ movie+'?FileIni='+ fileini + '&FileInfo='+ fileinfo +'" quality="high" bgcolor="#ffffff" width="'+ width + '" height="'+ height + '" name="multipromo" align="top" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true"/>');
         document.writeln('</object>');
     }
     
 /************************LO MAS VISTO Y ENVIADO EN PORTADAS****************************************/
     function showLoMas(param)
      {
      if (param=='visto')
      {
      document.getElementById("div_LoMasVisto").style.visibility="visible";
      document.getElementById("div_LoMasVisto").style.display="block";
      document.getElementById("div_Envidado").style.visibility="hidden";
      document.getElementById("div_Envidado").style.display="none";
      document.images["lomas_image"].src=document.images["lomas_image"].src.replace("_enviado","_visto");
      }
      if (param=='enviado')
      {
      document.getElementById("div_Envidado").style.visibility="visible";
      document.getElementById("div_Envidado").style.display="block";
      document.getElementById("div_LoMasVisto").style.visibility="hidden";
      document.getElementById("div_LoMasVisto").style.display="none";
      document.images["lomas_image"].src=document.images["lomas_image"].src.replace("_visto","_enviado");
      }
      }
      
   /************************TOPCINCO EN PORTADAS****************************************/
    function creaTopCincoItem(imagen,nombre)
    {
        this.imagen=imagen;
        this.nombre=nombre;
        return this;
    }

    function creaTopCinco()
    {
        this.span=document.getElementById("topcinco_span");
        this.td=document.getElementById("topcinco_td");
        this.imagen=document.images["topcinco_image"];
        this.topCincoItems = new Array();
        this.pathImages=null;    
        this.lastIndex=0;
        
        this.imagen.parent=this;
        this.imagen.onclick=function ()
        {
            if (typeof(this.parent.topCincoItems[this.parent.lastIndex])!="undefined")
                {
                document.formFT.texto.value=this.parent.topCincoItems[this.parent.lastIndex].nombre;
                document.formFT.fiaa.selectedIndex=0;
                document.formFT.fimm.selectedIndex=0;
                document.formFT.fidd.selectedIndex=0;
                var fecha_hoy = new Date();
                document.formFT.ffdd.selectedIndex = fecha_hoy.getDate()-1;	            
	            document.formFT.ffmm.selectedIndex = fecha_hoy.getMonth();	            
	            document.formFT.ffaa.selectedIndex = document.formFT.ffaa.length-1;
	            document.formFT.grcidorigen.value = 3;
	            
	            if (typeof(seccionOriginalFT)!="undefined")
	            {
	                document.formFT.seccion.value=seccionOriginalFT;	                
	             }
                if (checaDatosFT())
                  document.formFT.submit();
                }
        }
        
        this.creaItem=function(imagen,nombre)
        {
            this.topCincoItems.push(new creaTopCincoItem(imagen,nombre))
        }        
                            
        this.showInfo=function(xIndex)
        {
           if (this.topCincoItems.length>0)
           {           
            if (typeof(this.topCincoItems[xIndex])!="undefined")
            {
                this.span.innerHTML=this.topCincoItems[xIndex].nombre;            
                this.imagen.src=this.topCincoItems[xIndex].imagen;               
                this.td.style.backgroundImage=this.td.style.backgroundImage.replace("_fondo" + (this.lastIndex + 1), "_fondo" + (xIndex+1));
            }
            else
            {
                this.span.innerHTML="";
                this.imagen.src="";
                this.td.style.backgroundImage=this.td.style.backgroundImage.replace("_fondo" + (this.lastIndex + 1), "_fondo" + (xIndex+1));
             }
             document.images["topcinco_image_" + (this.lastIndex+1) ].src=document.images["topcinco_image_" + (this.lastIndex+1)].src.replace("topcinco_rank"+ (this.lastIndex+1)+ ".gif", "topcinco_rank" + (this.lastIndex+1) + "_off.gif");
             document.images["topcinco_image_" + (xIndex+1) ].src=document.images["topcinco_image_" + (xIndex+1)].src.replace("topcinco_rank"+ (xIndex+1)+ "_off.gif", "topcinco_rank" + (xIndex+1) + ".gif");
             this.lastIndex=xIndex;
            }
        }
        return this;
    } 

/****************************
 * FUNCIONES PARA CAMBIO DE *
 * TAMAÑO DE LETRA EN NOTAS *
 ****************************/
function setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alternate") != -1 && a.getAttribute("title")) {
			a.disabled = true;
			if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
}
function getActiveStyleSheet() {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alternate") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
	}
	return null;
}
function getPreferredStyleSheet() {
	return ('1');
}
function wOL() {
	var cookie = Get_Cookie("style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	if (title == 'null')
		title = '1';
	setActiveStyleSheet(title);
}
function wOUL() {
	var title = getActiveStyleSheet();
	createCookie("style", title, 365);
}

/**************
* Funciones para ventanas
***************/
function herramienta(direccion)
{	
    var aleatorio = "P"+Math.round(Math.random()*1000);
	LeftPosition = (screen.width) ? (screen.width-800)/2 : 0; 
	TopPosition = (screen.height) ? (screen.height-400)/2 : 0;
	window.open(direccion,aleatorio,'top=' + TopPosition + ',left=' + LeftPosition + ',width=800,height=400,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
}

/**************
* Hacer submit a forma de mi cajon
***************/
function DatosMicajon()
{
    usuarioidcajon = document.micajon.usuarioidcajon.value;
    titulocajon = document.micajon.titulocajon.value;
    ligacajon = document.micajon.ligacajon.value;
    seccioncajon = document.micajon.seccioncajon.value;
    tipocajon = document.micajon.tipocajon.value;
    fechacajon = document.micajon.fechacajon.value;
    archivoidcajon = document.micajon.archivoidcajon.value;
    basepathmicajon = document.micajon.basepathmicajon.value;
    titulocajon=titulocajon.replace(/'/g,"")
    titulocajon=caractEspec(titulocajon);
    titulocajon=escape(titulocajon);
    
    herramienta(basepathmicajon+"micajon/micajon.aspx?usuarioid="+usuarioidcajon+"&titulo="+titulocajon+"&liga="+ligacajon+"&seccion="+seccioncajon+"&tipo="+tipocajon+"&fecha="+fechacajon+"&archivoid="+archivoidcajon);
    return false;
}



/********************Carrito de fototienda***************************/
function infoagregar(idcoleccion,idfoto)
{
    if (idcoleccion > 0 && idfoto > 0)
    {
	    dominio = document.domain;
	    direccion = "http://" + dominio + "/fototienda/agregaweb.aspx?idcoleccion=" + idcoleccion + "&IdFotoArchivo=" + idfoto + "&usuario=" + Get_Cookie("cusuarioss");
	    TopPosition = (screen.height) ? (screen.height-500)/2 : 0;
	    LeftPosition = (screen.width) ? (screen.width-800)/2 : 0;
	    window.open(direccion,'msgagregar','top=' + TopPosition + ',left=' + LeftPosition + ',width=800,height=500,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
	}
}
/***********************menu suburbana*********************************/
function showMenuSuburbana(id) {
    if (document.getElementById) {
      if (document.getElementById(id).style.visibility == 'visible')
      {
        document.getElementById(id).style.visibility = 'hidden';
        document.getElementById(id).style.display = 'none';
      }
      else
      {
        document.getElementById(id).style.visibility = 'visible';	  
        document.getElementById(id).style.display = 'block';
      }
    }
  }
  
function ira(href)
{
    document.location.href =href;
}

/***************************************
* CONTEO EN INFOSTATS DE UN MULTIMEDIA *
****************************************/
function padZero (num, length) {
 num = String(num);
 length = parseInt(length) || 2;
 while (num.length < length)
  num = "0" + num;
 return num;
};
function FnInfostats(ElementoId, CategoriaId, SubCategoriaId, Titulo, Liga) {
 //se manda a llamar desde el FLASH del player de videogalerias
 var auxDate = new Date();
 var strDate = auxDate.getFullYear() + "-" + padZero(auxDate.getMonth()+1,2) + "-" + padZero(auxDate.getDate(),2) + " " + padZero(auxDate.getHours(),2) + ":" + padZero(auxDate.getMinutes(),2) + ":" + padZero(auxDate.getSeconds(),2);
 var urlHITIS = "http://estadisticas.gruporeforma.com/hit20.tif" +
          "?grcuser=" + grcuser +
          "&grcsesion=" + grcsesion +
          "&grcidcom=" + grcidcom +
          "&grcfrom=" + grcfrom +
          "&grcfecha=" + escape(strDate) +
          "&grcidfte=" + grcidfte +
          "&grcidgrupo=" + grcidgrupo +
          "&grcidelem=" + ElementoId +
          "&grcidcat=" + CategoriaId +
          "&grcidsubc=" + SubCategoriaId +
          "&grcidtcon=" + grcidtcon +
          "&grcliga=" + Liga +
          "&grctit=" + caractEspec(Titulo) +
          "&grcautornota=" + escape("null") +
          "&grcidplaza=" + grcidplaza +
          "&grcidtema=" + grcidtema +
          "&grcjver=" + escape(grcjver);
 var imgHITIS = document.getElementById("HIT")?document.getElementById("HIT"):new Image();
 imgHITIS.src = urlHITIS;
};