

if (document.images){
      preload_image_object = new Image();
      // set image url
      image_url = new Array();
     
}


function fondos_pestanias(div,tipo,seccion)  
 {  
 	if(seccion=="comentarios"){
		if(tipo=="over") {document.getElementById(div).style.backgroundImage="url(\""+"../sprites/css/css.gif"+"\")"; document.getElementById(div).style.backgroundPosition="0 -1593px";document.getElementById(div).className="sobre_login"; }
		else {document.getElementById(div).style.backgroundPosition="0 -438px";document.getElementById(div).className="boton_login";}
		 
	}
 	if((seccion=="ultimos")&&( document.getElementById(div).className!="selected")){
		if(tipo=="over") src="../imagen/fondo-p.gif";
		else src="../imagen/fondo-p2.gif";
		 document.getElementById(div).style.backgroundImage="url(\""+src+"\")";  
	}
	if(seccion=="principal"){
		if(tipo=="over") {document.getElementById(div).style.backgroundPosition="0 -1443px"; document.getElementById(div).className="sobre"; }
		else {document.getElementById(div).style.backgroundcolor="#4a6b9b";document.getElementById(div).style.backgroundPosition="0 -308px"; document.getElementById(div).className="normal";}
		 
	}
		if(seccion=="blanco"){
		if(tipo=="over") {document.getElementById(div).style.backgroundImage="url(\""+"../sprites/css/css.gif"+"\")";document.getElementById(div).style.backgroundPosition="0 -1700px"; }
		else {document.getElementById(div).style.backgroundPosition="0 -1780px";}
		 
	}
	if(seccion=="estilos"){
		if(tipo=="over") {src="../imagen/fondo-p6.gif"; document.getElementById(div).style.backgroundImage="url(\""+src+"\")"; }
		else {document.getElementById(div).style.backgroundcolor="#ffffff";document.getElementById(div).style.backgroundImage="";}
		 
	}
	if((seccion=="usuarios")&&( document.getElementById(div).className!="selected")){
		if(tipo=="over"){ document.getElementById(div).style.backgroundPosition="0 -1493px"; document.getElementById(div).className="sobre";}
		else { document.getElementById(div).style.backgroundPosition="0 -248px";document.getElementById(div).className="normal";}
		 //document.getElementById(div).style.backgroundImage="url(\""+src+"\")";  
	}
	if((seccion=="lomas")&&( document.getElementById(div).className!="selected")){
		if(tipo=="over"){ document.getElementById(div).style.backgroundPosition="0 -1493px"; document.getElementById(div).className="sobre";document.getElementById('mas').className="sobre";}
		else { document.getElementById(div).style.backgroundPosition="0 -248px";document.getElementById(div).className="normal";document.getElementById('mas').className="mas";}
		
		
	}
		if((seccion=="conciertos")&&( document.getElementById(div).className!="selected")){
		if(tipo=="over"){document.getElementById(div).style.backgroundPosition="0 -1493px";document.getElementById(div).className="sobre";}
		else {document.getElementById(div).style.backgroundPosition="0 -248px";document.getElementById(div).className="normal";}
		document.getElementById(div).style.backgroundImage="url(\""+src+"\")";  
	}
	
 }



function activar_pestania(div) {  
	if(div=="pestania_1"){
		document.getElementById(div).style.backgroundPosition="0 -188px";
		document.getElementById("pestania_0").style.backgroundPosition="0 -248px";
		document.getElementById(div).className="selected";
		document.getElementById("pestania_0").className="";
	}
	if(div=="pestania_0"){
		document.getElementById(div).style.backgroundPosition="0 -188px";
		document.getElementById("pestania_1").style.backgroundPosition="0 -248px";
		document.getElementById(div).className="selected";
		document.getElementById("pestania_1").className="";
	}
 	if(div=="pestania_lomas1"){
		document.getElementById(div).style.backgroundPosition="0 -188px";
		document.getElementById("pestania_lomas0").style.backgroundPosition="0 -248px";
		document.getElementById(div).className="selected";
		document.getElementById("pestania_lomas0").className="";
		
	}
 	if(div=="pestania_lomas0"){ 
		document.getElementById(div).style.backgroundPosition="0 -188px";
		document.getElementById("pestania_lomas1").style.backgroundPosition="0 -248px";
		document.getElementById(div).className="selected";
		document.getElementById("pestania_lomas1").className="";
	} 
		if(div=="pestania_u1"){ 
		document.getElementById(div).style.backgroundPosition="0 -188px";
		document.getElementById("pestania_u0").style.backgroundPosition="0 -248px";
		document.getElementById(div).className="selected";
		document.getElementById("pestania_u0").className="";
	} 
		if(div=="pestania_u0"){ 
		document.getElementById(div).style.backgroundPosition="0 -188px";
		document.getElementById("pestania_u1").style.backgroundPosition="0 -248px";
		document.getElementById(div).className="selected";
		document.getElementById("pestania_u1").className="";
	} 
 
 }
var tipo_actual="lomas_hoy";
function activar_pestania2(div) { // usada para la caja lo más 
	document.getElementById('lomas_hoy').style.color="#CC9900"
	document.getElementById('lomas_semana').style.color="#CC9900"
	document.getElementById('lomas_mes').style.color="#CC9900"
	document.getElementById('lomas_ano').style.color="#CC9900"
	document.getElementById(div).style.color="#CC6633";
 }


function estilos_activar(div,tipo) {  
	if(tipo=="mostrar"){
		document.getElementById(div).className="visible";
		document.getElementById('estilos_general').style.width=290;
		
	}
	else if(tipo=="ocultar"){
		document.getElementById(div).className="oculta";
		document.getElementById('estilos_general').style.width="";
	}
	
}
function estilos_activar2(div,div1,tipo) {  
	if(tipo=="mostrar"){
		document.getElementById('c_image1').className="img_conciertos_3";
		document.getElementById(div).className="visible";
		document.getElementById(div1).className="visible_estilos";
		
		
		
	
		
		
	}
	else if(tipo=="ocultar"){
		document.getElementById('c_image1').className="img_conciertos_1";
		document.getElementById(div).className="oculta";
		document.getElementById(div1).className="oculta_estilos";
		
		
		
		
	}
	
}

function obtenerXHR(){
	req=false;
	if(window.XMLHttpRequest){
		req=new XMLHttpRequest();
	}	else{
			if(ActiveXObject){
				//DEFINIMOS UN VECTOR CON LAS DISTINTAS POSIBILIDADES
				var vectorVersiones=["MSXML2.XMLhttp.5.0","MSXML2.XMLhttp.4.0","MSXML2.XMLhttp.3.0","MSXML2.XMLhttp","Microsoft.XMLHttp"];
				//LO RECORREMOS E INTENTAMOS VER EL QUE CORRESPONDE
				for(var i=0;i<vectorVersiones.length;i++){
					try{
						req=new ActiveXObject(vectorVersiones[i]);
						return req;
						} catch(e){}
				}
			}
		}
		return req;
}

