var empezar = true;
var retardo = false;
var ocultar = false;
var busqueda = false;
var timers=[];
var retardo_alt;
var capa_alt=[];
var lethide = true;
var stopform = false;
var puntos_extend_txt = "<option value=20>Dar 20 puntos</option>";
var tipo_voto_form;
var paises_span_semaforo=false;
var usuarios_js=new Array();
var usuarios_js_quiero_conocerte=new Array();
var forzar_show_pop=false;
var IE = document.all?true:false
var index_foto_album=false;
var drag = null;
var dragX = 0, dragY = 0;
var alertpos_names= new Array();

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)
// Set-up to use getMouse_XY function onMouseMove
document.onmousemove = getMouse_XY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
var MouseX = 0
var MouseY = 0
iframes_check();

// iframes check.
function iframes_check()
{return false; // jode las paginacion.
var iframes=document.getElementsByTagName("iframe");
	for (var i = 0 ; i< iframes.length; i++)
		iframes[i].src="";
}

function preload_imagenes() {
loadImages("/img/menud_inicio_over.jpg","/img/menud_iniciar_sesion_over.jpg","/img/menud_ellas_over.jpg","/img/menud_ellos_over.jpg","/img/menud_losmasvotados_over.jpg", "/img/menud_forodeamigos_over.jpg", "/img/menud_chat_over.jpg", "/img/menud_salir_de_sesion_over.jpg", "/img/menud_enviatufoto_over.jpg", "/img/menud_editarficha_over.jpg", "/img/menud_cambiatufoto_over.jpg", "/img/menud_modoadmin_over.jpg", "/img/menud_salirdeadmin_over.jpg","/img/fondo_layer.jpg","/img/progressbar_upload.gif");
}

function checkJavaSupport ()
{ 
var result = { javaEnabled: false, version: '' }; 
if (typeof navigator != 'undefined' && typeof navigator.javaEnabled != 'undefined') 
	result.javaEnabled = navigator.javaEnabled(); 
else 
	result.javaEnabled = 'unknown'; 

if (navigator.javaEnabled() && typeof java != 'undefined') 
	result.version = java.lang.System.getProperty("java.version"); 

return result; 
} 


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function loadImages() {

     for (var i = 0; i < arguments.length; i++) {
//         var temp = makeId(arguments[i]);
var temp=arguments[i].split(".");
temp=temp[0].split("/");
temp=temp[1];

         if (!eval(temp +"= new Image()"))
		document.write("n");
         if (!eval(temp+".src ='"+ arguments[i] +"'"))
		document.write("m");
     }
 }

function muestra_capa(capa)
{
posx= xOffsetLeft("ancla_menu")
posy= xOffsetTop ("ancla_menu")
// xMoveTo("ancla_menu",posx,posy+20)

xShow(capa)
return;

capa.style.visibility="visible";
}

function xShow(e) {
  if(!(e=xGetElementById(e))) return;
  if(e.style && xDef(e.style.visibility)) e.style.visibility='visible';
}

function oculta_retarda_capa(capa){
 if (empezar){
	ocultar =capa
	clearTimeout(retardo)
	retardo = setTimeout("xHide('" + ocultar + "')",500)
 }
}

// if (document.layers)
// document.captureEvents(Event.KEYPRESS)
// function backdoor(e){
// 
// if (document.layers){
// if (e.which==186)
// window.open('admin.php','_self');
// // } else if (document.all){
// if (event.keyCode==186)
// window.open('admin.php','_self');
// }
// }
// document.onkeypress=backdoor


function populate(inForm)
{
return;

var temp=0;
var today= new Date();
var day= today.getDate();
var month= today.getMonth();
var year= today.getFullYear();
t2= 80;

for (var i=0; i <=31 ; i++)
	{
	var x= String(i);
	inForm.bday1.options[i] = new Option(x,x);
	}

for (var i=0; i <=31 ; i++)
	{
	var d=0;
	d=inForm.bday1.options[i].value;
	if(d==day){
		inForm.bday1.options[i].selected=true;
		break;}
	}

for (var i=0,j=year; i<=t2 ; i++, j--)
	{
	var y= String(j);
	inForm.bday3.options[i] = new Option(j,j);
		
	}
for(var i=0;i<=12;i++)
	{
	
	if(i=month)
		{inForm.bday2.options[i].selected=true;
	break;}
	
	}

}

function populate2(inForm2)
{return;

var t3=0;

if(inForm2.bday2.options[1].selected)

t3=28;
else if(inForm2.bday2.options[8].selected||inForm2.bday2.options[3].selected||inForm2.bday2.options[5].selected||inForm2.bday2.options[10].selected)
t3=30;
else
t3=31;


for(i=0;i<=31;i++){
inForm2.bday1.options[i]=null;
}

for (var i=0; i <t3 ; i++)
	{
	var x= String(i+1);
	inForm2.bday1.options[i] = new Option(x,x);
		
	}
}

function ajusta_form(dia,mes,ano,cod_pais,cod_ciudad,ciudad,estado,creator)
{
ajusta_fecha_nacimiento(estado,dia,mes,ano,creator);
ajusta_localizacion(cod_pais,cod_ciudad,ciudad,creator);
}

function ajusta_fecha_nacimiento(estado,dia,mes,ano,creator)
{
var index=0;
while (index<creator.estado.length)
	{
	if (creator.estado[index].value==estado)
		creator.estado[index].checked=true;
	index++;
	}

populate(creator);
creator.bday1.options[dia].selected=true;
creator.bday2.options[mes].selected=true;
creator.bday3.value=ano;
}

function ajusta_localizacion(cod_pais,cod_ciudad,ciudad,creator)
{
creator.cod_pais.selectedIndex=cod_pais;
cod_paises=creator.cod_pais.options;
indice_pais=getoptionvalue(cod_paises,cod_pais)

creator.cod_pais.options[indice_pais].selected=true;
set_provincias();
//creator.ciudad.value=ciudad;

if (indice_pais==1)
	{
	ciudades=creator.cod_ciudad.options;
	indice=getoptionvalue(ciudades,cod_ciudad)
	creator.cod_ciudad.options[indice].selected=true;
	set_localidad();
	}
//alert(ciudad);
document.getElementById("ciudad").value=ciudad;
//alert(document.getElementById("ciudad").value);
}


function getoptionvalue(obj,value)
{
var index=0;

for (var i = 0; i < obj.length; i++)
	if (obj[i].value==value)
		{
		index=obj[i].index
		i=obj.length
		}
return index;
}

function openw(href, target, status)
{
window.open(href, target, "scrollbars=yes,resize=yes,resizable=yes,width=790,height=760,top=10,left=10"+status);
}

function open_upload(from_foro,reload_after,idadminmod,eltarget)
{
window.open("../upload.php?idadminmod="+idadminmod+"&from_foro="+from_foro+"&reload_after="+reload_after,eltarget,"scrollbars=yes,resize=yes,resizable=yes,width=750,height=590,top=10,left=10");
}

function open_upload_camisetas(from_foro,reload_after,idadminmod,eltarget)
{
window.open("../upload_camisetas.php?idadminmod="+idadminmod+"&from_foro="+from_foro+"&reload_after="+reload_after,eltarget,"scrollbars=yes,resize=yes,resizable=yes,width=900,height=700,top=10,left=10");
}

