var mi_url = document.location.href;
  dir_frame = "";


	  tamano_frame ="WIDTH: 1002px; HEIGHT: 35px";
          VABC = "no";
	  dir_frame ="";
	if(mi_url.indexOf("elcorreodigital.") > 0 || mi_url.indexOf("www.proyectosalava") > 0) {
		logotipo = "mancheta_elcorreo.gif";
		cabecera = "elcorreo";
		server_publi = "www.diario-elcorreo.es";
		nombre_server = "elcorreodigital.com";
		nombre_tienda = "elcorreodigital";
		url_portal = "elcorreodigital.com";
		nombre_portal="El Correo Digital";
		url_portal = "elcorreodigital.com";
        	id_medio_zooming = "elcorreodigital";
        	if(mi_url.indexOf("/la-blanca")> 0 || mi_url.indexOf("www.proyectosalava") > 0) {
			dir_frame = "http://www.elcorreodigital.com/ticker/alava/minicabecera.htm";
		}else{
			dir_frame = "http://www.elcorreodigital.com/ticker/vizcaya/minicabecera.htm";
		}
		server_ojd="elcorreo";
		url_blogs="blogs.elcorreodigital.com";
                nombre_cabecera1 = "elcorreodigital.com";
                nombre_trastienda = "latrastiendadigital.com/elcorreodigital";
		nombre_postal = "elcorreodigital";
		nombre_empresa = "EL CORREO DIGITAL, S.L.U";
                logos = "elcorreodigital.gif";
                sms = "ec.jpg";
                gg_tracker = "UA-7212485-3";

	} else if(mi_url.indexOf("diariovasco.") > 0) {

		logotipo = "mancheta_dvasco.gif";
		cabecera = "dvasco";
		server_publi = "www.diariovasco.com";
		nombre_server = "diariovasco.com";
		nombre_tienda = "diariovasco";
		url_portal = "diariovasco.com";
		nombre_portal="diariovasco.com";
                id_medio_zooming = "diariovasco";
		dir_frame = "http://www.diariovasco.com/ticker/minicabecera.htm";
		server_ojd="diariovasco";
		url_blogs="blogs.diariovasco.com";
                nombre_cabecera1 = "diariovasco.com";
		nombre_trastienda = "latrastiendadigital.com/diariovasco";
		nombre_postal = "diariovasco";
		nombre_empresa = "DIGITAL VASCA, S.A.";
		logos = "diariovasco.gif";
                sms = "dv.jpg";
                gg_tracker = "UA-59232-1";

	} else if(mi_url.indexOf("laverdad.") > 0) {

		logotipo = "mancheta_laverdad.gif";
		cabecera = "laverdad";
		server_publi = "www.la-verdad.com";
		nombre_server = "laverdad.es";
		nombre_tienda = "laverdad";
		url_portal = "laverdad.es";
		nombre_portal="La Verdad Digital";
                id_medio_zooming = "laverdad";
		dir_frame = "http://www.laverdad.es/ticker/murcia/minicabecera.htm";
		server_ojd="laverdad";
		url_blogs="blogs.laverdad.es";
	        nombre_cabecera1 = "laverdad.es/murcia";
		nombre_trastienda = "latrastiendadigital.com/laverdad";
		nombre_postal = "laverdad";
		nombre_empresa = "LA VERDAD DIGITAL S.L.";
		logos = "laverdad.gif";
                sms = "lv.jpg";
                gg_tracker = "UA-6052672-2";

	} else if(mi_url.indexOf("nortecastilla.") > 0) {
		logotipo = "mancheta_nortecas.gif";
		cabecera = "nortecastilla";
		server_publi = "www.nortecastilla.es";
		nombre_server = "nortecastilla.com";
		nombre_tienda = "nortecastilla";
		nombre_portal="El Norte de Castilla";
		url_portal = "nortecastilla.es";
                id_medio_zooming = "nortecastilla";
		dir_frame = "http://www.nortecastilla.es/ticker/minicabecera.htm";
		server_ojd="nortecastilla";
		url_blogs="blogs.nortecastilla.es";
		nombre_cabecera1 = "nortecastilla.es";
		nombre_trastienda = "latrastiendadigital.com/nortecastilla";
		nombre_postal = "nortecastilla";
		nombre_empresa = "El Norte de Castilla Digital S.L.";
		logos = "nortecastilla.gif";
                sms = "vacio.gif";
                gg_tracker = "UA-7123523-1";

	} else if((mi_url.indexOf("hoy.") > 0) || (mi_url.indexOf("hoysport.") > 0)) {
		logotipo = "mancheta_hoy.gif";
		cabecera = "hoy";
		server_publi = "www.hoy.es";
		nombre_server = "hoy.es";
		nombre_tienda = "hoy";
		url_portal = "hoy.es";
		nombre_portal="Hoy Digital";
                id_medio_zooming = "hoy";
		dir_frame = "http://www.hoy.es/ticker/minicabecera.htm";
		server_ojd="hoy";
		url_blogs="blogs.hoy.es";
		nombre_cabecera1 = "hoy.es";
		nombre_trastienda = "latrastiendadigital.com/hoy";
		nombre_postal = "hoy";
		nombre_empresa = "EDICIONES DIGITALES HOY, S.L.U";
		logos = "hoydigital.gif";
                sms = "vacio.gif";
                gg_tracker = "UA-7648528-1";

	} else if(mi_url.indexOf("larioja.") > 0) {
		logotipo = "mancheta_larioja.gif";
		cabecera = "larioja";
		server_publi = "www.larioja.com";
		nombre_server = "larioja.com";
		nombre_tienda = "larioja";
		url_portal = "larioja.com";
		nombre_portal="larioja.com";
                id_medio_zooming = "larioja";
		dir_frame = "http://www.larioja.com/ticker/minicabecera.htm";
		server_ojd="larioja";
		url_blogs="blogs.larioja.com";
		nombre_cabecera1 = "larioja.com";
		nombre_trastienda = "latrastiendadigital.com/larioja";
		nombre_postal = "larioja";
		nombre_empresa = "LA RIOJA COM SERVICIOS EN LA RED S.A.U.";
		logos = "larioja.gif";
                sms = "lr.jpg";
                gg_tracker = "UA-7124171-1";

	} else if(mi_url.indexOf("diariosur.") > 0) {
		logotipo = "mancheta_sur.gif";
		cabecera = "sur";
		server_publi = "www.diariosur.es";
		nombre_server = "diariosur.es";
		nombre_tienda = "diariosur";
		url_portal = "diariosur.es";
		nombre_portal="Diario Sur";
                id_medio_zooming = "diariosur";
		dir_frame = "http://www.diariosur.es/ticker/minicabecera.htm";
		server_ojd="diariosur";
		url_blogs="blogs.diariosur.es";
		nombre_cabecera1 = "diariosur.es";
		nombre_trastienda = "latrastiendadigital.com/diariosur";
		nombre_postal = "diariosur";
		nombre_empresa = "Diario SUR Digital, S. L.";
		logos = "diariosur.gif";
                sms = "dsur.jpg";
                gg_tracker = "UA-3128303-21";

	} else if(mi_url.indexOf("eldiariomontanes.") > 0) {
		logotipo = "mancheta_dmontanes.gif";
		cabecera = "dmontanes";
		server_publi = "www.eldiariomontanes.es";
		nombre_server = "eldiariomontanes.es";
		nombre_tienda = "eldiariomontanes";
		url_portal = "eldiariomontanes.es";
		nombre_portal="El Diario Monta&ntilde;&eacute;s";
                id_medio_zooming = "eldiariomontanes";
		dir_frame = "http://www.eldiariomontanes.es/ticker/minicabecera.htm";
		server_ojd="diariomontanes";
		url_blogs="blogs.eldiariomontanes.es";
		nombre_cabecera1 = "eldiariomontanes.es";
		nombre_trastienda = "latrastiendadigital.com/eldiariomontanes";
		nombre_postal = "eldiariomontanes";
		nombre_empresa = "Editorial Cantabria Interactiva S.L.";
		logos = "eldiariomontanes.gif";
                sms = "dm.jpg";
                gg_tracker = "UA-7123523-1";

	} else if(mi_url.indexOf("ideal.") > 0) {
		logotipo = "mancheta_ideal.gif";
		cabecera = "ideal";
		server_publi = "www.ideal.es";
		nombre_server = "ideal.es";
		nombre_tienda = "ideal";
		url_portal = "ideal.es";
		nombre_portal="Ideal Digital";
                id_medio_zooming = "ideal";
		dir_frame = "http://www.ideal.es/ticker/granada/minicabecera.htm";
		server_ojd="ideal";
		url_blogs="blogs.ideal.es";
		nombre_cabecera1 = "ideal.es/granada";
		nombre_trastienda = "latrastiendadigital.com/ideal";
		nombre_postal = "ideal";
		nombre_empresa = "Ideal Comunicación Digital SLU";
		logos = "elidealdigital.gif";
                sms = "vacio.gif";
                gg_tracker = "UA-4272508-12";

	} else if(mi_url.indexOf("elcomerciodigital.") > 0) {
		logotipo = "mancheta_elcomercio.gif";
		cabecera = "elcomercio";
		server_publi = "www.elcomercio-sa.es";
		nombre_server = "elcomerciodigital.com";
		nombre_tienda = "elcomerciodigital";
		url_portal = "elcomerciodigital.com";
		nombre_portal="El Comercio Digital";
                id_medio_zooming = "elcomercio";
		dir_frame = "http://www.elcomerciodigital.com/ticker/minicabecera.htm";
		server_ojd="elcomercio";
		url_blogs="blogs.elcomerciodigital.com";
		nombre_cabecera1 = "elcomerciodigital.com";
		nombre_trastienda = "latrastiendadigital.com/elcomerciodigital";
		nombre_postal = "elcomerciodigital";
		nombre_empresa = "El Comercio Digital, Servicios en la Red S.L.";
		logos = "elcomerciodigital.gif";
                sms = "d.jpg";
                gg_tracker = "UA-3458093-1";

	} else if(mi_url.indexOf("lasprovincias.") > 0) {
		logotipo = "mancheta_lasprovincias.gif";
		cabecera = "lasprovincias";
		server_publi = "www.lasprovincias.es";
		nombre_server = "lasprovincias.es";
		nombre_tienda = "lasprovincias";
		url_portal = "lasprovincias.es";
		nombre_portal="Las Provincias";
                id_medio_zooming = "lasprovincias";
		dir_frame = "http://www.lasprovincias.es/ticker/valencia/minicabecera.htm";
		server_ojd="lasprovincias";
		url_blogs="blogs.lasprovincias.es";
		nombre_cabecera1 = "lasprovincias.es/valencia";
		nombre_trastienda = "latrastiendadigital.com/lasprovincias";
		nombre_postal = "lasprovincias";
		nombre_empresa = "Valenciana Editorial Interactiva S.L.";
		logos = "lasprovincias.gif";
                sms = "vacio.gif";
                gg_tracker = "UA-7008806-1";

	} else if(mi_url.indexOf("ozu.") > 0) {
		logotipo = "ozutr.gif";
		cabecera = "ozu";
		server_publi = "www.ozu.es";
		nombre_server = "ozu.es";
		nombre_tienda = "ozu";
		url_portal = "ozu.es";
		nombre_portal="Ozu.es";
                id_medio_zooming = "ozu";
		dir_frame = "http://ozu.es/cabeceras/";
		server_ojd="ozu";
		url_blogs="blogs.ozu.es";
		nombre_cabecera1 = "diariovasco.com";
		nombre_trastienda = "latrastiendadigital.com/ozu";
		nombre_postal = "ozu";
		nombre_empresa = "ADVERNET, S.L.";
		logos = "ozu.gif";
                sms = "vacio.gif";
                gg_tracker = "";

	} else if(mi_url.indexOf("abc.") > 0) {
		logotipo = "mancheta_abc.gif";
		cabecera = "abc";
		server_publi = "www.abc.es";
		nombre_server = "abc.es";
		nombre_tienda = "abc";
		url_portal = "abc.es";
		nombre_portal="ABC";
                id_medio_zooming = "abc";
		dir_frame = "http://www.abc.es/ocio/cabecera/cab_cobranded_abc1024.htm";
		tamano_frame ="WIDTH: 1002px; HEIGHT: 35px";
		server_ojd = "abc";
		url_blogs="blogs.abc.es";
		nombre_cabecera1 = "abc.es";
                VABC ="si";
		nombre_trastienda = "latrastiendadigital.com/abc";
		nombre_postal = "abc";
		nombre_empresa = "ABC Periódico Electrónico S.L.U";
		logos = "abc.gif";
                sms = "abc.jpg";
                gg_tracker = "";

       } else if(mi_url.indexOf("abcdesevilla.") > 0) {
		logotipo = "mancheta_abc.gif";
		cabecera = "abc";
		server_publi = "www.abc.es/aldia";
		nombre_server = "abc.es";
		nombre_tienda = "abc";
		url_portal = "abc.es";
		nombre_portal="ABC";
		server_ojd = "abc";
                id_medio_zooming = "abc";
				dir_frame = "http://www.abcdesevilla.es/ocio/cabecerasevilla/cabecera_1002.htm";
		tamano_frame ="WIDTH: 1002px; HEIGHT: 35px";


	} else if(mi_url.indexOf("lavozdigital.") > 0) {
                logotipo = "mancheta_vdcadiz.gif";
                cabecera = "vdcadiz";
                server_publi = "www.lavozdecadiz.com";
                nombre_server = "lavozdigital.es";
                nombre_tienda = "lavozdecadiz";
                url_portal = "lavozdigital.es";
                nombre_portal="LA VOZ DIGITAL";
                id_medio_zooming = "lavozdecadiz";
                dir_frame = "http://www.lavozdigital.es/ticker/minicabecera.htm";
               server_ojd="lavozdecadiz";
               url_blogs="blogs.lavozdigital.es";
               nombre_cabecera1 = "lavozdigital.es/cadiz";
                nombre_trastienda = "latrastiendadigital.com/lavozdecadiz";
                nombre_postal = "lavozdecadiz";
                nombre_empresa = "LVCD S.L.U. ";
                logos = "lavozdigital.gif";
                sms = "lvoz.jpg";
                gg_tracker = "UA-3047322-6";

	} else if(mi_url.indexOf("www.finanzas.") > 0) {
                server_publi = "www.hoyInversion.com"
                nombre_server = "finanzas.com";
                url_portal = "finanzas.com";
                nombre_portal="FINANZAS";
                nombre_tienda = "hoyinversion";
                id_medio_zooming = "hoyinversion";
                dir_frame = "http://www.finanzas.com/minicabecera/minicabecera.htm";
		server_ojd="vocento";
		url_blogs="blogs.finanzas.com";
		logos = "finanzas.gif";
                sms = "vacio.gif";
                gg_tracker = "";


	}  else if(mi_url.indexOf("www.hoycinema.") > 0) {
                server_publi = "www.hoycinema.es";
                nombre_server = "hoycinema.com";
                url_portal = "hoycinema.com";
                nombre_portal="HOY CINEMA";
                nombre_tienda = "hoycinema";
                id_medio_zooming = "hoycinema";
                dir_frame = "";
                tamano_frame ="WIDTH: 780px; HEIGHT: 50px";
		server_ojd="vocento";
		url_blogs="blogs.hoycinema.com";
		logos = "hoycinema.gif";
                sms = "vacio.gif";
                gg_tracker = "";


	} else if(mi_url.indexOf("www.hoymotor.") > 0) {
                server_publi = "www.hoymotor.com"
                nombre_server = "hoymotor.com";
                url_portal = "hoymotor.com";
                nombre_portal="HOY MOTOR";
                nombre_tienda = "vocento";
                id_medio_zooming = "hoymotor";
                dir_frame = "";
                tamano_frame ="WIDTH: 780px; HEIGHT: 50px";
		server_ojd="vocento";
		url_blogs="blogs.hoymotor.com";
		logos = "hoymotor.gif";
                sms = "vacio.gif";
                gg_tracker = "";

	} else if(mi_url.indexOf("laguiatv.") > 0) {
	    	server_publi = "www.laguiatv.com";
	    	nombre_server = "laguiatv.com";
	    	nombre_tienda = "LATRASTIENDADIGITAL";
	    	url_portal = "laguiatv.com";
	    	nombre_portal="LaguiaTV";
            	id_medio_zooming = "laguiatv";
	    	dir_frame = "http://www.laguiatv.com/canales/cabe_especial.htm";
	    	tamano_frame ="WIDTH: 780px; HEIGHT: 50px";
	    	server_ojd="laguiatv";
	    	url_blogs="blogs.laguiatv.com";
                sms = "vacio.gif";
                gg_tracker = "";


	} else if(mi_url.indexOf("xlsemanal.") > 0) {
	    	server_publi = "www.laguiatv.com";
	    	nombre_server = "laguiatv.com";
	    	nombre_tienda = "LATRASTIENDADIGITAL";
	    	url_portal = "laguiatv.com";
	    	nombre_portal="LaguiaTV";
            	id_medio_zooming = "vocento";
	    	dir_frame = "http://www.xlsemanal.com/iframe2005.htm";
	    	tamano_frame ="WIDTH: 780px; HEIGHT: 50px";
            	server_ojd="laguiatv";
            	url_blogs="blogs.laguiatv.com";
                sms = "vacio.gif";
                gg_tracker = "";

        }  else if(mi_url.indexOf("planet-futbol.") > 0) {
                server_publi = "www.vocento.net"
                nombre_server = "que.es";
                url_portal = "que.es";
                nombre_portal="Qué!";
                server_ojd = "vocento";
                url_blogs="blogs.que.es";
                id_medio_zooming = "vocento";
		dir_frame ="http://www.planet-futbol.com/planetfutbol/minicabecera.htm";
                tamano_frame ="WIDTH: 780px; HEIGHT: 65px";
		nombre_cabecera1 = "";
	        nombre_trastienda = "latrastiendadigital.com/LATRASTIENDADIGITAL";
		logos = "planetfutbol.gif";
                sms = "vacio.gif";
                gg_tracker = "";
	 }  else if(mi_url.indexOf("que.") > 0) {
                server_publi = "vocento.que"
                nombre_server = "vocento.com";
                url_portal = "planet-futbol.com";
                nombre_portal="PLANETFUTBOL";
                server_ojd = "vocento";
                url_blogs="blogs.planet-futbol.com";
                id_medio_zooming = "vocento";
		dir_frame ="http://www.que.es/minicabecera/header.html";
                tamano_frame ="width:100%;height: 39px;";
		nombre_cabecera1 = "que";
	        nombre_trastienda = "latrastiendadigital.com/LATRASTIENDADIGITAL";
		logos = "vacio.gif";
                sms = "vacio.gif";
                gg_tracker = "UA-4520287-1";
	} else {
		logotipo = "logo_vocento.gif";
		cabecera = "vocento";
		server_publi = "www.vocento.net";
		nombre_server = "vocento.net";
		nombre_tienda = "LATRASTIENDADIGITAL";
		url_portal = "vocento.net";
		nombre_portal="Vocento";
		id_medio_zooming = "vocento";
	        tamano_frame ="WIDTH: 780px; HEIGHT: 0px";
		dir_frame = "";
		server_ojd="vocento";
		url_blogs="blogs.vocento.com";
	        nombre_cabecera1 = "abc.es";
                VABC ="si";
		nombre_trastienda = "latrastiendadigital.com/LATRASTIENDADIGITAL";
		nombre_postal = "ozu";
		nombre_empresa = "editora de este medio digital";
		logos = "planetfutbol.gif";
                sms = "vacio.gif";
                gg_tracker = "";
	}