var peticion;
var longevidad;
var contenido;
var pestania;
var tipo;
function actualizar_lomas(div,aux,tipo1,pestania1){ 
	//alert(div);
	pestania=pestania1;
	contenido= document.getElementById(div);
	tipo="tiempo";
	peticion=obtenerXHR();
	longevidad=aux;
	if(tipo1=="lomas_noticias"){
		peticion.open("POST","../includes/noticias/lo_mas/ajax-generar_lomas_noticias.php",true);
	}
	else if(tipo1=="lomas_comentado"){
		peticion.open("POST","../includes/noticias/lo_mas/ajax-generar_lomas_comentarios.php",true);
	}
	
	else if(tipo1=="lomas_visto_conciertos"){
		peticion.open("POST","../includes/conciertos/lo_mas/ajax-generar_lomas_visto_conciertos.php",true);
	}
	else if(tipo1=="lomas_comentado_conciertos"){
		peticion.open("POST","../includes/conciertos/lo_mas/ajax-generar_lomas_comentado_conciertos.php",true);
	}
	else if(tipo1=="lomas_visto_festivales"){
		peticion.open("POST","../includes/festivales/lo_mas/ajax-generar_lomas_visto.php",true);
	}
	else if(tipo1=="lomas_comentado_festivales"){
		peticion.open("POST","../includes/festivales/lo_mas/ajax-generar_lomas_comentado.php",true);
	}
	else if(tipo1=="lomas_visto_grupos"){
		peticion.open("POST","../includes/grupos/lo_mas/ajax-generar_lomas_visto.php",true);
	}
	else if(tipo1=="lomas_comentado_grupos"){
		peticion.open("POST","../includes/grupos/lo_mas/ajax-generar_lomas_comentado.php",true);
	}
	else if(tipo1=="lomas_visto_mas_secciones"){
		peticion.open("POST","../includes/mas_secciones/lo_mas/ajax-generar_lomas_visto.php",true);
	}
	else if(tipo1=="lomas_comentado_mas_secciones"){
		peticion.open("POST","../includes/mas_secciones/lo_mas/ajax-generar_lomas_comentado.php",true);
	}
	peticion.onreadystatechange=procesarPeticion;
	peticion.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	var parametros="longevidad="+aux;
	peticion.send(parametros);
}
function actualizar_lomas_general(div,aux){  
//alert(div);
	contenido= document.getElementById(div);
	tipo="general";
	peticion=obtenerXHR();
	longevidad=aux;
	if(aux=="lomas_noticias") peticion.open("POST","../includes/noticias/lo_mas/ajax-generar_lomas_general_noticias.php",true);
	else if(aux=="lomas_comentarios")peticion.open("POST","../includes/noticias/lo_mas/ajax-generar_lomas_general_comentarios.php",true);
	else if(aux=="lomas_visto_conciertos")peticion.open("POST","../includes/conciertos/lo_mas/ajax-generar_lomas_general_visto_conciertos.php",true);
	else if(aux=="lomas_comentado_conciertos")peticion.open("POST","../includes/conciertos/lo_mas/ajax-generar_lomas_general_comentado_conciertos.php",true);
	else if(aux=="lomas_visto_festivales")peticion.open("POST","../includes/festivales/lo_mas/ajax-generar_lomas_general_visto.php",true);
	else if(aux=="lomas_comentado_festivales")peticion.open("POST","../includes/festivales/lo_mas/ajax-generar_lomas_general_comentado.php",true);
	else if(aux=="lomas_visto_grupos")peticion.open("POST","../includes/grupos/lo_mas/ajax-generar_lomas_general_visto.php",true);
	else if(aux=="lomas_comentado_grupos")peticion.open("POST","../includes/grupos/lo_mas/ajax-generar_lomas_general_comentado.php",true);
	else if(aux=="lomas_visto_mas_secciones")peticion.open("POST","../includes/mas_secciones/lo_mas/ajax-generar_lomas_general_visto.php",true);
	else if(aux=="lomas_comentado_mas_secciones")peticion.open("POST","../includes/mas_secciones/lo_mas/ajax-generar_lomas_general_comentado.php",true);
	peticion.onreadystatechange=procesarPeticion;
	peticion.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	var parametros="longevidad="+aux;
	peticion.send(parametros);
}
function procesarPeticion(){
	if(peticion.readyState==4){
		if(peticion.status==200){
			//alert(pestania);
				document.getElementById('contenido_lomas_general').innerHTML=peticion.responseText;
			if(tipo!="general")	activar_pestania2(pestania);
				
		}
	}
}

var peticion;
var peticion2;
var peticion3;
var tipo;
var contenido;
var contenido2;
var contenido3;//cambia el contenido del selector conciertos provincias
function actualizar_todos_conciertos(provincia,estilo){  
	contenido= document.getElementById("sustituir_conciertos");
	contenido2= document.getElementById("provincias_conciertos1");
	contenido3= document.getElementById("sustituir_conciertos_tipo");
	
	peticion2=obtenerXHR();
	peticion=obtenerXHR();
	peticion3=obtenerXHR();
	
	peticion2.open("POST","../includes/conciertos/selector_provincias_conciertos.php",true);
	peticion.open("POST","../includes/conciertos/ajax-generar_todos_conciertos.php",true);
	peticion3.open("POST","../includes/conciertos/ajax_cambiar_tipo_conciertos.php",true);
	
	peticion2.onreadystatechange=procesarPeticion2;
	peticion.onreadystatechange=procesarPeticion;
	peticion3.onreadystatechange=procesarPeticion3;
	
	peticion2.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	peticion.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	peticion3.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	 var parametros="estilo="+estilo+"&provincia="+provincia;
	  
	  peticion2.send(parametros);
	  peticion.send(parametros);
	 peticion3.send(parametros);
	
}
function procesarPeticion(){
	if(peticion.readyState==4){
		if(peticion.status==200){
			 contenido.innerHTML=peticion.responseText;
		}
	}
}
function procesarPeticion2(){
	if(peticion2.readyState==4){
		if(peticion2.status==200){
			 
			 contenido2.innerHTML=peticion2.responseText;
			
		}
	}
}
function procesarPeticion3(){
	if(peticion3.readyState==4){
		if(peticion3.status==200){
			 
			 contenido3.innerHTML=peticion3.responseText;
			 
		}
	}
}

function foto_hover(div,tipo)  
 {  
 	
		
	var im=document.getElementById(div);  
	if(tipo=="over") opacity1=60; else opacity1=100;
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
  	  im.style.MozOpacity=opacity1/100;
 	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4){
	  if(tipo=="over") im.style.filter="alpha(opacity=60)";
	  else im.style.filter="alpha(opacity=100)";
	}
 }
function foto_hover_menus(div,tipo)  
 {  
 	
		
	var im=document.getElementById(div+'_foto');  
	if(tipo=="over"){ opacity1=60;document.getElementById(div).className="fondo_menu_resaltado";} else{ opacity1=100;document.getElementById(div).className="fondo_menu_no_resaltado";}
	if (navigator.appName.indexOf("Netscape")!=-1&&parseInt(navigator.appVersion)>=5)
  	  im.style.MozOpacity=opacity1/100;
 	else if (navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4){
	  if(tipo=="over") im.style.filter="alpha(opacity=60)";
	  else im.style.filter="alpha(opacity=100)";
	}
 }

function resaltar(div,tipo,seccion)  
 {  
 	if((seccion=="provincias")&&( tipo=="over")){
		
		 src="../imagen/fondo-p.gif";
		 document.getElementById(div).className="conciertos_resaltada";  
	}
	else if((seccion=="provincias")&&( tipo=="out")){		 
		 document.getElementById(div).className="conciertos_normal";
	}	
	if((seccion=="estilos")&&( tipo=="over")){		
		 src="../imagen/fondo-p.gif";
		 document.getElementById(div).className="conciertos_resaltada";  
	}
	else if((seccion=="estilos")&&( tipo=="out")){		 
		 document.getElementById(div).className="conciertos_normal";
	}
	
	 if((seccion=="todas")&&( tipo=="over")){
		
		 src="../imagen/fondo-p.gif";
		 document.getElementById(div).className="conciertos_tit_normal";  
	}
	else if((seccion=="todas")&&( tipo=="out")){
		 
		 document.getElementById(div).className="conciertos_tit_normal";
	}
	
 }