function open_upload_reg(addurl,eltarget)
{
window.open("../upload.php"+addurl,eltarget,"scrollbars=yes,resize=yes,resizable=yes,width=750,height=590,top=10,left=10");
}

function open_recordatorio(addurl,eltarget)
{
window.open("../recordatorio.php","RECORDARPASS","scrollbars=yes,resize=yes,resizable=yes,width=750,height=580,top=10,left=10");
}

function open_sms()
{
// alert("Lo sentimos pero el servicio de SMS esta suspendido debido a problemas tecnicos. Tus sms no se perderan, quedaran acumulados para poder utilizarlos una vez quede restablecido el servicio. Sentimos las molestias. El equipo de GenteYa");
// return;
window.open("../sms/","ENVIARSMS","scrollbars=yes,resize=yes,resizable=yes,width=647,height=422,top=10,left=10");
}

function open_invitacion_msn()
{
invitar_msn=window.open("",'invitar_msn',"scrollbars=yes,resize=yes,resizable=yes,width=600,height=400,top=100,left=100");
}

function open_chat()
{
chat=window.open('chat_cyberligues/','chat_cyberligues','width=730,height=450,scrollbars=yes,resizable=no,top=10,left=35');
}
function admin_on()
{
visibilidad_admin('SI');
if (typeof linkadmin=="undefined")
	linkadmin=new Object;
xGetElementById(linkadmin).innerHTML="<a href='#' onclick='javascript:admin_off()'><font size=2 color=RED><b>Desactivar Administración</b></font></a>";

xGetElementById(menu_admin).innerHTML="<a href='#' onclick='javascript:admin_off()'><IMG id='img_menu_admin' SRC=\"/img/menud_salirdeadmin.jpg\" onmouseover=\"javascript:this.src=menud_salirdeadmin_over.src\" onmouseout=\"javascript:this.src='/img/menud_salirdeadmin.jpg'\" ALT=\"\" border=0></a>";
adminwnd=window.open("admin.php?modoadmin=SI&notop","garbage_target");
top.document.getElementById("reportes_pendientes").style.visibility='visible';
self.focus();
}

function admin_off()
{
visibilidad_admin('NO');
if (typeof linkadmin=="undefined")
	linkadmin=new Object;
xGetElementById(linkadmin).innerHTML="<a href='#' onclick='javascript:admin_on()'><font size=2 color=RED><b>Activar modo de Administración</b></font></a>";

xGetElementById(menu_admin).innerHTML="<a href='#' onclick='javascript:admin_on()'><IMG id='img_menu_admin' SRC=\"/img/menud_modoadmin.jpg\" onmouseover=\"javascript:this.src=menud_modoadmin_over.src\" onmouseout=\"javascript:this.src='/img/menud_modoadmin.jpg'\" ALT=\"\" border=0></a>";
garbage_target=window.open("admin.php?modoadmin=NO&notop","garbage_target");
top.document.getElementById("reportes_pendientes").style.visibility='hidden';
self.focus();
}

function visibilidad_admin(modo)
{
if (modo=="SI")
	{
	modo="visible";
	modone="hidden";
	}
else
	{
	modo="hidden";
	modone="visible";
	}

if (typeof(iframe_fotos)!=null && typeof(iframe_fotos)!="undefined")
	basewindow=iframe_fotos
else
	basewindow=top

if(document.all)
	obj = basewindow.document.all;
else
	obj = basewindow.document.getElementsByTagName("div");

for (var i=0; i<obj.length; i++)
	{
	if (String(obj[i].id).indexOf('fotoadmin_')!=-1)
		obj[i].style.visibility=modo;
	
	if (String(obj[i].id).indexOf('fotoprot_')!=-1)
		obj[i].style.visibility=modone;
	}	


return;

var property;
    
for (property in obj)
	if (String(property).indexOf('fotoadmin_')!=-1)
		{
		objeto_foto = xGetElementById(property);
		objeto_foto.style.visibility=modo;
		}
}

function visibilidad_linksborrar(modo)
{
if (modo=="SI")
	{
	modo="visible";
	modone="hidden";
	}
else
	{
	modo="hidden";
	modone="visible";
	}

if (typeof(iframe_comentarios)!=null && typeof(iframe_comentarios)!="undefined")
	basewindow=document.getElementById("iframe_comentarios");
else
	basewindow=top


//alert(basewindow.document.getElementById("borrarlink3250635").id);
//debugobj(top.documentall,"documentall");
if(document.all)
	{
	if (top.documentall)
		obj = top.documentall;
	else
		obj = top.document.all;
	}
else
	{
	if (basewindow.document)
		obj = basewindow.document.getElementsByTagName("span");
	else
		obj = basewindow.contentDocument.getElementsByTagName("span");	
	}

//debugobj(obj,"obj");
var tmp;
for (var i=0; i<obj.length; i++)
	{if (String(obj[i].id))
		tmp=tmp+"\n"+obj[i].id; 
	if (String(obj[i].id).indexOf('borrarlink')!=-1)
		{ obj[i].style.visibility=modo; }
	}	
//alert(tmp);

return;

var property;
    
for (property in obj)
	if (String(property).indexOf('fotoadmin_')!=-1)
		{
		objeto_foto = xGetElementById(property);
		objeto_foto.style.visibility=modo;
		}
}

function open_suspender_user(id)
{
dcapa=document.getElementById("motivo_suspension")
//dcapa.style.top=currentposx+"px";
dcapa.style.top=(MouseY-300)+"px";
dcapa.style.left=(MouseX)+"px";
dcapa.style.visibility="visible";
return true;
//if (!confirm(' Vas a SUSPENDER la ficha de este usuario,\n\n ¿ estas segur@ ? '))
//	return false;
//procesando_reporte(id);
//open_comun('del_user.php?user='+id+'&suspender=SI','garbage_target');
}

function open_del_user(id)
{
if (!confirm(' Vas a ELIMINAR la ficha de este usuario,\n\n ¿ estas segur@ ? '))
	return false;
procesando_reporte(id);
open_comun('del_user.php?user='+id,'garbage_target');
}

function open_del_foto(url,id)
{
//if (!confirm(' Vas a ELIMINAR LA FOTOGRAFÍA de este usuario,\n\n ¿ estas segur@ ? '))
//	return false;
procesando_reporte(id);
open_comun(url,'garbage_target');
}

function open_suspender_user_reportes(index,id,id_reportante,email_reportante)
{
id_tmp=id;
dcapa=document.getElementById("motivo_suspension")
//dcapa.style.top=currentposx+"px";
dcapa.style.top=(MouseY-300)+"px";
dcapa.style.left="200px";
dcapa.style.visibility="visible";
var dform_suspender=document.getElementById("id_form_suspender");

dform_suspender.id.value=id
dform_suspender.id_reportante.value=id_reportante
dform_suspender.email_reportante.value=email_reportante
dform_suspender.index_reporte.value=index
dform_suspender.action.value="reportes_suspender";
dform_suspender.target='frame_tmp_'+id;

procesando_reporte(id);
return true;

if (!confirm(' Vas a SUSPENDER la ficha de este usuario,\n\n ¿ estas segur@ ? '))
	return false;
procesando_reporte(id);
open_comun('administracion.php?id='+id+'&id_reportante='+id_reportante+'&email_reportante='+email_reportante+'&action=reportes_suspender&index_reporte='+index+'&clean=SI','frame_tmp_'+id);
}