$(document).ready(function() {
    $('a').each(function() {
	    	var enlace = $(this).attr('href');
            var url = document.location.href;
            var campos2 = url.split('.');
            switch(true) {
                case (enlace.indexOf('multimedia/Audios') > 0):
                    var campos = enlace.split('multimedia/Audios');
                    $(this).attr('href', campos[0] + 'multimedia/' + campos2[1] + '/Audios' + campos[1]);
                    break;
                case (enlace.indexOf('multimedia/Videos') > 0):
                    var campos = enlace.split('multimedia/Videos');
                    $(this).attr('href', campos[0] + 'multimedia/' + campos2[1] + '/Videos' + campos[1]);
                    break;
                case (enlace.indexOf('multimedia/Imagenes') > 0):
                    var campos = enlace.split('multimedia/Imagenes');
                    $(this).attr('href', campos[0] + 'multimedia/' + campos2[1] + '/Imagenes' + campos[1]);
                    break;
            }
            if(enlace.indexOf('url_portal') > 0){
           	 var enlace_campos = enlace.split('url_portal');
            	$(this).attr('href', enlace_campos[0] + url_portal + enlace_campos[1]);
            }
        }
    );
});



function ir_a_tienda(parametros) {
	var url_tienda = "http://www.latrastiendadigital.com/"+nombre_tienda+"/default.asp?" + parametros;
	var pop_tienda = open(url_tienda, "pop_tienda", "scrollbars=1,menubar=1,titlebar=1,resizable=1,status=1,location=1");
}