/* Libreria Ajax*/
var $tipo={
		XML: 0,
		TEXTO: 1,
		JSON:2
}
var $metodo ={
		GET: "GET",
		POST: "POST"
}
function $Ajax(url, opciones){
	if(__$P(opciones, "cache", true)==false){
		var caracter="?";
		if(url.indexOf("?")>0) caracter ="&";
		url+=caracter + Math.random();
	}
	var metodo=__$P(opciones, "metodo", $metodo.GET);
	var parametros=__$P(opciones, "parametros");
	var protoOpc={
		method: metodo,
		onSuccess: __$AjaxRecibir.bind(this, opciones),
		onException: __$AjaxError.bind(this,opciones),
		onFailure: __$AjaxError.bind(this, opciones)
	}
	if(parametros!=undefined){
		protoOpc.parameters=parametros;
	}
	var peticion= new Ajax.Request(url, protoOpc);
	if(__$P(opciones, "avisoCargando")!=undefined){
		__$AjaxCargando(opciones.avisoCargando, true);
	}
	
}
function __$AjaxRecibir(opciones,xhr){
		if(__$P(opciones, "avisoCargando")!=undefined){
			__$AjaxCargando(opciones.avisoCargando, false);
		}
		var funcionRetorno=__$P(opciones, "onfinish");
		var id=__$P(opciones, "id");
		if(funcionRetorno!=undefined){
			var colour = "red";
			var tipoRespuesta = __$P(opciones, "tipoRespuesta",$tipo.TEXTO);
			switch(tipoRespuesta){
				case $tipo.TEXTO:
					funcionRetorno(xhr.responseText, id)
					break;
				case $tipo.XML:
					funcionRetorno(xhr.responseXML, id);
					break;
				case $tipo.JSON:
					var objeto;
					try{
						objeto=xhr.responseText.evalJSON();
					} catch(e){
						__$AjaxError(opciones, xhr, {code: -1, message: "JSON No Válido"});
						return;
					}
					   funcionRetorno(objeto,id);
			}
		}
}
function __$AjaxCargando(cartel,prender){
	if(prender){
		$(cartel).show();
	} else{
		$(cartel).hide();
	}
}

function __$AjaxError(opciones, xhr, excepcion){
	if(__$P(opciones, "avisoCargando")!=undefined){
			__$AjaxCargando(opciones.avisoCargando, false);
	}
	if(excepcion==undefined){
		excepcion={code : xhr.status, message : "Error del servidor"}
	}
	var funcionError=__$P(opciones, "onerror");
	if(funcionError!=undefined){
		funcionError(excepcion, __$P(opciones, "id"));
	}
}
function __$P(coleccion, parametro, defecto){
	if(coleccion==undefined){
		return defecto;
	} else{
		if(coleccion[parametro]==undefined){
			return defecto;
		}else{
			return coleccion[parametro];
		}
	}
}
	
		
		

var republicar;
function enviar_formulario(div,tipo){
	var valores=$(div).serialize();
//	alert(div + valores);
		$Ajax("../includes/comunes/comentarios/procesar_comentario_noticias.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: formularioEnviado});
	
}
function formularioEnviado(html){
	//alert(html);
	$("sustituir_comentarios").innerHTML=html;
	if(document.getElementById("comentario_no_registrado")) mostrar_login_register();
	else{
		$('cabecera_comentarios').show();
		
		
		if(document.getElementById("error_comentario")) mostrar_error_comentario();
		else mostrar_ok_comentario();
	}
}

function mostrar_login_register(){
	Dialog.info($('comentario_no_registrado').innerHTML, 
				 {
					 className:"alphacube", 
					 width:650, 
					 height:150, 
					 showProgress:true
					 
				}
	); 
	republicar=1;
	//setTimeout("Dialog.closeInfo();",4500);	
	//Jump();
	
}

function mostrar_error_comentario(){
	Dialog.info($('error_comentario').innerHTML, 
				 {
					 className:"alphacube", 
					 width:450, 
					 height:100, 
					 showProgress:true
					 
				}
	); 
//	Windows.closeAll();
	
//	Windows.overlayHideEffectOptions.duration=null;
	setTimeout("Dialog.closeInfo();",1500);	
	//setTimeout("ocultar_modal();",2500);	
	Jump();
	
}
function ocultar_modal(){
	var doc = content.document;
	var body = doc.body;
	var aElm=document.body.getElementsByTagName('*');
	for(var i=0; i<aElm.length; i++) {
    	if(aElm[i].className=="dialog") {
    		body.removeChild(aElm[i]);
  	      }
 	   }        

	
	
	//var div = doc.getElementById("overlay_modal");
	
}
function mostrar_ok_comentario(){
	
	
	Dialog.info($('ok_comentario').innerHTML, 
				 {
					 className:"alphacube", 
					 width:450, 
					 height:100, 
					 showProgress:true
					 
				}
	); 
	//alert("nova_ok");
	setTimeout("Dialog.closeInfo();",1500);	
	Jump();
	
}
function Jump() {
	
	var pagina=location.href;
	if(pagina.search('#')!=-1) location.href=location.href;
else location.href=location.href+"#cabecera_comentarios";
}
function Jump_comentar() {
	
	var pagina=location.href;
	if(pagina.search('#')!=-1) location.href=location.href;
else location.href=location.href+"#formulario_com";
}
function reiniciar_descripcion_comentario(){
	$("descripcion").value='';
}

// JavaScript Document
var idglobal;
var provinciaglobal;
var tipoglobal;
function seguimientos(id,provincia,tipo){
	idglobal=id;
	provinciaglobal=provincia;
	tipoglobal=tipo;
	var valores;
	$Ajax("../includes/aniadir/validar_usuario.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: validar_seguimientos});	
	
}
function validar_seguimientos(html){
	var logueado=0;
	var valores="?id="+idglobal+"&provincia="+provinciaglobal+"&tipo="+tipoglobal;
	var longitud=html.length;
	if(longitud==0)	$Ajax("../includes/comunes/seguimientos/comprobar_seguimientos.php",
		  			{metodo:$metodo.POST,
		  			parametros: valores,
		  			cache: true,
		  			onfinish: comprobar_duplicados});	
	else mostrar_registrarse_login();
}

function comprobar_duplicados(html){
	
	var longitud=html.length;
	var valores="?id="+idglobal+"&provincia="+provinciaglobal+"&tipo="+tipoglobal;
	if(longitud==0)	$Ajax("../includes/comunes/seguimientos/insertar.php",
		  			{metodo:$metodo.POST,
		  			parametros: valores,
		  			cache: true,
		  			onfinish: mostrar_seguimientos});
	else mostrar_seguimiento_duplicado()
}


function mostrar_seguimientos(html){
	
	Dialog.info($('seguimientos').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 
					 okLabel: "seguimientos",
					 showProgress:true
				}
			);
	setTimeout("Dialog.closeInfo();",2500);
}

function mostrar_seguimiento_duplicado(){
	
	//alert(republicar);
	Dialog.info($('mostrar_seguimiento_duplicado').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 
					 okLabel: "mostrar_seguimiento_duplicado",
					 showProgress:true
				}
			);
	setTimeout("Dialog.closeInfo();",2500);
}