function open_del_user_reportes(index,id,id_reportante,email_reportante)
{
id_tmp=id;
id_reportante_tmp=id_reportante;
email_reportante_tmp=email_reportante;
action_tmp="reportes_del_user";
index_reporte_tmp=index;

dcapa=document.getElementById("motivo_borrar_ficha")
//dcapa.style.top=currentposx+"px";
dcapa.style.top=(MouseY-300)+"px";
dcapa.style.left="200px";
dcapa.style.visibility="visible";
return true;

if (!confirm(' Vas a ELIMINAR la ficha de este usuario,\n\n ¿ estas segur@ ? '))
	return false;
procesando_reporte(id);
open_comun('administracion.php?id='+id+'&id_reportante='+id_reportante+'&email_reportante='+email_reportante+'&action=reportes_del_user&index_reporte='+index+'&clean=SI','frame_tmp_'+id);
}

function open_del_foto_reportes(url,id, tipo_retirada)
{
//if (tipo_retirada=="msn_ficha")
//	{
//	if (!confirm(' Vas a ELIMINAR LA FOTO de este usuario\ny enviarle un aviso para que retire\nsu MSN de la ficha.\n\n ¿ estas segur@ ? '))
//		return false;
//	}
//else
//	{
//	if (!confirm(' Vas a ELIMINAR LA FOTO de este usuario,\n\n ¿ estas segur@ ? '))
//		return false;
//	}

procesando_reporte(id);
open_comun(url,'frame_tmp_'+id);
}

function open_descartar_reportes(url,id)
{
procesando_reporte(id);
open_comun(url,'frame_tmp_'+id);
}

function open_solicita_quitar_foto_suspender_reporte(url,id)
{
if ( confirm(' Vas a eliminar la fotografía de este usuario y solicitar que sea suspendido,\n\n ¿ estas segur@ ? ') )
	open_comun(url,'frame_tmp_'+id);
}

function open_comun(url,target)
{
var today = new Date();
timestamp=today.getTime();
window.open(url+'&'+timestamp,target,'scrollbars=yes,resize=yes,resizable=yes,width=750,height=590,top=10,left=10');
self.focus();
}

function suspender_user_setimg(id)
{
var base;
if (opener)
	base=opener.document
else
	base=parent.document
	
if ( !existeObj(base.getElementById('fotoimg150_'+id)) )
	base.getElementById('fotoimg350_'+id).src="../img/contacto_suspendido.gif";
else
	base.getElementById('fotoimg150_'+id).src="../img/contacto_suspendido.gif";
}

function del_user_setimg(id)
{
var base;
if (opener)
	base=opener.document
else
	base=parent.document

if (base.getElementById('fotoimg150_'+id)==null)
	base.getElementById('fotoimg350_'+id).src="../img/contacto_deleted.gif";
else
	base.getElementById('fotoimg150_'+id).src="../img/contacto_deleted.gif";
}

function procesando_reporte(id)
{
reportes_comun_setimg(id,"../img/procesando_reporte.gif");
}

function del_foto_setimg(id)
{
var base;
if (opener)
	base=opener.document
else
	base=parent.document

if (base.getElementById('fotoimg150_'+id)==null)
	base.getElementById('fotoimg350_'+id).src="../upload2/sinfoto_tn350.gif";
else
	base.getElementById('fotoimg150_'+id).src="../upload2/sinfoto_tn150.gif";
}

function del_user_reportes_setimg(id)
{
reportes_comun_setimg(id,"../img/contacto_deleted.gif");
}

function suspender_user_reportes_setimg(id)
{
reportes_comun_setimg(id,"../img/contacto_suspendido.gif");
}

function del_foto_reportes_setimg(id)
{
reportes_comun_setimg(id,"../img/foto_retirada.gif");
}

function descartar_foto_reportes_setimg(id)
{
reportes_comun_setimg(id,"../img/descartada.gif");
}


function reportes_comun_setimg(id,fotoaccion)
{
var basewindow;
if (typeof(iframe_fotos)!=null && typeof(iframe_fotos)!="undefined")
	basewindow=iframe_fotos
else
	basewindow=top

if (index_foto_album)
	{
	id=id+''+index_foto_album;
	index_foto_album=false;
	}

basewindow=top

if(document.all)
	obj = basewindow.document.all;
else
	obj = basewindow.document.getElementsByTagName("img");

id=id*1;

if (typeof(usuarios_js)==null || typeof(usuarios_js)=="undefined" || usuarios_js=="")
	usuarios_js=parent.usuarios_js;

for ( key2 in usuarios_js[id] )
	{
	var id_element=usuarios_js[id][key2];
	basewindow.document.getElementById(id_element).src=fotoaccion;
	}
	
return;

for (var i=0; i<obj.length; i++)
	{
	var idfoto=obj[i].id;
	if (String(obj[i].id).indexOf('fotoimg150_'+id+'_')!=-1)
		basewindow.document.getElementById(idfoto).src=fotoaccion; 
	}	

}


function del_user_old(url,id)
{
if (xGetElementById('fotoimg150_'+id)==null)
	xGetElementById('fotoimg350_'+id).src="../img/contacto_deleted.gif";
else
	xGetElementById('fotoimg150_'+id).src="../img/contacto_deleted.gif";
}

function check_sexo()
{
if (!confirm('ATENCION!\nEl cambio de sexo de masculino a femenino o viceversa será penalizado con reseteo de votaciones para evitar posibles trampas o fraudes en el concurso.\n\nSi tu sexo actual en GenteYa es erroneo y no deseas perder tus votos semanales, es recomendable hacer el cambio de sexo a primeros de semana, cuando las votaciones están a 0 para todos.\n\n¿Deseas cambiar el sexo? '))
	if ( xGetElementById('creator').gender.options[1].defaultSelected )
		xGetElementById('creator').gender.options[1].selected=true;
	else
		xGetElementById('creator').gender.options[2].selected=true;
}

function onpaste()
{
//document.getElementById(comentarios_txt).value="";
event.returnValue = false;
//return false;
}

// SI SE MODIFICA AQUI, TAMBIEN HAY QUE MODIFICAR EN paginas.js
function comentarios_irpagina(pagina)
{
if (!top.document.getElementById("iframe_comentarios"))
	top.document.getElementById("comentarios_div").innerHTML="<br><iframe id='iframe_comentarios' name='iframe_comentarios' src='"+pagina+"' FRAMEBORDER='0' scrolling='no' marginwidth='0' marginheight='0' width=100% height=100 onload=\"if (top.go_visibilidad_linksborrar) top.visibilidad_linksborrar('SI'); iframe_autoResize('iframe_comentarios')\"></iframe>";
else
	top.document.getElementById("iframe_comentarios").src=pagina;
}