function hidediv(id) {
	if (document.getElementById) {
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) {
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	if (document.getElementById) {
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) {
			document.id.display = 'block';
		}
		else {
			document.all.id.style.display = 'block';
		}
	}
}
 function activa_multimedia(tipo){
	switch(tipo){
		case 'multimedia-fotos':
			hidediv('contenido-multimedia-videos');
			hidediv('contenido-multimedia-audios');
			document.getElementById('pestanna-multimedia-videos').className="";
			document.getElementById('pestanna-multimedia-audios').className="";

			break;
		case 'multimedia-videos':
			hidediv('contenido-multimedia-fotos');
			hidediv('contenido-multimedia-audios');
			document.getElementById('pestanna-multimedia-fotos').className="";
			document.getElementById('pestanna-multimedia-audios').className="";
			break;
		case 'multimedia-audios':
			hidediv('contenido-multimedia-videos');
			hidediv('contenido-multimedia-fotos');
			document.getElementById('pestanna-multimedia-videos').className="";
			document.getElementById('pestanna-multimedia-fotos').className="";
	}
	document.getElementById('pestanna-'+tipo).className="activo";
	showdiv('contenido-'+tipo);

}
function activa_contenido(tipo, tipo2){
	hidediv('contenido-'+tipo2);
	document.getElementById('pestanna-'+tipo2).className="";
	document.getElementById('pestanna-'+tipo).className="activo";
	showdiv('contenido-'+tipo);

}
function activa_contenido_varios(tipo,general){

	pestanas = window.document.getElementById('pestannas-' + general);
	hijosArray = pestanas.childNodes;
	for(i=0;i<hijosArray.length;i++) {
		if((typeof(hijosArray[i].id) != 'undefined') && (hijosArray[i].id.indexOf('pestanna-')== 0)) {
			hijosArray[i].className="";
		}
	}

	contenidos = window.document.getElementById('contenido-' + general);
	hijosArray = contenidos.childNodes;
	for(i=0;i<hijosArray.length;i++) {
		if((typeof(hijosArray[i].id) != 'undefined') && (hijosArray[i].id.indexOf('contenido-')== 0)) {
			hidediv(hijosArray[i].id);
		}
	}
	document.getElementById('pestanna-'+tipo).className="activo";
	showdiv('contenido-'+tipo);
}