function mostrar_registrarse_login(){
	Dialog.info($('no_registrado_seguimientos').innerHTML, 
				 {
					 className:"alphacube", 
					 width:650, 
					 height:150, 
					 showProgress:true
					 
				}
	);
}

  var win = null;
  var index = 1;
	function openDialog(id,size) {
	  Dialog.alert($(id).innerHTML, {className: "alphacube",  width:size, okLabel: "Actualizar", ok: closeAllModalWindows})
	  index++;
  }
  
 
  
  function closeAllModalWindows() {
    Windows.closeAllModalWindows();
    return true;
  }


var aux2;
function importar(rutaJS) {/* IMPORTO LAS LIBRERIAS EXTERNAS PROTOTYPE Y WINDOWS CUANDO SON NECESARIAS SOLO*/
    var scr=document.createElement("SCRIPT");
    scr.setAttribute("src", rutaJS);
    scr.setAttribute("type", "text/javascript");
    document.body.appendChild(scr);
} 
function cargar_login() {  
 	if(republicar==1){republicar=0;Dialog.closeInfo(); }
	setTimeout("mostrar_dialogo2();",500);
	

 }
function mostrar_dialogo2(){
	
	//alert(republicar);
	Dialog.confirm($('login').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 
					 okLabel: "login", 
					 cancelLabel: "cancel", 
					 onOk:validar
				}
			);
	
}
function validar()
 { 
 	
 	var valores=$('login_variables').serialize();
 	$Ajax("../includes/comunes/login/procesar.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: verificar_login});
	
	
	
 }
 
 function verificar_login(html){
	var valores;
	var longitud=html.length;
	if(longitud==0){//SI SE HACE LOGIN CORRECTO
		Dialog.closeInfo();
		
		setTimeout("mostrar_dialogo4();",1000);
		$Ajax("../includes/comunes/login/actualizar_menuder.php",
		  {metodo:$metodo.POST,
		  parametros: valores+'?tipo2=si',
		  onfinish: actualizar_menuder});
		
		$('login').hide();
		$("login_ok_msg1").innerHTML="Login Correcto";
		$('login_ok_msg1').show();
		
		//Dialog.cancelCallback();
		
		
	}
	else{
		$("login_error_msg").innerHTML=html;
		$('login_error_msg').show();
		Windows.focusedWindow.updateHeight();
		 
		//new Effect.Shake(Windows.focusedWindow.getId()); 
		return false;
	}
	
}
function mostrar_dialogo4(){
	
	
	Dialog.info($('login_exito').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 
					 height:100, 
					 showProgress:true
					 
				}
			); 	
	


//	if(aux2=='publicar') Windows.closeAll();
//	if(aux2=='publicar') $("overlay_modal").style.display="none";
	//Dialog.closeInfo();
}
function actualizar_menuder(html){	
		
	setTimeout("Dialog.closeInfo();",2500);
	$("contenedor_iuser").innerHTML=html;
	//if(aux2=='publicar'){aux2=''; enviar_formulario_republicar('formulario_com','');}
	
	if(document.getElementById("comentario_descripcion")) publicar_comentario_temporal();
	if(document.getElementById("comentarios")) actualizar_nombre_comentario();
	
	
	
	//if(document.getElementById("overlay_modal")) $("overlay_modal").style.display="none";
	
	
}
function actualizar_nombre_comentario(){	
	var valores;
	$Ajax("../includes/comunes/comentarios/actualizar_nuevo_comentario.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  onfinish: actualizar_nombre_comentario2});
	
	
}
function actualizar_nombre_comentario2(html){	
	var valores;
	$("comentario_nombre").innerHTML=html;
	
	
}
function publicar_comentario_temporal(){
	
	var valores=$('formulario_com').serialize();
//	alert(div + valores);
		$Ajax("../includes/comunes/comentarios/procesar_comentario_noticias.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: publicar_comentario_temporal2});
	
}
function publicar_comentario_temporal2(html){
	$("sustituir_comentarios").innerHTML=html;
	setTimeout("mostrar_ok_comentario();",2500);
}
function no_disponible() {  
 	Dialog.info($('no_disponible').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 					  
					 showProgress:true
					 
				}
			);
	setTimeout("Dialog.closeInfo();",2500);
	

 }

function recordar_password() {  
	setTimeout("mostrar_dialogor();",500);
 }
function mostrar_dialogor(){
	//alert(republicar);
	Dialog.info($('reenvio_password').innerHTML, 
				 {
					 className:"alphacube", 
					 width:420, 
					 height:170, 
					 showProgress:false
				}
			);
}
function validarr()
 { 
 	var valores=$('reenvio_password_form').serialize();
 	$Ajax("../includes/comunes/login/procesar_reenviar_clave.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: verificar_reenvio_clave});
 }
 
 function verificar_reenvio_clave(html){
	
	var valores;
	var longitud=html.length;
	if(longitud==68){//SI SE HACE LOGIN CORRECTO
		
		$('reenvio_error_msg').hide();
		$("reenvio_ok_msg1").innerHTML="Se ha enviado un email con los datos de usuario al email introducido.";
		$('reenvio_ok_msg1').show();
		setTimeout("Dialog.closeInfo();",2500);
	}
	else{ 
		$("reenvio_error_msg").innerHTML=html;
		$('reenvio_error_msg').show();
		Windows.focusedWindow.updateHeight();
		return false;
	}
}


function logout()
{ 
 	var valores;
	Dialog.info($('saliendo').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 
					 height:100, 
					 showProgress:true
					 
				}
			); 
	$("saliendo_msg").innerHTML="Cerrando Sesi&#243;n";
	$('saliendo_msg').show();
	
 	$Ajax("../includes/comunes/login/logout.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: recargar_menuder});
	
	
	
	
}
function recargar_menuder(html){
	
	var valores;	
	setTimeout("Dialog.closeInfo();",1500);
	//alert(document.cookie);

	//eraseCookie('portalmusic');
	$Ajax("../includes/comunes/login/actualizar_menuder.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: actualizar_menuder5});
	
}
function actualizar_menuder5(html){	
		
	
	$("contenedor_iuser").innerHTML=html;
	
	if(document.getElementById("comentarios")) actualizar_nombre_comentario();
	
	
	
	
	
}

function registrarse() {  
	
		
	 mostrar_dialogo1();

 }
function mostrar_dialogo1(){
Dialog.confirm($('contenedor_registro').innerHTML, 
				 {
					 className:"alphacube", 
					 width:400, 
					 height:300,
					 okLabel: "Registrarse", 
					 cancelLabel: "Cancelar", 
					 onOk:validar_registrarse
				}
			); 
}
function validar_registrarse()
 { 
 	var valores=$('registrarse').serialize();
 	$Ajax("../includes/comunes/registrarse/procesar.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: verificar_registrarse});
	
	
	
 }

 function verificar_registrarse(html){
	var valores;
	var longitud=html.length;
	//alert(longitud);
	if(longitud==68){//SI SE HACE LOGIN CORRECTO
		//hago una consulta ajax para sacar el usuario y el password y email y mostrarlos
		Dialog.closeInfo();
		$Ajax("../includes/comunes/registrarse/fin_mostrar_datos.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: mostrar_info_fin});
		
		
	}
	else{
		$("registrar_error_msg").innerHTML=html;
		$('registrar_error_msg').show();
		Windows.focusedWindow.updateHeight();
		//new Effect.Shake(Windows.focusedWindow.getId());
		Windows.focusedWindow.updateHeight();
		return false;
	}
	
}
 function mostrar_info_fin(html){
	 var valores;
	 Dialog.info($('fin_registro_ok').innerHTML, 
				 {
					 className:"alphacube", 
					 width:450, 
					 height:240, 
					 showProgress:true
					 
				}
			); 
		
		$('login').hide();
		$("agrupador_registrarse").innerHTML=html;
		//$('agrupador_registrarse').show();
		
		setTimeout("Dialog.closeInfo();",7500);
		
		$Ajax("../includes/comunes/login/actualizar_menuder.php",
		  {metodo:$metodo.POST,
		  parametros: valores+"?tipo2=si",
		  cache: true,
		  onfinish: actualizar_menuder2});
		
 }
 
function actualizar_menuder2(html){	
	$("contenedor_iuser").innerHTML=html;
	if(document.getElementById("comentario_descripcion")) publicar_comentario_temporalx();
	if(document.getElementById("comentarios")) actualizar_nombre_comentario();
//	if(aux=='publicar'){aux=''; enviar_formulario_republicar('formulario_com','');}

	//setTimeout("Dialog.closeInfo();",7500);
	
	
}
function actualizar_nombre_comentario(){	
	var valores;
	$Ajax("../includes/comunes/comentarios/actualizar_nuevo_comentario.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  onfinish: actualizar_nombre_comentario2});
	
	
}
function actualizar_nombre_comentario2(html){	
	var valores;
	$("comentario_nombre").innerHTML=html;
	
	
}
function publicar_comentario_temporalx(){
	
	var valores=$('formulario_com').serialize();
//	alert(div + valores);
		$Ajax("../includes/comunes/comentarios/procesar_comentario_noticias.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: publicar_comentario_temporal2x});
	
}
function publicar_comentario_temporal2x(html){
	$("sustituir_comentarios").innerHTML=html;
	
}

function cargar_formulario_contacto(){
		var valores;
		
		$Ajax("../includes/contacto/contacto.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: mostrar_contacto});
	
}
function mostrar_contacto(html){	
	$("cont_pie").innerHTML=html;
	Dialog.info($('contenedor_contacto').innerHTML, 
				 {
					 className:"alphacube", 
					 width:450, 
					 height:450,
					 showProgress:false
					 
				}
	); 
	
}
function procesar_consulta(){
	var valores=$('formulario_contacto').serialize();
		$Ajax("../includes/contacto/procesar_contacto.php",
		  {metodo:$metodo.POST,
		  parametros: valores,
		  cache: true,
		  onfinish: validar_consulta});
	
}
function validar_consulta(html){
var valores;
	var longitud=html.length;
	//alert(longitud);
	if(longitud==69){//SI SE HACE LOGIN CORRECTO
		Dialog.closeInfo();		
		setTimeout("mostrar_ok_consulta();",1000);		
	}
	else{
		$("contacto_error_msg").innerHTML=html;
		$('contacto_error_msg').show();
		Windows.focusedWindow.updateHeight();
		return false;
	}	
}
function mostrar_ok_consulta(){
	
	
	Dialog.info($('ok_consulta').innerHTML, 
				 {
					 className:"alphacube", 
					 width:450, 
					 height:100, 
					 showProgress:true
					 
				}
	); 
	//alert("nova_ok");
	setTimeout("Dialog.closeInfo();",2500);		
	
}

var WlWebsiteId = null;

function zbox_quoted(str) 
{
  return (str != "") ? '"' + str + '"' : '""';
}

function zbox_size(num) 
{
  return (num!="") && (num>0) ? '"' + num + '"' : '"0"';
}

function zbox_partner_code( id, checknumber, suba_id ) 
{
  if((id != "" ) && ( id > 0 ) &&  ( checknumber != "" ) && ( checknumber > 0 ))
  {
    return id + 'C' + checknumber + 'S' + suba_id;
  }
  return '';
}

function zbox_bg_param(adbox_color_bg)
{
	return('&ttbg=#' + adbox_color_bg);
}

function zbox_page_param(adbox_width, adbox_height, adbox_show_images)
{
	var page = 25;
	if((adbox_width == 125) && (adbox_height == 125))
	{
		page = 20;
	}
	else if((adbox_width == 468) && (adbox_height == 60))
	{
		page = 25;
	}
	else if((adbox_width == 120) && (adbox_height == 240))
	{
		page = 30;
	}
	else if((adbox_width == 120) && (adbox_height == 600))
	{
		page = 35;
	}
	else if((adbox_width == 160) && (adbox_height == 600))
	{
		page = 40;
	}
	else if((adbox_width == 180) && (adbox_height == 150))
	{
		page = 45;
	}
	else if((adbox_width == 300) && (adbox_height == 250))
	{
		page = 50;
	}
	else if((adbox_width == 336) && (adbox_height == 280))
	{
		page = 55;
	}
	else if((adbox_width == 250) && (adbox_height == 250))
	{
		page = 60;
	}
	else if((adbox_width == 728) && (adbox_height == 90))
	{
		page = 65;
	}
	else if((adbox_width == 240) && (adbox_height == 400))
	{
		page = 100;
	}
	else if((adbox_width == 234) && (adbox_height == 60))
	{
		page = 105;
	}
	else if((adbox_width == 120) && (adbox_height == 90))
	{
		page = 110;
	}
	else if((adbox_width == 120) && (adbox_height == 60))
	{
		page = 115;
	}
	else if((adbox_width == 88) && (adbox_height == 31))
	{
		page = 120;
	}
	else if((adbox_width == 200) && (adbox_height == 200))
	{
		page = 125;
	}
	else if((adbox_width == 300) && (adbox_height == 600))
	{
		page = 130;
	}
	else if((adbox_width == 250) && (adbox_height == 600))
	{
		page = 135;
	}
	else if((adbox_width == 120) && (adbox_height == 468))
	{
		page = 140;
	}
	else if((adbox_width == 468) && (adbox_height == 400))
	{
		page = 145;
	}
	else if((adbox_width == 400) && (adbox_height == 468))
	{
		page = 150;
	}
	else if((adbox_width == 300) && (adbox_height == 400))
	{
		page = 155;
	}
	else if((adbox_width == 600) && (adbox_height == 400))
	{
		page = 160;
	}
	else if((adbox_width == 140) && (adbox_height == 350))
	{
		page = 165;
	}
	else if((adbox_width == 250) && (adbox_height == 240))
	{
		page = 170;
	}
	else if((adbox_width == 250) && (adbox_height == 120))
	{
		page = 175;
	}

	if((page == 25) || (page == 65) || (page == 115) || (page == 120))
	{
		return '&page='+page;
	}
	if(adbox_show_images == true)
	{
		page += 1;
		return ('&page=' + page);
	}
	return ('&page=' + page);
}

function zbox_master_param()
{
	return '&master=11';
};

function zbox_master_website_param()
{
	return '&ma_website_id=183924';
};

function zbox_img_default_param(adbox_img_default)
{
	return ('&DefaultURL='+adbox_img_default);
};

function CallAdBoxTracking(adbox_id, adbox_checknumber, adbox_subaffiliate, adbox_width, adbox_height, adbox_color_border, adbox_color_bg, adbox_color_link, adbox_color_url, adbox_color_text, adbox_frameborder, adbox_img_default, adbox_show_images)
{
	if((adbox_id != "") && (adbox_id > 0) && (adbox_checknumber != "") && (adbox_checknumber > 0)) 
	{
	 window.document.open();
//   WlWebsiteId = adbox_id;
//   if (typeof (wlrcmd) == "undefined") { var wlrcmd = ""; };
//	 var tmp=		'<scr' + 'ipt language="JavaScript" src="http://rc.wunderloop.zanox.com/Tag/zanox/JS/Gt.js"></scr' + 'ipt>';
	 		var tmp = '<ifr' + 'ame' + ' name="zanox_adbox_frame"';
      tmp+=' width=' + zbox_size(adbox_width) + ' height=' + zbox_size(adbox_height);
      tmp+=               ' frameborder=' + zbox_quoted(adbox_frameborder);
      tmp+=               ' src="http://zbox.zanox.com/ppb/?' + zbox_partner_code(adbox_id, adbox_checknumber, adbox_subaffiliate) + zbox_img_default_param(adbox_img_default) + zbox_master_param() + zbox_page_param(adbox_width, adbox_height, adbox_show_images) + zbox_master_website_param() + zbox_bg_param(adbox_color_bg) + '" marginwidth="0"';
      tmp+=               ' marginheight="0"';
      tmp+=               ' vspace="0"';
      tmp+=               ' hspace="0"';
      tmp+=               ' allowtransparency="true"';
      tmp+=               ' scrolling="no">';
	  tmp+=				 '</ifr' + 'ame>';
//	  alert(tmp);
	 window.document.write(tmp);
	 window.document.close();
	}
}



var iBox=function(){var _pub={close_label:"Close",inherit_frames:false,fade_in_speed:300,fade_out_speed:300,attribute_name:"rel",tags_to_hide:["select","embed","object"],default_width:450,version_number:"2.2",build_number:"1612",is_opera:navigator.userAgent.indexOf("Opera/9")!=-1,is_ie:navigator.userAgent.indexOf("MSIE ")!=-1,is_ie6:false
/*@cc_on || @_jscript_version < 5.7 @*/
,is_firefox:navigator.appName=="Netscape"&&navigator.userAgent.indexOf("Gecko")!=-1&&navigator.userAgent.indexOf("Netscape")==-1,is_mac:navigator.userAgent.indexOf("Macintosh")!=-1,base_url:"",setPath:function(path){_pub.base_url=path},checkTags:function(container,tag_name){if(!container){var container=document.body}if(!tag_name){var tag_name="a"}var els=container.getElementsByTagName(tag_name);for(var i=0;i<els.length;i++){if(els[i].getAttribute(_pub.attribute_name)){var t=els[i].getAttribute(_pub.attribute_name);if((t.indexOf("ibox")!=-1)||t.toLowerCase()=="ibox"){els[i].onclick=_pub.handleTag}}}},bind:function(fn){var args=[];for(var n=1;n<arguments.length;n++){args.push(arguments[n])}return function(e){return fn.apply(this,[e].concat(args))}},html:function(content,params){if(content===undefined){return els.content}if(params===undefined){var params={}}if(!active.is_loaded){return }_pub.clear();_pub.updateObject(els.wrapper.style,{display:"block",visibility:"hidden",left:0,top:0,height:"",width:""});if(typeof (content)=="string"){els.content.innerHTML=content}else{els.content.appendChild(content)}var pagesize=_pub.getPageSize();if(params.can_resize===undefined){params.can_resize=true}if(params.fade_in===undefined){params.use_fade=true}if(params.fullscreen){params.width="100%";params.height="100%"}offset.container=[els.wrapper.offsetLeft*2,els.wrapper.offsetTop*2];offset.wrapper=[els.wrapper.offsetWidth-els.content.offsetWidth,els.wrapper.offsetHeight-els.content.offsetHeight];offset.wrapper[1]+=4;if(params.width){var width=params.width}else{var width=_pub.default_width}if(params.height){var height=params.height}else{els.content.style.height="100%";var height=els.content.offsetHeight+12;els.content.style.height=""}active.dimensions=[width,height];active.params=params;_pub.reposition();for(var i=0;i<_pub.tags_to_hide.length;i++){showTags(_pub.tags_to_hide[i],els.content)}els.wrapper.style.visibility="visible"},clear:function(){els.loading.style.display="none";while(els.content.firstChild){els.content.removeChild(els.content.firstChild)}},show:function(text,title,params){showInit(title,params,function(){_pub.html(text,active.params)})},showURL:function(url,title,params){showInit(title,params,function(){for(var i=0;i<_pub.plugins.list.length;i++){var plugin=_pub.plugins.list[i];if(plugin.match(url)){active.plugin=plugin;plugin.render(url,active.params);break}}})},hide:function(){if(active.plugin){if(active.plugin.unload){active.plugin.unload()}}active={};_pub.clear();for(var i=0;i<_pub.tags_to_hide.length;i++){showTags(_pub.tags_to_hide[i])}els.loading.style.display="none";els.wrapper.style.display="none";_pub.fade(els.overlay,_pub.getOpacity(null,els.overlay),0,_pub.fade_out_speed,function(){els.overlay.style.display="none"});_pub.fireEvent("hide")},reposition:function(){if(!active.is_loaded){return }if(els.loading.style.display!="none"){_pub.center(els.loading)}if(active.dimensions){var pagesize=_pub.getPageSize();var width=active.dimensions[0];var height=active.dimensions[1];if(height.toString().indexOf("%")!=-1){els.wrapper.style.height=(Math.max(document.documentElement.clientHeight,document.body.clientHeight,pagesize.height)-offset.container[0])*(parseInt(height)/100)+"px"}else{if(height){els.content.style.height=height+"px";els.wrapper.style.height=els.content.offsetHeight+offset.wrapper[1]+"px"}else{els.wrapper.style.height=els.content.offsetHeight+offset.wrapper[1]+"px"}}var container_offset=(els.content.offsetHeight-els.content.firstChild.offsetHeight);if(width.toString().indexOf("%")!=-1){els.wrapper.style.width=(Math.max(document.documentElement.clientWidth,document.body.clientWidth,pagesize.width)-offset.container[1])*(parseInt(width)/100)+"px";var container_offset=0}else{els.content.style.width=width+"px";els.wrapper.style.width=els.content.offsetWidth+offset.wrapper[0]+"px"}_pub.updateObject(els.content.style,{width:"",height:""});var width=parseInt(els.wrapper.style.width);var height=parseInt(els.wrapper.style.height);if(active.params.can_resize){var x=pagesize.width;var y=pagesize.height;x-=offset.container[0];y-=offset.container[1];if(width>x){if(active.params.constrain){height=height*(x/width)}width=x}if(height>y){if(active.params.constrain){width=width*(y/height)}height=y}_pub.updateObject(els.wrapper.style,{width:width+"px",height:height+"px"})}els.content.style.height=height-offset.wrapper[1]+"px";if(active.dimensions!=["100%","100%"]){_pub.center(els.wrapper)}}els.overlay.style.height=Math.max(document.body.clientHeight,document.documentElement.clientHeight)+"px"},updateObject:function(obj,params){for(var i in params){obj[i]=params[i]}},center:function(obj){var pageSize=_pub.getPageSize();var scrollPos=_pub.getScrollPos();var emSize=_pub.getElementSize(obj);var x=Math.round((pageSize.width-emSize.width)/2+scrollPos.scrollX);var y=Math.round((pageSize.height-emSize.height)/2+scrollPos.scrollY);if(obj.offsetLeft){x-=obj.offsetLeft}if(obj.offsetTop){y-=obj.offsetTop}if(obj.style.left){x+=parseInt(obj.style.left)}if(obj.style.top){y+=parseInt(obj.style.top)}x-=10;_pub.updateObject(obj.style,{top:y+"px",left:x+"px"})},getStyle:function(obj,styleProp){if(obj.currentStyle){return obj.currentStyle[styleProp]}else{if(window.getComputedStyle){return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp)}}},getScrollPos:function(){var docElem=document.documentElement;return{scrollX:document.body.scrollLeft||window.pageXOffset||(docElem&&docElem.scrollLeft),scrollY:document.body.scrollTop||window.pageYOffset||(docElem&&docElem.scrollTop)}},getPageSize:function(){return{width:window.innerWidth||(document.documentElement&&document.documentElement.clientWidth)||document.body.clientWidth,height:window.innerHeight||(document.documentElement&&document.documentElement.clientHeight)||document.body.clientHeight}},getElementSize:function(obj){return{width:obj.offsetWidth||obj.style.pixelWidth,height:obj.offsetHeight||obj.style.pixelHeight}},fade:function(obj,start,end,speed,callback){if(start===undefined||!(start>=0)||!(start<=100)){var start=0}if(end===undefined||!(end>=0)||!(end<=100)){var end=100}if(speed===undefined){var speed=0}if(obj.fader){clearInterval(obj.fader)}if(!speed){_pub.setOpacity(null,obj,end);if(callback){callback()}}var opacity_difference=end-start;var time_total=speed;var step_size=25;var steps=time_total/step_size;var increment=Math.ceil(opacity_difference/steps);obj.fader=setInterval(_pub.bind(function(e,obj,increment,end,callback){var opacity=_pub.getOpacity(e,obj)+increment;_pub.setOpacity(e,obj,opacity);if((increment<0&&opacity<=end)||(increment>0&&opacity>=end)){_pub.setOpacity(e,obj,end);clearInterval(obj.fader);if(callback){callback()}}},obj,increment,end,callback),step_size)},setOpacity:function(e,obj,value){value=Math.round(value);obj.style.opacity=value/100;obj.style.filter="alpha(opacity="+value+")"},getOpacity:function(e,obj){return _pub.getStyle(obj,"opacity")*100},createXMLHttpRequest:function(){var http;if(window.XMLHttpRequest){http=new XMLHttpRequest();if(http.overrideMimeType){http.overrideMimeType("text/html")}}else{if(window.ActiveXObject){try{http=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{http=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}}if(!http){alert("Cannot create XMLHTTP instance");return false}return http},addEvent:function(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true}else{if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r}else{return false}}},addEventListener:function(name,callback){if(!events[name]){events[name]=new Array()}events[name].push(callback)},fireEvent:function(name){if(events[name]&&events[name].length){for(var i=0;i<events[name].length;i++){var args=[];for(var n=1;n<arguments.length;n++){args.push(arguments[n])}if(events[name][i](args)===false){break}}}},parseQuery:function(query){var params=new Object();if(!query){return params}var pairs=query.split(/[;&]/);var end_token;for(var i=0;i<pairs.length;i++){var keyval=pairs[i].split("=");if(!keyval||keyval.length!=2){continue}var key=unescape(keyval[0]);var val=unescape(keyval[1]);val=val.replace(/\+/g," ");if(val[0]=='"'){var token='"'}else{if(val[0]=="'"){var token="'"}else{var token=null}}if(token){if(val[val.length-1]!=token){do{i+=1;val+="&"+pairs[i]}while((end_token=pairs[i][pairs[i].length-1])!=token)}val=val.substr(1,val.length-2)}if(val=="true"){val=true}else{if(val=="false"){val=false}else{if(val=="null"){val=null}}}params[key]=val}return params},handleTag:function(e){var t=this.getAttribute("rel");var params=_pub.parseQuery(t.substr(5,999));if(params.target){var url=params.target}else{if(this.target&&!params.ignore_target){var url=this.target}else{var url=this.href}}var title=this.title;if(_pub.inherit_frames&&window.parent){window.parent.iBox.showURL(url,title,params)}else{_pub.showURL(url,title,params)}return false},plugins:{list:new Array(),register:function(func,last){if(last===undefined){var last=false}if(!last){_pub.plugins.list=[func].concat(_pub.plugins.list)}else{_pub.plugins.list.push(func)}}}};var active={};var events={};var els={};var offset={};var create=function(elem){pagesize=_pub.getPageSize();els.container=document.createElement("div");els.container.id="ibox";els.overlay=document.createElement("div");els.overlay.style.display="none";_pub.setOpacity(null,els.overlay,0);if(!_pub.is_firefox){els.overlay.style.background="#000000"}else{els.overlay.style.backgroundImage="url('"+_pub.base_url+"images/bg.png')"}els.overlay.id="ibox_overlay";params={position:"absolute",top:0,left:0,width:"100%"};_pub.updateObject(els.overlay.style,params);els.overlay.onclick=_pub.hide;els.container.appendChild(els.overlay);els.loading=document.createElement("div");els.loading.id="ibox_loading";els.loading.innerHTML="Loading...";els.loading.style.display="none";els.loading.onclick=_pub.hide;els.container.appendChild(els.loading);els.wrapper=document.createElement("div");els.wrapper.id="ibox_wrapper";_pub.updateObject(els.wrapper.style,{position:"absolute",top:0,left:0,display:"none"});els.content=document.createElement("div");els.content.id="ibox_content";_pub.updateObject(els.content.style,{overflow:"auto"});els.wrapper.appendChild(els.content);var child=document.createElement("div");child.id="ibox_footer_wrapper";var child2=document.createElement("a");child2.innerHTML=_pub.close_label;child2.href="javascript:void(0)";child2.onclick=_pub.hide;child.appendChild(child2);els.footer=document.createElement("div");els.footer.id="ibox_footer";els.footer.innerHTML="&nbsp;";child.appendChild(els.footer);els.wrapper.appendChild(child);els.container.appendChild(els.wrapper);elem.appendChild(els.container);_pub.updateObject(els.wrapper.style,{right:"",bottom:""});return els.container};var hideTags=function(tag,container){if(container===undefined){var container=document.body}var list=container.getElementsByTagName(tag);for(var i=0;i<list.length;i++){if(_pub.getStyle(list[i],"visibility")!="hidden"&&list[i].style.display!="none"){list[i].style.visibility="hidden";list[i].wasHidden=true}}};var showTags=function(tag,container){if(container===undefined){var container=document.body}var list=container.getElementsByTagName(tag);for(var i=0;i<list.length;i++){if(list[i].wasHidden){list[i].style.visibility="visible";list[i].wasHidden=null}}};var showInit=function(title,params,callback){if(!_initialized){initialize()}if(params===undefined){var params={}}if(active.plugin){_pub.hide()}active.is_loaded=true;active.params=params;els.loading.style.display="block";_pub.center(els.loading);_pub.reposition();for(var i=0;i<_pub.tags_to_hide.length;i++){hideTags(_pub.tags_to_hide[i])}els.footer.innerHTML=title||"&nbsp;";els.overlay.style.display="block";if(!_pub.is_firefox){var amount=70}else{var amount=100}_pub.fade(els.overlay,_pub.getOpacity(null,els.overlay),amount,_pub.fade_in_speed,callback);_pub.fireEvent("show")};var drawCSS=function(){var core_styles="#ibox {z-index:1000000;text-align:left;} #ibox_overlay {z-index:1000000;} #ibox_loading {position:absolute;z-index:1000001;} #ibox_wrapper {margin:30px;position:absolute;top:0;left:0;z-index:1000001;} #ibox_content {z-index:1000002;margin:27px 5px 5px 5px;padding:2px;} #ibox_content object {display:block;} #ibox_content .ibox_image {width:100%;height:100%;margin:0;padding:0;border:0;display:block;} #ibox_footer_wrapper a {float:right;display:block;outline:0;margin:0;padding:0;} #ibox_footer_wrapper {text-align:left;position:absolute;top:5px;right:5px;left:5px;white-space:nowrap;overflow:hidden;}";var default_skin="#ibox_footer_wrapper {font-weight:bold;height:20px;line-height:20px;} #ibox_footer_wrapper a {text-decoration:none;background:#888;border:1px solid #666;line-height:16px;padding:0 5px;color:#333;font-weight:bold;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:10px;} #ibox_footer_wrapper a:hover {background-color:#bbb;color:#111;} #ibox_footer_wrapper {font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;color:#111;} #ibox_wrapper {border:1px solid #ccc;} #ibox_wrapper {background-color:#999;}#ibox_content {background-color:#eee;border:1px solid #666;} #ibox_loading {padding:50px; background:#000;color:#fff;font-size:16px;font-weight:bold;}";var head=document.getElementsByTagName("head")[0];var htmDiv=document.createElement("div");htmDiv.innerHTML='<p>x</p><style type="text/css">'+default_skin+"</style>";head.insertBefore(htmDiv.childNodes[1],head.firstChild);htmDiv.innerHTML='<p>x</p><style type="text/css">'+core_styles+"</style>";head.insertBefore(htmDiv.childNodes[1],head.firstChild)};var _initialized=false;var initialize=function(){if(_initialized){return }_initialized=true;drawCSS();var els=document.getElementsByTagName("script");var src;for(var i=0,el=null;(el=els[i]);i++){if(!(src=el.getAttribute("src"))){continue}src=src.split("?")[0];if(src.substr(src.length-8)=="/ibox.js"){_pub.setPath(src.substr(0,src.length-7));break}}create(document.body);_pub.checkTags(document.body,"a");_pub.http=_pub.createXMLHttpRequest();_pub.fireEvent("load")};_pub.addEvent(window,"keypress",function(e){if(e.keyCode==(window.event?27:e.DOM_VK_ESCAPE)){iBox.hide()}});_pub.addEvent(window,"resize",_pub.reposition);_pub.addEvent(window,"load",initialize);_pub.addEvent(window,"scroll",_pub.reposition);var iBoxPlugin_Container=function(){var was_error=false;var original_wrapper=null;return{match:function(url){return url.indexOf("#")!=-1},unload:function(){if(was_error){return }var elemSrc=_pub.html().firstChild;if(elemSrc){elemSrc.style.display="none";original_wrapper.appendChild(elemSrc)}},render:function(url,params){was_error=false;var elemSrcId=url.substr(url.indexOf("#")+1);var elemSrc=document.getElementById(elemSrcId);if(!elemSrc){was_error=true;_pub.html(document.createTextNode("There was an error loading the document."),params)}else{original_wrapper=elemSrc.parentNode;elemSrc.style.display="block";_pub.html(elemSrc,params)}}}}();_pub.plugins.register(iBoxPlugin_Container,true);var iBoxPlugin_Image=function(){var image_types=/\.jpg|\.jpeg|\.png|\.gif/gi;return{match:function(url){return url.match(image_types)},render:function(url,params){var img=document.createElement("img");img.onclick=_pub.hide;img.className="ibox_image";img.style.cursor="pointer";img.onload=function(){_pub.html(img,{width:this.width,height:this.height,constrain:true})};img.onerror=function(){_pub.html(document.createTextNode("There was an error loading the document."),params)};img.src=url}}}();_pub.plugins.register(iBoxPlugin_Image);var iBoxPlugin_YouTube=function(){var youtube_url=/(?:http:\/\/)?(?:www\d*\.)?(youtube\.(?:[a-z]+))\/(?:v\/|(?:watch(?:\.php)?)?\?(?:.+&)?v=)([^&]+).*/;return{match:function(url){return url.match(youtube_url)},render:function(url,params){var _match=url.match(youtube_url);var domain=_match[1];var id=_match[2];params.width=425;params.height=355;params.constrain=true;var html='<span><object width="100%" height="100%" style="overflow: hidden; display: block;"><param name="movie" value="http://www.'+domain+"/v/"+id+'"/><param name="wmode" value="transparent"/><embed src="http://www.'+domain+"/v/"+id+'" type="application/x-shockwave-flash" wmode="transparent" width="100%" height="100%"></embed></object></span>';_pub.html(html,params)}}}();_pub.plugins.register(iBoxPlugin_YouTube);var iBoxPlugin_Document=function(){return{match:function(url){return true},render:function(url,params){_pub.http.open("get",url,true);_pub.http.onreadystatechange=function(){if(_pub.http.readyState==4){if(_pub.http.status==200||_pub.http.status==0){_pub.html(_pub.http.responseText,params)}else{_pub.html(document.createTextNode("There was an error loading the document."),params)}}};_pub.http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");try{_pub.http.send(null)}catch(ex){_pub.html(document.createTextNode("There was an error loading the document."),params)}}}}();_pub.plugins.register(iBoxPlugin_Document,true);return _pub}();

function esperar(aux){
	//setTimeout("ajustar_cabecera("+aux+")", 500);	
}
function nohagonada(){
	
}
function ajustar_cabecera(image_h){

	var parrafo_h;
	var imagen_h;
	 parrafo_h=document.getElementById('parrafo').scrollHeight;

	 imagen_h=image_h;
	//alert (imagen_h);
	if(imagen_h>parrafo_h){
	//	alert("Imagen :"+imagen_h+" Parrafo :"+parrafo_h);
		diferencia=imagen_h-parrafo_h;
		margen=Math.round(diferencia/2);
		document.getElementById('parrafo').style.marginTop=margen+'px';
		//alert(margen);
	}
	else if(imagen_h<parrafo_h)
	{
	//	alert("Imagen :"+imagen_h+" Parrafo :"+parrafo_h);
		diferencia=parrafo_h-imagen_h;
		margen=Math.round(diferencia/2);
		document.getElementById('foto').style.marginTop=margen+'px';
		//alert(margen);
	
	}
}

function esperar2(aux){
	setTimeout("ajustar_cabecera2("+aux+")", 500);	
}

function ajustar_cabecera2(image_h){

	var parrafo_h;
	var imagen_h;
	 parrafo_h=document.getElementById('agrupador_elementos').scrollHeight;

	 imagen_h=image_h;
	//alert (imagen_h);
	if(imagen_h>parrafo_h){
	//	alert("Imagen :"+imagen_h+" Parrafo :"+parrafo_h);
		diferencia=imagen_h-parrafo_h;
		margen=Math.round(diferencia/2);
		document.getElementById('agrupador_elementos').style.marginTop=margen+'px';
		//alert(margen);
	}
	else if(imagen_h<parrafo_h)
	{
	//	alert("Imagen :"+imagen_h+" Parrafo :"+parrafo_h);
		diferencia=parrafo_h-imagen_h;
		margen=Math.round(diferencia/2);
		document.getElementById('agrupador_elementos').style.marginTop=margen+'px';
		//alert(margen);
	
	}
}

function anchura_navegador() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 
}
function altura_navegador() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return (myHeight );
}
function mostrar_foto_individual(ubicacion,ancho,alto){	
	ancho_navegador=anchura_navegador();
	alto_navegador=altura_navegador();
	ratio=ancho/alto;
	if(alto_navegador -58 <=parseInt(alto)){
		diferencia=(alto - alto_navegador) +160;
		alto=alto_navegador -160;		
		ancho=parseInt(ancho) - (ratio*diferencia);
	}
	
	ancho=parseInt(ancho) + 15;
	alto=parseInt(alto) +58;
	Dialog.alert({url: "http://www.portalmusic.net/includes/comunes/mostrar_foto_individual.php?h="+alto+"&u="+ubicacion, options: {method: 'get'}}, {className: "alphacube", width:ancho,height:alto, okLabel: "Cerrar"});
	
	
}