function scrollup()
{
if ( paises_span_semaforo==true )
	{
	document.getElementById('paises_span').innerHTML="";
	if (document.getElementById('provincias_span'))
		document.getElementById('provincias_span').innerHTML="";
	}

abrir("cargando");
top.scrollTo(0,100);
//top.document.getElementById("myframe").document.body.innerHTML
//self.document.body.innerHTML="<br><br><br><br><center><font size=2 face=verdana color=blue><b>Cargando página...</b></font></center>";
//top.document.getElementById('bottom_a').focus();
}

function send_form_comentarios(elform,id)
{
var form_coment=document.getElementById("frm_comentarios");
if (form_coment.comentarios_txt.value.length<25)
	{
	alert("Tu comentario tiene poco texto, no te quedes cort@ :D");
	return false;
	}

var path="fichas/"+Math.floor(id/10000)+"/"+id+"-1.html";
//top.document.getElementById("top_paginacion").innerHTML="xx";
//top.document.getElementById("bottom_paginacion").innerHTML="xx";
if (!top.document.getElementById("iframe_comentarios"))
	top.document.getElementById("comentarios_div").innerHTML="<br><iframe id='iframe_comentarios' name='iframe_comentarios' src='"+path+"' FRAMEBORDER='0' scrolling='no' marginwidth='0' marginheight='0' width=100% height=100 onload=\"if (top.go_visibilidad_linksborrar) top.visibilidad_linksborrar('SI');\"></iframe>";
else
	top.document.getElementById("iframe_comentarios").src=path;

form_coment.submit();
top.location="#top_comentarios";
}

function debugobj(obj,name)
{
DOMViewerName=name;
DOMViewerObj=obj;
window.open('/domviewer.html');
}

function show_capa_alt(id,lacapa)
{
if (!xDef(lacapa))
	return false;

var docum_foto=document.getElementById("ancla_"+id);
var ancho=200;
var alto=250;
var offsetx=90
var offsety=100
var anclax=docum_foto.offsetLeft;
var anclay=docum_foto.offsetTop;
var retardo_alt1;
var ajuste_ie=0;

var sumax= anclax+ancho+offsetx
var sumay= anclay+alto+offsety


if (!esIE30())
	dwidth=document.width;
else
	{
	dwidth=document.documentElement.offsetWidth;
	offsetx=offsetx-50
	ajuste_ie=100;
	}

dheight=document.body.offsetHeight;

if (sumax>dwidth)
	offsetx=-1*offsetx-50-ajuste_ie
if (sumay>dheight)
	offsety=-1*offsety-100

sumax=anclax+offsetx+"px";
sumay=anclay+offsety+"px";
document.getElementById(lacapa).style.left=sumax
document.getElementById(lacapa).style.top=sumay
document.getElementById(lacapa).style.zIndex=50;

timers[lacapa+"timeout"] = setTimeout("xShow('" + lacapa + "'); ",500)
}

function hide_capa_alt(id,lacapa)
{
if (!lethide)
	return;

clearTimeout(timers[lacapa+"timeout"]);
timers[lacapa+"retardo"] = setTimeout("if (lethide) xHide('" + lacapa + "')",500)
}

function hideCapas(lacapa)
{
for (var i=0; i<capas_alt.length; i++)
	{
	capa=capas_alt[i];
	if (capa!="" && capa!=lacapa)
		document.getElementById(capa).style.visibility="hidden";
	}
}

function stoptimer(id)
{
tim=timers["capa_alt"+id+"retardo"];
//debugwnd.document.write("OVER "+id+"<br>\n");
//debugwnd.scroll(0,100000)
clearTimeout(tim)
lethide=false;
}

function esIE30()
{
var browserType=navigator.userAgent;
if (browserType.indexOf("MSIE")==-1)
return false;
else
return true;
}

function votacion_rapida(id)
{
document.getElementById("votacion_rapida").style.visibility="visible";

}

function cerrar(capa)
{
document.getElementById(capa).style.visibility="hidden";
}

function abrir(capa)
{
document.getElementById(capa).style.visibility="visible";
}

function motivo_solicita_suspension_reportes(id, capa)
{
//currentposx=document.getElementById("ancla_"+id).offsetTop;
dcapa=document.getElementById(capa)
//dcapa.style.top=currentposx+"px";
dcapa.style.top=(MouseY-300)+"px";
dcapa.style.left=(MouseX)+"px";
dcapa.style.visibility="visible";
}

function abrir_reportes(id, usuario, nick, capa)
{
abrir_pos(id, id, false, false, usuario, nick, capa, false);
//document.getElementById("reporte_file1").value=""; alert("CUT");
//document.getElementById("reporte_file2").value="";
//document.getElementById("reporte_file3").value="";
document.getElementById("reportes_observaciones_fotos").value="";
if (document.getElementById("otros_asunto"))
	document.getElementById("otros_asunto").value="";
if (document.getElementById("otros_msg"))
	document.getElementById("otros_msg").value="";
}

function abrir_reportes_albums(id_usuario, usuario, nick, id_foto, ii, idu, capa)
{
//alert("capa: "+capa+" id_usuario: "+id_usuario+" id_foto: "+id_foto);
abrir_pos(id_usuario, id_foto, ii, idu, usuario, nick, capa, false);

document.getElementById("reportes_albums_observaciones_fotos").value="";
if (document.getElementById("otros_asunto"))
	document.getElementById("otros_asunto").value="";
if (document.getElementById("otros_msg"))
	document.getElementById("otros_msg").value="";
}

function abrir_votos(id, usuario, nick, puntos, puntos_total, capa, tipo_votacion, dateRegistered, svip)
{
var theSelect=document.getElementById("form_votacion_rapida").voto;
if (tipo_votacion=="")
	tipo_votacion="normal";

if ( tipo_votacion=="vip" || tipo_votacion=="camisetas" || tipo_votacion=="rrpp" || (tipo_votacion=="ganadores" && svip))
	{
	document.getElementById("span_votos_select").innerHTML="<select name=voto><option value=90>Dar 90 puntos</option> <!--<option value=10>Dar 10 puntos</option><option value=9>Dar 9 puntos</option><option value=8>Dar 8 puntos</option><option value=7>Dar 7 puntos</option><option value=6>Dar 6 puntos</option><option value=5>Dar 5 puntos</option><option value=4>Dar 4 puntos</option><option value=3>Dar 3 puntos</option><option value=2>Dar 2 puntos</option><option value=1>Dar 1 puntos</option> --></select>"; 
	document.getElementById("span_tipo_voto").innerHTML="<input type='hidden' name='tipo_votacion' value='"+tipo_votacion+"'>"; 
	}
else if ( tipo_votacion=="camisetas" || tipo_votacion=="rrpp" || (tipo_votacion=="ganadores" && svip))
	{
	document.getElementById("span_votos_select").innerHTML="<select name=voto><option value=20>Dar 20 puntos</option> <!--<option value=10>Dar 10 puntos</option><option value=9>Dar 9 puntos</option><option value=8>Dar 8 puntos</option><option value=7>Dar 7 puntos</option><option value=6>Dar 6 puntos</option><option value=5>Dar 5 puntos</option><option value=4>Dar 4 puntos</option><option value=3>Dar 3 puntos</option><option value=2>Dar 2 puntos</option><option value=1>Dar 1 puntos</option> --></select>"; 
	document.getElementById("span_tipo_voto").innerHTML="<input type='hidden' name='tipo_votacion' value='"+tipo_votacion+"'>"; 
	}
else
	{
	document.getElementById("span_votos_select").innerHTML="<select name=voto><option value=10>Dar 10 puntos</option><option value=9>Dar 9 puntos</option><option value=8>Dar 8 puntos</option><option value=7>Dar 7 puntos</option><option value=6>Dar 6 puntos</option><option value=5>Dar 5 puntos</option><option value=4>Dar 4 puntos</option><option value=3>Dar 3 puntos</option><option value=2>Dar 2 puntos</option><option value=1>Dar 1 puntos</option></select>";
	document.getElementById("span_tipo_voto").innerHTML="<input type='hidden' name='tipo_votacion' value='"+tipo_votacion+"'>"; 
	}

//document.getElementById("extend_puntos").innerHTML="aaa";
document.getElementById("votacion_rapida_puntos").value=puntos;
document.getElementById("votacion_rapida_puntos_totales").value=puntos_total;
abrir_pos(id, id, false, false, usuario, nick, capa, dateRegistered);
}