function multimedia(categoria,num) {
		contenidos = window.document.getElementById('contenido-multimedia-' + categoria);
		hijosArray = contenidos.childNodes;
		for(i=0;i<hijosArray.length;i++) {
			if((typeof(hijosArray[i].id) != 'undefined') && (hijosArray[i].id.indexOf('multimedia-' + categoria + '-') == 0)) {
				if(hijosArray[i].id == 'multimedia-' + categoria + '-' + num)
					hijosArray[i].style.display = '';
				else
					hijosArray[i].style.display = 'none';
			}
		}
	}

	function thumbnail(id,masmenos,total) {
		contenidos = window.document.getElementById(id);
		hijosArray = contenidos.childNodes;
		for(i=0;i<hijosArray.length;i++) {
			if((typeof(hijosArray[i].id) != 'undefined') && (hijosArray[i].id.indexOf(id + '-ver-') == 0)) {
				datosThum = hijosArray[i].id.split('-');
				numThum = parseInt(datosThum[datosThum.length - 2]);
				numCont = parseInt(datosThum[datosThum.length - 1]);
				if(numCont == 0)
					numCont = numThum;
				else {
					numCont = masmenos == '-' ? numCont - 1 : numCont + 1;
					if(numCont < 1)
						numCont = numCont + total;
					else if(numCont > total)
						numCont = numCont - total;
				}
				hijosArray[i].id = id + '-ver-' + numCont + '-' + numCont;
				if(window.document.getElementById(id + '-' + numCont)) {
					hijosArray[i].innerHTML = window.document.getElementById(id + '-' + numCont).innerHTML;
				}
			}
		}
	}

