<!--
	var http = createRequestObject();
	var httpPost = createRequestObject();
	var id_capa = "";
	var tipo_seleccionado = "";
	var OAS_listpos = OAS_sitepage = "";
	var pestana_validacion = "";

	var mi_url = document.location.href;
	var tamano_frame ="WIDTH: 1002px; HEIGHT: 35px";			
	if(mi_url.indexOf("elcorreodigital") > 0) {
		//server_publi = "www.diario-elcorreo.es/hoyTecnologia";
		server_ojd = "elcorreo";
		dir_frame = "http://www.elcorreodigital.com/ticker/vizcaya/minicabecera.htm";
		periodico = '/diario-elcorreo';
	} else if(mi_url.indexOf("diariovasco") > 0) {
		//server_publi = "www.diariovasco.com/hoyTecnologia";
		server_ojd = "diariovasco";
		dir_frame = "http://www.diariovasco.com/ticker/minicabecera.htm";
		periodico = '/diariovasco';
		
	} else if(mi_url.indexOf("laverdad") > 0) {
		//server_publi = "www.la-verdad.com/hoyTecnologia";
		server_ojd = "laverdad";
		dir_frame = "http://www.laverdad.es/ticker/murcia/minicabecera.htm";
		periodico = '/la-verdad';
		
	} else if(mi_url.indexOf("nortecastilla") > 0) {
		//server_publi = "www.nortecastilla.es/hoyTecnologia";
		server_ojd = "nortecastilla";
		dir_frame = "http://www.nortecastilla.es/ticker/minicabecera.htm";
		periodico = '/nortecastilla';
		
	} else if(mi_url.indexOf("hoy.es") > 0 || mi_url.indexOf("hoy.hoytecnologia") > 0) {
		//server_publi = "www.hoy.es/hoyTecnologia";
		server_ojd = "hoy";
		dir_frame = "http://www.hoy.es/ticker/minicabecera.htm";
		periodico = '/hoy';
		
	} else if(mi_url.indexOf("larioja") > 0) {
		//server_publi = "www.larioja.com/hoyTecnologia";
		server_ojd = "larioja";
		dir_frame = "http://www.larioja.com/ticker/minicabecera.htm";
		periodico = '/larioja';
		
	} else if(mi_url.indexOf("diariosur") > 0) {
		//server_publi = "www.diariosur.es/hoyTecnologia";
		server_ojd = "diariosur";
		dir_frame = "http://www.diariosur.es/ticker/minicabecera.htm";
		periodico = '/diariosur';
		
	} else if(mi_url.indexOf("eldiariomontanes") > 0) {
		//server_publi = "www.eldiariomontanes.es/hoyTecnologia";
		server_ojd = "diariomontanes";
		dir_frame = "http://www.eldiariomontanes.es/ticker/minicabecera.htm";
		periodico = '/eldiariomontanes';
		
	} else if(mi_url.indexOf("ideal") > 0) {
		//server_publi = "www.ideal.es/hoyTecnologia";
		server_ojd = "ideal";
		dir_frame = "http://www.ideal.es/ticker/granada/minicabecera.htm";
		periodico = '/ideal'
		
	} else if(mi_url.indexOf("elcomercio") > 0) {
		//server_publi = "www.elcomercio-sa.es/hoyTecnologia";
		server_ojd = "elcomercio";
		dir_frame = "http://www.elcomerciodigital.com/ticker/minicabecera.htm";
		periodico = '/elcomercio-sa';
		
	} else if(mi_url.indexOf("lasprovincias") > 0) {
		//server_publi = "www.lasprovincias.es/hoyTecnologia";
		server_ojd = "lasprovincias";
		dir_frame = "http://www.lasprovincias.es/ticker/valencia/minicabecera.htm";
		periodico = '/lasprovincias';
	} else if(mi_url.indexOf("abcdesevilla") > 0) {
		//server_publi = "www.abc.es/hoyTecnologia";
		server_ojd = "abc";
		dir_frame = "http://www.abcdesevilla.es/ocio/cabecerasevilla/cabecera_1002.htm";
		tamano_frame ="WIDTH: 1002px; HEIGHT: 75px";
		periodico = '/abcdesevilla'	
	} else if(mi_url.indexOf("abc") > 0) {
		//server_publi = "www.abc.es/hoyTecnologia";
		server_ojd = "abc";
		dir_frame = "http://www.abc.es/ocio/cabecera/cab_cobranded_abc1024.htm";
		tamano_frame ="WIDTH: 1002px; HEIGHT: 50px";
		periodico = '/abc'
	} else if(mi_url.indexOf("lavozdecadiz") > 0 || mi_url.indexOf("lavozdigital") > 0) {
		//server_publi = "www.lavozdecadiz.com/hoyTecnologia";
		server_ojd = "lavozdecadiz";
		dir_frame = "http://www.lavozdigital.es/ticker/minicabecera.htm";
		periodico = '/lavozdecadiz'
		
	} else if (mi_url.indexOf("ozu") > 0) {
		server_ojd = "ozu";
		dir_frame = "http://ozu.es/cabeceras/";
		periodico = '/ozu'
	} else if (mi_url.indexOf("que.hoytecnologia") > 0) {
		server_ojd = "que";
		dir_frame = "http://www.que.es/minicabecera/header.html";
		periodico = '/que'	
	} else {
		//server_publi = "www.hoytecnologia.com";
		server_ojd = "vocento";
		dir_frame = "";
				
		periodico = '';
	}

	function variablesOAS() {
		//Nueva publicidad MJX
		var mi_url = document.location.href;
		OAS_listpos = 'Position1';
		if(document.getElementById("publi1_Position3")) OAS_listpos += ',Position3';
		if(document.getElementById("publi1_Top1")) OAS_listpos += ',Top1';
		if(document.getElementById("publi1_Top2")) OAS_listpos += ',Top2';
		if(document.getElementById("publi1_Top3")) OAS_listpos += ',Top3';
		if(document.getElementById("publi1_BottomRight")) OAS_listpos += ',BottomRight';
		if(document.getElementById("publi1_Bottom1")) OAS_listpos += ',Bottom1';
		if(document.getElementById("publi1_x01")) OAS_listpos += ',x01';

		document.write('');		

		if(typeof(OAS_url)=='undefined')
			OAS_url ='http://publi.grupocorreo.es/RealMedia/ads/';
		if(typeof(OAS_listpos)=='undefined')
			OAS_listpos = '';
		if(typeof(OAS_query)=='undefined')
			OAS_query = '?';
		if(typeof(OAS_sitepage)=='undefined')		
			OAS_sitepage = ''
		if(typeof(OAS_version)=='undefined')
			OAS_version = 10;
		if(typeof(OAS_rn)=='undefined')
			OAS_rn = '001234567890';
		if(typeof(OAS_rns)=='undefined')
			OAS_rns = '1234567890';
		OAS_rn = new String (Math.random()); OAS_rns = OAS_rn.substring (2, 11);
		OAS_version = 11;
		if (navigator.userAgent.indexOf('Mozilla/3') != -1)
		OAS_version = 10;
		if (OAS_version >= 11)
		document.write('<SC'+'RIPT LANGUAGE=JavaScript1.1 SRC="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + OAS_query + '"><\/SCRIPT>');
	}

	function OAS_NORMAL(pos) { 
		document.write('<A HREF="' + OAS_url + 'click_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + OAS_query + '" TARGET=_top>');
		document.write('<IMG SRC="' + OAS_url + 'adstream_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + OAS_query + '" BORDER=0 ALT="Click!"></A>');
	}
	/*
	function OAS_AD(pos) {
		//return; // Esto si se quiere desactivar las publis
		if (OAS_version >= 11 && typeof(OAS_RICH)!='undefined')
		  OAS_RICH(pos);
		else
		  OAS_NORMAL(pos);
	}
	*/
	function cargarPubliMethode(posicion) {
		if(navigator.userAgent.indexOf("Netscape/7.0") > -1) {
			bIsNS70 = true;
		}
		else {
			bIsNS70 = false;
		}
		var ie4 = document.all;
		var ns6 = document.getElementById;
		if (ie4 || ns6) {
			eval('var objOrigen = document.getElementById ? document.getElementById("publi2_' + posicion + '") : document.all.publi2_' + posicion + ';');
			eval('var objDestino = document.getElementById ? document.getElementById("publi1_' + posicion + '") : document.all.publi1_' + posicion + ';');
			if((objDestino != null) && (!bIsNS70))
				objDestino.appendChild(objOrigen);
			else
				objOrigen.style.display = "none";
		}
	}

	//Fin publicidad MJX

	function createRequestObject() {
		var ro;
		var browser = navigator.appName;

		if(browser == "Microsoft Internet Explorer"){
			ro = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else{
			ro = new XMLHttpRequest();
		}
		return ro;
	}  

	function votar(id, tipo) {
		
		tipo_seleccionado = tipo;
		id_capa = id;
		
		if (tipo.indexOf("link") != -1) {
			campos = tipo.split("|");
			tipo = "link";	
			pagina_link = campos[2];
		}
		
		http.open("get", "/backend/votar.php?tipo="+tipo+"&id="+id+"&r=" + Math.random());
		http.onreadystatechange = actualizaVotos;
		http.send(null);
	}

	function actualizaVotos() {
		if(http.readyState == 4){
			var response = http.responseText;
			if(tipo_seleccionado == "noticia") {
				window.document.getElementById("votos-" + id_capa).innerHTML = response;
				//if(document.formIds) termometros(document.formIds.listaIds.value);
			}else if(tipo_seleccionado == "producto") {
				if (window.document.getElementById("votos-" + id_capa)) {
					window.document.getElementById("votos-" + id_capa).innerHTML = response;
				}
				else {
					window.location.reload( false );
				}
			
			} else if(tipo_seleccionado == "multimedia|video") {
				if (window.document.location.href.indexOf("video-mp3") == -1) {
					estrellas(document.formMultimediaIds.listaIdsVideos.value);
				}
				else {
					window.location.reload( false );
				}
			} else if(tipo_seleccionado == "multimedia|podcast") {
				if (window.document.location.href.indexOf("video-mp3") == -1) {
					estrellas(document.formMultimediaIds.listaIdsAudios.value);
				}
				else {
					window.location.reload( false );
				}
				
			} else if(tipo_seleccionado == "analisis" || tipo_seleccionado == "opiniones" || tipo_seleccionado == "misproductos") {
				cambio_pestana(tipo_seleccionado, "");
			} else if (tipo_seleccionado.indexOf("link") != -1) {
				campos = tipo_seleccionado.split("|");
				if(window.document.location.href.indexOf("-") == -1) {
					listadoLinks(campos[1], pagina_link);
				}
				else {
					window.location.reload( false );		
				}
				
			} else if (tipo_seleccionado == 'blog') {
				
				eval('contenido = window.document.getElementById("numero-comment-' + id_capa + '").innerHTML;');
				campos = contenido.split("|");
				campos2 = campos[1].split(" ");
				votos = parseInt(campos2[1]) + 1;
				contenido = '<input type="button" value="Gracias!" id="botonvotar" disabled /> | ' + votos + ' Votos | ' + campos[2];
				eval('window.document.getElementById("numero-comment-' + id_capa + '").innerHTML = contenido;');
				
			}
			
			
		}
	}

	function termometros(listaIds) {
		http.open("get", "/backend/termometros.php?tipo="+tipo_seleccionado+"&listaIds="+listaIds+"&r=" + Math.random());
		http.onreadystatechange = actualizaGraficos;
		http.send(null);
	}

	function actualizaGraficos() {
		var aux = "";
		var arr = arr2 = "";
		var id = "";
		var contenido = "";

		if(http.readyState == 4){
			var response = http.responseText;
			arr = response.split("###");
			for(var i=0; i<arr.length; i++) {
				aux = arr[i];
				if(aux != "" && aux.indexOf("#") > 0) {
					arr2 = aux.split("#");
					id = arr2[0];
					contenido = arr2[1];
					window.document.getElementById(id).innerHTML = contenido;
					window.document.getElementById('boton-' + id).innerHTML = arr2[2];
				}
			}
		}
	}

	function estrellas(listaIds) {
		http.open("get", "/backend/estrellas.php?tipo="+tipo_seleccionado+"&listaIds="+listaIds+"&r=" + Math.random());
		http.onreadystatechange = actualizaGraficos;
		http.send(null);
	}

	function cambio_pestana(tipo, tipoComentados, id_usuarioMD5) {
		http.open("get", "/backend/pestanas.php?tipo="+tipo+"&tipoComentados="+tipoComentados+"&id_usuarioMD5="+id_usuarioMD5+"&r=" + Math.random());
		http.onreadystatechange = contenidoPestana;
		http.send(null);
	}

	function contenidoPestana() {
		if(http.readyState == 4){
			var response = http.responseText;
			var arr = response.split("###");
			var pestana = arr[0];
			var contenido = arr[1];
			window.document.getElementById(pestana).innerHTML = contenido;
		}
	}

	function cargaPestanasHome() {
		cambio_pestana('opiniones', 'producto');
	}

	function comentar() {
		var frm = document.frmComentario;	
		if(checkForm(frm)) {
			httpPost.open("post", "/backend/comentar.php", true);
			httpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			httpPost.onreadystatechange = actualizaFormuComentario;
			httpPost.send(getParametros(frm));
		}
	}

	function actualizaFormuComentario() {
		if(httpPost.readyState == 4) {
			var response = httpPost.responseText;
			var arr = response.split("###");
			var aprobado = arr[0];
			var contenido = arr[1];
			window.document.getElementById("formu-comentario").innerHTML = contenido;
			if(aprobado == 1) { // Actualizo la zona de comentarios (q vaya a la ultima pagina para ver su contenido) y num comentarios
				var frm = window.document.frmComentario;
				frm.ultimapagina.value = parseInt(frm.ultimapagina.value) + 1;
				pagComentarios(frm.ultimapagina.value, frm.id.value, frm.tipo.value);
				document.getElementById("numerocomentarios").innerHTML = parseInt(document.getElementById("numerocomentarios").innerHTML) + 1;
			}
			setTimeout("window.location.reload( false )", 5000);
		}
	}

	function pagComentarios(pagina, id, tipo) {
		http.open("get", "/backend/lista-comentarios.php?id="+id+"&tipo="+tipo+"&pagina="+pagina+"&r=" + Math.random());
		http.onreadystatechange = contenidoComentarios;
		http.send(null);
	}

	function contenidoComentarios() {
		if(http.readyState == 4){
			var response = http.responseText;
			window.document.getElementById("comentarios").innerHTML = response;
			document.location.href = "#listadocomentarios";
		}
	}



	
	function entrar(frm, pesta) { 
		//var frm = document.frmReg;		
		if(checkForm(frm)) {
			httpPost.onreadystatechange = actualizaReg;
			httpPost.open("post", "/backend/validar.php", true);
			pestana_validacion = pesta;
			httpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
			httpPost.send(getParametros(frm));
		}
	}

	function actualizaReg() {
		if(httpPost.readyState == 4){
			var response = httpPost.responseText;
			
			if (response.indexOf('#|#') != -1) {
				campos = response.split('#|#');
				response = campos[1];
				window.location = 'http://comunidad.hoytecnologia.com/api/voc1/login?parametros=' + campos[0];	
			}
			
			if(pestana_validacion == "registro") {
				window.document.getElementById('registro').innerHTML = response;
			} else if(pestana_validacion == "anadiramigo-registro") {
				window.document.getElementById('anadiramigo-registro').innerHTML = response;
			} 
			
			if (window.document.location.href.indexOf('/enlaces/') != -1) {
				window.location.reload( false );	
			}
		}
	}

	function desconectar() {
		if(confirm("¿Seguro que quieres desconectar?")) {
			http.open("get", "/backend/desconectar.php?r=" + Math.random());
			http.onreadystatechange = actualizaReg2;
			http.send(null);
			
		}
	}

	function actualizaReg2() {
		if(http.readyState == 4){
			var response = http.responseText;
			
			if (response.indexOf('#|#') != -1) {
				campos = response.split('#|#');
				response = campos[1];
				window.location = 'http://comunidad.hoytecnologia.com/api/voc1/login/logout?email=' + campos[0] + '&back_url=' + window.document.location.href;	
			}
			
			window.document.getElementById("registro").innerHTML = response;
			window.location.reload( false );
		}
	}

	function anadirAmigo() { 
		var frm = document.frmAnadirColega;		
		httpPost.onreadystatechange = actualizaAnadirAmigo;
		httpPost.open("post", "/backend/anadir-colega.php", true);
		httpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		httpPost.send(getParametros(frm));
	}

	function actualizaAnadirAmigo() {
		if(httpPost.readyState == 4){
			var response = httpPost.responseText;
			window.document.getElementById('anadircolega').innerHTML = response;
		}
	}

	function getParametros(formu) {
		var parametros = "";
		for(var i=0;i<formu.length;i++) {
			if(formu.elements[i].type == "button" || formu.elements[i].type == "reset" || formu.elements[i].type == "submit") continue;
			
			if(parametros != "") {
				if (formu.elements[i].type == "radio" || formu.elements[i].type == "checkbox") {
					if (formu.elements[i].checked) {
						parametros += "&" + formu.elements[i].name + "=" + formu.elements[i].value;	
					}
				}
				else {
					parametros += "&" + formu.elements[i].name + "=" + encodeURIComponent(formu.elements[i].value);
				}
			}
			else {
				if (formu.elements[i].type == "radio" || formu.elements[i].type == "checkbox") {
					if (formu.elements[i].checked) {
						parametros += formu.elements[i].name + "=" + formu.elements[i].value;	
					}
				}
				else {
					parametros += formu.elements[i].name + "=" + encodeURIComponent(formu.elements[i].value);
				}
			}
		}	
		return parametros;
	}
	
	function altaNewsletter() {
		email = window.document.getElementById("email").value;
		if (email != "") {
			http.open("get", "/backend/alta_newsletter.php?email=" + email + "&r=" + Math.random());
			http.onreadystatechange = mensajeNewsletter;
			http.send(null);
		}	
	}
	
	function bajaNewsletter() {
		email = window.document.getElementById("email").value;
		if (email != "") {
			http.open("get", "/backend/baja_newsletter.php?email=" + email + "&r=" + Math.random());
			http.onreadystatechange = mensajeNewsletter;
			http.send(null);
		}	
	}
	
	function mensajeNewsletter() {
		if(http.readyState == 4){
			var response = http.responseText;
			window.document.getElementById("mensaje").innerHTML = response;
			setTimeout("borrarMensajeNewsletter()", 5000);
		}
	}
	
	function borrarMensajeNewsletter() {
		window.document.getElementById("mensaje").innerHTML = "";
		window.document.getElementById("email").value = "";	
	}
	
	function enviarLink() {
		
		enlace = window.document.envio.enlace.value;
		titulo = window.document.envio.titulo.value;
		etiquetas = window.document.envio.etiquetas.value;
		descripcion = window.document.envio.descripcion.value;
		categoria = "";
		
		for (i = 0; i < window.document.envio.categoria.length; i++) {
			if (window.document.envio.categoria[i].checked) {
				categoria = window.document.envio.categoria[i].value;
				break;
			}
		}
		
		if (enlace == "") {
			window.document.getElementById("mensaje").innerHTML = "<b>El link está vacío.</b>";
			return;
		}
		
		if (enlace.indexOf("http://") == -1) {
			window.document.getElementById("mensaje").innerHTML = "<b>La URL del link es incorrecta.</b>";
			return;	
		}
		
		if (titulo == "") {
			window.document.getElementById("mensaje").innerHTML = "<b>El título está vacío.</b>";
			return;
		}
		
		if (etiquetas == "") {
			window.document.getElementById("mensaje").innerHTML = "<b>La estiquetas están vacias.</b>";
			return;
		}
		
		if (descripcion == "") {
			window.document.getElementById("mensaje").innerHTML = "<b>La descripción está vacía.</b>";
			return;
		}
		
		if (descripcion.length > 550) {
			window.document.getElementById("mensaje").innerHTML = "<b>La descripción tiene más de 550 caracteres.</b>";
			return;	
		}	
		
		if (categoria == "") {
			window.document.getElementById("mensaje").innerHTML = "<b>No has seleccionado una categoría.</b>";
			return;
		}
		
		httpPost.open("post", "/backend/enviar_link.php", true);
		httpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		httpPost.onreadystatechange = mensajeEnvioLink;
		httpPost.send(getParametros(window.document.envio));
	}
	
	function mensajeEnvioLink() {
		if(httpPost.readyState == 4) {
			var response = httpPost.responseText;
			var contenido = '<div id="form-enviar-link">';
			
			contenido += '<div id="form-enviar-link-top"></div><div id="form-enviar-link-centro"><br />';
			contenido += '<table border="0" cellspacing="0" cellpadding="0" class="fr-labelinput">';
	                contenido += ' <tr> ';
	                contenido += '    <th class="fr-label">&nbsp;</th>';
	                contenido += '    <td colspan="2" class="fr-input"><div id="mensaje"><h1>' + response + '</h1></div></td>';
	                contenido += '</tr>';
	                contenido += '</table>	<div class="clear"></div>';
			contenido += '		<div class="fr-barrabotones"></div>';
			contenido += '</div><div id="form-enviar-link-centro2"><div class="fr-barradoble"></div>';
			contenido += '</div><div id="form-enviar-link-bottom"></div>';
			contenido += '<div class="clear"></div>';
			contenido += '</div>';
			
			window.document.getElementById("form-enviar-link").innerHTML = contenido;
			
			setTimeout("window.location='/enlaces/'", 3000);
		}
	}
	
	function listadoLinks(tipo, pagina) {
		http.open("get", "/backend/listado_links.php?tipo=" + tipo + "&pagina=" + pagina + "&r=" + Math.random());
		http.onreadystatechange = listadoEnlaces;
		http.send(null);
	}
	
	function listadoEnlaces() {
		if(http.readyState == 4) {
			var MAX_LINKS = 5;
			var response = http.responseText;
			arr = response.split("#@#");
			var contenido = "";
			var tipo = 1;
			for(var i=0; i<arr.length; i++) {
				aux = arr[i];
				if(aux != "" && aux.indexOf("#|#") > 0) {
					
					arr2 = aux.split("#|#");
					
					id_link = arr2[0];
					enlace = arr2[1];
					titulo = arr2[2];
					etiquetas = arr2[3];
					descripcion = arr2[4];
					id_usuario = arr2[5];
					fecha = arr2[6];
					numvotos = arr2[7];
					boton = arr2[8];
					nick = arr2[9] ? arr2[9] : "Anonimo";
					categoria = arr2[10];
					id_categoria = arr2[11];
					hora = arr2[12];
					numcomentarios = arr2[13];
					num_links = arr2[14];
					pag = arr2[15];
					detalle = arr2[16];
					
					contenido += '<div class="caja' + tipo + '-agregador-portada">';  
					contenido += '  <div class="agregador-votos">'; 
					contenido += '  <div class="numero-votos">'; 
					contenido += '  <div class="nu" id="votos-' + id_link + '">' + numvotos + '</div>'; 
					contenido += '  <div class="txt">Votos</div>'; 
					contenido += '  </div>'; 
					contenido += '  <div class="votar">'; 
					contenido += '  <div class="mc-boton"> '; 
					contenido += boton; 
					contenido += '    </div></div>'; 
					contenido += '  </div>'; 
					contenido += '	<div class="agregador-noticia">'; 
					contenido += '	<div class="coli-noticia1">'; 
					contenido += '  <h1><a href="' + enlace + '">' + titulo + '</a></h1>'; 
					contenido += '  <p>'; 
					contenido += ' ' + descripcion + '</p>'; 
					enlace_nick = (nick.indexOf('Anonimo') == -1) ? '/usuario/' + nick : '#';
					contenido += ' <div class="usuario-categoria"><div class="usuario"><a href="' + enlace_nick + '">' + nick + '&nbsp;</a></div> enviado a<div class="nombrecat"><a href="#">&nbsp;' + categoria + '&nbsp;</a></div>el ' + fecha + ' a las ' + hora; 
					contenido += '  </div>'; 
					contenido += ' <div class="comentarios"><ul><li><a href="' + detalle + '">[' + numcomentarios + '] Comentarios</a></li>'; 
					contenido += '  </ul></div> '; 
					contenido += '</div>'; 
					contenido += '	</div>  '; 
					contenido += '	   <div class="clear"></div>'; 
					contenido += ' </div>'; 
					
					tipo = (tipo == 1) ? 2 : 1;
				}
			}
			
			window.document.getElementById("agregador-portada").innerHTML = contenido;
			
			total_paginas = Math.ceil(num_links / MAX_LINKS);
			
			contenido = '<div class="paginacion">';
  			contenido += '<div class="paginacion-dato">Página ' + pag + ' de ' +total_paginas + ' </div>';
			contenido += '  <div class="paginacion-link">'
			
			campos = window.document.location.href.split("/");
			
			tipo_sel = (campos[campos.length - 1].indexOf("?") != -1) ? campos[campos.length - 1] : ((campos[campos.length - 2].indexOf("?") != -1) ? campos[campos.length - 2] : "?popularidad"); 
			
			MAX_PAGINAS = 10;
			
			for (i = 1; i <= total_paginas; i++) {
			
				if (i <= MAX_PAGINAS) {	
					if (i == pag) {
						contenido += '<a href="' + tipo_sel + '/' + i + '" class="seleccionado">[ ' + i + ' ]</a>';
					}
					else {
						contenido += '<a href="' + tipo_sel + '/' + i + '"> ' + i + '</a>';
					}
				}
				if (i > MAX_PAGINAS && i == total_paginas) {
					contenido += '...' + '<a href="' + tipo_sel + '/' + i + '"> ' + i + '</a>';	
				}
			}	
			contenido += '  </div>';
			
			window.document.getElementById("top-paginacion-t2").innerHTML = contenido;
			window.document.getElementById("bottom-paginacion-t2").innerHTML = contenido;	
		}	
	}

	function guardaDatosPersonales() {
		var frm = document.frmDatosPers;	
//		if(checkForm(frm)) {
			httpPost.open("post", "/backend/datos-personales.php", true);
			httpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			httpPost.onreadystatechange = actualizaFormuRegistro;
			httpPost.send(getParametros(frm));
//		}
	}

	function actualizaFormuRegistro() {
		if(httpPost.readyState == 4) {
			var response = httpPost.responseText;
			window.document.getElementById("mensaje").innerHTML = response;
		}
	}

	function guardaLinks() {
		var frm = document.frmLinks;	
//		if(checkForm(frm)) {
			httpPost.open("post", "/backend/datos-personales-administrarlinks.php", true);
			httpPost.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			httpPost.onreadystatechange = actualizaLinks;
			httpPost.send(getParametros(frm));
//		}
	}

	function actualizaLinks() {
		if(httpPost.readyState == 4) {
			var response = httpPost.responseText;
			window.document.getElementById("mensaje").innerHTML = response;
		}
	}

	function guardaFotos() {
		var frm = document.frmFoto;
		frm.accion.value = "subirfoto";
		frm.submit();
	}
	
	function getVideos(id, pag) {
		var http = createRequestObject();
		
		pag = pag ? pag : 1;
		
		http.open("get", "/backend/videos.php?id=" + id + "&pag=" + pag + "&r=" + Math.random());
		http.onreadystatechange = function () {
			if(http.readyState == 4) {
				muestraVideos(http.responseXML);
			}
		};
		http.send(null);
	}
	
	function muestraVideos(response) {
		var limite = response.getElementsByTagName('video').length;
		
		var cont = '';
		var noticia = 1;
		
		for (i = 0; i < limite ; i++) {
			
			var id = response.getElementsByTagName('id')[i].firstChild.data;
			var nombre = response.getElementsByTagName('nombre')[i].firstChild.data;	
			var archivo_video1 = response.getElementsByTagName('archivo_video1')[i].firstChild.data;
			var descripcion = response.getElementsByTagName('descripcion')[i].firstChild.data;
			var votos_media = response.getElementsByTagName('votos_media')[i].firstChild.data;
			var votos_num = response.getElementsByTagName('votos_num')[i].firstChild.data;
			var url_video = response.getElementsByTagName('url_video')[i].firstChild.data;
			
			var contenido = '<div id="noticia' + noticia + '">';
      			contenido += '<h1><a href="' + url_video + '">' + nombre + ' (' + votos_num + ' Votos)</a></h1>';
		  	contenido += '    <div class="txt">' + descripcion + '</div>';
		  	contenido += '<div>';
    			contenido += '<div class="caja-video"><object codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="250" height="190" id="reproductor" >';
		    	contenido += '  <param name="movie" value="http://www.dalealplay.com/dalealplay.swf?file=' + id + '/' + archivo_video1 + '&amp;videoValoracion=' + votos_media + '&amp;autoStart=false" />';
		    	contenido += '  <param name="quality" value="high" />';
		    	contenido += '  <param name="wmode" value="transparent" />';
		    	contenido += '  <embed src="http://www.dalealplay.com/dalealplay.swf?file=' + id + '/' + archivo_video1 + '&amp;videoValoracion=' + votos_media + '&amp;autoStart=false" quality="high" wmode="transparent" bgcolor="#ffffff" width="250" height="190" name="flvplayer" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>';
		    	contenido += '</object></div>';
		   	contenido += '</div>';
		   	contenido += '</div>';
		  	
		  	cont += contenido;
		  	
		  	noticia = (noticia == 1) ? 2 : 1;
		}
		
		window.document.getElementById('noticias-estirado').innerHTML = cont;
		
	}
	
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
	/////////////// U R L  U N I C A /////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function personalizar() {
		var cook = getCookie_p("HOYTECNOLOGIA");
		var referer = document.referrer;
		campos = referer.split("/");
	
		if(cook != "" && cook != "undefined" && cook != null) {
	
			if (cook == "www1.hoytecnologia.com" || cook == "www2.hoytecnologia.com") {
				var curCookie = "HOYTECNOLOGIA=" + escape("www.hoytecnologia.com") + "; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
	                        document.cookie = curCookie;	
			}
	
			if(document.location.host != cook ) {
				var protocol = document.location.protocol;
				//var host = cook;
				var host = 'www.hoytecnologia.com';
				var pathname = document.location.pathname;
				var search = document.location.search;
				var hash = document.location.hash;
				var url = protocol + '//' + host + pathname + search + hash;
				document.location.href = url;
			}
			 
		} else {
	
			if ((document.location.host == "www1.hoytecnologia.com" && campos[2] && campos[2] != document.location.host) || (document.location.host == "www2.hoytecnologia.com" && campos[2] && campos[2] != document.location.host)) {
	
				var curCookie = "HOYTECNOLOGIA=" + escape("www.hoytecnologia.com") + "; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
	                        document.cookie = curCookie;
	
				var protocol = document.location.protocol;
	                        var host = "www.hoytecnologia.com";
	                        var pathname = document.location.pathname;
	                        var search = document.location.search;
	                        var hash = document.location.hash;
	                        var url = protocol + '//' + host + pathname + search + hash;
	                        document.location.href = url;
			}
	
			if (document.location.host != "www1.hoytecnologia.com" && document.location.host != "www2.hoytecnologia.com") {
				var curCookie = "HOYTECNOLOGIA=" + escape(document.location.host) + "; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
				document.cookie = curCookie;
			}
		}
	}

	function personalizar2() {
		
		//Se aniade para redirigir de general a local desde referer o variable refer
		var vengode = "";
		vengode = document.referrer + " ";
		if (!document.referrer && window.opener && !window.opener.closed){
			vengode = " " + window.opener.location;
		}
		//Para que no coja el referer si viene ya de una pagina de hoyinversion, si no se revisa falla con la funcion pers de cambio de cobranding del pie
		if(vengode.indexOf("hoytecnologia.com") > 0) {
			vengode ="";
		}
		
		var nombre = document.location.href.split('?refer=');
		if (document.location.href.indexOf("?refer=")>0){
			vengode =  " " + nombre[1];
		}
		if(vengode.indexOf("elcorreodigital.") > 0) {
			vengode_c = "elcorreodigital.hoytecnologia.com";
		} else if(vengode.indexOf("diariovasco.") > 0) {
			vengode_c = "diariovasco.hoytecnologia.com";
		} else if(vengode.indexOf("laverdad.") > 0) {
			vengode_c = "laverdad.hoytecnologia.com";
		} else if(vengode.indexOf("nortecastilla.") > 0) {
			vengode_c = "nortecastilla.hoytecnologia.com";
		} else if(vengode.indexOf("hoy.") > 0) {
			vengode_c = "hoy.hoytecnologia.com";
		} else if(vengode.indexOf("larioja.") > 0) {
			vengode_c = "larioja.hoytecnologia.com";
		} else if(vengode.indexOf("diariosur.") > 0) {
			vengode_c = "diariosur.hoytecnologia.com";
		} else if(vengode.indexOf("eldiariomontanes.") > 0) {
			vengode_c = "eldiariomontanes.hoytecnologia.com";
		} else if(vengode.indexOf("ideal.") > 0) {
			vengode_c = "ideal.hoytecnologia.com";
		} else if(vengode.indexOf("elcomerciodigital.") > 0) {
			vengode_c = "elcomerciodigital.hoytecnologia.com";
		} else if(vengode.indexOf("lasprovincias.") > 0) {
			vengode_c = "lasprovincias.hoytecnologia.com";
		} else if(vengode.indexOf("ozu.") > 0) {
			vengode_c = "ozu.hoytecnologia.com";
		} else if(vengode.indexOf("abc.") > 0) {
			vengode_c = "abc.hoytecnologia.com";
		} else if(vengode.indexOf("lavoz") > 0) {
			vengode_c = "lavozdigital.hoytecnologia.com";
		}  else{ 
			vengode_c = "";
		}
		if (vengode_c!="" && getCookie_p("HOYTECNOLOGIA")!=vengode_c) {
			
			//var curCookie = "HOYTECNOLOGIA=" + vengode_c + "; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
			var curCookie = "HOYTECNOLOGIA=www.hoytecnologia.com; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
			document.cookie = curCookie;
			//Lo reenvia directamente personalizar
			//if (document.location.href.indexOf("?refer=") >0){
			//	document.location.href = "http://"+vengode_c;
			//}
		
		}else{
			//lo original
			if(document.location.host != "www.hoytecnologia.com" && document.location.host != "www1.hoytecnologia.com" && document.location.host != "www2.hoytecnologia.com") {
				//var curCookie = "HOYTECNOLOGIA=" + escape(document.location.host) + "; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
				var curCookie = "HOYTECNOLOGIA=www.hoytecnologia.com; expires=Fri, 31-Dec-2010 00:00:00 GMT;path=/;domain=.hoytecnologia.com";
				document.cookie = curCookie;
			}
			
		}
		personalizar();
		
		
		
	}
	
	
	function setCookie_p(name, value, expires, path, domain, secure) {
		var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
		document.cookie = curCookie;
		personalizar();
	}
	    	
	function getCookie_p(name) {
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);
		if (begin == -1) {
			begin = dc.indexOf(prefix);
		if (begin != 0) return null;
		} else
			begin += 2;
		var end = document.cookie.indexOf(";", begin);
		if (end == -1)
			end = dc.length;
		return unescape(dc.substring(begin + prefix.length, end));
	}
	
	function pers() {
		for (i=0;i<document.perso.radiobloqueportal.length;i++){ 
			if (document.perso.radiobloqueportal[i].checked) {
				setCookie_p('HOYTECNOLOGIA', document.perso.radiobloqueportal[i].value, 'Fri, 31-Dec-2010 00:00:00 GMT', '/', '.hoytecnologia.com', '');
				break;
			}
				
		} 
	}
	
	//para la redireccion a www.hoyinversion.com que se hace para los especiales no tiene que redirigir, sino quedarse como www.hoyinversion.com
	var url_actual = document.location.href;
	
	//personalizar2();

    $(document).ready(function() {
        
        $('#registro-enlaces > a').each(function() {
            if ($(this).attr('href') == '#') {
              
                        $(this).attr('href', 'javascript:void(0)');
                        $(this).click(function() {
                            if ($('[name="nick"]').val() == '') {
                                alert('Por favor, introduce tu email o nombre de usuario');
                            }
                            else {
                                $.post('/backend/contrasena.php', {email_usuario: $('[name="nick"]').val()}, function() {
                                    alert('En breve recibiras un email con tu nueva contraseña');
                                });
                            }
                        });
            }
        });
		
		$("div.publi-interna,#publi1_Position1,div.publi-zona2").each(
	function() {
		if ($(this).height() < 25 ){
		$(this).css('display', 'none');
	} 
	}
);

		
    });
	
//-->