function abrir_pos(id_usuario, id_foto, ii, idu, usuario, nick, capa, dateRegistered)
{
if (top.location==self.location)
	{
	currentposx=document.getElementById("ancla_left").offsetLeft+100
	document.getElementById(capa).style.left=currentposx+"px";
	}


document.getElementById(capa+"_id").value=id_usuario;
if (dateRegistered && document.getElementById(capa+"_dr"))
	document.getElementById(capa+"_dr").value=dateRegistered;

if (ii)
	{
	document.getElementById(capa+"_ii").value=ii;
	document.getElementById(capa+"_idu").value=idu;
	}

// Activar si se implementa el JOIN yabbse_members el tema de memberName y realName para el query de los albums.
//document.getElementById(capa+"_usuario").innerHTML=usuario+" (<b>"+nick+"</b>)";
document.getElementById(capa+"_texto").innerHTML="";
	
//currentposy=document.getElementById("ancla_"+id_foto).offsetTop;
//var arr=FindXY(document.getElementById("ancla_"+id_foto))
//currentposy=arr.y; if (ii) alert(currentposy+" "+MouseX+" "+MouseY);
currentposy=MouseY;
dcapa=document.getElementById(capa)
dcapa.style.top=currentposy+"px";
dcapa.style.visibility="visible";
}

function iecompattest()
{
return (top.document.compatMode!="BackCompat")? top.document.documentElement : top.document.body
}

function otros(valor)
{
if (stopform)
	return false;

var d=document.getElementById("reporte_otros_motivos_txt");

if (valor)
	{
	d.style.display="";
	d.style.visibility="visible";
	}
else
	{
	d.style.display="none";
	d.style.visibility="hidden";
	}
return;

if (valor)
	d.innerHTML="<center><table border=0 width=70%><tr><td><font color='white'><b>Asunto: </b></font><input type='text' name='otros_asunto'  size=35></td></tr><tr><td><b><font color='white'>Motivo del reporte:</b></font><br><textarea cols=40 rows=4 name='otros_msg'></textarea></td></tr></table></center>";
else
	d.innerHTML="";
	
}

function reportes_submit()
{
if (stopform)
	return false;

otros(false);
stopform=true;
var elForm=document.getElementById("form_reportes");
var tiempo_espera="";

if ( elForm.motivo[2].checked )
	{
	if (check_reporte_foto())
		{
		tiempo_espera="Si usted esta adjuntando fotografías con su reporte,<br> el proceso puede durar unos minutos. Por favor, espere ...<br><br><img src='/img/progressbar_upload.gif'>";
		cerrar("reporte_subir_fotos");
		}
	else
		return false;
	}
else
	tiempo_espera='Por favor, espere unos segundos...';

document.getElementById('reportes_texto').innerHTML='<font face=Verdana size=2 color=WHITE>Enviando reporte a un moderador.<br>'+tiempo_espera+'</font>';

elForm.submit();
}

function reportes_albums_submit()
{
if (stopform)
	return false;

otros(false);
stopform=true;
var elForm=document.getElementById("form_reportes_albums");
var tiempo_espera="";

if ( elForm.motivo[2].checked )
	{
	if (check_reporte_foto())
		{
		tiempo_espera="Si usted esta adjuntando fotografías con su reporte,<br> el proceso puede durar unos minutos. Por favor, espere ...<br><br><img src='/img/progressbar_upload.gif'>";
		cerrar("reportes_albums_subir_fotos");
		}
	else
		return false;
	}
else
	tiempo_espera='Por favor, espere unos segundos...';

document.getElementById('reportes_albums_texto').innerHTML='<font face=Verdana size=2 color=WHITE>Enviando reporte a un moderador.<br>'+tiempo_espera+'</font>';

elForm.submit();
}

function check_reporte_foto()
{
var elForm=document.getElementById("form_reportes");
if ( !elForm.motivo[2].checked )
	return true;

if (!document.getElementById("reporte_file1").value && !document.getElementById("reporte_file2").value && !document.getElementById("reporte_file3").value)
	{
	alert("Debe adjuntar fotografías de su persona para comprobar la veracidad del reporte.");
	return false;
	}
else if (!elForm.reportes_observaciones_fotos.value)
	{
	alert("Incluya sus observaciones para ayudar en la resolución del reporte.");
	return false;
	}
else
	return true;
}

function votar_submit(target_txt,txt_color)
{
var form="";

if (window.tipo_voto_form=="votacion_rapida")
	form="form_votacion_rapida";
else
	form="form_votar";

tipo_voto_form="";
if ( document.getElementById("passgen").value=="" && false)
	{
	alert("Para votar debes introducir la palabra del recuadro azul.\n\nEsto es una medida de seguridad\npara evitar trampas en las votaciones :D");
	document.getElementById("passgen").focus();
	}
else
	{
	if (form!="form_votacion_rapida")
		{
		self.location="#verperfil_top";
		self.scrollTo(0,0);
		}
	document.getElementById(target_txt).innerHTML="<font face=Verdana size=2 color='"+txt_color+"'>Realizando votación.<br>Por favor, espere unos segundos...</font>";
	document.getElementById(form).submit();
	}
}

function vip_submit()
{
var elForm=document.getElementById("form_vip_clave");
//elForm.vip_enviar.disabled=true;
//wnd_vip_clave=window.open("","wnd_vip_clave","scrollbars=yes,resize=yes,resizable=yes,width=750,height=350,top=10,left=10");

abre_capa_window("capa_vip_clave");
//document.getElementById("capa_vip_clave").style.visibility="visible";
//document.getElementById("capa_vip_clave").style.display="";
//var xpos=document.body.clientWidth/2-parseInt(document.getElementById("capa_vip_clave").style.width)/2;
//document.getElementById("capa_vip_clave").style.left=xpos+"px";

window.frames["wnd_vip_clave"].document.body.innerHTML="<br><br><br><br><br><br><br><br><center><font size=3 color='blue' face='verdana'><b>Clave vip procesandose.<br>Por favor, espere...</b></font></center>";


//elForm.submit();
return true;
//document.getElementById("span_frm_vip").innerHTML="<br><br><a href='#nowhere' onclick='self.location=self.location'><font size=2 color='blue'><b>Clave vip procesandose. Pulse aquí si desea enviar otra clave.</b></font></a><br><br>";
}