/***************************** Comentarios **********************************/

	var ids_noticias = '';

	function getNumComentariosPortada(id) {

		ids_noticias = (ids_noticias != '') ? ids_noticias + '|' + id : id;

		if (window.document.getElementById('num-comentarios-' + id)) window.document.getElementById('num-comentarios-' + id).innerHTML = 'Comenta esta noticia';

	 }

	 function setNumComentariosPortada(id, v) {

	 	v = typeof(v) != 'undefined' ? v : '';

	 	var dir;

	 	if (id) {
	 		var http = createRequestObject();

	 		dir = '/backend/comentarios' + v + '/getComentariosPortada.php?id=' + id + '&by=date';

                        http.open('get', dir);
                        http.onreadystatechange = function () {
       				 if(http.readyState == 4){
                                	if (http.responseText) {
                                                var campos = http.responseText.split('|');
                                                var limite = campos.length;
                                                var i = limite - 1;
                                                do {
                                                	campos2 = campos[i].split('@');

                                                       	var num = campos2[1];

                                                        switch (num) {
                                                        	case '0':
                                                        		if (window.document.getElementById('num-comentarios-' + campos2[0])) window.document.getElementById('num-comentarios-' + campos2[0]).innerHTML = 'Comenta esta noticia';
                                                        		break;
                                                        	case '1':
                                                        		if (window.document.getElementById('num-comentarios-' + campos2[0])) window.document.getElementById('num-comentarios-' + campos2[0]).innerHTML = '<strong>' + num + '</strong> Comentario';
                                                        		break;
                                                        	default:
                                                        		if (window.document.getElementById('num-comentarios-' + campos2[0])) window.document.getElementById('num-comentarios-' + campos2[0]).innerHTML = '<strong>' + num + '</strong> Comentarios';
                                                        		break;
                                                        }
                                                }
                                               while (i--);

                                        }
                                }
                        };
                        http.send(null);
	 	}
	 }

       	function getNumComentarios(id) {
		if (id) {
			var http = createRequestObject();
			//http.open("get", "/backend/comentarios/getComentarios.php?id=" + id + "&by=date&r=" + Math.random());
			http.open("get", "/backend/comentarios/getComentarios.php?id=" + id + "&by=date");
			http.onreadystatechange = function () {

				if(http.readyState == 4){
					if (http.responseXML) {
						if (http.responseText.indexOf('comments') != -1) {
						//if (http.responseXML.getElementsByTagName('comments')) {
							var num = http.responseXML.getElementsByTagName('total_comments')[0].firstChild.data;
							window.document.getElementById('num-comentarios').innerHTML = '(' + num + ')';
						}

					}
				}
			};
			http.send(null);
		}
	}


	function getComentarios(id, by, v, a) {

		v = typeof(v) != 'undefined' ? v : '';
		a = typeof(a) != 'undefined' ? a : 1;

		var dir;

		if (id) {
			var http = createRequestObject();

			dir = '/backend/comentarios' + v + '/getComentarios.php?id=' + id + '&by=' + by + (a ? '' : '&r=' + Math.random());

			http.open('get', dir);
			http.onreadystatechange = function () {

				if(http.readyState == 4){
					if (http.responseXML) {
						if (http.responseText.indexOf('comments') != -1) {

							eval('muestraComentarios' + v + '(http.responseXML)');

							window.document.getElementById('lomasreciente').className = (by == 'date') ? 'activo' : '';
							window.document.getElementById('lomasvalorado').className = (by == 'votes') ? 'activo' : '';
						}

					}
				}
			};
			http.send(null);
		}
	}



	function muestraComentarios(response) {

		var contenido;
		var html;
		var fecha_load = new Date();
		var browser = navigator.appName;
		var positive_votes;
		var negative_votes;

		var limite = response.getElementsByTagName('comment').length;
		html = '<div class="numopiniones"><span>' + response.getElementsByTagName('total_comments')[0].firstChild.data + ' OPINIONES</span></div>';

		limite_b = (limite > 5) ? 5 : limite;

		for (i = 0; i < limite_b; i++) {

			id = response.getElementsByTagName('id')[i].firstChild.data;
			fecha = response.getElementsByTagName('date')[i].firstChild.data;
			campos = fecha.split(' ');
			hora = campos[3];
			nombre = response.getElementsByTagName('name')[i].firstChild ? response.getElementsByTagName('name')[i].firstChild.data : '';
			if (browser == 'Microsoft Internet Explorer'){
				texto = response.getElementsByTagName('content')[i].firstChild.data;
			}
			else {
				texto = response.getElementsByTagName('content')[i].childNodes[1].data;
			}

			positive_votes = response.getElementsByTagName('positive_votes')[i].firstChild.data;
			negative_votes = response.getElementsByTagName('negative_votes')[i].firstChild.data;

			fecha = campos[2] + "/" + campos[1] + "/" + campos[5];

			contenido = '	<div class="opinion">';
	              	contenido += '<div class="fecha">' + fecha + ' | <span class="hora">' + hora + '</span></div>';
	   		contenido += '<h3>' + unescape(nombre) + '</h3>';
	              	contenido += '<div class="texto">' + unescape(texto) + '</div>';
	              	contenido += '<div class="detalles-opinion">';
	                contenido += '<div class="favorcontra" id="favorcontra-' + id + '"><a href="javascript:votarComentario(' + id+ ', 1);" class="afavor">A';
	                contenido += '    favor (' + positive_votes + ')</a><a href="javascript:votarComentario(' + id + ', 2);" class="encontra">En';
	                contenido += '    contra (' + negative_votes + ')</a></div>';
	                contenido += '<div class="inadecuado" id="inadecuadoboton"><a href="javascript:mostrarDenunciar(' + id + ');" class="boton" title="Comentario inadecuado"><img src="/img/ico_inadecuado.gif" alt="Comentario inadecuado" />Comentario';
	                contenido += '    inadecuado</a></div>';
	                contenido += '<div class="clear"></div>';
	              	contenido += '</div>';
	              	contenido += '<div class="formdenunciar" id="formdenunciar-' + id + '" style="display:none;">';
	              	contenido += '<form name="formulario_' + id + '" action="/backend/comentarios/denunciarComentario.php" method="post">';
	                contenido += '<input type="hidden" name="load_time" value="' + fecha_load.getTime() + '">';
			contenido += '<input type="hidden" name="submit_time" value="0">';
			contenido += '<input type="hidden" name="id" value="' + id + '">';
			contenido += '<input type="hidden" name="anchor" value="comentarios">';
	                contenido += '<p>Por favor seleciona el motivo por el que crees que este comentario';
	                contenido += '  es inadecuado </p>';
	                contenido += '<textarea name="denuncia_' + id + '">Escriba aquí el motivo de la denuncia.</textarea>';
	                contenido += '<a href="javascript:denunciarComentario(' + id + ');" class="boton">denunciar comentario</a>';
	                contenido += '</label>';
	                contenido += '<div class="clear"></div>';
	              	contenido += '</div>';
	              	contenido += '<div class="clear"></div>';
	              	contenido += '</form>';
	            	contenido += '</div>';

	            	html += contenido;
            	}

            	window.document.getElementById('listado-comentarios').innerHTML = html;

            	verMas(limite);

	}

	function muestraComentarios2(response, pagina) {
		var contenido;
		var html;
		var fecha_load = new Date();
		var browser = navigator.appName;
		var positive_votes;
		var negative_votes;
		var max_comentarios = 5;

		pagina = typeof(pagina) != 'undefined' ? pagina : 1;

		var limite = response.getElementsByTagName('comment').length;
		html = '<div class="numopiniones"><span>' + response.getElementsByTagName('total_comments')[0].firstChild.data + ' OPINIONES</span></div>';

		if (window.document.getElementById('num-comentarios')) {
			window.document.getElementById('num-comentarios').innerHTML = '(' + response.getElementsByTagName('total_comments')[0].firstChild.data + ')';
		}

		var limite_b = ((((pagina - 1) * max_comentarios) + max_comentarios) > limite) ? limite : (((pagina - 1) * max_comentarios) + max_comentarios);
		var inicio = (pagina - 1) * max_comentarios;
		var paginas = Math.ceil(limite / max_comentarios);

		var pagina_ver = (pagina < 10) ? '0' + pagina : pagina;
		var paginas_ver = (paginas < 10) ? '0' + paginas : paginas;

		for (var i = inicio; i < limite_b; i++) {

			var id = response.getElementsByTagName('id')[i].firstChild.data;

			var fecha = response.getElementsByTagName('date')[i].firstChild.data;
			var campos = fecha.split(' ');
			var hora = campos[3];

			fecha = campos[2] + "/" + campos[1] + "/" + campos[5];

			/*
			var fecha = response.getElementsByTagName('date')[i].firstChild.data;
			var hora = fecha.substr(8,2) + ':' + fecha.substr(10,2)
			*/
			var nombre = response.getElementsByTagName('name')[i].firstChild ? response.getElementsByTagName('name')[i].firstChild.data : '';
			if (browser == 'Microsoft Internet Explorer'){
				var texto = response.getElementsByTagName('content')[i].firstChild.data;
			}
			else {
				var texto = response.getElementsByTagName('content')[i].childNodes[1].data;
			}

			positive_votes = response.getElementsByTagName('positive_votes')[i].firstChild.data;
			negative_votes = response.getElementsByTagName('negative_votes')[i].firstChild.data;
			//fecha = fecha.substr(6,2) + "/" + fecha.substr(4,2) + "/" + fecha.substr(0,4);
			contenido = '	<div class="opinion">';
			contenido += '<div class="fecha">' + fecha + ' | <span class="hora">' + hora + '</span></div>';
	   		contenido += '<h3>' + unescape(nombre) + '</h3>';
			contenido += '<div class="texto">' + unescape(texto) + '</div>';
			contenido += '<div class="detalles-opinion">';
			contenido += '<div class="favorcontra" id="favorcontra-' + id + '"><a href="javascript:votarComentario(' + id+ ', 1, 2);" class="afavor">A';
			contenido += '    favor (' + positive_votes + ')</a><a href="javascript:votarComentario(' + id + ', 2, 2);" class="encontra">En';
			contenido += '    contra (' + negative_votes + ')</a></div>';
			contenido += '<div class="inadecuado" id="inadecuadoboton"><a href="javascript:mostrarDenunciar(' + id + ');" class="boton" title="Comentario inadecuado"><img src="/img/ico_inadecuado.gif" alt="Comentario inadecuado" />Comentario';
			contenido += '    inadecuado</a></div>';
			contenido += '<div class="clear"></div>';
			contenido += '</div>';
			contenido += '<div class="formdenunciar" id="formdenunciar-' + id + '" style="display:none;">';
			contenido += '<form name="formulario_' + id + '" action="/backend/comentarios2/denunciarComentario.php" method="post">';
			contenido += '<input type="hidden" name="load_time" value="' + fecha_load.getTime() + '">';
			contenido += '<input type="hidden" name="submit_time" value="0">';
			contenido += '<input type="hidden" name="id" value="' + id + '">';
			contenido += '<input type="hidden" name="anchor" value="comentarios">';
			contenido += '<p>Por favor seleciona el motivo por el que crees que este comentario';
			contenido += '  es inadecuado </p>';
			contenido += '<textarea name="denuncia">Escriba aquí el motivo de la denuncia.</textarea>';
			contenido += '<a href="javascript:denunciarComentario(' + id + ');" class="boton">denunciar comentario</a>';
			contenido += '</label>';
			contenido += '<div class="clear"></div>';
			contenido += '</div>';
			contenido += '<div class="clear"></div>';
			contenido += '</form>';
			contenido += '</div>';

			html += contenido;
		}

		if (limite > max_comentarios) {
			html += '<div class="botones-listado"><a id="anterior" href="javascript:nada()" class="boton anterior">&lt;&lt;';
                  	html += 'Anterior</a>&nbsp;&nbsp;<span><strong>' + pagina_ver + '</strong>/' + paginas_ver + '</span>&nbsp;&nbsp;<a id="siguiente" href="javascript:nada()" class="boton siguiente">Siguiente';
                  	html += '&gt;&gt; </a></div>';
		}

		window.document.getElementById('listado-comentarios').innerHTML = html;


		if (limite > max_comentarios) {

			window.document.getElementById('anterior').onclick = function () {
				if (pagina != 1) {
					muestraComentarios2(response, (pagina - 1));
				}
				else {
					muestraComentarios2(response, pagina);
				}

			}

			window.document.getElementById('siguiente').onclick = function () {
				if (pagina != paginas) {
					muestraComentarios2(response, (pagina + 1));
				}
				else {
					muestraComentarios2(response, pagina);
				}

			}
		}

	}

	function nada() {
		return;
	}


	function desconectar() {
		window.location = '/backend/desconectar.php?url=' + window.location.href;

	}

	function conectar() {

		var direccion;

		if (window.document.location.href.indexOf('?') > 0) {
			var campos = window.document.location.href.split('?');
			direccion = campos[0];
		}
		else {
			direccion = window.document.location.href;
		}

		var qs = 'url=' + direccion;
		qs += '&email=' + window.document.logueo.email.value;
		qs += '&contrasena=' + window.document.logueo.contrasena.value;

		window.location = '/backend/conectar.php?' + qs;
	}

	function enviaComentario() {
	  var fecha_submit = new Date();
          var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

	  if (window.document.formulario.author_name.value == '') {
	  	alert('Por favor, introduce tu nombre');
	  	window.document.formulario.author_name.focus();
	  	return;
	  }

	  if (window.document.formulario.author_email.value == '') {
	  	alert('Por favor, introduce tu email');
	  	window.document.formulario.author_email.focus();
	  	return;
	  }

	  if (!filter.test(window.document.formulario.author_email.value)) {
		alert('El email introducido no es válido');
		 window.document.formulario.author_email.focus();
                return;

	  }

	  if (window.document.formulario.message.value == '') {
	  	alert('Por favor, introduce tu opinión');
	  	window.document.formulario.message.focus();
	  	return;
	  }

	  if (!window.document.formulario.acepto.checked) {
	  	alert('Tienes que aceptar las condiciones de uso');
	  	return;
	  }

	  var registrado = getCookie('registrado') ? ' (Usuario registrado)' : '';

	  window.document.formulario.message.value = window.document.formulario.message.value;
	  window.document.formulario.author_name.value = window.document.formulario.author_name.value + registrado;

	  window.document.formulario.submit_time.value = fecha_submit.getTime();
	  window.document.formulario.submit();
	  alert('Gracias por escribir un comentario');
	}

	function votarComentario(id, tipo, v) {

		v = typeof(v) != 'undefined' ? v : '';

		var dir;

		if (id) {
			var http = createRequestObject();

			dir = '/backend/comentarios' + v + '/votarComentario.php?id=' + id + '&tipo=' + tipo + '&r=' + Math.random();

			http.open('get', dir);

			http.onreadystatechange = function () {
				if(http.readyState == 4){
					if (http.responseText) {
						var response = http.responseText;

						if (response.indexOf('ok')) {
							if (tipo == 1) {
								window.document.getElementById('favorcontra-' + id).innerHTML = '<span class="afavor">A favor</span> <span class="mensaje">| Gracias por votar</span>';
							}
							else {
								window.document.getElementById('favorcontra-' + id).innerHTML = '<span class="encontra">En contra</span> <span class="mensaje">| Gracias por votar</span>';
							}
						}

					}
				}
			};
			http.send(null);
		}
	}

	function mostrarDenunciar(id) {
		var display = window.document.getElementById('formdenunciar-' + id).style.display;
		if (display == 'none' && !getCookie('registrado')) {
			alert('Para denunciar un comentario Regístrate');
			return;
		}
		window.document.getElementById('formdenunciar-' + id).style.display = (display == 'none') ? 'block' : 'none';
	}

	function denunciarComentario(id) {
		var fecha_submit = new Date();
		eval('var formu = window.document.formulario_' + id);
		formu.submit_time.value = fecha_submit.getTime();
		formu.submit();
		 alert('Gracias por denunciar el comentario');

	}

	function muestraLogueo() {
		window.document.getElementById('artlogeo').style.display = '';
	}

	function borrarTexto() {
		if (window.document.formulario.message.value == 'escribe aquí tu comentario') {
			window.document.formulario.message.value = '';
		}
	}

	/***************************** FIN Comentarios **********************************/