function abre_capa_window(id)
{
document.getElementById(id).style.visibility="visible";
document.getElementById(id).style.display="";
var xpos=document.body.clientWidth/2-parseInt(document.getElementById(id).style.width)/2;
var ypos=document.body.scrollTop+10;
document.getElementById(id).style.left=xpos+"px";
document.getElementById(id).style.top=ypos+"px";
}

function abre_capa_comun_window(id,titulo,url)
{
document.getElementById("titulo_ventana_"+id).innerHTML=titulo;
if (url)
	document.getElementById("iframe_"+id).src=url;

document.getElementById(id).style.visibility="visible";
document.getElementById(id).style.display="";
var xpos=document.body.clientWidth/2-parseInt(document.getElementById(id).style.width)/2;
var ypos=document.body.scrollTop+10;
document.getElementById(id).style.left=xpos+"px";
document.getElementById(id).style.top=ypos+"px";
document.getElementById(id).style.width=window.capa_width_inic+"px";
document.getElementById(id).style.height=window.capa_height_inic+"px"
document.getElementById("iframe_"+id).scrolling=window.capa_scrolling_inic; 
}

function abre_capa_comun_windowx(id,titulo,url,width,height,scrolling)
{
abre_capa_comun_window(id,titulo,url);

if (width)
	document.getElementById(id).style.width=width;
else
	document.getElementById(id).style.width=window.capa_width_inic+"px";

if (height)
	document.getElementById(id).style.height=height;
else
	document.getElementById(id).style.height=window.capa_height_inic+"px"

if (scrolling)
	document.getElementById("iframe_"+id).scrolling="yes";
else
	document.getElementById("iframe_"+id).scrolling=window.capa_scrolling_inic;
}

function open_canal_chat()
{
var openwnd=parent.document.getElementById('chat').target;
if (openwnd=='CHAT_GENTEYA')
	{
	leftx=45
	topx=20
	}
else
	{
	topx=40
	leftx=65
	document.getElementById('nick').value+="_sx";
	}
	
window.open('blank',openwnd,'width=730,height=450,scrollbars=no,resizable=yes,top='+topx+',left='+leftx)
}

function existeObj(obj)
{
if(typeof(obj)=='undefined' || obj==null)
	return false;
else
	return true;

}

function show_tarjeta_box()
{
document.getElementById('tarjeta_box').style.height="250px";
document.getElementById('tarjeta_box').style.width="450px";
//xGetElementById('tarjeta_box').style.display='inline';
document.getElementById('tarjeta_box').style.display="";
return;
document.getElementById(tarjeta_box).innerHTML="<br><table border=1 cellpadding=10 cellspacing=0 bgcolor='white' width='80%'><tr><td>Titular de la tarjeta:<br><input type='text' name='titulart' id='titulart' id='numt' size='35' maxlength='35'><br><br>Número de tarjeta:<br><input type='text' name='numt' id='numt' size='35' maxlength='16'><br><br>Fecha de caducidad: &nbsp;&nbsp;&nbsp; Mes <select name='mest' id='mest'><option value='' selected>--</option><option value='01' >1</option><option value='02' >2</option><option value='03' >3</option><option value='04' >4</option><option value='05' >5</option><option value='06' >6</option><option value='07' >7</option><option value='08' >8</option><option value='09' >9</option><option value='10' >10</option><option value='11' >11</option><option value='12' >12</option></select> &nbsp;&nbsp; Año <select name='anyot' ID='anyot'><option value='' selected>--</option><option value='05' >2005</option><option value='06' >2006</option> <option value='07' >2007</option> <option value='08' >2008</option> <option value='09' >2009</option> <option value='10' >2010</option> <option value='11' >2011</option> <option value='12' >2012</option> <option value='13' >2013</option> <option value='14' >2014</option> <option value='15' >2015</option></select><br><br> Número CVV: <input type='text' name='cvvt' size='4' maxlength='4' ID='cvvt'> &nbsp;&nbsp;&nbsp;&nbsp;<a href='#cvv' onclick='javascript:show_cvv()'><small><font color='blue'>(¿Qué es el número CVV?)</font></small></a></td><tr></table>";
}

function set_bpais()
{
if (typeof(document.getElementById("bpais"))== 'undefined')
	return false;

var bcheck=document.getElementById("bpais")
if (bcheck && bcheck!="null" && xDef(bcheck))
	bcheck.checked='on';
}

function set_bciudad()
{
if ( typeof(document.getElementById("bciudad"))== 'undefined' )
	return false;
	
var bcheck=document.getElementById("bciudad")
if (xDef(bcheck))
	bcheck.checked='on';
}

function textCounter(field, countfield, maxlimit)
{
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
}

function contador_texto(field, countfield, maxlimit)
{
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.innerHTML = maxlimit - field.value.length;}
}

function replyquote(mid,url,date_time,memberName,realName)
{
var midx=document.getElementById("mid"+mid);
var texto;

if (document.all)
	texto=midx.innerText;
else
	texto=midx.textContent;

if (!memberName)
	memberName="Usuario_eliminado";
	
document.getElementById("message").value="[quote nick="+realName+" author="+memberName+" link="+url+" date="+date_time+"]"+texto+"[/quote]";
}

function alert_historial()
{
alert("Este post pertenece al historial del foro de GenteYa.\n\nSi deseas responder o hacerlo activo de nuevo, contacta con la administracion.\n\n");
}

function quiero_conocerte(id)
{
var fotoid=document.getElementById("foto_"+id);

fotoid.innerHTML='<br><br><br><font size=2 face="Verdana" color="blue"><b>Enviando petición...</b></font>';
fotoid.onmouseover="return false;";
fotoid.onmouseout="return false;";
//document.getElementById("garbage_target_"+id).src='quiero_conocerte.php=?id='+id; // Ya se hace desde PHP con el target.
}

function quiero_conocerte_admitir(id)
{
id=id*1;

for ( key2 in usuarios_js[id] )
	{//alert("ID: "+id+" KEYVAR: "+id+" VALOR: "+usuarios_js[id][key2]);
	var id_element=usuarios_js[id][key2];
	document.getElementById(id_element).innerHTML="<span align='center' valign='middle'><img src='/img/usuario_admitido.jpg'></span>";
	}

}

function quiero_conocerte_no_admitir(id)
{
id=id*1;

for ( key2 in usuarios_js[id] )
	{//alert("ID: "+id+" KEYVAR: "+id+" VALOR: "+usuarios_js[id][key2]);
	var id_element=usuarios_js[id][key2];
	document.getElementById(id_element).innerHTML="<span align='center' valign='middle'><img src='/img/usuario_no_admitido.jpg'></span>";
	}

}

function set_solicitudes_contactos(cod_solicitud,set)
{
if (set=="admitir")
	document.getElementById("solicitudes"+cod_solicitud).innerHTML="<span align='center' valign='middle'><img src='/img/usuario_admitido.jpg'></span>";
else if (set=="noadmitir")
	document.getElementById("solicitudes"+cod_solicitud).innerHTML="<span align='center' valign='middle'><img src='/img/usuario_no_admitido.jpg'></span>";
else
	alert("Error de parametros.");
}

function procesando_solicitud_contactos(id,urlx,targetx)
{
document.getElementById(id).innerHTML="<span align='center' valign='middle'><img src='/img/procesando.gif'></span>";

window.open(urlx,targetx);
}

function procesando(id,urlx,targetx,checkboxx)
{
id=id*1;

for ( key2 in usuarios_js[id] )
	{
	var id_element=usuarios_js[id][key2];
	document.getElementById(id_element).innerHTML="<span align='center' valign='middle'><img src='/img/procesando.gif'></span>";
	}

if (checkboxx)
	var param="&noemail_checked=SI";
else
	var param="";

window.open(urlx+param,targetx);
}

function procesando_solicitudes_grupos(id,urlx,targetx)
{
id=id*1;

for ( key2 in usuarios_js[id] )
	{
	var id_element=usuarios_js[id][key2];
	document.getElementById(id_element).innerHTML="<span align='center' valign='middle'><img src='/img/procesando.gif'></span>";
	}

window.open(urlx,targetx);
}

function set_noemail(id,checkbox_click)
{
id=id*1;

for ( key2 in usuarios_js_checkbox[id] )
	{
	var id_element=usuarios_js_checkbox[id][key2];
	if (id_element!=checkbox_click)
		{
		if (document.getElementById(id_element).checked)
			document.getElementById(id_element).checked=false
		else
			document.getElementById(id_element).checked=true
		}
	}
}

function check_img_size(img)
{
if (img.width>=600)
	{
	img.width=600;
	}
if (img.height>=400)
	{
	img.height=400;
	}
}

function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}

function go_bottom()
{
top.document.body.scrollTop=(document.body.scrollHeight-screen.height);
}

function xxClientHeight() {
  var h=0;
  if(xOp5or6) h=window.innerHeight;
  else if(!window.opera && document.documentElement && document.documentElement.clientHeight)
    h=document.documentElement.clientHeight;
  else if(document.body && document.body.clientHeight)
    h=document.body.clientHeight;
  else if(xDef(window.innerWidth,window.innerHeight,document.width)) {
    h=window.innerHeight;
    if(document.width>window.innerWidth) h-=16;
  }
  return h;
}

function getMouse_XY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  MouseX = tempX
  MouseY = tempY

if (document.getElementById("pos_mousex"))
	document.getElementById("pos_mousex").innerHTML="X="+MouseX;
if (document.getElementById("pos_mousey"))
	document.getElementById("pos_mousey").innerHTML="Y="+MouseY;
window.lastActivity=(new Date()).getTime();

  // Para la funcion de arrastrar capas. 
   if (drag) {
    drag.style.left = String(dragX + getMouse_X(e) ) + "px";
    drag.style.top  = String(dragY + getMouse_Y(e) ) + "px";
    return(false);
  }

  return {x:tempX,y:tempY}
}

function registerMouse_dragFunction() {
  document.onmousedown = onMouseDown;
  document.onmouseup  = onMouseUp;
}

function onMouseDown(e) {
  var object = getMouseObject(e);
  var cur_obj=new Object;

  if (object.className == "movible") {
    cur_obj=object;
    while (cur_obj.tagName!="" && cur_obj.tagName!="DIV" && cur_obj.tagName!="div")
	cur_obj=cur_obj.parentNode;

    drag  = cur_obj;
    if (typeof(top_wnd_zindex)!="undefined" && drag.style.zIndex!=top_wnd_zindex )
	drag.style.zIndex=top_wnd_zindex ;
  	
    dragX = pxToNumber(drag.style.left) - getMouse_X(e);
    dragY = pxToNumber(drag.style.top)  - getMouse_Y(e);


    return(false);
  }
}


function onMouseUp(e) {
  drag = null;
}

function getMouseObject(e) {
  return(e? e.target: window.event.srcElement);
}
function getMouse_X(e) {
  return(e? e.clientX: window.event.clientX);
}
function getMouse_Y(e) {
  return(e? e.clientY: window.event.clientY);
}
function pxToNumber(s) {
  return( Number( s.substring(0, s.length - 2) ) );
}

function FindXY(obj){
	var x=0,y=0;
	while (obj!=null){
		x+=obj.offsetLeft-obj.scrollLeft;
		y+=obj.offsetTop-obj.scrollTop;
		obj=obj.offsetParent;
	}
	return {x:x,y:y};
}

// Find the x,y location in pixels for a relatively positioned object
// returns an object with .x, .y, .w (width) and .h (height) properties.
function FindXYWH(obj){
	var objXY = FindXY(obj);
	return objXY?{ x:objXY.x, y:objXY.y, w:obj.offsetWidth, h:obj.offsetHeight }:{ x:0, y:0, w:0, h:0 };
}

// SI SE MODIFICA AQUI, TAMBIEN HAY QUE MODIFICAR EN paginas.js
function iframe_autoResize(id){
    var newheight;
    var newwidth;

    if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
        newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
    }

    document.getElementById(id).height= (newheight) + "px";
    document.getElementById(id).width= (newwidth) + "px";
}

function getViewportSize() {
    var x, y;
    if (self.innerHeight) { // MOS
        y = self.innerHeight;
        x = self.innerWidth;
    } else if (document.documentElement && document.documentElement.clientWidth) { // IE6 Strict
        x = document.documentElement.clientWidth;
        y = document.documentElement.clientHeight;
    } else if (document.body.clientHeight) { // IE quirks
        y = document.body.clientHeight;
        x = document.body.clientWidth;
    }
    return {x: x, y: y};
}

function stop_inactividad()
{
window.inactividad=false;
clearInterval(window.timerInactividad);
window.timerInactividad=setInterval(en_inactividad,300000); // 5 minutos.
}

function en_inactividad()
{
window.inactividad=true;
check_new_msg();	
}

function check_new_msg()
{
// Si ya se ha recargado la web con sonido de alerta, reproduce sonido. Si no, recarga la web.
AjaxRequest.get(
  {
	'url':"/check_new_msg.php",
	'onSuccess':function(req){ if (!window.alertas_mostradas) top.location.reload(); else {sound_zumbido_new_msg(); self.xfocus();} } // Fuerza la carga de la web con muestra de alertas y zumbidos.
	,'onError':function(req)
				{ret_err='Error!\nStatusText='+req.statusText+'\nContents='+req.responseText;}
  }
);
}

function sound_zumbido_new_msg()
{
var snd_new=top.document.getElementById('snd_new');
snd_new.play();
}

function xfocus()
{
// Desactivar el focus sin quitarlo definitivamente.
}

// javascript:var obj=document.getElementsXByTagName("IM G");for (var i=0; i<obj.length; i++) if (String(obj[i].src).indexOf('X')!=-1) obj[i].src="/img/blank.gif";X

function set_span_notas(id)
{
var texto=document.getElementById("span_notas").innerHTML;
document.getElementById("span_notas").innerHTML="<form id='form_set_span_notas' action='set_span_notas.php' target='garbage_target'><textarea rows=2 cols=60 maxsize=250 id='set_notas_txt' name='set_notas_txt' onblur='if (window.setting_span_notas) submit_set_span();'>"+texto+"</textarea><input type='hidden' name='id' value='"+id+"'</form>";
document.getElementById("set_notas_txt").focus();
}

function submit_set_span()
{
window.span_notas_nuevo_texto=document.getElementById("set_notas_txt").value;
document.getElementById("form_set_span_notas").submit();
document.getElementById("span_notas").innerHTML="<br><font color='blue'><b>Estableciendo nuevo texto, por favor, espere...</b></font><br><br>";
}

function submit_dinamico(id,frm)
{
if (document.getElementById("fd_texto_"+id).value=="")
	{
	alert("Debes introducir algún texto para poder enviarlo.");
	return false;
	}
frm.submit();
document.getElementById("fd_texto_"+id).disabled=true;
}

function set_frm_comentar(cod_noticia,cod_comentario,co,tpo)
{
if (window.current_comentario_id_ce)
	document.getElementById("span_frm_comentar_"+window.current_comentario_id_ce).innerHTML="";

window.current_comentario_id_ce=cod_noticia;
var html="<form method='POST' action='/enviar_comentario_noticia.php' target='garbage_target' onsubmit='submit_frm_comentar(this); return false;'><input type='hidden' name='cod_noticia' value='"+cod_noticia+"'><input type='hidden' name='tpo' value='"+tpo+"'><input type='hidden' name='cod_comentario' value='"+cod_comentario+"'><input type='hidden' name='co' value='"+co+"'><input id='comentario_texto' type='text' name='comentario_texto' size=60 maxsize=250 style='font-family:Verdana; color:#996666; border: #FFCCCC; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px' onfocus='this.parentNode.comentario_texto.value=\"\"' value='Escribe tu comentario...'><input type='submit' value='Publicar comentario' style='color:#FFFFFF; font-size:12px; background-color:#3366CC'></form>";
document.getElementById("span_frm_comentar_"+cod_noticia).innerHTML=html;
}

function submit_frm_comentar(frm)
{
if (document.getElementById("comentario_texto").value=="")
	{
	alert("Debes introducir algún texto para poder enviarlo.");
	return false;
	}

frm.submit();
document.getElementById("comentario_texto").disabled=true;
}

function submit_frm_comentar_add(frm,cod_noticia)
{
if (document.getElementById("comentario_texto"+cod_noticia).value=="")
	{
	alert("Debes introducir algún texto para poder enviarlo.");
	return false;
	}

frm.submit();
document.getElementById("comentario_texto"+cod_noticia).disabled=true;
document.getElementById("boton_submit"+cod_noticia).style.display="none";
}

function hidesubmit(haEscrito,cod_noticia)
{
if (!haEscrito || document.getElementById("comentario_texto"+cod_noticia).value.length==0)
	{
	if (document.getElementById("comentario_texto"+cod_noticia).value.length==0)
		window["haEscrito"+cod_noticia]=false;
	document.getElementById("comentario_texto"+cod_noticia).value="Escribe tu comentario...";
	document.getElementById("boton_submit"+cod_noticia).style.display="none";
	}

return false;
}

function showsubmit(haEscrito,obj,cod_noticia)
{
if (!haEscrito)
	obj.value="";

if (document.getElementById("comentario_texto"+cod_noticia).value.length==0)
	window["haEscrito"+cod_noticia]=false;

document.getElementById("boton_submit"+cod_noticia).style.display="";

return false;
}

function reset_txt_comentario(cod_noticia)
{
window["haEscrito"+cod_noticia]=false;
document.getElementById("comentario_texto"+cod_noticia).value="Escribe tu comentario...";

return false;
}


function unset_frm_comentar(cod_noticia)
{
window.current_comentario_id_ce=false;
document.getElementById("span_frm_comentar_"+cod_noticia).innerHTML="";
}

function cerrar_mini(id)
{
document.getElementById("mini_"+id).style.display="none";
oDiv = document.createElement('DIV');
oDiv.id='garbage_div_'+id;
oDiv.style.display="none";
oDiv.style.width='0px';
oDiv.style.height='0px';
oDiv.style.position="absolute";
oDiv.style.top="-1000px";
oDiv.style.left="-1000px";

var theBod=document.getElementsByTagName("body").item(0);
theBod.appendChild(oDiv);

iframe = document.createElement('IFRAME');
iframe.id='garbage_iframe_'+id;
iframe.name='garbage_iframe_'+id;
iframe.width='0px';
iframe.height='0px';
oDiv.appendChild(iframe);

window.open("/del_sugerencia.php?id="+id,'garbage_iframe_'+id);
}

function del_cerrar_mini(id)
{
var div=document.getElementById('garbage_div_'+id);
div.parentNode.removeChild(div);
}

function crear_ventana_din(id,titulo,cont_html,modo,width,height)
{
if (document.getElementById('dinwin_'+id))
	return false;

if (!width)
	var width=600;
if (!height)
	var height=350;

if (modo=="gdp")
	{
	var bgcolor='background-color:WHITE;';
	var titlecolor='background-color:#6D84B4;';
	var titlecolorfont="color:WHITE";
	var bordercolor="border-color:#3B5998";
	}
else
	{
	var bgcolor='background-color:WHITE;';
	var titlecolor='background-color:BLUE;';
	var titlecolorfont="color:WHITE";
	var bordercolor="border-color:BLUE";
	}

var theBod=document.getElementsByTagName("body").item(0);
var xpos=theBod.clientWidth/2-250;
var ypos=theBod.scrollTop;

oDiv = document.createElement('DIV');
oDiv.id='dinwin_'+id;
oDiv.style.display="";
oDiv.style.width=width+'px';
oDiv.style.height=height+'px';
oDiv.style.position="absolute";
oDiv.style.top=ypos+"px";
oDiv.style.left=xpos+"px";
oDiv.style.backgroundColor="white";
oDiv.style.zIndex="200";
oDiv.style.textAlign="center";

oDiv.innerHTML="<table border=2 width=100% style='"+bordercolor+"' height=100% cellpadding=0 cellspacing=0>\n<tr height=25  class='movible'><td id='ventana_comun_mover"+id+"' name='ventana_comun_mover"+id+"' style='"+titlecolor+"' cursor: move; cursor: move;' align=center valign=middle class='movible'>\n	<table class='movible' border=0 cellpadding=0 cellspacing=0 height='100%'><tr class='movible'><td class='movible' width='100%' height='100%'><span style='font-family:verdana; padding-left:10px; "+titlecolorfont+"'><b>"+titulo+"</b></font></td><td style='"+titlecolor+"'><a href='#cerrar' onclick='cerrar_din(\"dinwin_"+id+"\");'><img src='/img/cerrar.jpg' border=0></a></td></tr></table>\n</td></tr>\n<tr><td valign='top' style='text-align:center; "+bgcolor+"'>\n	<table border=0 width=100% height=95%><tr><td>\n	"+cont_html+"\n	</td></tr></table>\n<a href='#cerrar' onclick='cerrar_din(\"dinwin_"+id+"\");' ><font color='BLUE' size=1><b> &gt; CERRAR &lt; </b></font></a><br><br>\n</td></tr></table>";

theBod.appendChild(oDiv);

}

function cerrar_din(id)
{
var obj=document.getElementById(id);
obj.parentNode.removeChild(obj);
}