var _urlInutoi          = "/Inutoi";
var _urlOututoi         = "/Oututoi";
var _urlUTOI            = "/Profileutoi";
var _urlTSUpdate        = "/utoiTSUpdate";
var _urlDENEGACIONES    = "/Scripts/autocompletado.pl";
var _urlAUTOCOMPLETADO  = _urlDENEGACIONES;
var _urlNOTIFICACIONES  = "/Scripts/notificacion.pl";
var _mensaje_respuesta_notificacion_insulto = 'La notificacion del insulto se ha realizado correctamente. Muchas gracias por colaborar.';
var _mensaje_respuesta_notificacion_spam    = 'La notificacion de \'spam\' se ha realizado correctamente. Muchas gracias por colaborar.';




function f_muestra_menciones_usuario(idUsuario) {
location.href = '/' + idUsuario + '/referencias';
}
function f_muestra_mensajes_enviados(idUsuario) {
location.href = '/' + idUsuario;
}
function f_comprobar_url_valida(url) {
if (url == '') {
return '';
}
if (/https?:\/\/(\w+\.)/.test(url)) {
return url;
}
else {
return 'http://' + url;
}
}
function trim(cadena) {
var nueva_cadena = cadena.replace(/^\s*|\s*$/g,"");
return nueva_cadena;
}
function f_cerrar_panel(idCaja) {
var divCaja = document.getElementById(idCaja);
divCaja.style.display = 'none';
}
function f_cerrar_panel_aclaracion_suscripciones() {
var divPanel = document.getElementById('panel_aclaracion');
divPanel.style.display = 'none';
_mostrarPanelAclaracion = false;
}
function f_muestra_panel_ayuda(tipo_tablon) {
if (_mostrarPanelAclaracion == true) {
var html = '';
if (tipo_tablon == 2) {
html = '  <p>En este panel aparecen los mensajes de los temas a los que est&eacute;s suscrito y de los contactos a los que sigues.</p>';
}
else  {
if (tipo_tablon == 3) {
html = '  <p>Desde este panel puedes enviar mensajes privados a cualquier usuario de Utoi. Tambi&eacute;n aqu&iacute; recibes los que te env&iacute;an. Una N te avisar&aacute;..</p>';
}
else {
if (tipo_tablon == 4) {
html = '  <p>En este panel aparecen todos los mensajes que se est&aacute;n escribiendo en Utoi. Todos todos.</p>';
}
else {
if (tipo_tablon == 1) {
html = '  <p>En este panel ves s&oacute;lo los mensajes que t&uacute; has escrito en Utoi.</p>';
}
}
}
}
if (html != '') {
html = html + '  <div class="cerrar"><a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'panel_aclaracion\');" title="Cerrar aviso"><img src="/Iconos/v1.x/v1.0/bolillos/cerrar.png" width="13" height="12" alt="Cerrar" /></a></div><!-- === cierre div cerrar === -->';
if (document.getElementById('panel_aclaracion')) {
var divPanel = document.getElementById('panel_aclaracion');
divPanel.innerHTML = html;
divPanel.style.display = '';
}
}
}
}
function f_es_valor_vacio(valor) {
nuevo_valor = valor.replace(/^(\s|\&nbsp;)*|(\s|\&nbsp;)*$/g,"");
if (nuevo_valor == '') {
return true;
}
else {
return false;
}
}
function f_es_longitud_correcta(mensaje) {
var valor_actual = mensaje.replace(/<\/?[bi]>/ig, '');
valor_actual = valor_actual.replace(/((https?|ftp):\/\/[\w\.\-\:/\%\~\?\#\[\]\@\!\$\&\'\(\)\*\+,;=]+)/ig, function($1) {
if ($1.length>=30) {
return '12345678901234567890';
}
return($1);
}
);
var num = valor_actual.length;
if (num > _numero_maximo_caracteres_mensaje) {
return false;
}
else {
return true;
}
}
function f_obtener_paginacion_usuarios(idUsuario, tipoUsuario, numeroUsarios, pagina) {
var html_paginacion = '';
if ( numeroUsarios == 0) {
return html_paginacion;
}
if (tipoUsuario == 1) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_seguidores_movil";
} else {
html_funcion = "javascript:f_muestra_listado_seguidores";
}
}
else {
if (tipoUsuario == 2) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_a_quien_sigo_movil";
} else {
html_funcion = "javascript:f_muestra_listado_a_quien_sigo";
}
}
else {
if (tipoUsuario == 3) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_seguidores_evento_movil";
} else {
html_funcion = "javascript:f_muestra_listado_seguidores_evento";
}
}
else {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_escritores_evento_movil";
} else {
html_funcion = "javascript:f_muestra_listado_escritores_evento";
}
}
}
}
html_paginacion = html_paginacion + '<div class="paginacion">';
html_paginacion = html_paginacion + '  <ul>';
var pagina_anterior = pagina - 1;
if (pagina <= 1) {
pagina_anterior = 1;
pagina          = 1;
html_paginacion = html_paginacion + '    <li><span class="inhabilitado" title="Primera p&aacute;gina">&lt;&lt;</span></li>';
html_paginacion = html_paginacion + '    <li><span class="inhabilitado" title="P&aacute;gina anterior">&lt;</span></li>';
}
else {
html_paginacion = html_paginacion + '    <li><a href="javascript:void(0);" onclick="' + html_funcion + '(\'' + idUsuario + '\', 1);posicionarEnDiv(\'id_usuarios\');" class="flecha" title="Primera P&aacute;gina">&lt;&lt;</a> </li>';
html_paginacion = html_paginacion + '    <li><a href="javascript:void(0);" onclick="' + html_funcion + '(\'' + idUsuario + '\', ' + pagina_anterior + ');posicionarEnDiv(\'id_usuarios\');" class="flecha" title="P&aacute;gina anterior">&lt;</a> </li>';
}
html_paginacion = html_paginacion + '    <li class="activo"><a href="javascript:void(0);" onclick="' + html_funcion + '(\'' + idUsuario + '\', ' + pagina + ');">' + pagina + '</a> </li>';
numero_paginas = Math.ceil(numeroUsarios / _numero_maximo_usuarios_a_mostrar);
pagina_siguiente = pagina + 1;
if (pagina >= numero_paginas) {
pagina_siguiente = numero_paginas;
html_paginacion = html_paginacion + '    <li><span class="inhabilitado" title="P&aacute;gina siguiente">&gt;</span></li>';
}
else {
html_paginacion = html_paginacion + '    <li><a href="javascript:void(0);" onclick="' + html_funcion + '(\'' + idUsuario + '\',' + pagina_siguiente + ');posicionarEnDiv(\'id_usuarios\');" class="flecha" title="P&aacute;gina siguiente">&gt;</a> </li>';
}
html_paginacion = html_paginacion + '  </ul>';
html_paginacion = html_paginacion + '</div><!-- === cierre div paginacion === -->';
return html_paginacion;
}
function f_obtener_html_numero_usuarios_listado(numero) {
var html = '';
var str_numero = numero + '';
var numero_caracteres = str_numero.length;
if (numero_caracteres == 1) {
html = '<span class="cifra">' + numero + '</span>';
}
else {
for (i=0; i<numero_caracteres; i++) {
digito = str_numero.charAt(i);
html = html + '<span class="cifra">' + digito + '</span>';
}
}
return html;
}
function f_limpia_campos_formulario_evento() {
if (document.getElementById('campo_formulario_texto_mensaje')) {
document.getElementById('campo_formulario_texto_mensaje').value = '';
}
if (document.getElementById('m')) {
document.getElementById('m').value = '';
}
if (document.getElementById('etiqueta_numero_maximo_caracteres') ) {
var etiqueta = document.getElementById('etiqueta_numero_maximo_caracteres');
etiqueta.innerHTML = _numero_maximo_caracteres_mensaje;
etiqueta.style.color = '';
}
if (document.getElementById('t') ) {
document.getElementById('t').value = '';
var numero_li = 0;
var panelEventos = document.getElementById('id_eventos_para_escribir');
if (panelEventos) {
numero_li = panelEventos.childNodes.length;
}
for (var i = 0; i < numero_li; i++) {
campo_li = panelEventos.childNodes[i];
clave_id = campo_li.id;
id_evento = clave_id.substring(3);
var campoCheck = document.getElementById('id_' + id_evento);
if (campoCheck != null) {
campoCheck.checked = false;
}
}
}
var panelUsuarios = document.getElementById('caja_destinatarios');
if (panelUsuarios) {
panelUsuarios.innerHTML = '';
}
if (document.getElementById('p') ) {
document.getElementById('p').value = '';
}
}
function f_lanza_proceso_para_borrar_temporal(idMensajeTemporal) {
if (typeof _timer_borrado_temporal != "undefined") {
clearInterval(_timer_borrado_temporal);
}
_idMensajeTemporal = idMensajeTemporal;
_timer_borrado_temporal = setInterval(f_borra_mensaje_temporal, _segsBorrarTemporal * 1000);
}
function f_borra_mensaje_temporal() {
if (typeof _timer_borrado_temporal != "undefined") {
clearInterval(_timer_borrado_temporal);
}
if (document.getElementById('provisional')) {
var idMsg = 'mensaje_' + _idMensajeTemporal;
if (document.getElementById(idMsg)) {
var divMensajeTemporal = document.getElementById('provisional');
divMensajeTemporal.removeChild(document.getElementById(idMsg));
}
}
}
function f_lanza_actualizacion_a_quien_sigo() {
if (typeof _timer_actualizar_aquiensigo != "undefined") {
clearInterval(_timer_actualizar_aquiensigo);
}
_timer_actualizar_aquiensigo = setInterval(f_actualiza_a_quien_sigo, _tiempoActualizarAQuienSigo * 1000);
}
function f_actualiza_a_quien_sigo() {
f_obtener_quien_sigo();
}
function f_poner_foco_campo_texto(idCampo) {
if (document.getElementById(idCampo)) {
var campo_texto = document.getElementById(idCampo);
campo_texto.focus();
}
}
function f_autentica_usuario(idCampoLogin, idCampoPasswd) {
var campoLogin  = document.getElementById(idCampoLogin);
var campoPasswd = document.getElementById(idCampoPasswd);
if ( (campoLogin.value == '') || (campoPasswd.value == '') )  {
alert('Tienes que teclear usuario y clave');
return false;
}
var formulario = document.getElementById('formulario_sesion');
formulario.submit();
}
function f_quitar_div_trabajando(idPanelEscribir, idPanelTrabajando) {
var divEscribirMensaje = document.getElementById(idPanelEscribir);
if (document.getElementById(idPanelTrabajando)) {
divEscribirMensaje.removeChild(document.getElementById(idPanelTrabajando));
}
}
function f_contabiliza_peticion() {
if (_es_primera_carga == 0) {
METtrackNewInfoFromAJAX();
}
}
function f_pide_publicidad() {
if (_es_primera_carga == 0) {
if (typeof mas_id_iframe_megabanner_utoi != "undefined" &&
mas_id_iframe_megabanner_utoi != "") {
document.getElementById(mas_id_iframe_megabanner_utoi).src = mas_url_iframe_megabanner_utoi;
}
}
}
function f_muestra_panel_informacion_sms(id_campo) {
var panelSMS = null;
if (document.getElementById('id_instruccionessms')) {
panelSMS = document.getElementById('id_instruccionessms');
if (document.getElementById(id_campo)) {
panelPadre = document.getElementById(id_campo);
var posicion_clave_sms = METUtils_calcAbsPosition(panelPadre);
panelSMS.style.left = posicion_clave_sms[0] + 'px';
panelSMS.style.top  = posicion_clave_sms[1] + panelPadre.clientHeight +'px';
}
esta_visible = panelSMS.style.display;
if (esta_visible == '') {
panelSMS.style.display = 'none';
}
else {
panelSMS.style.display = '';
}
}
}
function f_muestra_panel_aviso_permisos_escritura(idMensaje) {
var panelAviso = null;
if (document.getElementById('cuidado_aclaracion')) {
panelAviso = document.getElementById('cuidado_aclaracion');
var id_campo = 'cuidado_' + idMensaje;
if (document.getElementById(id_campo)) {
panelPadre = document.getElementById(id_campo);
var posicion_clave = METUtils_calcAbsPositionV2(panelPadre);
panelAviso.style.left = ( posicion_clave[0] + (panelPadre.clientWidth / 2) ) - 230 +'px';
panelAviso.style.top  = posicion_clave[1] - 68  + 'px';
}
esta_visible = panelAviso.style.display;
if (esta_visible == '') {
panelAviso.style.display = 'none';
}
else {
panelAviso.style.display = '';
}
}
}
function f_cierra_panel_informacion_sms() {
f_cerrar_panel('id_instruccionessms');
}
function f_obtener_html_informacion_sms() {
var html = '';
html = html + '<div id="id_instruccionessms" class="instruccionessms" style="display:none;">';
html = html + '  <div class="cerrar"><a href="javascript:f_cierra_panel_informacion_sms();" onclick="javascript:f_cierra_panel_informacion_sms();" title="Cerrar"><img src="/Iconos/v1.x/v1.0/bolillos/cerrar.png" width="13" height="12" /></a></div>';
html = html + '  <h3>Puedes enviar mensajes a utoi desde tu m&oacute;vil</h3>';
html = html + '  <p>Env&iacute;a un sms con la siguiente estructura al <span class="numero">5195</span>:</p>';
html = html + '  <div class="caso"><span class="letraa">A</span>Si es para un usuario:</div>';
html = html + '  <div class="estructura">utoi [espacio] #nombredeusuario [espacio] mensaje</div>';
html = html + '  <div class="caso"><span class="letrab">B</span>Si es para un tema:</div>';
html = html + '  <div class="estructura">utoi [espacio] *clavesms [espacio] mensaje</div>';
html = html + '  <div class="caso"><span class="letrac">C</span>Si s&oacute;lo quieres que aparezca en tu tabl&oacute;n:</div>';
html = html + '  <div class="estructura">utoi [espacio]  mensaje</div>';
html = html + '  <div class="caso"><span class="espacio"></span>Ejemplos:</div>';
html = html + '  <div class="estructura"><span class="letraa">A</span>utoi #juanperez &iexcl;Hola!</div>';
html = html + '  <div class="estructura"><span class="letrab">B</span>utoi *fotografia &iquest;Qu&eacute; c&aacute;mara me compro?</div>';
html = html + '  <div class="estructura"><span class="letrac">C</span>utoi Estoy en la T4.</div>';
html = html + '  <div class="coste">El coste del mensaje es el de un mensaje normal, por lo que depender&aacute; de tu operador de telefon&iacute;a y los acuerdos a los que hayas llegado con el mismo.</div><!-- === cierre div coste === -->';
html = html + '</div><!-- === cierre div instruccionessms === -->';
return html;
}



function f_mostrar_caja_adjuntar_imagen() {
var html = "";
html = html + '  <p>Dinos la ubicaci&oacute;n de la imagen que quieres que acompa&ntilde;e tu mensaje:</p>';
html = html + '  <span><input id="p" name="p" type="file" size="55" /></span>';
var divCajaAdjuntar = document.getElementById('capaopciones_adjuntar');
var divCajaDestino  = document.getElementById('capaopciones_destino');
if (divCajaAdjuntar.innerHTML == '') {
divCajaAdjuntar.innerHTML = html;
}
divCajaAdjuntar.style.display = '';
divCajaDestino.style.display = 'none';
var boton_adjuntar = document.getElementById('boton_adjuntar');
boton_adjuntar.className = 'botonactivo';
var boton_donde_publicar = document.getElementById('boton_donde_publicar');
if (boton_donde_publicar != null) {
boton_donde_publicar.className = 'segundo';
}
var boton_destinatarios = document.getElementById('boton_destinatario');
if (boton_destinatarios != null) {
boton_destinatarios.className = 'segundo';
}
}
function f_pinta_caja_destinatarios(idCaja) {
var html = "";
html = html + '  <p>Selecciona los usuarios a los que quieras enviar el mensaje:</p>';
html = html + '  <p>Empieza a escribir el nombre del usuario y se ir&aacute; autocompletando.</p>';
html = html + '  <div class="introduccion">';
html = html + '    <input name="campo_formulario_nombre_usuario_para_publicar" id="nombre_usuario_para_publicar" value="" autocomplete="off" onfocus="UTOIautocompleteInitialize(this, f_muestra_usuarios_para_enviar);" type="text" />';
html = html + '    <a href="javascript:void(0);" onClick="javascript:f_muestra_usuarios_para_enviar(document.formulario_escribir.nombre_usuario_para_publicar);" class="fijar"></a>';
html = html + '  </div><!-- === cierre div introduccion === -->';
html = html + '  <div class="usuarios" id="caja_destinatarios"></div><!-- === cierre div usuarios === -->';
var divCajaDestino = document.getElementById(idCaja);
if (divCajaDestino.innerHTML == '') {
divCajaDestino.innerHTML = html;
}
divCajaDestino.style.display = '';
var divCajaAdjuntar = document.getElementById('capaopciones_adjuntar');
divCajaAdjuntar.style.display = 'none';
var boton_destinatarios = document.getElementById('boton_destinatario');
boton_destinatarios.className = 'botonactivodestinatario';
var boton_adjuntar = document.getElementById('boton_adjuntar');
boton_adjuntar.className = 'primero';
}
function f_muestra_usuarios_para_enviar(campo_patron_usuario) {
var divCaja = document.getElementById('caja_destinatarios');
var html_actual = divCaja.innerHTML;
var nombre_usuario = campo_patron_usuario.value;
campo_patron_usuario.value = '';
if (f_es_valor_vacio(nombre_usuario) ) {
return true;
}
var lista_usuarios = Array();
if (nombre_usuario.indexOf(",") != -1) {
var usuarios = nombre_usuario.split(",");
lista_usuarios = usuarios;
}
else {
lista_usuarios[0] = nombre_usuario;
}
var numero_usuarios = lista_usuarios.length;
var nombre_nuevo_usuario = '';
var usuario_valido = true;
for (i=0; i<numero_usuarios; i++) {
nombre_nuevo_usuario = trim(lista_usuarios[i]);
usuario_valido = true;
if (nombre_nuevo_usuario == '') {
usuario_valido = false;
}
else {
f_es_usuario_valido(nombre_nuevo_usuario);
var numero_elementos_usuario = divCaja.childNodes.length;
if (numero_elementos_usuario == 0) {
var cajaUL = document.createElement('ul');
cajaUL.id = 'caja_ul_destinatarios';
divCaja.appendChild(cajaUL);
}
else {
cajaUL = divCaja.childNodes[0];
if (f_comprobar_existe_usuario(cajaUL, nombre_nuevo_usuario) == true) {
usuario_valido = false;
}
}
}
if (usuario_valido == true) {
var cajaLI = document.createElement('li');
cajaLI.id = "li_" + nombre_nuevo_usuario;
cajaLI.innerHTML = '<a href="javascript:f_quita_usuarios_para_enviar(\'li_' + nombre_nuevo_usuario + '\');" title="Quitar destinatario"><img src="/Iconos/v1.x/v1.0/bolillos/cerrar.png" width="13" height="12" alt="Quitar" /></a>' + nombre_nuevo_usuario;
cajaUL.appendChild(cajaLI);
}
}
}
function f_quita_usuarios_para_enviar(id_li) {
var cajaLI = document.getElementById(id_li);
var divCaja = document.getElementById('caja_destinatarios');
var cajaUL = divCaja.childNodes[0];
cajaUL.removeChild(cajaLI);
}
function f_comprobar_existe_usuario(caja, nombre) {
var existe_usuario = false;
var nuevo_id = 'li_' + nombre;
numero_usuarios = caja.childNodes.length;
for (var i = 0; i < numero_usuarios; i++) {
cajaLI = caja.childNodes[i];
if (cajaLI.id == nuevo_id) {
existe_usuario = true;
}
}
return existe_usuario;
}
function f_es_usuario_valido(nombre) {
UTOIautocompleteVerifyUser(nombre);
}
function f_envia() {
var mensaje_error = 'No has seleccionado ningún usuario';
var panelUsuarios = document.getElementById('caja_ul_destinatarios');
if (panelUsuarios == null) {
alert(mensaje_error);
return false;
}
if (panelUsuarios.childNodes == null) {
alert(mensaje_error);
return false;
}
if (panelUsuarios.childNodes.length == 0) {
alert(mensaje_error);
return false;
}
var numero_destinatarios = panelUsuarios.childNodes.length;
if (numero_destinatarios == 0) {
alert(mensaje_error);
return false;
}
var hayErrores = false;
var lista_usuarios = '';
for (var i = 0; i < numero_destinatarios; i++) {
usuario = panelUsuarios.childNodes[i];
clave_id = usuario.id;
id_usuario = clave_id.substring(3);
nombre_class = usuario.className;
if (nombre_class == 'invalido') {
hayErrores = true;
}
lista_usuarios = lista_usuarios + id_usuario + '|';
}
if (hayErrores == true) {
if (numero_destinatarios == 1) {
alert("El usuario al que vas a enviar el mensaje no es válido");
}
else {
alert("Hay usuarios a los que vas a enviar el mensaje que no son válidos");
}
return false;
}
var contenido_mensaje = document.getElementById('campo_formulario_texto_mensaje').value;
if ( f_es_valor_vacio(contenido_mensaje) ) {
alert("No has escrito nada para enviar");
return false;
}
if ( ! f_es_longitud_correcta(contenido_mensaje) ) {
alert("El mensaje no puede tener más de " + _numero_maximo_caracteres_mensaje + " caracteres");
return false;
}
document.getElementById('m').value = contenido_mensaje;
document.getElementById('t').value = lista_usuarios;
var valor_imagen = '';
if (document.getElementById('p') ) {
valor_imagen = document.getElementById('p').value;
}
var divContenedor = document.getElementById("id_escribir_mensaje");
var divTrabajando = document.createElement("DIV");
divTrabajando.id = "trabajando_evento";
divTrabajando.className = "trabajando";
divContenedor.insertBefore(divTrabajando, divContenedor.firstChild);
var formulario = document.getElementById('formulario_escribir');
formulario.submit();
}
function comprobarPost_mensaje_evento(idMensaje, comando, pintarMensajeNuevo) {
var i = document.getElementById("iframe_"+idMensaje);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames["iframe_"+idMensaje].document;
}
if (d.location.href == "about:blank") {
return true;
}
if (!d.getElementById("status")) {
alert("Ha ocurrido un error al enviar el mensaje. Por favor, inténtalo más tarde.");
f_quitar_div_trabajando('id_escribir_mensaje', 'trabajando_evento');
return false;
}
if (d.getElementById("status").innerHTML != "OK") {
msg = d.getElementById("info").innerHTML + " (Error " +d.getElementById("code").innerHTML + ")";
alert(msg);
f_quitar_div_trabajando('id_escribir_mensaje', 'trabajando_evento');
return false;
}
var retorno = true;
var mensaje = 'El mensaje se ha enviado correctamente.....';
if (d.getElementById("info").innerHTML != "") {
mensaje = d.getElementById("info").innerHTML;
alert(mensaje);
}
var quitarMensajeTemporal = false;
var hashMensajeTemporal   = null;
if (pintarMensajeNuevo == 1) {
var sigoalevento = false;
var numero_eventos_seleccionados = _arrayEventosSeleccionadosParaEscribir.length;
if (numero_eventos_seleccionados > 0 ) {
for (var i=0; i < numero_eventos_seleccionados; i++) {
var id_evento_seleccionado = _arrayEventosSeleccionadosParaEscribir[i];
for (var claveEvento in _hashEventosSeguidos) {
if (id_evento_seleccionado == claveEvento) {
sigoalevento = true;
}
}
}
}
if ( (_tipoTablon == 2) && (_usuario_sigue_a_si_mismo == 0) && (sigoalevento == false) ) {
quitarMensajeTemporal = true;
}
}
else {
if (_hashDatosEvento.estado_seguimiento == 0) {
quitarMensajeTemporal = true;
}
}
hashMensajeTemporal = crearMensajeTemporal();
var htmlMensajeTemporal         = pintaMensaje(hashMensajeTemporal, true);
var divContenedorMensajes       = document.getElementById(_idContenedorMsgs);
divContenedorMensajes.innerHTML = htmlMensajeTemporal + divContenedorMensajes.innerHTML;
if (quitarMensajeTemporal) {
f_lanza_proceso_para_borrar_temporal(hashMensajeTemporal["idMsg"]);
}
f_quitar_div_trabajando('id_escribir_mensaje', 'trabajando_evento');
f_limpia_campos_formulario_evento();
i.src = "about:blank";
return retorno;
}
function f_publica(tipo_publicacion) {
var lista_eventos = '';
if (tipo_publicacion == 'evento') {
lista_eventos = '*' + _tablon;
_arrayEventosSeleccionadosParaEscribir[0] = _tablon;
}
else {
var panelEventos = document.getElementById('id_eventos_para_escribir');
var numero_li = 0;
if (panelEventos) {
numero_li = panelEventos.childNodes.length;
}
var indice_array = 0;
for (var i = 0; i < numero_li; i++) {
campo_li = panelEventos.childNodes[i];
clave_id = campo_li.id;
id_evento = clave_id.substring(3);
var campoCheck = document.getElementById('id_' + id_evento);
var estaSeleccionado = false;
if (campoCheck != null) {
estaSeleccionado = campoCheck.checked;
}
if (estaSeleccionado) {
lista_eventos = lista_eventos + '*' + id_evento + '|';
_arrayEventosSeleccionadosParaEscribir[indice_array] = id_evento;
indice_array++;
}
}
}
var contenido_mensaje = document.getElementById('campo_formulario_texto_mensaje').value;
if ( f_es_valor_vacio(contenido_mensaje) ) {
alert("No has escrito nada para enviar");
return false;
}
if ( ! f_es_longitud_correcta(contenido_mensaje) ) {
alert("El mensaje no puede tener más de " + _numero_maximo_caracteres_mensaje + " caracteres");
return false;
}
document.getElementById('m').value = contenido_mensaje;
document.getElementById('t').value = lista_eventos;
var valor_imagen = '';
if (document.getElementById('p') ) {
valor_imagen = document.getElementById('p').value;
}
var divContenedor = document.getElementById("id_escribir_mensaje");
var divTrabajando = document.createElement("DIV");
divTrabajando.id = "trabajando_evento";
divTrabajando.className = "trabajando";
divContenedor.insertBefore(divTrabajando, divContenedor.firstChild);
var formulario = document.getElementById('formulario_escribir');
formulario.submit();
}
function f_tecleando(evento, idCampo, idEtiqueta) {
if (window.event) {
tecla = evento.keyCode;
src   = evento.srcElement;
}
else if (evento.which) {
tecla = evento.which;
src   = evento.target;
}
var campo = document.getElementById(idCampo);
var valor_actual = campo.value;
valor_actual = valor_actual.replace(/<\/?[bi]>/ig, '');
valor_actual = valor_actual.replace(/((https?|ftp):\/\/[\w\.\-\:/\%\~\?\#\[\]\@\!\$\&\'\(\)\*\+,;=]+)/ig, function($1) {
if ($1.length>=30) {
return '12345678901234567890';
}
return($1);
}
);
var len_actual = valor_actual.length;
diferencia = _numero_maximo_caracteres_mensaje - len_actual;
var color_texto = '';
if (diferencia >= 140) {
color_texto = '';
}
else {
if ( (diferencia >= 20) && (diferencia < 140) ) {
color_texto = '#b64924';
}
else {
if ( (diferencia > 0) && (diferencia < 20) ) {
color_texto = '#f80000';
}
else {
color_texto = '#bebebe';
}
}
}
var etiqueta = document.getElementById(idEtiqueta);
etiqueta.innerHTML = diferencia;
etiqueta.style.color = color_texto;
return true;
}
function f_comprobar_submit(evento, idFormulario) {
if (window.event) {
tecla = evento.keyCode;
src   = evento.srcElement;
}
else if (evento.which) {
tecla = evento.which;
src   = evento.target;
}
if (tecla == 13) {
f_autentica_usuario('cajalogin_camponombreusuario', 'cajalogin_campocontrasena');
}
}
function f_obtener_eventos_seguidos(idCaja) {
var cadena_params = "action=list_eventos";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
if (_obtenidasSuscripciones == true) {
f_pinta_caja_derecha_eventos_seguidos(idCaja);
}
else {
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los temas seguidos por el usuario");
_obtenidasSuscripciones = false;
} else {
_obtenidasSuscripciones = true;
var _hashTMP = Array();
var data = httpRequest.responseText;
eval("_hashTMP = " + data);
_hashEventosSeguidos = _hashTMP.perfilesEventos;
_numeroEventosSeguidos = _hashTMP.numeroEventos;
}
f_pinta_caja_derecha_eventos_seguidos(idCaja);
}, _urlUTOI + "?" + cadena_params);
}
}
function f_obtener_eventos_para_escribir(idCaja) {
var cadena_params = "action=list_writers";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
if (_obtenidosEventosParaEscribir == true) {
f_pinta_caja_donde_publicar(idCaja);
}
else {
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los eventos para escribir");
_obtenidosEventosParaEscribir = false;
} else {
_obtenidosEventosParaEscribir = true;
var _hashTMP = Array();
var data = httpRequest.responseText;
eval("_hashTMP = " + data);
_hashEventosParaEscribir = _hashTMP.perfilesEventos;
}
f_pinta_caja_donde_publicar(idCaja);
}, _urlUTOI + "?" + cadena_params);
}
}
function f_obtener_eventos_para_escribir_en_respuesta(idMensaje, listaTablones) {
var cadena_params = "action=list_writers";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
var divEscribirMensaje = document.getElementById("escribirmensaje_"+idMensaje);
if (_obtenidosEventosParaEscribir == true) {
if (document.getElementById("trabajando_"+idMensaje)) {
divEscribirMensaje.removeChild(document.getElementById("trabajando_"+idMensaje));
asignarTablonesDestino(idMensaje);
}
}
else {
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los eventos para escribir");
_obtenidosEventosParaEscribir = false;
} else {
_obtenidosEventosParaEscribir = true;
var _hashTMP = Array();
var data = httpRequest.responseText;
eval("_hashTMP = " + data);
_hashEventosParaEscribir = _hashTMP.perfilesEventos;
}
if (document.getElementById("trabajando_"+idMensaje)) {
divEscribirMensaje.removeChild(document.getElementById("trabajando_"+idMensaje));
asignarTablonesDestino(idMensaje);
}
}, _urlUTOI + "?" + cadena_params);
}
}
function asignarTablonesDestino(idMensaje) {
if (document.getElementById("t_" + idMensaje).value != "") {
var avisoPermisosEscritura = false;
var arrayTablonesDestino = document.getElementById("t_" + idMensaje).value.split(/,/);
var strTablonesDestino   = "";
for (var contTab = 0; contTab != arrayTablonesDestino.length; contTab++) {
var strTablon = arrayTablonesDestino[contTab].substring(3);
var nombreTablon = arrayTablonesDestino[contTab];
if (typeof _hashEventosParaEscribir[strTablon] != "undefined" &&
arrayTablonesDestino[contTab].search("ev-") != -1) {
strTablonesDestino += "*" + strTablon + "|";
}
else {
if (nombreTablon.search(/t(1|4)-/) != -1) {
}
else {
avisoPermisosEscritura = true;
}
}
}
if (avisoPermisosEscritura == true) {
var iconoAviso = document.getElementById("cuidado_" + idMensaje);
iconoAviso.style.display = '';
}
strTablonesDestino = strTablonesDestino.substr(0, (strTablonesDestino.length-1));
document.getElementById("t_" + idMensaje).value = strTablonesDestino;
}
}
function f_marca_elemento(id) {
var campoLI = document.getElementById('li_' + id);
var campoCheck = document.getElementById('id_' + id);
var estaSeleccionado = campoCheck.checked;
if (estaSeleccionado) {
campoLI.className = 'seleccionado';
}
else {
campoLI.className = '';
}
}
function f_pinta_caja_donde_publicar(idCaja) {
var divCajaAdjuntar = document.getElementById('capaopciones_adjuntar');
divCajaAdjuntar.style.display = 'none';
var boton_destinatarios = document.getElementById('boton_donde_publicar');
boton_destinatarios.className = 'botonactivodestinatario';
var boton_adjuntar = document.getElementById('boton_adjuntar');
boton_adjuntar.className = 'primero';
var html_lista_eventos = '';
var id_campo_ul = '';
var numero_eventos = 0;
for (var nombreEvento in _hashEventosParaEscribir) {
var lh_datos_evento = _hashEventosParaEscribir[nombreEvento];
numero_eventos++;
descripcion = lh_datos_evento['descripcion'];
nombre      = lh_datos_evento['nombre'];
path_foto   = lh_datos_evento['path_foto'];
activo      = lh_datos_evento['activo'];
var html_elemento = '';
if (activo) {
html_elemento = '<li id="li_' + nombreEvento + '" onclick="javascript:f_marca_elemento(\'' + nombreEvento + '\');" ><input name="s_' + nombreEvento + '" value="' + nombreEvento + '" type="checkbox" value="" id="id_' + nombreEvento + '" /><label id="lb_' + nombreEvento + '" for="id_' + nombreEvento + '" >' + nombre + '</label></li>';
}
else {
html_elemento = '<li id="li_' + nombreEvento + '"><a href="javascript:void(0);" title="Tema cerrado"><label for="' + nombreEvento + '">' + nombre + '</label></a> </li>';
}
html_lista_eventos = html_lista_eventos + html_elemento;
}
if (numero_eventos == 0) {
id_campo_ul = 'id_sin_eventos_para_escribir';
html_lista_eventos = '<li>No tienes ning&uacute;n evento donde escribir</li>';
}
else {
id_campo_ul = 'id_eventos_para_escribir';
}
var html = "";
html = html + '  <p><strong>Selecciona los temas en los que quieres que aparezca tu mensaje:</strong></p>';
html = html + '  <p>Estos son los temas a los que te has apuntado para escribir.<br />Si no seleccionas nada, s&oacute;lo aparecer&aacute; en \'mis mensajes\'.</p>';
html = html + '  <div class="marco">';
html = html + '    <div id="id_temas_para_escribir" class="temas">';
html = html + '    <ul id="' + id_campo_ul + '">' + html_lista_eventos + '</ul>';
html = html + '    </div><!-- === cierre div temas === -->';
html = html + '  </div><!-- === cierre div marco === -->';
html = html + '  <div class="mistemas">';
html = html + '  </div><!-- === cierre div mistemas === -->';
var divCaja = document.getElementById(idCaja);
if (divCaja.innerHTML == '') {
divCaja.innerHTML = html;
}
divCaja.style.display = '';
var boton_donde_publicar = document.getElementById('boton_donde_publicar');
boton_donde_publicar.className = 'botonactivo';
var boton_adjuntar = document.getElementById('boton_adjuntar');
boton_adjuntar.className = 'primero';
}
function f_muestra_temas_destacados(listaTemasDestacados, listaTemasDestacadosExtra) {
var html = '';
html = html + '<div class="contenido">';
html = html + '  <div class="temasdestacados">';
html = html + '    <div class="pestanas">';
html = html + '      <ul><li><a href="/temas.html" class="activo">temas destacados</a></li></ul>';
html = html + '    </div><!-- === cierre div pestanas === -->';
var numero_temas = 0;
for (var claveTema in listaTemasDestacados) {
var datosTema = listaTemasDestacados[claveTema];
numero_temas++;
html = html + '     <div class="tema">';
if  ( (datosTema.nombre) && (datosTema.nombre != '') ) {
html = html + '       <div class="nombretema"><a href="/' + '*' + claveTema + '" title="Ver tema">' + datosTema.nombre + '</a></div><!-- === cierre div nombretema === -->';
}
html = html + '       <div class="texto">';
if  ( (datosTema.pathfoto) && (datosTema.pathfoto != '') ) {
if  ( (datosTema.mostrarfototemasdestacados) && (datosTema.mostrarfototemasdestacados == '1') ) {
html = html + '         <div class="foto"><img src="' + datosTema.pathfoto + '" width="60" height="60" alt="Foto del tema" /></div><!-- === cierre div foto === -->';
}
}
var texto_reclamo    = '';
var texto_entradilla = '';
if  ( (datosTema.reclamo) && (datosTema.reclamo != '') ) {
texto_reclamo = '<span class="titular"><a href="/' + '*' + claveTema + '" title="Ver tema">' + datosTema.reclamo + '</a></span>';
}
if  ( (datosTema.entradillatemasdestacados) && (datosTema.entradillatemasdestacados != '') ) {
texto_entradilla = '<span class="parrafo">' + datosTema.entradillatemasdestacados + '</span>';
}
html = html + '         ' + texto_reclamo + ' ' + texto_entradilla;
if (listaTemasDestacadosExtra[claveTema]) {
var datosExtra = listaTemasDestacadosExtra[claveTema];
if  ( (datosExtra.ts_ultimo_mensaje) && (datosExtra.ts_ultimo_mensaje != '') )  {
var ts_ultima_actualizacion = f_obtener_html_ultima_actualizacion_evento(datosExtra.ts_ultimo_mensaje, 1);
texto_ultima_actualizacion = 'Actualizado ' + ts_ultima_actualizacion;
}
else {
texto_ultima_actualizacion = 'No ha sido actualizado';
}
html = html + '         <div class="detalles"><span class="tiempo">' + texto_ultima_actualizacion + '</span></div><!-- === cierre div detalles === -->';
}
html = html + '       </div><!-- === cierre div texto === -->';
html = html + '       <div style="clear: both;"></div>';
html = html + '     </div><!-- === cierre div tema === -->';
}
if (numero_temas == 0) {
html = html + '  <div class="sintemas">';
html = html + '    <p>No hay temas disponibles</p>';
html = html + '  </div><!-- === cierre div sintemas === -->';
}
html = html + '  </div><!-- === cierre div temasdestacados === -->';
html = html + '  <div class="enlaces">';
html = html + '  <a href="/Formularios/utoi_nuevo_tema.pl" class="primero">Crear un tema</a>';
html = html + ' <a href="/temas.html" class="segundo">Verlos todos</a>';
html = html + '  </div><!-- === cierre div enlaces === -->';
html = html + '</div><!-- === cierre div contenido === -->';
var divCajaDestacados = document.getElementById('id_caja_temas_destacados');
divCajaDestacados.innerHTML = html;
}
function f_muestra_caja_eventos_usuario() {
f_obtener_eventos_seguidos('id_contenido_temas_derecha_superior');
}
function f_pinta_caja_derecha_eventos_seguidos(idCaja) {
var html = '';
var texto_ultima_actualizacion = '';
html =        '<div class="caja">';
html = html + '  <div class="contenido">';
html = html + '    <div class="mistemas">';
html = html + '      <div class="pestanas">';
html = html + '        <ul><li><a href="/' + _nickname + '/temasseguidos" class="activo">mis temas</a></li></ul>';
html = html + '      </div><!-- === cierre div pestanas === -->';
if (_numeroEventosSeguidos > 0) {
html = html + '  <div class="contador">  <a href="/' + _nickname + '/temasseguidos" title="Ver todos">Temas que sigo:</a>';
html = html + '    <div class="numero">' + _numeroEventosSeguidos + '</div>';
html = html + '  </div>';
var numero_eventos_procesados = 0;
for (var claveEvento in _hashEventosSeguidos) {
if (numero_eventos_procesados < _numero_maximo_eventos_a_mostrar) {
var lh_datos_evento = _hashEventosSeguidos[claveEvento];
descripcion = '';
nombre      = '';
path_foto   = '';
idTablon    = claveEvento;
descripcion = lh_datos_evento['descripcion'];
nombre      = lh_datos_evento['nombre'];
path_foto   = lh_datos_evento['path_foto'];
if (lh_datos_evento['ts_ultimo_mensaje']) {
var ts_ultima_actualizacion = f_obtener_html_ultima_actualizacion_evento(lh_datos_evento['ts_ultimo_mensaje'], 1);
texto_ultima_actualizacion = 'Actualizado ' + ts_ultima_actualizacion;
}
else {
texto_ultima_actualizacion = 'No ha sido actualizado';
}
html = html + '  <div class="tema">';
html = html + '    <div class="nombretema"><a href="/' + '*' + idTablon + '" title="Ver tema">' + nombre + '</a></div>';
html = html + '    <div class="texto">';
html = html + '      <div class="detalles">';
html = html + '         <div class="detalles"><span class="tiempo">' + texto_ultima_actualizacion + '</span></div>';
html = html + '      </div><!-- === cierre div detalles === -->';
html = html + '    </div><!-- === cierre div texto === -->';
html = html + '    <div style="clear: both;"></div>';
html = html + '  </div><!-- === cierre div tema === -->';
}
numero_eventos_procesados++;
}
}
else {
html = html + '  <div class="sintemas">';
html = html + '    <p>No hay temas disponibles</p>';
html = html + '  </div><!-- === cierre div sintemas === -->';
}
html = html + '  </div><!-- === cierre div mistemas === -->';
html = html + '  <div class="enlaces">';
html = html + '  <a href="/Formularios/utoi_nuevo_tema.pl" class="primero">Crear un tema</a>';
if (_numeroEventosSeguidos > 0) {
html = html + ' <a href="/' + _nickname + '/temasseguidos" class="segundo">Verlos todos</a>';
}
html = html + '  </div><!-- === cierre div enlaces === -->';
html = html + '  </div><!-- === cierre div contenido === -->';
html = html + ' </div><!-- === cierre div caja === -->';
var divCaja = document.getElementById(idCaja);
divCaja.innerHTML = html;
}
function f_pinta_html_numero_seguidores(numero_seguidores) {
var divCaja = document.getElementById('id_numero_seguidores');
divCaja.innerHTML = numero_seguidores;
}
function f_muestra_seguidores(hashDatos) {
var numero_seguidores = 0;
if (hashDatos.numeroUsuarios) {
numero_seguidores = hashDatos.numeroUsuarios;
}
f_pinta_html_numero_seguidores(numero_seguidores);
}


function f_muestra_listado_seguidores(idUsuario, pagina) {
var cadena_params = 'action=list_seguidores&max=' + _numero_maximo_usuarios_a_mostrar + '&user=' + idUsuario + '&pag=' + pagina;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los seguidores de este usuario");
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idUsuario, hashTMP, 'id_usuarios', 1, pagina);
}
}, _urlUTOI + "?" + cadena_params);
}
function f_muestra_listado_a_quien_sigo(idUsuario, pagina) {
var cadena_params = 'action=list_usuarios&max=' + _numero_maximo_usuarios_a_mostrar + '&user=' + idUsuario + '&pag=' + pagina;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se ha podido obtener la lista de usuarios que sigo");
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idUsuario, hashTMP, 'id_usuarios', 2, pagina);
}
}, _urlUTOI + "?" + cadena_params);
}
function f_muestra_listado_seguidores_evento(idEvento, pagina) {
var cadena_params = 'action=list_seguidores&max=' + _numero_maximo_usuarios_a_mostrar + '&event=ev-' + idEvento + '&pag=' + pagina;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se ha podido obtener la lista de usuarios que siguen el evento");
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idEvento, hashTMP, 'id_usuarios', 3, pagina);
}
}, _urlUTOI + "?" + cadena_params);
}
function f_muestra_listado_escritores_evento(idEvento, pagina) {
var cadena_params = 'action=list_writers&max=' + _numero_maximo_usuarios_a_mostrar + '&event=ev-' + idEvento + '&pag=' + pagina;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se ha podido obtener la lista de usuarios que pueden escribir en el evento");
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idEvento, hashTMP, 'id_usuarios', 4, pagina);
}
}, _urlUTOI + "?" + cadena_params);
}
function f_obtener_html_envoltorio_usuario(idUsuario, datosUsuario, tipoUsuario) {
var html = '';
var es_activo = datosUsuario.activo;
var url_foto = datosUsuario.pathfoto;
if (url_foto == '') {
url_foto = _url_imagen_usuario_por_defecto;
}
url_usuario = "/" + idUsuario;
var nombre = '';
if (datosUsuario.nombre) {
nombre = datosUsuario.nombre + ' ' + datosUsuario.apellidos;
}
var soyyomismo = false;
var html_url_usuario = '';
if (idUsuario == _nickname) {
soyyomismo = true;
html = html + '<div class="tumismo">';
}
id_html_usuario = 'id_envoltoriousuariousuario_' + idUsuario;
html = html + '<div id="' + id_html_usuario + '" class="envoltoriousuario">';
html = html + '  <div class="usuario">';
html = html + '    <div class="contenedorfoto">';
html = html + '      <div class="foto"><a href="' + url_usuario + '" title="Ver todos sus mensajes"><img src="' + url_foto + '" alt="avatar" ></a></div><!-- === cierre div foto === -->';
html = html + '    </div><!-- === cierre div contenedorfoto === -->';
html = html + '    <div class="texto">';
html = html + '      <div class="contenedornombreymas">';
if (nombre != '') {
if (soyyomismo) {
html = html + '      <div class="nombre"><span>' + idUsuario + ' &raquo;</span> ' + nombre + ' </div><!-- === cierre div nombre === -->';
}
else {
html = html + '      <div class="nombre"><a href="' + url_usuario + '" title="Ver todos sus mensajes">' + idUsuario + ' &raquo;</a> ' + nombre + ' </div><!-- === cierre div nombre === -->';
}
}
else {
html = html + '      <div class="nombre"><a href="' + url_usuario + '" title="Ver todos sus mensajes">' + idUsuario + ' &raquo;</a> </div><!-- === cierre div nombre === -->';
}
if (_nickname != '') {
html = html + '          <div id="id_botones" class="botones">';
if ( datosUsuario.seguido == 1 ) {
estilo_seguir = 'display: none';
estilo_dejar = '';
}
else {
if ( (soyyomismo) && (_usuario_sigue_a_si_mismo == 1) ) {
estilo_seguir = 'display: none';
estilo_dejar = '';
}
else {
estilo_seguir = '';
estilo_dejar = 'display: none';
}
}
html = html + '             <a id="id_boton_dejar_'  + idUsuario + '" style="' + estilo_dejar  + '" href="javascript:void(0);" onclick="f_peticion_utoi_seguir_usuario_desde_listado(\'dejar\',\''  + idUsuario + '\');" title="Dejar de seguir al usuario"><img src="/Iconos/v1.x/v1.0/bolillos/boton_ya_no_seguir.png" width="13" height="13" alt="Dejar de seguir al usuario" /></a>';
html = html + '             <a id="id_boton_seguir_' + idUsuario + '" style="' + estilo_seguir + '" href="javascript:void(0);" onclick="f_peticion_utoi_seguir_usuario_desde_listado(\'seguir\',\'' + idUsuario + '\');" title="Seguir al usuario"><img src="/Iconos/v1.x/v1.0/bolillos/boton_seguir.png" width="13" height="13" alt="Seguir al usuario" /></a>';
if (! soyyomismo) {
if ( datosUsuario.bloqueado == 1 ) {
estilo_bloquear    = 'display: none';
estilo_desbloquear = '';
}
else {
estilo_bloquear    = '';
estilo_desbloquear = 'display: none';
}
html = html + '             <a id="id_boton_bloquear_'    + idUsuario + '" style="' + estilo_bloquear    + '" href="javascript:void(0);" onclick="f_peticion_utoi_bloquear_usuario_desde_listado(\'bloquear\',\''    + idUsuario + '\');"    title="Bloquear al usuario"><img src="/Iconos/v1.x/v1.0/bolillos/boton_bloquear.png" width="13" height="13" alt="Bloquear al usuario" /></a>';
html = html + '             <a id="id_boton_desbloquear_' + idUsuario + '" style="' + estilo_desbloquear + '" href="javascript:void(0);" onclick="f_peticion_utoi_bloquear_usuario_desde_listado(\'desbloquear\',\'' + idUsuario + '\');" title="Desbloquear al usuario"><img src="/Iconos/v1.x/v1.0/bolillos/boton_ya_no_bloquear.png" width="13" height="13" alt="Desbloquear al usuario" /></a>';
html = html + '             <a id="id_boton_enviar_privado_' + idUsuario + '" href="javascript:void(0);" onclick="f_pinta_caja_envio_privado_desde_listado(\'' + idUsuario + '\');" title="Enviar privado al usuario"><img src="/Iconos/v1.x/v1.0/bolillos/boton_enviar_privado.png" width="13" height="13" alt="Enviar privado al usuario" /></a>';
}
html = html + '          </div><!-- === cierre div botones === -->';
}
html = html + '      </div><!-- === cierre div contenedornombreymas === -->';
if (datosUsuario.profesion) {
html = html + '      <div class="profesion">' + datosUsuario.profesion + '</div><!-- === cierre div profesion === -->';
}
if (datosUsuario.urlwebpersonal) {
html = html + '      <div class="web"><a href="' + datosUsuario.urlwebpersonal + '" title="Visitar sitio web">' + datosUsuario.urlwebpersonal + '</a></div><!-- === cierre div web === -->';
}
html = html + '    <div id="id_escribir_mensaje_' + idUsuario + '" style="display: none;" class="escribirmensaje"></div><!-- === cierre div escribirmensaje === -->';
html = html + '    </div><!-- === cierre div texto === -->';
html = html + '    <div style="clear: both;"></div>';
html = html + '  </div><!-- === cierre div usuario === -->';
html = html + '</div><!-- === cierre div envoltoriousuario === -->';
if (soyyomismo) {
html = html + '</div><!-- === cierre div tumismo === -->';
}
return html;
}
function f_pinta_html_listado_usuarios(idUsuario, hashDatos, idCajaUsuarios, tipoUsuarios, pagina) {
var html_contenedor_usuario = '';
var html_encabezado         = '';
var html                    = '';
var numero_usuarios = 0;
var hashUsuarios    = hashDatos.perfilesUsuarios;
var numero_usuarios = hashDatos.numeroUsuarios;
if (numero_usuarios > 0) {
if (tipoUsuarios == 1) {
if (_nickname == idUsuario) {
html_encabezado = '  <p>Usuarios que te siguen: </p>';
}
else {
html_encabezado = '  <p>Usuarios que siguen a  <a href="/' + idUsuario + '" class="nombre" title="Ver todos sus mensajes">' + idUsuario + '</a></p>';
}
}
else {
if (tipoUsuarios == 2) {
if (_nickname == idUsuario) {
html_encabezado = '  <p>Usuarios a los que sigues: </p>';
}
else {
html_encabezado = '  <p>Usuarios a los que sigue <a href="/' + idUsuario + '" class="nombre" title="Ver todos sus mensajes">' + idUsuario + '</a></p>';
}
}
else {
if (tipoUsuarios == 3) {
html_encabezado = '  <p>Usuarios que siguen el tema  <a href="/' + '*' + idUsuario + '" class="nombre" title="Ver tema">' + idUsuario + '</a></p>';
}
else {
html_encabezado = '  <p>Usuarios que pueden escribir en el tema  <a href="/' + '*' + idUsuario + '" class="nombre" title="Ver tema">' + idUsuario + '</a></p>';
}
}
}
html_numero_usuarios = f_obtener_html_numero_usuarios_listado(numero_usuarios);
html_encabezado = html_encabezado + '  <div class="contenedornumeroyboton">';
html_encabezado = html_encabezado + '  <div class="numero">' + html_numero_usuarios + '</div><!-- === cierre div numero === -->';
if ( (tipoUsuarios == 2) && (_nickname == idUsuario) ) {
html_encabezado = html_encabezado + '  <a href="/anadir_usuario.html" title="A&ntilde;adir usuarios">A&ntilde;adir</a>';
}
html_encabezado = html_encabezado + '  </div><!-- === cierre div contenedornumeroyboton === -->';
}
else {
if (tipoUsuarios == 1) {
if (_nickname == idUsuario) {
html_encabezado = '  <p>No te sigue ning&uacute;n usuario</p>';
}
else {
html_encabezado = '  <p>Al usuario ' + idUsuario + ' no le sigue nadie</p>';
}
}
else {
if (tipoUsuarios == 2) {
if (_nickname == idUsuario) {
html_encabezado = '  <p>No sigues a ning&uacute;n usuario</p>';
}
else {
html_encabezado = '  <p>El usuario ' + idUsuario + ' no sigue a nadie</p>';
}
}
else {
if (tipoUsuarios == 3) {
html_encabezado = '  <p>El tema <span class="nombre">' + idUsuario + '</span> no lo sigue nadie</p>';
}
else {
html_encabezado = '  <p>Ning&uacute;n usuario escribe en el tema <span class="nombre">' + idUsuario + '</span></p>';
}
}
}
}
html =        '<div class="encabezado">';
html = html + '  ' + html_encabezado;
html = html + '</div><!-- === cierre div encabezado === -->';
for (var clave_usuario in hashUsuarios) {
usuario = hashUsuarios[clave_usuario];
html_contenedor_usuario = f_obtener_html_envoltorio_usuario(clave_usuario, usuario, tipoUsuarios);
html = html + html_contenedor_usuario;
}
var html_paginacion = f_obtener_paginacion_usuarios(idUsuario, tipoUsuarios, numero_usuarios, pagina);
html = html + html_paginacion;
var divCaja = document.getElementById(idCajaUsuarios);
divCaja.innerHTML = html;
}
function f_peticion_busqueda_usuarios(cadena_busqueda) {
if (cadena_busqueda == '') {
return false;
}
var cadena_params = "text=" + cadena_busqueda;
METUtils_makeHttpRequestGet(f_procesa_peticion_busqueda_usuarios, _urlAUTOCOMPLETADO + "?" + cadena_params);
}
function f_procesa_peticion_busqueda_usuarios(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
eval("_hash_resultado_busqueda_usuarios = " + data);
}
else {
_hash_resultado_busqueda_usuarios = Array();
}
}
function f_pinta_html_listado_usuarios_resultado(idUsuario, cadena_busqueda) {
var html_contenedor_usuario = '';
var html                    = '';
if (cadena_busqueda == '') {
return false;
}
var cadena_params = "text=" + cadena_busqueda;
METUtils_makeHttpRequestGet(function f_procesa_peticion_busqueda_usuarios(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var hashUsuarios    = Array();
var hashDatos    	= Array();
var numero_usuarios = 0;
eval("hashDatos = " + data);
if (hashDatos.perfilesUsuarios) {
hashUsuarios    = hashDatos.perfilesUsuarios;
numero_usuarios = hashDatos.num;
cadena_busqueda = hashDatos.query;
}
if (numero_usuarios > 0) {
for (var clave_usuario in hashUsuarios) {
usuario = hashUsuarios[clave_usuario];
html_contenedor_usuario = f_obtener_html_envoltorio_usuario(clave_usuario, usuario, 1);
html = html + html_contenedor_usuario;
}
}
else {
html = html + '<div class="error">';
html = html + '  <p>No existen usuarios que cumplan la condici&oacute;n: ' + cadena_busqueda + '</p>';
html = html + '<!-- === cierre div error === -->';
}
}
else {
html = html + '<div class="error">';
html = html + '  <p>Se ha producido un error al realizar la consulta. Por favor, int&eacute;ntalo m&aacute;s tarde</p>';
html = html + '<!-- === cierre div error === -->';
}
var html_formulario = f_obtener_html_formulario_buscar_usuarios(0, html);
var divCaja = document.getElementById('id_busquedas');
divCaja.innerHTML = html_formulario;
} , _urlAUTOCOMPLETADO + "?" + cadena_params);
}
function f_obtener_informacion_usuario_busqueda(idUsuario) {
var cadena_params = "action=info_usuarios&user=" + idUsuario;
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los datos del usuario");
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
if (! hashTMP.perfilesUsuarios[idUsuario]) {
alert("No se han podido obtener los datos del usuario (" + idUsuario+ ")");
return false;
}
else {
hashUsuario = hashTMP.perfilesUsuarios[idUsuario];
}
f_muestra_informacion_usuario_busqueda(idUsuario, hashUsuario);
}
}, _urlUTOI + "?" + cadena_params);
}
function f_muestra_informacion_usuario_busqueda(idUsuario, datosUsuario) {
var html_contenedor_usuario = f_obtener_html_envoltorio_usuario(idUsuario, datosUsuario, 1);
var divCajaResultados = document.getElementById('id_usuarios_buscar');
divCajaResultados.innerHTML = html_contenedor_usuario;
divCajaResultados.style.display = '';
}
function f_muestra_informacion_error_busqueda() {
var mensaje_error =             '<div id="id_contenedor_error_buscar" class="error">';
mensaje_error = mensaje_error + '  <p>No hemos encontrado ning&uacute;n usuario con ese nombre.</p>';
mensaje_error = mensaje_error + '</div><!-- === fin de id_contenedor_error_buscar === -->';
var divCajaResultados = document.getElementById('id_usuarios_buscar');
divCajaResultados.innerHTML = mensaje_error;
divCajaResultados.style.display = '';
}
function f_peticion_buscar_usuarios(p) {
if (! _hashAnswer) {
return false;
}
var campoUsuario = document.getElementById('id_nombre_usuario_para_buscar');
var cadena_tecleada = campoUsuario.value;
var campoQ = document.getElementById('q');
campoQ.value = cadena_tecleada;
var numero_usuarios_busqueda = _hashAnswer.num;
if (numero_usuarios_busqueda == 0) {
f_muestra_informacion_error_busqueda();
}
else {
if (numero_usuarios_busqueda == 1) {
var nombre = '';
var nick   = '';
if ( (typeof campoUsuario.utoi_seleccionado != 'undefined') && (campoUsuario.utoi_seleccionado == 1) ) {
campoUsuario.utoi_seleccionado = 0;
nick = cadena_tecleada;
}
else {
var listaBusqueda = _hashAnswer.answer;
var hashDatos = listaBusqueda[0];
nick   = hashDatos['nick'];
nombre = hashDatos['answer'];
}
f_obtener_informacion_usuario_busqueda(nick);
}
else {
var formulario_usuarios = document.getElementById('formulario_usuarios');
formulario_usuarios.submit();
}
}
}
function f_peticion_buscar_contenido(idCampo, formulario_busqueda) {
var campo_texto = document.getElementById(idCampo);
var valor_tecleado = campo_texto.value;
if (f_es_valor_vacio(valor_tecleado) ) {
alert("No has escrito nada para buscar");
return true;
}
formulario_busqueda.submit();
}
function f_obtener_html_formulario_buscar(valor_campo_busqueda) {
var html = '';
html = html + '  <div class="contenedorbusquedasylogo">';
html = html + '  <h3>Contenido</h3>';
html = html + '  <div class="cajabusqueda">';
html = html + '    <form id="formulario_busquedas" name="formulario_busquedas" action="/resultado_buscar.html" method="POST">';
html = html + '    <input type="text" name="q" id="q_busqueda_form" value="' + _cadenaQ_escapada + '" />';
html = html + '    <input href="javascript:void(0);" onclick="javascript:f_peticion_buscar_contenido(\'q_busqueda_form\', document.formulario_busquedas);" value="Buscar" type="button" class="botonbuscar">';
html = html + '    </form>';
html = html + '  </div><!-- === cierre div cajabusqueda === -->';
html = html + '  <div class="buscacon"><img src="/Iconos/v1.x/v1.0/varios/autonomy_buscador.png" width="88" height="43" alt="Busca con Autonomy" /></div><!-- === cierre div buscacon === -->';
html = html + '  <div style="clear: both;"></div>';
html = html + '  </div><!-- === cierre div contenedorbusquedasylogo === -->';
return html;
}
function f_obtener_html_formulario_buscar_usuarios(obtener_buscar_contenido, html_usuarios) {
var html = '';
var html_buscar_contenido = '';
var html_buscar_usuarios  = '';
if (obtener_buscar_contenido == 1) {
var html_caja = f_obtener_html_formulario_buscar('');
html_buscar_contenido =                         '<h2>Buscar</h2>';
html_buscar_contenido = html_buscar_contenido + '<div class="porpalabras">';
html_buscar_contenido = html_buscar_contenido + html_caja;
html_buscar_contenido = html_buscar_contenido + '</div><!-- === cierre div porpalabras === -->';
}
else {
html_buscar_usuarios =                        '<h2>Buscar</h2>';
html_buscar_usuarios = html_buscar_usuarios + '<div class="porusuarios">';
html_buscar_usuarios = html_buscar_usuarios + '  <h3>Usuarios</h3>';
html_buscar_usuarios = html_buscar_usuarios + '  <ul>';
html_buscar_usuarios = html_buscar_usuarios + '    <li>Empieza a escribir el nombre del usuario y se ir&aacute; autocompletando.</li>';
html_buscar_usuarios = html_buscar_usuarios + '    <li>Para ver todas las opciones del desplegable a la vez, pulsa la flecha antes de seleccionar ning&uacute;n usuario.</li>';
html_buscar_usuarios = html_buscar_usuarios + '  </ul>';
html_buscar_usuarios = html_buscar_usuarios + '  <div class="cajabusqueda">';
html_buscar_usuarios = html_buscar_usuarios + '    <form id="formulario_usuarios" name="formulario_usuarios" action="/consulta_usuarios.html" method="POST">';
html_buscar_usuarios = html_buscar_usuarios + '    <input name="campo_formulario_nombre_usuario_para_buscar" id="id_nombre_usuario_para_buscar" value="" autocomplete="off" onfocus="UTOIautocompleteInitialize(this, f_peticion_buscar_usuarios);" type="text" />';
html_buscar_usuarios = html_buscar_usuarios + '    <input type="hidden" name="q" id="q" value="" />';
html_buscar_usuarios = html_buscar_usuarios + '    <a href="javascript:void(0);" onclick="javascript:f_peticion_buscar_usuarios(1);" class="fijar"></a>';
html_buscar_usuarios = html_buscar_usuarios + '    </form>';
html_buscar_usuarios = html_buscar_usuarios + '  </div><!-- === cierre div cajabusqueda === -->';
html_buscar_usuarios = html_buscar_usuarios + '  <div id="id_usuarios_buscar" class="usuarios">' + html_usuarios + '</div><!-- === cierre div usuarios === -->';
html_buscar_usuarios = html_buscar_usuarios + '</div><!-- === cierre div porusuarios === -->';
}
html = html_buscar_contenido + html_buscar_usuarios;
return html;
}
function f_pinta_html_buscar(mostrar_buscar_contenido) {
var divContenedorBusquedas = document.getElementById('id_busquedas');
var html = f_obtener_html_formulario_buscar_usuarios(mostrar_buscar_contenido, '');
divContenedorBusquedas.innerHTML = html;
}
function f_pinta_html_listado_resultado_mensajes(paginaActual, numeroTotal, numeroMensajes, hashDatos) {
var html_encabezado         = '';
var html                    = '';
var numero_mensajes = numeroTotal;

var cadena_buscada = '';
var descripcion_cadena_buscada = '';
if (_cadenaQ != '') {
cadena_buscada = _cadenaQ;
descripcion_cadena_buscada = 'mensajes encontrados con <strong>' + cadena_buscada + '</strong>';
}
else {
cadena_buscada = '';
descripcion_cadena_buscada = 'mensajes relacionados';
}
var html_caja = f_obtener_html_formulario_buscar(cadena_buscada);
html =        '<h2><a href="/buscar.html" title="Volver a buscar">Buscar</a></h2>';
html = html + '<div class="porpalabras">';
html = html + html_caja;
if (numero_mensajes > 0) {
var inicioNumeroActual  = ((parseInt(paginaActual) - 1) * _numMsgPag) + 1;
var finNumeroActual     = parseInt(paginaActual) * _numMsgPag;
if (finNumeroActual > numeroTotal) {
finNumeroActual = numeroTotal
}
var estilo_ordenacion_frescura   = '';
var estilo_ordenacion_relevancia = '';
if (_tipoOrdenacionBusquedas == 'r') {
estilo_ordenacion_relevancia = 'class="activo"';
}
else {
estilo_ordenacion_frescura = 'class="activo"';
}
html = html + '<ul class="opciones">';
html = html + '  <li>Ordenar por</li>';
html = html + '  <li><a href="javascript:void(0);" onclick="javascript:f_buscar_contenido_por_frescura(1);" '   +  estilo_ordenacion_frescura   + '>Frescura </a></li>';
html = html + '  <li><a href="javascript:void(0);" onclick="javascript:f_buscar_contenido_por_relevancia(1);" ' +  estilo_ordenacion_relevancia + '>Coincidencia </a></li>';
html = html + '</ul><!-- === cierre ul opciones === -->';
html = html + '<p>Mostrando del ' + inicioNumeroActual + ' al ' + finNumeroActual + ' de <strong>' + numeroTotal + '</strong> ' + descripcion_cadena_buscada + '</p>';
}
else {
html = html + '<div class="error">';
html = html + '  <p>No se ha encontrado ning&uacute;n mensaje que cumpla la condici&oacute;n</p>';
html = html + '</div><!-- === cierre div error === -->';
}
html = html + '</div><!-- === cierre div porpalabras === -->';
var divCaja = document.getElementById('id_busquedas');
divCaja.innerHTML = html;
if (numero_mensajes > 0) {
if (hashDatos.mensajes.length > 0) {
muestraMensajesResultadoBusquedas(paginaActual, numeroTotal, numero_mensajes, hashDatos.mensajes);
}
else {
var html_error  = '<div class="error">';
html_error      = html_error + '  <p>Se ha producido un error al realizar la consulta. Por favor, espere y rep&iacute;talo m&aacute;s tarde.</p>';
html_error      = html_error + '</div><!-- === cierre div error === -->';
var divContenedor = document.getElementById(_idContenedorErr);
divContenedor.innerHTML = html_error;
divContenedor.style.display = '';
}
}
}

function f_pinta_html_numero_seguidos(numero_seguidos, idCaja) {
var divCaja = document.getElementById(idCaja);
divCaja.innerHTML = numero_seguidos;
}
function f_pinta_html_a_quien_sigo(hashDatos) {
var html ='';
var clave_usuario = '';
var numero_usuarios = 0;
var numero_aquien_sigo = 0;
if (hashDatos.numeroUsuarios) {
numero_aquien_sigo = hashDatos.numeroUsuarios;
}
var hashUsuarios     = Array();
var lista_ordenacion = Array();
var numero_elementos = 0;
if (hashDatos.perfilesUsuarios) {
hashUsuarios = hashDatos.perfilesUsuarios;
lista_ordenacion = hashDatos.ordenPerfilesUsuariosActivos;
numero_elementos = lista_ordenacion.length;
}
for (i = 0; i < numero_elementos; i++) {
clave_usuario = lista_ordenacion[i];
usuario = hashUsuarios[clave_usuario];
url_foto = usuario.pathfoto;
if (url_foto == '') {
url_foto = _url_imagen_usuario_por_defecto;
}
nombre = usuario.nombre;
if (nombre == '') {
nombre = clave_usuario;
}
url_usuario = "/" + clave_usuario;
es_activo =  usuario.activo;
if (es_activo == 1) {
class_activo = "activo";
}
else {
class_activo = "inactivo";
}
html = html + '  <div class="contenedorfoto">';
html = html + '    <div class="foto"> <a href="' + url_usuario + '" title="' + nombre + '"><img src="' + url_foto + '" width="100" height="100" alt="foto" /></a>';
html = html + '       <div class="' + class_activo + '"></div><!-- === cierre div activo o inactivo === -->';
html = html + '    </div><!-- === cierre div foto === -->';
html = html + '  </div><!-- === cierre div contenedorfoto === -->';
numero_usuarios++;
}
if (numero_aquien_sigo == 0) {
numero_aquien_sigo = numero_usuarios;
}
f_pinta_html_numero_seguidos(numero_aquien_sigo, 'id_aquien_sigo');
var divCaja = document.getElementById('id_usuarios_aquien_sigo');
divCaja.innerHTML = html;
}
function f_muestra_a_quien_sigo(hashDatos) {
f_pinta_html_a_quien_sigo(hashDatos);
}
function f_procesa_a_quien_sigo(httpRequest) {
var numero_aquien_sigo = 0;
if (httpRequest.status != 200) {
alert("No se ha podido obtener a quien sigo");
} else {
var data = httpRequest.responseText;
eval("hashTMP = " + data);
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
f_pinta_html_a_quien_sigo_movil(hashTMP);
} else {
f_pinta_html_a_quien_sigo(hashTMP);
}
}
}
function f_obtener_quien_sigo() {
var numero_seguidos = 0;
var cadena_params = "action=list_usuarios&max=" + _numero_maximo_usuarios_conectados;
cadena_params += '&sort=1';
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
METUtils_makeHttpRequestGet(f_procesa_a_quien_sigo, _urlUTOI + "?" + cadena_params);
}

function f_procesa_denegados(httpRequest) {
var numero_aquien_sigo = 0;
if (httpRequest.status != 200) {
alert("No se ha podido obtener los usuarios bloqueados");
}
else {
var data = httpRequest.responseText;
eval("hashTMP = " + data);
_hashListaDenegados = hashTMP;
f_pinta_denegados_para_listado(hashTMP);

}
}
function f_obtener_denegados(idUsuario) {
var numero_seguidos = 0;
var cadena_params = 'action=list_denegaciones';
if (_idUsuario != '') {
cadena_params += "&user=" + idUsuario;
}
_idUsuario = idUsuario;
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
METUtils_makeHttpRequestGet(f_procesa_denegados, _urlUTOI + "?" + cadena_params);
}

function f_pinta_denegados_para_listado(hashDatos) {
var numero_usuarios = 0;
var hashUsuarios    = hashDatos.perfilesUsuarios;
var numero_usuarios = hashDatos.numeroUsuarios;
if (numero_usuarios > 0) {
for (var clave_usuario in hashUsuarios) {
usuario = hashUsuarios[clave_usuario];
var boton_bloquear    = document.getElementById('id_boton_bloquear_'    + clave_usuario);
var boton_desbloquear = document.getElementById('id_boton_desbloquear_' + clave_usuario);
if (boton_bloquear) {
boton_bloquear.style.display  = 'none';
}
if (boton_desbloquear) {
boton_desbloquear.style.display = '';
}
}
}
}
function f_cerrar_detalles() {
var divCaja = document.getElementById('id_detalles_evento');
divCaja.style.display = 'none';
var botonCerrar = document.getElementById('boton_cerrar_detalles');
var botonVer = document.getElementById('boton_ver_detalles');
botonCerrar.style.display = 'none';
botonVer.style.display    = '';
_detallesEventoCerrados = true;
}
function f_abrir_detalles() {
var divCaja = document.getElementById('id_detalles_evento');
divCaja.style.display = '';
var botonCerrar = document.getElementById('boton_cerrar_detalles');
var botonVer = document.getElementById('boton_ver_detalles');
botonCerrar.style.display = '';
botonVer.style.display    = 'none';
_detallesEventoCerrados = false;
}
function f_cerrar_panel_aviso() {
f_cerrar_panel('id_caja_aviso');
var botonDejar  = document.getElementById('boton_dejar_evento');
var botonSeguir = document.getElementById('boton_seguir_evento');
botonDejar.className  = '';
botonSeguir.className = '';
}
function f_obtener_html_caja_escribir_evento(botonera_visible) {
var estilo_visible = '';
var estilo_textarea = '';
if (botonera_visible == 0) {
estilo_visible = 'style="visibility: hidden;"';
estilo_textarea = 'readonly';
}
var html = '<form id="formulario_escribir" name="formulario_escribir" method="post" enctype="multipart/form-data" action="' + _urlInutoi + '" target="iframe_escribir" >';
html = html + '<div class="contenedorlabelymas">';
html = html + '   <label>Tu mensaje</label>';
html = html + '   <p><span id="etiqueta_numero_maximo_caracteres" class="numero">' + _numero_maximo_caracteres_mensaje + '</span> caracteres</p>';
html = html + '</div><!-- === cierre div contenedorlabelymas === -->';
html = html + '<textarea ' + estilo_textarea + ' id="campo_formulario_texto_mensaje" name="campo_formulario_texto_mensaje" onchange="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onkeypress="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onkeyup="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onfocus="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');"></textarea>';
html = html + '<input type="hidden" name="m" id="m" value="" />';
html = html + '<input type="hidden" name="t" id="t" value="" />';
html = html + '<input type="hidden" name="x" id="x" value="" />';
html = html + '<input type="hidden" name="c" id="c" value="add" />';
html = html + '<input type="hidden" name="f" id="f" value="html" />';
html = html + '<div id="id_botones" class="botones" ' + estilo_visible + '>';
html = html + '   <a class="primero"  id="boton_adjuntar" href="javascript:void(0);" onclick="javascript:f_mostrar_caja_adjuntar_imagen();">Adjuntar imagen</a>';
html = html + '   <a class="publicar" id="boton_publicar" href="javascript:void(0);" onclick="javascript:f_publica(\'evento\');">Publicar</a>';
html = html + '</div><!-- === cierre div botones === -->';
html = html + '<div class="capaopciones" id="capaopciones_adjuntar" style="display:none;"></div><!-- === cierre div capaopciones === -->';
html = html + '<div class="capaopciones" id="capaopciones_destino" style="display:none;"></div><!-- === cierre div capaopciones === -->';
html = html + ' <iframe style="display:none" src="about:blank" id="iframe_escribir" name="iframe_escribir" onLoad="comprobarPost_mensaje_evento(\'escribir\', \'add\', 0);" ></iframe>';
html = html + '</form>';
return html;
}
function f_obtener_html_caja_escribir_evento_falsa(mensaje) {
var html = '';
html = html + '<form id="formulario_escribir" name="formulario_escribir" method="post" enctype="multipart/form-data" action="' + _urlInutoi + '" target="iframe_escribir" >';
html = html + '<div class="contenedorlabelymas">';
html = html + '   <label>Tu mensaje</label>';
html = html + '   <p><span id="etiqueta_numero_maximo_caracteres" class="numero">' + _numero_maximo_caracteres_mensaje + '</span> caracteres</p>';
html = html + '</div><!-- === cierre div contenedorlabelymas === -->';
if (mensaje != '') {
html = html + mensaje;
}
html = html + '<div id="id_botones" class="botones">';
html = html + '   <span class="primero">Adjuntar imagen</span>';
html = html + '   <span class="publicar">Publicar</span>';
html = html + '</div><!-- === cierre div botones === -->';
html = html + '</form>';
return html;
}
function f_pinta_caja_escribir_evento(idEvento, eventoActivo, estadoEscrituraEvento, eventoSuscripcionAutomatica) {
var html = '';
var html_caja = '';
var html_escribir = '';
var pintar_botones = 0;
if (_nickname == '') {
html_escribir = html_escribir + '  <div class="aviso">';
html_escribir = html_escribir + '  <p class="solicitudenviada">Tienes que estar <a href="' + _url_utoi_nuevousuario + '" title="Registrarme ahora">registrado</a> y haber <a href="' + _url_utoi_iniciarsesion + '" title="Iniciar sesi&oacute;n ahora">iniciado sesi&oacute;n</a> para poder enviar mensajes.</p>';
html_escribir = html_escribir + '  </div><!-- === cierre div aviso === -->';
html_caja = f_obtener_html_caja_escribir_evento_falsa(html_escribir);
class_para_div = 'escribirmensajefalsa';
}
else {
if (eventoActivo == 0) {
html_escribir = html_escribir + '  <div class="aviso">';
html_escribir = html_escribir + '  <p>El tema est&aacute; cerrado y no se permite escribir m&aacute;s mensajes</p>';
html_escribir = html_escribir + '  </div><!-- === cierre div aviso === -->';
html_caja = f_obtener_html_caja_escribir_evento_falsa(html_escribir);
class_para_div = 'escribirmensajefalsa';
}
else {
if (estadoEscrituraEvento == 0) {
html_escribir = html_escribir + '  <div class="aviso">';
if (eventoSuscripcionAutomatica == 1) {
html_escribir = html_escribir + '    <p>Si quieres escribir en este tema pulsa el bot&oacute;n. &iexcl;Gracias!</p>';
}
else {
html_escribir = html_escribir + '  <p>Este tema es de participaci&oacute;n restringida. Si quieres formar parte de esta comunidad tienes que solicitarlo pulsando el bot&oacute;n. &iexcl;Gracias!</p>';
}
html_escribir = html_escribir + '    <div class="botones">';
html_escribir = html_escribir + '       <a href="javascript:void(0);" onclick="javascript:f_solicitar_permiso_escritura(\'' + idEvento + '\');" class="botonescribir">Quiero escribir</a>';
html_escribir = html_escribir + '    </div><!-- === cierre div botones === -->';
html_escribir = html_escribir + '  </div><!-- === cierre div aviso === -->';
html_caja = f_obtener_html_caja_escribir_evento_falsa(html_escribir);
class_para_div = 'escribirmensajefalsa';
}
else {
if (estadoEscrituraEvento == 2) {
html_escribir = html_escribir + '  <div class="aviso">';
html_escribir = html_escribir + '    <p class="solicitudenviada">Estamos analizando tu solicitud para escribir.<br />En breve nos pondremos en contacto contigo. &iexcl;Gracias!</p>';
html_escribir = html_escribir + '  </div><!-- === cierre div aviso === -->';
html_caja = f_obtener_html_caja_escribir_evento_falsa(html_escribir);
class_para_div = 'escribirmensajefalsa';
}
else {
pintar_botones = 1;
html_caja = f_obtener_html_caja_escribir_evento(pintar_botones);
class_para_div = 'escribirmensaje';
}
}
}
}
html = html_caja;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.className = class_para_div;
divCajaEscribir.innerHTML = html;
}
function f_solicitar_permiso_escritura(idEvento) {
if (_hashDatosEvento.sub_automatica == 1) {
f_peticion_utoi_escritura(idEvento);
}
else {
var html_aportacion = '';
html_aportacion = html_aportacion + '  <div class="aviso">';
html_aportacion = html_aportacion + '    <p>El creador de este grupo tiene la llave. Conv&eacute;ncele para que te abra</p>';
html_aportacion = html_aportacion + '    <div class="formulario">';
html_aportacion = html_aportacion + '        <textarea id="id_campo_formulario_texto_solicitud" name="campo_formulario_texto_solicitud" class="enviarsolicitud" value="" ></textarea>';
html_aportacion = html_aportacion + '        <div class="botones"><a href="javascript:void(0);" onclick="javascript:f_pinta_html_informacion_evento(\'' + idEvento + '\');" class="cancelar">Cancelar</a> <a href="javascript:void(0);" onclick="javascript:f_peticion_utoi_escritura(\'' + idEvento + '\');" class="publicar">Enviar</a> </div><!-- === cierre div botones === -->';
html_aportacion = html_aportacion + '      <div style="clear: both;"></div>';
html_aportacion = html_aportacion + '    </div><!-- === cierre div formulario === -->';
html_aportacion = html_aportacion + '  </div><!-- === cierre div aviso === -->';
html = f_obtener_html_caja_escribir_evento_falsa(html_aportacion);
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.className = 'escribirmensajefalsa';
divCajaEscribir.innerHTML = html;
f_poner_foco_campo_texto('id_campo_formulario_texto_solicitud');
}
}
function f_mostrar_peticion_seguir_evento(idEvento) {
if (_mostrar_captcha) {
var html =    '<div class="escribirmensaje">';
html = html + '  <div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '    <div class="captcha">';
html = html + '      <p>Por favor, teclea los n&uacute;meros de la izquierda en la caja de la derecha y pulsa Enviar.</p>';
html = html + '      <div class="contenedorcatpcha">';
html = html + '      <div class="imagencaptcha"><img src="http://www.soitu.es/captcha/captchaimg.pl" alt="captcha" /></div><!-- === cierre div imagencaptcha === -->';
html = html + '      <div class="pymas">';
html = html + '      <input name="capcha" autocomplete="off" type="text">';
html = html + '      </div><!-- === cierre div pymas === -->';
html = html + '      </div><!-- === cierre div contenedorcaptcha === -->';
html = html + '      <div class="botones"><a href="javascript:void(0);" onclick="javascript:f_peticion_utoi_seguir_evento(\'seguir_suscripcion\', \'' + idEvento + '\');" class="publicar">Aceptar</a> <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel_aviso();" class="cancelar">Cancelar</a></div><!-- === cierre div botones === -->';
html = html + '    </div><!-- === cierre div captcha === -->';
html = html + '  </form>';
html = html + '  </div><!-- === cierre div seguir === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var cajaAviso = document.getElementById('id_caja_aviso');
cajaAviso.innerHTML = html;
}
else {
f_peticion_utoi_seguir_evento('seguir_suscripcion', idEvento);
}
}
function f_dejar_evento(idEvento) {
var botonDejar  = document.getElementById('boton_dejar_evento');
var botonSeguir = document.getElementById('boton_seguir_evento');
botonDejar.className = 'activo';
var cajaBotonera        = document.getElementById('id_caja_botonera');
var cajaCaracteristicas = document.getElementById('id_caja_caracteristicas');
var cajaAviso = document.getElementById('id_caja_aviso');
if (cajaAviso == null) {
cajaAviso = document.createElement('DIV');
cajaAviso.id = 'id_caja_aviso';
}
else {
cajaAviso.style.display = '';
}
var html =    '<div class="escribirmensaje">';
html = html + '  <div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '    <p>Est&aacute;s seguro que quieres dejar de seguir este evento? </p>';
html = html + '    <div class="botones"><a href="javascript:void(0);" onclick="javascript:f_peticion_utoi_seguir_evento(\'dejar_suscripcion\', \'' + idEvento + '\');" class="publicar">Aceptar</a> <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel_aviso();" class="cancelar">Cancelar</a></div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '  </div><!-- === cierre div seguir === -->';
html = html + '</div><!-- === cierre div seguir === -->';
cajaAviso.innerHTML = html;
cajaCaracteristicas.insertBefore(cajaAviso, cajaBotonera.nextSibling);
}
function f_seguir_evento(idEvento) {
var botonDejar  = document.getElementById('boton_dejar_evento');
var botonSeguir = document.getElementById('boton_seguir_evento');
botonSeguir.className = 'activo';
var cajaBotonera        = document.getElementById('id_caja_botonera');
var cajaCaracteristicas = document.getElementById('id_caja_caracteristicas');
var cajaAviso = document.getElementById('id_caja_aviso');
if (cajaAviso == null) {
cajaAviso = document.createElement('DIV');
cajaAviso.id = 'id_caja_aviso';
}
else {
cajaAviso.style.display = '';
}
var html =    '<div class="escribirmensaje">';
html = html + '  <div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '    <p>Est&aacute;s seguro que quieres seguir este evento? </p>';
html = html + '    <div class="botones"><a href="javascript:void(0);" onclick="javascript:f_mostrar_peticion_seguir_evento(\'' + idEvento + '\');" class="publicar">Aceptar</a> <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel_aviso();" class="cancelar">Cancelar</a></div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '  </div><!-- === cierre div seguir === -->';
html = html + '</div><!-- === cierre div seguir === -->';
cajaAviso.innerHTML = html;
cajaCaracteristicas.insertBefore(cajaAviso, cajaBotonera.nextSibling);
}
function f_pinta_html_informacion_evento(idEvento) {
var html = '';
var nombreEvento        = _hashDatosEvento.nombre;
var descripcionEvento   = _hashDatosEvento.descripcion;
var pathfotoEvento = _url_imagen_por_defecto;
if (_hashDatosEvento.pathfoto != '') {
pathfotoEvento = _hashDatosEvento.pathfoto;
}
var eventoActivo      = _hashDatosEvento.activo;
var descripcionEstado = _hashDatosEvento.descripcionEstado;
var seguimiento_usuario = false;
if (_hashEventosSeguidos[idEvento]) {
seguimiento_usuario = true;
}
var suscripcion_diferida_escritura = false;
if (_hashDatosEvento.sub_automatica == 0) {
suscripcion_diferida_escritura = true;
}
var ancho_caja_con_dimensiones = 'style="width: 450px;"';
var ancho_caja = '';
var class_estado = '';
var html_icono_suscripcion = '';
if (eventoActivo == 0) {
class_estado = '<span class="cerradopor">Cerrado</span> ';
ancho_caja = ancho_caja_con_dimensiones;
html_icono_suscripcion = '  <div class="info"><img src="/Iconos/v1.x/v1.0/varios/ico_tema_cerrado.png" width="34" height="35" alt="Tema cerrado" title="Tema cerrado" /></div>';
}
else {
if (eventoActivo == 'temporal') {
class_estado = '<span class="temporalpor">Temporal</span> ';
}
if (suscripcion_diferida_escritura == true) {
ancho_caja = ancho_caja_con_dimensiones;
html_icono_suscripcion = '  <div class="info"><img src="/Iconos/v1.x/v1.0/varios/ico_tema_suscripcion.png" width="51" height="38" alt="Tema para suscripcion" title="Tema para suscripcion"/></div>';
}
}
html = html +  '<div class="contenedorencabezado">';
html = html + '  <h2 ' + ancho_caja + '>' + nombreEvento + '</h2>';
html = html + html_icono_suscripcion;
html = html + '</div><!-- === cierre div contenedorencabezado === -->';
html = html + '<div id="id_caja_caracteristicas" class="caracteristicas">';
html = html + '<div id="id_caja_botonera" class="contenedorbotones">';
html = html + '  <ul>';
var estilo_cerrar_detalles = '';
var estilo_ver_detalles = '';
if ( _detallesEventoCerrados) {
estilo_cerrar_detalles = 'style="display: none;"';
}
else {
estilo_ver_detalles = 'style="display: none;"';
}
html = html + '  <li id="boton_cerrar_detalles" ' + estilo_cerrar_detalles + '><a href="javascript:void(0);" onclick="javascript:f_cerrar_detalles();" class="detalles2">Cerrar</a></li>';
html = html + '  <li id="boton_ver_detalles" '    + estilo_ver_detalles + '><a href="javascript:void(0);" onclick="javascript:f_abrir_detalles();" class="detalles1">Detalles</a></li>';
var estilo_dejar_evento  = '';
var estilo_seguir_evento = '';
if (_nickname == '') {
html = html + '  <li id="boton_seguir_evento" ' + estilo_seguir_evento + '><span class="inactivo">Quiero seguirlo</span></li>';
}
else {
if (seguimiento_usuario == true) {
estilo_seguir_evento = 'style="display: none;"';
}
else {
estilo_dejar_evento = 'style="display: none;"';
}
html = html + '  <li id="boton_dejar_evento" '  + estilo_dejar_evento + '><a href="javascript:void(0);" onclick="javascript:f_dejar_evento(\'' + idEvento + '\');" class="botonyanoseguir">Dejar de seguirlo</a></li>';
html = html + '  <li id="boton_seguir_evento" ' + estilo_seguir_evento + '><a href="javascript:void(0);" onclick="javascript:f_seguir_evento(\'' + idEvento + '\');" class="botonseguir">Quiero seguirlo</a></li>';
}
html = html + '  <li><a href="/Oututoi?f=rss&t=ev-' + idEvento + '" class="botonrss" title="Apuntarse al RSS"><img src="/Iconos/v1.x/v1.0/varios/ico_rss.png" width="36" height="14" /></a></li>';
html = html + '  </ul>';
html = html + '</div><!-- === cierre div contenedorbotones === -->';
if ( _detallesEventoCerrados) {
estilo_detalles = 'style="display: none;"';
}
else {
estilo_detalles = '';
}
html = html + '<div id="id_detalles_evento" class="capadetalles" ' + estilo_detalles + ' >';
html = html + '<div class="fotoizquierda">';
html = html + '  <div class="foto"><img id="fotoEvento" src="' + pathfotoEvento + '" width="135" height="135" alt="Foto del tema" /></div><!-- === cierre div foto === -->';
html = html + '</div><!-- === cierre div fotoizquierda === -->';
html = html + '  <ul>';
if (class_estado != '') {
html = html + '    <li>' + class_estado + '</li>';
}
if (_hashDatosEvento.num_mensajes > 0) {
if (_hashDatosEvento.num_mensajes > 1) {
html = html + '    <li><strong>' + _hashDatosEvento.num_mensajes + '</strong> mensajes, ';
}
else {
html = html + '    <li><strong>' + _hashDatosEvento.num_mensajes + '</strong> mensaje, ';
}
if (_hashDatosEvento.ts_ultimo_mensaje) {
var texto_html = f_obtener_html_ultima_actualizacion_evento(_hashDatosEvento.ts_ultimo_mensaje, 1);
html = html + 'el &uacute;ltimo ' + texto_html + '</li>';
html = html + '</li>';
}
}
else {
html = html + '    <li>No hay ning&uacute;n mensaje</li>';
}
if (_hashDatosEvento.numero_seguidores_evento > 0) {
if (_hashDatosEvento.numero_seguidores_evento == 1) {
html = html + '    <li>Lo sigue s&oacute;lo <strong>' + _hashDatosEvento.numero_seguidores_evento + '</strong> usuario ';
}
else {
html = html + '    <li>Lo siguen <strong>' + _hashDatosEvento.numero_seguidores_evento + '</strong> usuarios ';
}
html = html + '    <a href="/' + '*' + idEvento + '/seguidores">Ver todos &raquo;</a></li>';
}
else {
html = html + '    <li>Todav&iacute;a no lo sigue nadie</li>';
}
if (_hashDatosEvento.numero_writers_evento > 0) {
if (_hashDatosEvento.numero_writers_evento == 1) {
html = html + '    <li>Puede escribir <strong>' + _hashDatosEvento.numero_writers_evento + '</strong> usuario ';
}
else {
html = html + '    <li>Pueden escribir <strong>' + _hashDatosEvento.numero_writers_evento + '</strong> usuarios ';
}
html = html + '    <a href="/' + '*' + idEvento + '/escritores">Ver todos &raquo;</a></li>';
}
else {
html = html + '    <li>Todav&iacute;a no escribe nadie en el evento</li>';
}
var nombreparamovil = idEvento;
if ( (_hashDatosEvento.nombreparamovil) && (_hashDatosEvento.nombreparamovil != '') ) {
nombreparamovil = _hashDatosEvento.nombreparamovil;
}
html = html + '     <li><div id="id_clave_sms_' + idEvento + '">Clave SMS: <a href="javascript:void(0);" onclick="javascript:f_muestra_panel_informacion_sms(\'id_clave_sms_' + idEvento + '\');" title="&iquest;Qu&eacute; es esto?">*' + nombreparamovil + '</a></div></li>';
html = html + f_obtener_html_informacion_sms();

if (_hashDatosEvento.adm) {
var texto_html = f_obtener_html_administradores_evento(_hashDatosEvento.adm);
if (texto_html != '') {
html = html + '     <li>Administrado por: ' + texto_html + '</li>';
}
}
html = html + '  </ul>';
html = html + '  <p class="contexto">' + descripcionEvento + '</p>';
html = html + '</div><!-- === cierre div capadetalles === -->';
html = html + '</div><!-- === cierre div caracteristicas === -->';
var caja = document.getElementById('id_info_evento');
caja.innerHTML = html;
f_pinta_caja_escribir_evento(idEvento, eventoActivo, _hashDatosEvento.estado_escritura, _hashDatosEvento.sub_automatica);
}
function f_obtener_html_etiquetas_evento(lista_etiquetas) {
var html_etiquetas = '';
var numero_etiquetas = lista_etiquetas.length;
for (i = 0; i < numero_etiquetas; i++) {
etiqueta = lista_etiquetas[i];
if (i != 0) {
html_etiquetas = html_etiquetas + ', ';
}
html_etiquetas = html_etiquetas + '<a href="/soitu/tags/portadilla/' + etiqueta + '/">' + etiqueta + '</a>';
}
return html_etiquetas;
}
function f_obtener_html_administradores_evento(lista_administradores) {
var html_administradores = '';
var numero_administradores = lista_administradores.length;
for (i = 0; i < numero_administradores; i++) {
adm = lista_administradores[i];
if (i != 0) {
html_administradores = html_administradores + ', ';
}
html_administradores = html_administradores + '<a href="/' + adm + '" title="Ver perfil">' + adm + '</a>';
}
return html_administradores;
}
function f_obtener_html_ultima_actualizacion_evento(ts_actualizacion, mostrar_horaminutosegundo) {
var ts_actual = '';
if (_tsServidor == 0) {
var date_actual  = new Date();
var ts_actual = date_actual.getTime();
}
else {
ts_actual = _tsServidor;
}
var segundo = 1;
var minuto = 60 * segundo;
var hora   = 60 * minuto;
var dia    = 24 * hora;
diferencia = ts_actual - ts_actualizacion;
var tiempo = '';
var cadena = '';
if (diferencia < minuto) {
cadena = ' hace <strong>1</strong> minuto';
}
else if ( (diferencia > minuto) && (diferencia < hora) ) {
tiempo = parseInt(diferencia / minuto);
cadena = ' hace <strong>' +  tiempo + '</strong> minutos';
}
else if ( (diferencia > hora) && (diferencia < dia) ) {
tiempo = parseInt(diferencia / hora);
if (tiempo > 1) {
cadena = ' hace <strong>' +  tiempo + '</strong> horas';
}
else {
cadena = ' hace <strong>' +  tiempo + '</strong> hora';
}
}
else {
cadena = "el d&iacute;a " + f_obtener_fecha_visible(ts_actualizacion, mostrar_horaminutosegundo);
}
return cadena;
}
function f_obtener_fecha_visible(ts_fecha, mostrar_horaminutosegundo) {
var date_actualizacion = new Date(ts_fecha * 1000);
var dia  = date_actualizacion.getDate();
var mes  = date_actualizacion.getMonth();
var agno = date_actualizacion.getFullYear();
var hora    = date_actualizacion.getHours();
var minuto  = date_actualizacion.getMinutes();
var segundo = date_actualizacion.getSeconds();
if (dia <= 9) {
dia = '0' + dia;
}
mes++;
if (mes <= 9) {
mes = '0' + mes;
}
if (hora <= 9) {
hora = '0' + hora;
}
if (minuto <= 9) {
minuto = '0' + minuto;
}
if (segundo <= 9) {
segundo = '0' + segundo;
}
var cadena = dia + '/' + mes + '/' + agno;
if (mostrar_horaminutosegundo == 1) {
cadena = cadena + ' -- ' + hora + ':' + minuto + ':' + segundo;
}
return cadena;
}

function f_procesa_informacion_evento(idEvento, datos) {
var _hashTMP = Array();
eval("_hashTMP = " + datos);
if (! _hashTMP.perfilesEventos[idEvento]) {
alert("No se han podido obtener los datos del evento (" + idEvento + ")");
return false;
}
else {
_hashDatosEvento = _hashTMP.perfilesEventos[idEvento];
}
if (_hashDatosEvento.pathfoto == '') {
_hashDatosEvento.pathfoto = _url_imagen_por_defecto;
}
if (! _hashDatosEvento.activo) {
_hashDatosEvento.activo = 0;
}
if (! _hashDatosEvento.num_mensajes) {
_hashDatosEvento.num_mensajes = '0';
}
if (! _hashDatosEvento.ts_ultimo_mensaje) {
_hashDatosEvento.ts_ultimo_mensaje = '';
}
if (! _hashDatosEvento.adm) {
_hashDatosEvento.adm = new Array();
}
if (! _hashDatosEvento.etiquetas) {
_hashDatosEvento.etiquetas = new Array();
}
if (! _hashDatosEvento.estado_seguimiento) {
_hashDatosEvento.estado_seguimiento = 0;
}
}
function f_pinta_nombre_usuario_en_mensaje(idUsuario, idCampo) {
if (idUsuario == '') {
return false;
}
var cadena_params = "action=info_usuarios&user=" + idUsuario;
var date_actual  = new Date();
var ts_actual = date_actual.getTime();
cadena_params += "&ts=" + parseInt(ts_actual);
METUtils_makeHttpRequestGet(function(httpRequest) {
document.getElementById('boton_ver_nombre_completo').className = 'oculto';
document.getElementById('ver_nombre_completo_cargando').className = 'alavista';
var cajaNombre = document.getElementById(idCampo);
var nombreCompleto = 'No existe informaci&oacute;n';
if (httpRequest.status == 200) {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
if (hashTMP.perfilesUsuarios[idUsuario]) {
hashDatos = hashTMP.perfilesUsuarios[idUsuario];
var nombreUsuario    = hashDatos.nombre;
var apellidosUsuario = hashDatos.apellidos;
if (apellidosUsuario != '') {
nombreCompleto = nombreUsuario + ' ' + apellidosUsuario;
}
else {
if (nombreUsuario != '') {
nombreCompleto = nombreUsuario;
}
}
}
}
if (document.getElementById(idCampo)) {
cajaNombre.innerHTML = '(' + nombreCompleto + ')';
}
document.getElementById('ver_nombre_completo_cargando').className = 'oculto';
}, _urlUTOI + "?" + cadena_params);
}

function f_pinta_html_informacion_usuario(idUsuario, hashDatosUsuario) {
var html = '';
var estilo_dejar_usuario        = '';
var estilo_seguir_usuario       = '';
var estilo_bloquear_usuario     = '';
var estilo_desbloquear_usuario  = '';
var nombreUsuario    = hashDatosUsuario.nombre;
var apellidosUsuario = hashDatosUsuario.apellidos;
var usuarioActivo    = hashDatosUsuario.activo;
var pathfotoUsuario  = hashDatosUsuario.pathfoto;
if (pathfotoUsuario == '') {
pathfotoUsuario = _url_imagen_usuario_por_defecto;
}
var urlUsuario         = '';
var profesionUsuario   = '';
var descripcionUsuario = '';
if (hashDatosUsuario.urlwebpersonal) {
urlUsuario = f_comprobar_url_valida(hashDatosUsuario.urlwebpersonal);
}
if (hashDatosUsuario.profesion) {
profesionUsuario = hashDatosUsuario.profesion;
}
if (hashDatosUsuario.descripcion) {
descripcionUsuario = hashDatosUsuario.descripcion;
}
var usuarioSeguido     = false;
var usuarioBloqueado   = false;
if (_nickname != '') {
if (hashDatosUsuario.seguido == 1) {
usuarioSeguido = true;
}
else {
usuarioSeguido = false;
}
if (hashDatosUsuario.bloqueado == 1) {
usuarioBloqueado = true;
}
}
var numeroUsuariosSeguidores = hashDatosUsuario.numero_seguidores;
var numeroUsuariosSeguidos   = hashDatosUsuario.numero_usuarios;
var numeroEventosSeguidos    = hashDatosUsuario.numero_eventos;
var numeroMensajes   		 = hashDatosUsuario.numero_mensajes_propios;
var numeroReferencias 		 = hashDatosUsuario.numero_mensajes_referenciados;
if (usuarioActivo == '0') {
class_activo = 'inactivo';
}
else {
class_activo = 'activo';
}
var html =    '<div class="pico"></div><!-- === cierre div pico === -->';
html = html + '<div class="contadores">';
html = html + '  <div class="contador"><a href="/' + idUsuario + '/seguidos" title="Ver todos">Sigue a:</a><div id="id_numero_usuarios_seguidos" class="numero">' + numeroUsuariosSeguidos + '</div></div>';
html = html + '  <div class="contador"><a href="/' + idUsuario + '/seguidores" title="Ver todos">Le siguen:</a><div id="id_numero_usuarios_seguidores" class="numero">' + numeroUsuariosSeguidores + '</div></div>';
html = html + '  <div class="contador"><a href="/' + idUsuario + '/temasseguidos" title="Ver todos">Temas que sigue:</a><div id="id_numero_temas_seguidos" class="numero">' + numeroEventosSeguidos + '</div></div>';
html = html + '  <div class="contador"><a href="/' + idUsuario + '" title="Ver todos">Mensajes enviados:</a><div id="id_numero_mensajes_enviados" class="numero">' + numeroMensajes + '</div></div>';
html = html + '  <div class="contador"><a href="/' + idUsuario + '/referencias" title="Ver todos">Menciones:</a><div id="id_numero_mensajes_referenciados" class="numero">' + numeroReferencias + '</div></div>';
html = html + '</div>';
html = html + '<div class="principal">';
html = html + '      <div class="contenedorbotones">';
html = html + '         <ul>';
if (_nickname != '') {
if (usuarioSeguido == false) {
estilo_dejar_usuario = 'style="display: none;"';
}
else {
estilo_seguir_usuario = 'style="display: none;"';
}
html = html + '           <li id="opcion_seguir_usuario" ' + estilo_seguir_usuario + '><a href="javascript:void(0);" onclick="javascript:f_pinta_caja_confirmacion_seguir(\'seguir\', \'' + idUsuario + '\');" class="botonseguir">Seguir al usuario</a></li>';
html = html + '           <li id="opcion_dejar_usuario" ' + estilo_dejar_usuario + '><a href="javascript:void(0);" onclick="javascript:f_pinta_caja_confirmacion_seguir(\'dejar\', \'' + idUsuario + '\');" class="botonyanoseguir">Dejar de seguir</a></li>';
if (idUsuario != _nickname) {
if (usuarioBloqueado == false) {
estilo_desbloquear_usuario = 'style="display: none;"';
}
else {
estilo_bloquear_usuario = 'style="display: none;"';
}
html = html + '           <li id="opcion_bloquear_usuario" '    + estilo_bloquear_usuario + '><a href="javascript:void(0);" onclick="javascript:f_confirmar_peticion_bloquear(\'bloquear\', \'' + idUsuario + '\');" class="botonbloquear">Bloquear al usuario</a></li>';
html = html + '           <li id="opcion_desbloquear_usuario" ' + estilo_desbloquear_usuario + '><a href="javascript:void(0);" onclick="javascript:f_confirmar_peticion_bloquear(\'desbloquear\', \'' + idUsuario + '\');" class="botonyanobloquear">Desbloquear usuario</a></li>';
html = html + '           <li id="opcion_envio_privado" ><a href="javascript:void(0);" onclick="javascript:f_pinta_caja_envio_privado(\'' + idUsuario + '\');" class="botonenviarprivado">Enviar privado</a></li>';
}
else {
html = html + '           <li id="opcion_bloquear_usuario"><span class="inactivo">Bloquear al usuario</span></li>';
html = html + '           <li id="opcion_envio_privado"><span class="inactivo">Enviar privado</span></li>';
}
}
else {
html = html + '           <li id="opcion_seguir_usuario"><span class="inactivo">Seguir al usuario</span></li>';
html = html + '           <li id="opcion_bloquear_usuario"><span class="inactivo">Bloquear al usuario</span></li>';
html = html + '           <li id="opcion_envio_privado"><span class="inactivo">Enviar privado</span></li>';
}
html = html + '         </ul>';
html = html + '      </div><!-- === cierre div contenedorbotones === -->';
html = html + '      <div id="id_escribir_mensaje_' + idUsuario + '" style="display: none;" class="escribirmensaje"></div><!-- === cierre div escribirmensaje === -->';
html = html + '      <div class="contenedordetalles">';
html = html + '        <div class="izquierda">';
html = html + '           <div class="contenedorfoto">';
html = html + '             <div class="foto"><img src="' + pathfotoUsuario + '" width="75" height="75" alt="avatar" /></div><!-- === cierre div foto === -->';
html = html + '           </div><!-- === cierre div contenedorfoto === -->';
html = html + '           <div class="estado">';
html = html + '             <div class="' + class_activo + '"></div>';
html = html + '           </div>';
html = html + '        </div>';
if (_detallesUsuarioCerrados) {
estilo_detalles             = 'style="display: none;"';
}
else {
estilo_detalles             = 'style=""';
}
html = html + '        <div id="id_detalles_usuario" class="detalles" ' + estilo_detalles + '>';
html = html + '           <div class="alias" title="nickdelusuarioporsinocabe">' + idUsuario + '</div>';
var nombreCompleto = nombreUsuario;
if (apellidosUsuario != '') {
nombreCompleto = nombreUsuario + ' ' + apellidosUsuario;
}
if (nombreCompleto != idUsuario) {
html = html + '       <div class="nombre">' + nombreCompleto + '</div>';
}
if (profesionUsuario != '') {
html = html + '       <div class="profesion">' + profesionUsuario + '</div>';
}
if (urlUsuario != '') {
html = html + '       <div class="web"><a href="' + urlUsuario + '" title="Visitar sitio web">' + urlUsuario + '</a></div>';
}
if (descripcionUsuario != '') {
html = html + '      <div id="boton_mostrar_detalles" style="display: none;"' + ' class="botondetalles2"><a href="javascript:void(0);" onclick="javascript:f_descripcion_usuario(\'abrir\', \''  + idUsuario + '\');">Mostrar descripci&oacute;n</a></div>';
html = html + '      <div id="boton_ocultar_detalles" style=""'               + ' class="botondetalles1"><a href="javascript:void(0);" onclick="javascript:f_descripcion_usuario(\'cerrar\', \'' + idUsuario + '\');">Ocultar descripci&oacute;n</a></div>';
html = html + '       <p id="id_descripcion_usuario"  style="">' + descripcionUsuario + '</p>';
}
html = html + '    </div><!-- === cierre div principal === -->';
html = html + '        </div><!-- === cierre div detalles === -->';
html = html + '      </div>';
html = html + '</div>';
html = html + '<div style="clear: both;"></div>';
var caja = document.getElementById('id_info_usuario');
caja.innerHTML = html;
}
function f_detalles_usuario(operacion, idUsuario) {
var boton_mostrar_detalles = document.getElementById('boton_mostrar_detalles');
var boton_ocultar_detalles = document.getElementById('boton_ocultar_detalles');
var caja_detalles = document.getElementById('id_detalles_usuario');
if (operacion == 'abrir') {
_detallesUsuarioCerrados = false;
boton_mostrar_detalles.style.display = 'none';
boton_ocultar_detalles.style.display = '';
caja_detalles.style.display = '';
f_cerrar_panel('id_escribir_mensaje_' + idUsuario);
}
else {
_detallesUsuarioCerrados = true;
boton_mostrar_detalles.style.display = '';
boton_ocultar_detalles.style.display = 'none';
caja_detalles.style.display = 'none';
}
}
function f_descripcion_usuario(operacion, idUsuario) {
var boton_mostrar_detalles = document.getElementById('boton_mostrar_detalles');
var boton_ocultar_detalles = document.getElementById('boton_ocultar_detalles');
var caja_descripcion = document.getElementById('id_descripcion_usuario');
if (operacion == 'abrir') {
boton_mostrar_detalles.style.display = 'none';
boton_ocultar_detalles.style.display = '';
caja_descripcion.style.display = '';
}
else {
_detallesUsuarioCerrados = true;
boton_mostrar_detalles.style.display = '';
boton_ocultar_detalles.style.display = 'none';
caja_descripcion.style.display = 'none';
}
}
function f_detalles_panel_usuario(operacion) {
var boton_mostrar_detalles = document.getElementById('boton_mostrar_detalles_panel_usuario');
var boton_ocultar_detalles = document.getElementById('boton_ocultar_detalles_panel_usuario');
var caja_detalles = document.getElementById('id_detalles_usuario');
var divError = document.getElementById('id_error_usuario');
var divUsuarios = document.getElementById('id_info_usuario');
divUsuarios.style.display = "none";
if (operacion == 'abrir') {
_detallesUsuarioCerrados = false;
boton_mostrar_detalles.style.display = 'none';
boton_ocultar_detalles.style.display = '';
divUsuarios.style.display = '';
}
else {
boton_mostrar_detalles.style.display = '';
boton_ocultar_detalles.style.display = 'none';
divUsuarios.style.display = 'none';
}
}
function f_desactiva_pestana_perfil_usuario() {
if (document.getElementById('opcion_bloquear_usuario')) {
document.getElementById('opcion_bloquear_usuario').className = '';
}
if (document.getElementById('opcion_desbloquear_usuario')) {
document.getElementById('opcion_desbloquear_usuario').className = '';
}
if (document.getElementById('opcion_seguir_usuario')) {
document.getElementById('opcion_seguir_usuario').className = '';
}
if (document.getElementById('opcion_dejar_usuario')) {
document.getElementById('opcion_dejar_usuario').className = '';
}
if (document.getElementById('opcion_envio_privado')) {
document.getElementById('opcion_envio_privado').className = '';
}
}
function f_confirmar_peticion_bloquear(operacion, idUsuario) {
var html    = '';
var mensaje = '';
var boton_bloquear    = document.getElementById('opcion_bloquear_usuario');
var boton_desbloquear = document.getElementById('opcion_desbloquear_usuario');
if (operacion == 'bloquear') {
mensaje = 'Si bloqueas al usuario evitar&aacute;s que te mande mensajes privados. &iquest;Seguro que quieres bloquearlo?';
f_desactiva_pestana_perfil_usuario();
boton_bloquear.className = 'activo';
}
else {
mensaje = '&iquest;Seguro que quieres desbloquear al usuario para que pueda volver a mandarte mensajes privados?';
f_desactiva_pestana_perfil_usuario();
boton_desbloquear.className = 'activo';
}
var html = '';
html = html + '<div class="bloquear">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '  <p>' + mensaje + '</p>';
html = html + '  <div id="id_botones_usuario" class="botones">';
html = html + '    <a id="id_boton_bloquear_' + idUsuario + '" href="javascript:void(0);" onclick="javascript:f_peticion_utoi_bloquear_usuario(\'' + operacion + '\',\'' + idUsuario + '\');" class="publicar">Confirmar</a>';
html = html + '    <a id="id_boton_cancelar_bloquear" href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + idUsuario + '\');f_desactiva_pestana_perfil_usuario();" class="cancelar">Cancelar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '</div><!-- === cierre div bloquear === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_pinta_caja_confirmacion_seguir(operacion, idUsuario) {
var html    = '';
var mensaje = '';
var boton_seguir = document.getElementById('opcion_seguir_usuario');
var boton_dejar  = document.getElementById('opcion_dejar_usuario');
if (operacion == 'seguir') {
if (idUsuario != _nickname) {
mensaje = '&iquest;Seguro que quieres seguir al usuario?';
}
else {
mensaje = '&iquest;Seguro que quieres seguirte?';
}
f_desactiva_pestana_perfil_usuario();
boton_seguir.className = 'activo';
}
else {
if (idUsuario != _nickname) {
mensaje = '&iquest;Seguro que quieres dejar de seguir al usuario?';
}
else {
mensaje = '&iquest;Seguro que quieres dejar de seguirte?';
}
f_desactiva_pestana_perfil_usuario();
boton_dejar.className = 'activo';
}
var html = '';
html = html + '<div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '  <p>' + mensaje + '</p>';
html = html + '  <div class="botones">';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_peticion_utoi_seguir_usuario(\'' + operacion + '\',\'' + idUsuario + '\');" class="publicar">Confirmar</a>';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + idUsuario + '\');f_desactiva_pestana_perfil_usuario();" class="cancelar">Cancelar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_pinta_caja_envio_privado(idUsuario) {
var html    = '';
var mensaje = '';
var date_actual = new Date();
var ts_actual = 1;
var html = '';
html = html + '<div class="seguir">';
html = html + '<p>Comprobando denegaciones...</p>';
html = html + '  <div class="botones">';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
f_comprobar_usuario_bloqueado(idUsuario);
var boton_envio = document.getElementById('opcion_envio_privado');
f_desactiva_pestana_perfil_usuario();
boton_envio.className    = 'activo';
var html = '';
html = html + '<form id="id_form_mensaje_privado" name="id_form_mensaje_privado" method="post" enctype="multipart/form-data" action="' + _urlInutoi + '" target="iframe_' + ts_actual + '" >';
html = html + '  <div class="contenedorlabelymas">';
html = html + '  <label>Tu mensaje</label>';
html = html + '  <p><span id="etiqueta_numero_maximo_caracteres" class="numero">' + _numero_maximo_caracteres_mensaje + '</span> caracteres</p>';
html = html + '  </div><!-- === cierre div contenedorlabelymas === -->';
html = html + '  <textarea id="campo_formulario_texto_mensaje" name="campo_formulario_texto_mensaje" onchange="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onkeypress="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onkeyup="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onfocus="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');"></textarea>';
html = html + '  <input type="hidden" name="m" id="m" value="" />';
html = html + '  <input type="hidden" name="t" id="t" value="' + idUsuario + '" />';
html = html + '  <input type="hidden" name="p" id="p" value="" />';
html = html + '  <input type="hidden" name="x" id="x" value="" />';
html = html + '  <input type="hidden" name="c" id="c" value="add" />';
html = html + '  <input type="hidden" name="f" id="f" value="html" />';
html = html + '  <div id="id_botones" class="botones">';
html = html + '    <a id="id_boton_adjuntar_imagen" href="javascript:void(0);" onclick="javascript:f_pinta_caja_adjuntar_imagen_privado(\'capaopciones\');" class="primero">Adjuntar imagen</a>';
html = html + '    <a id="id_boton_enviar_privado"  href="javascript:void(0);" onclick="javascript:f_confirmar_enviar_mensaje_privado(\'' + idUsuario + '\');" class="publicar">Enviar</a>';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + idUsuario + '\');f_desactiva_pestana_perfil_usuario();" class="cancelar">Cancelar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '  <div id="capaopciones" class="capaopciones" style="display:none;"></div><!-- === cierre div botones === -->';
html = html + '</form>';
html = html + '<iframe style="display:none" src="about:blank" id="iframe_' + ts_actual + '" name="iframe_' + ts_actual + '" onLoad="comprobarPost_mensaje_privado(\'' + ts_actual+ '\', \'add\', \'' + idUsuario + '\');" ></iframe>';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
f_poner_foco_campo_texto('campo_formulario_texto_mensaje');
}
function f_pinta_caja_envio_privado_desde_listado(idUsuario) {
var html    = '';
var mensaje = '';
var date_actual = new Date();
var ts_actual = 1;
var html = '';
html = html + '<div class="seguir">';
html = html + '<p>Comprobando denegaciones...</p>';
html = html + '  <div class="botones">';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
f_comprobar_usuario_bloqueado(idUsuario);
var html = '';
html = html + '<div class="bloquear">';
html = html + '<form id="id_form_mensaje_privado" name="id_form_mensaje_privado" method="post" enctype="multipart/form-data" action="' + _urlInutoi + '" target="iframe_' + ts_actual + '" >';
html = html + '  <div class="contenedorlabelymas">';
html = html + '  <label>Tu mensaje</label>';
html = html + '  <p><span id="etiqueta_numero_maximo_caracteres" class="numero">' + _numero_maximo_caracteres_mensaje + '</span> caracteres</p>';
html = html + '  </div><!-- === cierre div contenedorlabelymas === -->';
html = html + '  <textarea id="campo_formulario_texto_mensaje" name="campo_formulario_texto_mensaje" onchange="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onkeypress="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onkeyup="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" onfocus="javacript:f_tecleando(event,\'campo_formulario_texto_mensaje\',\'etiqueta_numero_maximo_caracteres\');" ></textarea>';
html = html + '  <input type="hidden" name="m" id="m" value="" />';
html = html + '  <input type="hidden" name="t" id="t" value="' + idUsuario + '" />';
html = html + '  <input type="hidden" name="p" id="p" value="" />';
html = html + '  <input type="hidden" name="x" id="x" value="" />';
html = html + '  <input type="hidden" name="c" id="c" value="add" />';
html = html + '  <input type="hidden" name="f" id="f" value="html" />';
html = html + '  <div id="id_botones" class="botones">';
html = html + '    <a id="id_boton_adjuntar_imagen" href="javascript:void(0);" onclick="javascript:f_pinta_caja_adjuntar_imagen_privado(\'capaopciones\');" class="primero">Adjuntar imagen</a>';
html = html + '    <a id="id_boton_enviar_privado"  href="javascript:void(0);" onclick="javascript:f_confirmar_enviar_mensaje_privado(\'' + idUsuario + '\');" class="publicar">Enviar</a>';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + idUsuario + '\');" class="cancelar">Cancelar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '  <div id="capaopciones" class="capaopciones" style="display:none;"></div><!-- === cierre div botones === -->';
html = html + '</form>';
html = html + '<iframe style="display:none" src="about:blank" id="iframe_' + ts_actual + '" name="iframe_' + ts_actual + '" onLoad="comprobarPost_mensaje_privado(\'' + ts_actual+ '\', \'add\', \'' + idUsuario + '\');" ></iframe>';
html = html + '</div><!-- === cierre div bloquear === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
f_poner_foco_campo_texto('campo_formulario_texto_mensaje');
}
function f_pinta_caja_envio_privado_bloqueado(idUsuario) {
if (document.getElementById('opcion_envio_privado')) {
var boton_envio = document.getElementById('opcion_envio_privado');
boton_envio.className = 'activo';
}
var html = '';
html = html + '<div class="seguir">';
html = html + '<p>El usuario te tiene bloqueado, no quiere recibir mensajes privados tuyos.....</p>';
html = html + '  <div class="botones">';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + idUsuario + '\');" class="publicar">Cerrar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_pinta_caja_adjuntar_imagen_privado(idCaja) {
var html = "";
html = html + '  <input name="p" id="p" type="file" size="35" />';
var divCaja = document.getElementById(idCaja);
divCaja.innerHTML = html;
divCaja.style.display = '';
var boton_adjuntar = document.getElementById('id_boton_adjuntar_imagen');
boton_adjuntar.className = 'botonactivo';
}
function f_comprobar_usuario_bloqueado(idUsuario) {
var cadena_params = 'verify=1&text=' + idUsuario;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var json = httpRequest.responseText;
eval("_hashVerify = " + json);
var data = _hashVerify.value;
if (data != 0)  {
f_pinta_caja_envio_privado_bloqueado(idUsuario);
}
}
}, _urlDENEGACIONES + "?" + cadena_params);
}
function f_confirmar_enviar_mensaje_privado(idUsuario) {
var divCajaMensaje    = document.getElementById('campo_formulario_texto_mensaje');
var contenido_mensaje = divCajaMensaje.value;
if ( f_es_valor_vacio(contenido_mensaje) ) {
alert("No has escrito nada para enviar");
return false;
}
if ( ! f_es_longitud_correcta(contenido_mensaje)) {
alert("El mensaje no puede tener más de " + _numero_maximo_caracteres_mensaje + " caracteres");
return false;
}
f_enviar_mensaje_privado(idUsuario);
}
function f_enviar_mensaje_privado(idUsuario) {
document.getElementById('m').value = document.getElementById('campo_formulario_texto_mensaje').value;
var divContenedor = document.getElementById("id_escribir_mensaje_" + idUsuario);
var divTrabajando = document.createElement("DIV");
divTrabajando.id = "trabajando_botones";
divTrabajando.className = "trabajando";
divContenedor.insertBefore(divTrabajando, divContenedor.firstChild);
var formulario = document.getElementById('id_form_mensaje_privado');
formulario.submit();
}
function comprobarPost_mensaje_privado(idMensaje, comando, idUsuario) {
var i = document.getElementById("iframe_"+idMensaje);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames["iframe_"+idMensaje].document;
}
if (d.location.href == "about:blank") {
return true;
}
if (!d.getElementById("status")) {
alert("Ha ocurrido un error al enviar el mensaje. Por favor, inténtalo más tarde.");
f_quitar_div_trabajando('id_escribir_mensaje_' + idUsuario, 'trabajando_botones');
return false;
}
if (d.getElementById("status").innerHTML != "OK") {
msg = d.getElementById("info").innerHTML + " (Error " +d.getElementById("code").innerHTML + ")";
alert(msg);
f_quitar_div_trabajando('id_escribir_mensaje_' + idUsuario, 'trabajando_botones');
return false;
}
var mensaje = 'El mensaje se ha enviado correctamente.....';
if (d.getElementById("info").innerHTML != "") {
mensaje = d.getElementById("info").innerHTML;
alert(mensaje);
}
var html = '';
html = html + '<div class="seguir">';
html = html + '<p>' + mensaje + '</p>';
html = html + '  <div class="botones">';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + idUsuario + '\');f_desactiva_pestana_perfil_usuario();" class="publicar">Cerrar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
f_limpia_campos_formulario_evento();
i.src = "about:blank";
return true;
}
function f_peticion_utoi_seguir_usuario_desde_listado(operacion, idUsuario) {
var cadena_params = 'data=' + idUsuario;
var msg = '';
if (operacion == 'seguir') {
cadena_params = cadena_params + '&action=add_usuarios';
msg = 'Seguro que quieres seguir al usuario?';
}
else {
cadena_params = cadena_params  + '&action=del_usuarios';
msg = 'Seguro que quieres dejar de seguir al usuario?';
}
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert('Se ha producido un error al realizar la operación. Por favor, inténtalo más tarde');
}
else {
var _hashTMP = Array();
var data = httpRequest.responseText;
var boton_seguir = document.getElementById('id_boton_seguir_'    + idUsuario);
var boton_dejar  = document.getElementById('id_boton_dejar_' + idUsuario);
var cadena_params = 'user=' + _nickname + '&data=' + idUsuario;
if (operacion == 'seguir') {
html_mensaje = '&iexcl;Ya est&aacute;! Sus mensajes aparecer&aacute;n en tu tabl&oacute;n principal';
boton_seguir.style.display  = 'none';
boton_dejar.style.display = '';
}
else {
cadena_params = cadena_params  + '&action=del_usuarios';
html_mensaje = '&iexcl;Ya est&aacute;! Sus mensajes ya no aparecer&aacute;n en tu tabl&oacute;n principal';
boton_seguir.style.display  = '';
boton_dejar.style.display = 'none';
}
f_obtener_quien_sigo();
}
}, _urlUTOI + "?" + cadena_params);
}
function f_peticion_utoi_seguir_usuario(operacion, idUsuario) {
var html = '';
html = html + '<div class="seguir">';
html = html + '<p>Se esta procesando la peticion, espere un momento por favor...</p>';
html = html + '  <div class="botones">';
html = html + '    <div class="trabajando" style="position: relative;"></div>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
var cadena_params = 'user=' + _nickname + '&data=' + idUsuario;
if (operacion == 'seguir') {
cadena_params = cadena_params + '&action=add_usuarios';
}
else {
cadena_params = cadena_params  + '&action=del_usuarios';
}
_operacion = operacion;
_idUsuario = idUsuario;
METUtils_makeHttpRequestGet(f_procesa_peticion_utoi_seguir_usuario, _urlUTOI + "?" + cadena_params);
}
function f_procesa_peticion_utoi_seguir_usuario(httpRequest) {
var html    = '';
var mensaje = '';
var boton_seguir = document.getElementById('opcion_seguir_usuario');
var boton_dejar  = document.getElementById('opcion_dejar_usuario');
if (httpRequest.status != 200) {
html_mensaje = 'Se ha producido un error al realizar la operaci&oacute;n. Por favor, int&eacute;ntalo m&aacute;s tarde.</p>';
}
else {
var data = httpRequest.responseText;
f_obtener_quien_sigo();
if (_operacion == 'seguir') {
html_mensaje = '&iexcl;Ya est&aacute;! Sus mensajes aparecer&aacute;n en tu tabl&oacute;n principal';
boton_seguir.style.display = 'none';
boton_dejar.style.display  = '';
f_desactiva_pestana_perfil_usuario();
boton_dejar.className = 'activo';
}
else {
html_mensaje = '&iexcl;Ya est&aacute;! Sus mensajes ya no aparecer&aacute;n en tu tabl&oacute;n principal';
boton_seguir.style.display = '';
boton_dejar.style.display  = 'none';
f_desactiva_pestana_perfil_usuario();
boton_seguir.className = 'activo';
}
}
html = html + '<div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '  <p>' + html_mensaje + '</p>';
html = html + '  <div class="botones">';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + _idUsuario + '\');f_desactiva_pestana_perfil_usuario();" class="publicar">Cerrar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + _idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_peticion_utoi_bloquear_usuario_desde_listado(operacion, idUsuario) {
var cadena_params = 'data=' + idUsuario;
var msg = '';
if (operacion == 'bloquear') {
cadena_params = cadena_params + '&action=add_denegaciones';
msg = 'Si bloqueas al usuario evitar&aacute;s que te mande mensajes privados. &iquest;Seguro que quieres bloquearlo?';
}
else {
cadena_params = cadena_params  + '&action=del_denegaciones';
msg = '&iquest;Seguro que quieres desbloquear al usuario para que pueda volver a mandarte mensajes privados?';
}
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert('No se ha podido ' + operacion + ' al usuario');
}
else {
var _hashTMP = Array();
var data = httpRequest.responseText;
var boton_bloquear    = document.getElementById('id_boton_bloquear_'    + idUsuario);
var boton_desbloquear = document.getElementById('id_boton_desbloquear_' + idUsuario);
if (operacion == 'bloquear') {
html_mensaje = 'El usuario ha sido bloqueado correctamente. Ya no recibiras mas mensajes privados de el';
boton_bloquear.style.display  = 'none';
boton_desbloquear.style.display = '';
}
else {
html_mensaje = 'El usuario ha sido desbloqueado correctamente. A partir de ahora podras recibir mensajes privados de el';
boton_bloquear.style.display  = '';
boton_desbloquear.style.display = 'none';
}
}
}, _urlUTOI + "?" + cadena_params);
}
function f_peticion_utoi_bloquear_usuario(operacion, idUsuario) {
var boton_bloquear = document.getElementById('id_boton_bloquear_' + idUsuario);
var posBotonbloquear = METUtils_calcAbsPosition(boton_bloquear);
var html = '';
html = html + '<div class="seguir">';
html = html + '<p>Se esta procesando la peticion, espere un momento por favor...</p>';
html = html + '  <div class="botones">';
html = html + '    <div class="trabajando" style="position: relative;"></div>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
var cadena_params = 'data=' + idUsuario;
if (operacion == 'bloquear') {
cadena_params = cadena_params + '&action=add_denegaciones';
}
else {
cadena_params = cadena_params  + '&action=del_denegaciones';
}
_operacion = operacion;
_idUsuario = idUsuario;
METUtils_makeHttpRequestGet(f_procesa_peticion_utoi_bloquear_usuario, _urlUTOI + "?" + cadena_params);
}
function f_procesa_peticion_utoi_bloquear_usuario(httpRequest) {
var html    = '';
var mensaje = '';
var boton_bloquear    = document.getElementById('opcion_bloquear_usuario');
var boton_desbloquear = document.getElementById('opcion_desbloquear_usuario');
if (httpRequest.status != 200) {
html_mensaje = 'Se ha producido un error al realizar la operaci&oacute;n. Por favor, int&eacute;ntalo m&aacute;s tarde';
}
else {
var data = httpRequest.responseText;
if (_operacion == 'bloquear') {
html_mensaje = 'El usuario ha sido bloqueado correctamente. Ya no recibir&aacute;s m&aacute;s mensajes privados de &eacute;l';
boton_bloquear.style.display  = 'none';
boton_desbloquear.style.display = '';
f_desactiva_pestana_perfil_usuario();
boton_desbloquear.className = 'activo';
}
else {
html_mensaje = 'El usuario ha sido desbloqueado correctamente. A partir de ahora podr&aacute;s recibir mensajes privados de &eacute;l';
boton_bloquear.style.display  = '';
boton_desbloquear.style.display = 'none';
f_desactiva_pestana_perfil_usuario();
boton_bloquear.className = 'activo';
}
}
html = html + '<div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + '  <p>' + html_mensaje + '</p>';
html = html + '  <div class="botones">';
html = html + '    <a href="javascript:void(0);" onclick="javascript:f_cerrar_panel(\'id_escribir_mensaje_' + _idUsuario + '\');f_desactiva_pestana_perfil_usuario();" class="publicar">Cerrar</a>';
html = html + '  </div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '</div><!-- === cierre div seguir === -->';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + _idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_peticion_utoi_seguir_evento(operacion, idEvento) {
var html =    '<div class="escribirmensaje">';
html = html + '  <div class="seguir">';
html = html + '  <p>Se esta procesando la peticion, espere un momento por favor...</p>';
html = html + '    <div class="botones">';
html = html + '      <div class="trabajando" style="position: relative;"></div>';
html = html + '    <div><!-- === cierre div botones === -->';
html = html + '  </div><!-- === cierre div seguir === -->';
html = html + '</div><!-- === cierre div escribirmensaje === -->';
var divCajaEscribir = document.getElementById('id_caja_aviso');
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
var cadena_params = 'user=' + _nickname + '&data=' + idEvento;
if (operacion == 'dejar_suscripcion') {
cadena_params = cadena_params  + '&action=del_eventos';
}
else {
cadena_params = cadena_params + '&action=add_eventos';
}
_operacion = operacion;
_idEvento = idEvento;
METUtils_makeHttpRequestGet(f_procesa_peticion_utoi_seguir_evento, _urlUTOI + "?" + cadena_params);
}
function f_procesa_peticion_utoi_seguir_evento(httpRequest) {
var html    = '';
var mensaje = '';
var botonDejar  = document.getElementById('boton_dejar_evento');
var botonSeguir = document.getElementById('boton_seguir_evento');
if (httpRequest.status != 200) {
html_mensaje = '<p>Se ha producido un error al realizar la operaci&oacute;n. Por favor, int&eacute;ntalo m&aacute;s tarde.</p>';
}
else {
var data = httpRequest.responseText;
_obtenidasSuscripciones = false;
f_obtener_eventos_seguidos('id_contenido_temas_derecha_superior');
if (_operacion == 'dejar_suscripcion') {
html_mensaje = '    <p>Ya no est&aacute;s siguiendo este evento. Puedes volver a seguirlo cuando quieras.</p>';
botonDejar.style.display  = 'none';
botonSeguir.style.display = '';
_hashDatosEvento.estado_seguimiento = 0;
}
else {
html_mensaje = '    <p>Te has suscrito correctamente al evento</p>';
botonDejar.style.display  = '';
botonSeguir.style.display = 'none';
_hashDatosEvento.estado_seguimiento = 1;
}
}
var html =    '<div class="escribirmensaje">';
html = html + '  <div class="seguir">';
html = html + '  <form id="xx" name="xx" method="post" action="">';
html = html + html_mensaje;
html = html + '    <div class="botones"><a href="javascript:void(0);" onclick="javascript:f_cerrar_panel_aviso();" class="cancelar">Cerrar</a> </div><!-- === cierre div botones === -->';
html = html + '  </form>';
html = html + '  </div><!-- === cierre div seguir === -->';
html = html + '</div><!-- === cierre div escribirmensaje === -->';
var divCajaEscribir = document.getElementById('id_caja_aviso');
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_peticion_utoi_escritura(idEvento) {
var texto_solicitud = '';
if (document.getElementById('id_campo_formulario_texto_solicitud')) {
var divCajaSolicitud = document.getElementById('id_campo_formulario_texto_solicitud');
texto_solicitud = divCajaSolicitud.value;
if (texto_solicitud == '') {
alert('Es necesario que nos envies el texto de solicitud para poder aprobar tu petición');
return false;
}
}
var html_escribir = f_obtener_html_caja_escribir_evento(0);
var html_trabajando = '<div class="trabajando"></div>';
var html = html_trabajando + html_escribir;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.className = 'escribirmensaje';
divCajaEscribir.innerHTML = html;
var cadena_params = 'action=add_writers&user=' + _nickname + '&data=' + idEvento;
if (texto_solicitud != '') {
cadena_params = cadena_params  + '&msg=' + texto_solicitud;
}
_idEvento = idEvento;
METUtils_makeHttpRequestGet(f_procesa_peticion_utoi_escritura, _urlUTOI + "?" + cadena_params);
}
function f_procesa_peticion_utoi_escritura(httpRequest) {
var html          = '';
var html_mensaje  = '';
var html_escribir = '';
var clase_div     = ''
if (httpRequest.status != 200) {
html_mensaje = html_mensaje + '  <div class="aviso">';
html_mensaje = html_mensaje + '  <p>Se ha producido un error en la petici&oacute;n.<br/>Por favor, int&eacute;ntalo m&aacute;s tarde.</p>';
html_mensaje = html_mensaje + '  </div><!-- === cierre div aviso === -->';
html_escribir = f_obtener_html_caja_escribir_evento_falsa(html_mensaje);
clase_div = 'escribirmensajefalsa';
}
else {
var data = httpRequest.responseText;
if (_hashDatosEvento.sub_automatica == 1) {
_hashDatosEvento.estado_escritura = 1;
html_escribir = f_obtener_html_caja_escribir_evento(1);
clase_div = 'escribirmensaje';
}
else {
_hashDatosEvento.estado_escritura = 2;
html_mensaje = html_mensaje + '  <div class="aviso">';
html_mensaje = html_mensaje + '  <p class="solicitudenviada">Estamos analizando tu solicitud para escribir.<br />En breve nos pondremos en contacto contigo. &iexcl;Gracias!</p>';
html_mensaje = html_mensaje + '  </div><!-- === cierre div aviso === -->';
html_escribir = f_obtener_html_caja_escribir_evento_falsa(html_mensaje);
clase_div = 'escribirmensajefalsa';
}
}
html = html_escribir;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.innerHTML = html;
divCajaEscribir.className = clase_div;
divCajaEscribir.style.display = '';
}
function muestraMensajesResultadoBusquedas(numPagina, numTotalMensajes, numMensajes, hashDatosMensajes) {
var html = "";
_numPagActual = parseInt(numPagina, 10);
for (var i = 0; i < numMensajes; i++) {
if (hashDatosMensajes[i]) {
html += pintaMensaje(hashDatosMensajes[i]);
}
}
var divContenedor = document.getElementById(_idContenedorMsgs);
divContenedor.innerHTML = html;
pintaPaginacionResultadoBusquedas(numTotalMensajes, numMensajes);
}
function pintaPaginacionResultadoBusquedas(numTotalMensajes, numMensajes) {
if ( ( _numPagActual == 1) && (numTotalMensajes <= _numMsgPag) ) {
return(false);
}
var divContenedor = document.getElementById(_idContenedorPag);
var html = "";
html += "<ul>";
if (_numPagActual == 1) {
html += "<li><span class=\"inhabilitado\" title=\"Primera p&aacute;gina\">&lt;&lt;</span></li>";
} else {
html += "<li><a href=\"javascript:void(0);\" class=\"flechadoble\" onClick=\"javascript:f_buscar_contenido(1, '" + _tipoOrdenacionBusquedas + "');posicionarEnDiv('id_busquedas');\" title=\"Primera p&aacute;gina\">&lt;&lt;</a></li>";
}
var paginaAnterior  = _numPagActual - 1;
var paginaSiguiente = _numPagActual + 1;
if (_numPagActual > 1) {
html += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:f_buscar_contenido(" + paginaAnterior + ", '" + _tipoOrdenacionBusquedas + "');posicionarEnDiv('id_busquedas');\" class=\"flecha\" title=\"P&aacute;gina anterior\">&lt;</a></li>";
} else {
html += "<li><span class=\"inhabilitado\" title=\"P&aacute;gina anterior\">&lt;</span></li>";
}
html += "<li class=\"activo\"><a href=\"javascript:void(0);\">" + _numPagActual + "</a></li>";
if (parseInt(_numPagActual*_numMsgPag) < parseInt(numTotalMensajes)) {
html += "<li><a href=\"javascript:void(0);\" onClick=\"javascript:f_buscar_contenido(" + paginaSiguiente + ", '" + _tipoOrdenacionBusquedas + "');posicionarEnDiv('id_busquedas');\" class=\"flecha\" title=\"P&aacute;gina siguiente\">&gt;</a></li>";
} else {
html += "<li><span class=\"inhabilitado\" title=\"P&aacute;gina siguiente\">&gt;</span></li>";
}
html += "</ul>";
divContenedor.innerHTML = html;
divContenedor.style.display  = '';
}
function f_buscar_contenido(numeroPagina, tipoOrdenacion) {
var cadena = '';
if (_cadenaQ != '') {
cadena = 'q=' + unescape(_cadenaQ);
}
else {
cadena = 'qru=' + _cadenaQRU;
}
location.href='/resultado_buscar.html?r=php&' + cadena + '&p=' + numeroPagina + '&s=' + tipoOrdenacion + '&n=' + _numMsgPag;
}
function f_buscar_contenido_por_relevancia(numeroPagina) {
_tipoOrdenacionBusquedas = 'r';
f_buscar_contenido(numeroPagina, _tipoOrdenacionBusquedas);
}
function f_buscar_contenido_por_frescura(numeroPagina) {
_tipoOrdenacionBusquedas = 'd';
f_buscar_contenido(numeroPagina, _tipoOrdenacionBusquedas);
}
function f_buscar_relacionado(idMensaje) {
location.href='/resultado_buscar.html?r=php&qru=' + idMensaje;
}
function f_muestra_listado_temas_utoi(hashEventosUTOI, hashEventosUTOIExtra, hashEventosSeguidosUsuario) {
f_muestra_listado_temas(hashEventosUTOI, hashEventosSeguidosUsuario, hashEventosUTOIExtra, '');
}
function f_muestra_listado_temas_usuario(hashEventos, hashEventosSeguidosUsuario, idUsuario) {
f_muestra_listado_temas(hashEventos, hashEventosSeguidosUsuario, Array(),  idUsuario);
}
function f_muestra_listado_temas(listaTemas, listaEventosSeguidosUsuario, listaDatosTemasExtra, idUsuario) {
var html = '';
var html_encabezado = '';
if (idUsuario == '') {
html_encabezado =                   '<div class="encabezado">';
html_encabezado = html_encabezado + '  <p>Listado completo de temas </p>';
html_encabezado = html_encabezado + '</div><!-- === cierre div encabezado === -->';
}
else {
html_encabezado =                   '<div class="encabezado">';
if (idUsuario == _nickname) {
html_encabezado = html_encabezado + '  <p>Temas que sigues: </p>';
}
else {
html_encabezado = html_encabezado + '  <p>Temas que sigue  <a href="/' + idUsuario + '" class="nombre" title="Ver todos sus mensajes">' + idUsuario + '</a>: </p>';
}
html_encabezado = html_encabezado + '</div><!-- === cierre div encabezado === -->';
}
var numero_temas = 0;
for (var claveTema in listaTemas) {
var datosTema = listaTemas[claveTema];
numero_temas++;
if (datosTema.pathfoto == '') {
datosTema.pathfoto = _url_imagen_por_defecto;
}
html = html + '     <div class="tema">';
html = html + '       <div class="foto"><img src="' + datosTema.pathfoto + '" width="135" height="135" alt="Foto del tema" />';
var numero_mensajes_evento  = 0;
var fecha_ts_ultimo_mensaje = '';
if (listaDatosTemasExtra[claveTema]) {
var datosExtra = listaDatosTemasExtra[claveTema];
if ( (datosExtra.num_mensajes) && (datosExtra.num_mensajes > 0) ) {
numero_mensajes_evento = datosExtra.num_mensajes;
}
if  ( (datosExtra.ts_ultimo_mensaje) && (datosExtra.ts_ultimo_mensaje != '') )  {
fecha_ts_ultimo_mensaje = datosExtra.ts_ultimo_mensaje;
}
}
else {
if ( (datosTema.num_mensajes) && (datosTema.num_mensajes > 0) ) {
numero_mensajes_evento = datosTema.num_mensajes;
}
if  ( (datosTema.ts_ultimo_mensaje) && (datosTema.ts_ultimo_mensaje != '') )  {
fecha_ts_ultimo_mensaje = datosTema.ts_ultimo_mensaje;
}
}
if (numero_mensajes_evento > 0) {
var texto_fecha = '';
var texto_mensajes = 'mensaje';
if (numero_mensajes_evento > 1) {
texto_mensajes = texto_mensajes + 's';
}
if (fecha_ts_ultimo_mensaje != '') {
var texto_ts = f_obtener_html_ultima_actualizacion_evento(fecha_ts_ultimo_mensaje, 0);
var texto_fecha = '<span class="tiempo">El &uacute;ltimo ' + texto_ts + '</span>';
}
html = html + '         <p><span class="mensajes"><strong>' + numero_mensajes_evento + '</strong> ' + texto_mensajes + '</span> ' + texto_fecha + '</p>';
}
else {
html = html + '         <p><span class="mensajes"><strong>No hay mensajes</strong></span></p>';
}
html = html + '       </div><!-- === cierre div foto === -->';
html = html + '       <div class="texto">';
html = html + '         <div class="contenedornombreygestion">';
html = html + '           <div class="nombretema"><a href="/' + '*' + claveTema + '" title="Ver tema">' + datosTema.nombre + '</a> </div><!-- === cierre div nombretema === -->';
html = html + '           <div class="botones">';
if (_nickname == '') {
}
else {
var estilo_seguir = '';
var estilo_dejar  = '';
if (listaEventosSeguidosUsuario[claveTema]) {
estilo_seguir  = 'style="display: none;"';
estilo_dejar = '';
}
else {
estilo_seguir = '';
estilo_dejar  = 'style="display: none;"';
}
html = html + '             <a id="id_boton_dejar_'  + claveTema + '" ' + estilo_dejar  + ' href="javascript:void(0);" onclick="javascript:f_seguir_evento_desde_listado(\'dejar\', \''  + claveTema + '\');" title="Dejar de seguir el tema"><img src="/Iconos/v1.x/v1.0/bolillos/boton_ya_no_seguir.png" alt="Dejar de seguir el tema" width="13" height="13"></a>';
html = html + '             <a id="id_boton_seguir_' + claveTema + '" ' + estilo_seguir + ' href="javascript:void(0);" onclick="javascript:f_seguir_evento_desde_listado(\'seguir\', \'' + claveTema + '\');" title="Seguir el tema"><img src="/Iconos/v1.x/v1.0/bolillos/boton_seguir.png" alt="Seguir el tema" width="13" height="13"></a>';
}
html = html + '           </div><!-- === cierre div botones === -->';
html = html + '         </div><!-- === cierre div contenedornombreygestion === -->';
if ( (datosTema.descripcion) && (datosTema.descripcion != '') ) {
html = html + '          <p>' + datosTema.descripcion + '</p>';
}
html = html + '          <div class="detalles">';
html = html + '             <ul>';
if ( (datosTema.ts_inicio) && (datosTema.ts_inicio != '') ) {
var texto_html = f_obtener_html_ultima_actualizacion_evento(datosTema.ts_inicio, 0);
html = html + '               <li>Creado ' + texto_html + '</li>';
}
var nombreparamovil = claveTema;
if ( (datosTema.nombreparamovil) && (datosTema.nombreparamovil != '') ) {
nombreparamovil = datosTema.nombreparamovil;
}
html = html + '               <li><div id="id_clave_sms_' + claveTema + '">Clave SMS: <a href="javascript:void(0);" onclick="javascript:f_muestra_panel_informacion_sms(\'id_clave_sms_' + claveTema + '\');" title="&iquest;Qu&eacute; es esto?">*' + nombreparamovil + '</a></div></li>';
html = html + f_obtener_html_informacion_sms();
var numero_seguidores_evento = 0;
if (listaDatosTemasExtra[claveTema]) {
var datosExtra = listaDatosTemasExtra[claveTema];
if ( (datosExtra.numero_seguidores_evento) && (datosExtra.numero_seguidores_evento > 0) ) {
numero_seguidores_evento = datosExtra.numero_seguidores_evento;
}
}
else {
if (datosTema.numero_seguidores_evento) {
numero_seguidores_evento = datosTema.numero_seguidores_evento;
}
}
if (numero_seguidores_evento > 0) {
if (numero_seguidores_evento == 1) {
html = html + '               <li>Lo sigue s&oacute;lo ' + numero_seguidores_evento + ' usuario';
}
else {
html = html + '               <li>Lo siguen ' + numero_seguidores_evento + ' usuarios';
}
html = html + '    <a href="/' + '*' + claveTema + '/seguidores">Ver todos &raquo;</a></li>';
}
else {
html = html + '               <li>Todav&iacute;a no lo sigue nadie</li>';
}
var numero_escritores_evento = 0;
if (listaDatosTemasExtra[claveTema]) {
var datosExtra = listaDatosTemasExtra[claveTema];
if ( (datosExtra.numero_writers_evento) && (datosExtra.numero_writers_evento > 0) ) {
numero_escritores_evento = datosExtra.numero_writers_evento;
}
}
else {
if (datosTema.numero_writers_evento) {
numero_escritores_evento = datosTema.numero_writers_evento;
}
}
if (numero_escritores_evento > 0) {
if (numero_escritores_evento == 1) {
html = html + '               <li>S&oacute;lo escribe ' + numero_escritores_evento + ' usuario';
}
else {
html = html + '               <li>Pueden escribir ' + numero_escritores_evento + ' usuarios';
}
html = html + '    <a href="/' + '*' + claveTema + '/escritores">Ver todos &raquo;</a></li>';
}
else {
html = html + '               <li>Todav&iacute;a no escribe nadie</li>';
}
html = html + '             </ul>';
html = html + '          </div><!-- === cierre div detalles === -->';
html = html + '       </div><!-- === cierre div texto === -->';
html = html + '       <div style="clear: both;"></div>';
html = html + '     </div><!-- === cierre div tema === -->';
}
if (numero_temas == 0) {
html =        '<div class="sintemas">';
html = html + '  <p>No hay temas disponibles</p>';
html = html + '</div><!-- === cierre div sintemas === -->';
}
html = html_encabezado + html;
var caja = document.getElementById('id_temas');
caja.innerHTML = html;
}
function f_seguir_evento_desde_listado(operacion, idEvento) {
var cadena_params = 'user=' + _nickname + '&data=' + idEvento;
if (operacion == 'dejar') {
cadena_params = cadena_params  + '&action=del_eventos';
}
else {
cadena_params = cadena_params + '&action=add_eventos';
}
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert('Se ha producido un error al realizar la operación. Por favor, inténtalo más tarde');
}
else {
var _hashTMP = Array();
var data = httpRequest.responseText;
var boton_seguir = document.getElementById('id_boton_seguir_' + idEvento);
var boton_dejar  = document.getElementById('id_boton_dejar_'  + idEvento);
if (operacion == 'seguir') {
boton_seguir.style.display  = 'none';
boton_dejar.style.display = '';
}
else {
boton_seguir.style.display  = '';
boton_dejar.style.display = 'none';
}
_obtenidasSuscripciones = false;
f_muestra_caja_eventos_usuario();
}
}, _urlUTOI + "?" + cadena_params);
}



function muestraMensajes(numPagina, forzado) {
if (typeof forzado == "undefined") {
forzado = false;
}
if (location.hash && !forzado) {
numPagina = parseInt(location.hash.substring(1));
}
var divContenedor = document.getElementById(_idContenedorMsgs);
var html = "";
var msgInicio = (numPagina-1)*_numMsgPag;
var msgFin    = (numPagina*_numMsgPag);
if (msgFin > _hashMsgs.numMensajes) {
msgFin = _hashMsgs.numMensajes;
}
_numPagActual = numPagina;
if (forzado) {
location.href = "#" + _numPagActual;
}
if (typeof _hashMsgs.mensajes != "undefined" && _hashMsgs.mensajes.length > 0) {
if ( (msgInicio+1) > (_numPagCache*_numMsgCache) ||
(msgFin-1)    < ((_numPagCache-1)*_numMsgCache) ) {
_numPagCache = parseInt(msgInicio/_numMsgCache)+1;
_ultimaRecargaServidor = 0;
recuperarInformacionMensajes();
return(false);
}
for (var i = msgInicio; (i != msgFin && i < _hashMsgs.numMensajes); i++) {
var num = i - ((_numPagCache-1)*_numMsgCache);
if (_hashMsgs.mensajes[num]) {
html += pintaMensaje(_hashMsgs.mensajes[num]);
}
}
pintaPaginacion();
f_pide_publicidad();
f_contabiliza_peticion();
_es_primera_carga = 0;
mostrarError('');
} else if (_hashMsgs.numMensajes == 0) {
}
divContenedor.innerHTML = html;
if (typeof _intRecarga == "undefined") {
lanzaEventosRecarga();
}
}
function muestraMensajesHilo() {
var divContenedor = document.getElementById(_idContenedorHilo);
var html = "";
var idMensajeCompuestoMostrar = "";
if (typeof _hashMsgs.mensajes != "undefined" && _hashMsgs.mensajes.length > 0) {
var arraySubnivelesTransparentes = Array();
var idMensajeCompuesto = "";
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i]) {
var ultimoSubnivel = "";
var htmlDivSubniveles = "";
var htmlCierreDivSubniveles = "";
var hayEnvoltorio = true;
var visible = true;
arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] = 0;
if (_hashMsgs.mensajes[i].level > _nivelMinVisibleHilo) {
visible = false;
}
for (var contLevel = _hashMsgs.mensajes[i].level; contLevel > 0; contLevel--) {
var htmlUltimo = "";
if (contLevel == _hashMsgs.mensajes[i].level) {
ultimoSubnivel = "subnivel"+contLevel;
if ((i+1) == _hashMsgs.numMensajes ||
_hashMsgs.mensajes[i].level > _hashMsgs.mensajes[i+1].level) {
htmlUltimo = "ultimo";
hayEnvoltorio = false;
} else {
for (var j = (i+1); j != _hashMsgs.numMensajes; j++) {
htmlUltimo = "ultimo";
hayEnvoltorio = false;
arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] = 1;
if (_hashMsgs.mensajes[j].level == _hashMsgs.mensajes[i].level) {
htmlUltimo = "";
hayEnvoltorio = true;
arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] = 0;
break;
}
if (_hashMsgs.mensajes[j].level < _hashMsgs.mensajes[i].level) {
break;
}
}
}
}
var htmlTransparente = "";
if (typeof arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] != "undefined" &&
arraySubnivelesTransparentes[contLevel] == 1 &&
htmlUltimo == "") {
htmlTransparente = "transparente";
}
var htmlStyle = "";
var htmlIdMensaje = "";
if (contLevel == 1) {
if (typeof _idMsg == "undefined" || _idMsg != _hashMsgs.mensajes[i].idMsg) {
if (!visible) {
htmlStyle = "style='display: none'";
}
htmlIdMensaje = "id='" + idMensajeCompuesto + "|" +  _hashMsgs.mensajes[i].idMsg + "'";
} else {
idMensajeCompuestoMostrar = idMensajeCompuesto;
}
}
htmlDivSubniveles = "<div class='subnivel" + contLevel + htmlUltimo + htmlTransparente + "' " + htmlStyle + " " + htmlIdMensaje + ">" + htmlDivSubniveles;
htmlCierreDivSubniveles += "</div>";
}
if (typeof _idMsg != "undefined" && _idMsg == _hashMsgs.mensajes[i].idMsg) {
html += "<div id='" + idMensajeCompuestoMostrar + "|" + _hashMsgs.mensajes[i].idMsg + "' class='entrada'>";
htmlCierreDivSubniveles += "</div>";
}
html += htmlDivSubniveles;
if (hayEnvoltorio) {
var idPrimerMensaje = "";
if (_hashMsgs.mensajes[i].level == 0) {
idPrimerMensaje = " id = '|" +  _hashMsgs.mensajes[i].idMsg + "' ";
}
html += "<div " + idPrimerMensaje + " class='envoltorio" + ultimoSubnivel + "'>";
htmlCierreDivSubniveles += "</div>";
}
if (_hashMsgs.mensajes[i].borrado == 1) {
html += "<div class=\"borrado\">";
}
html += pintaMensajeHilo(_hashMsgs.mensajes[i], visible);
html += "<div class=\"enlacesconversacion\">";
if ((i+1) == _hashMsgs.numMensajes ||
_hashMsgs.mensajes[i].level >= _hashMsgs.mensajes[i+1].level) {
} else if (_hashMsgs.mensajes[i].level < _nivelMinVisibleHilo) {
html += "<a href='javascript:void(0);' class='primero2' onClick='javascript:ocultarRespuestas(\"" + _hashMsgs.mensajes[i].idMsg + "\", " + _hashMsgs.mensajes[i].level + ");' id='linkrespuestas_" + _hashMsgs.mensajes[i].idMsg + "'>Cerrar</a>";
} else {
numMensajesDebajo = 0;
for (var j = (i+1); j != _hashMsgs.numMensajes; j++) {
if (_hashMsgs.mensajes[j].level <= _hashMsgs.mensajes[i].level) {
break;
}
numMensajesDebajo++;
}
html += "<a href='javascript:void(0);' class='primero1'' onClick='javascript:mostrarRespuestas(\"" + _hashMsgs.mensajes[i].idMsg + "\", " + _hashMsgs.mensajes[i].level + ");' id='linkrespuestas_" + _hashMsgs.mensajes[i].idMsg + "'>" + numMensajesDebajo + " respuestas</a>";
}
if (_hashMsgs.mensajes[i].level != 0) {
html += "<a href='javascript:void(0);' class='segundo1' onClick='javascript:mostrarMensajeRespuesta(\"" + _hashMsgs.mensajes[i].idMsg + "\");' id='linkrespondea_" + _hashMsgs.mensajes[i].idMsg + "'>Responde a</a>";
}
html += "</div>";
if (_hashMsgs.mensajes[i].borrado == 1) {
html += "</div>";
}
html += htmlCierreDivSubniveles;
if ((i+1) != _hashMsgs.numMensajes) {
if (_hashMsgs.mensajes[i].level < _hashMsgs.mensajes[i+1].level) {
idMensajeCompuesto += "|" + _hashMsgs.mensajes[i].idMsg;
} else if (_hashMsgs.mensajes[i].level > _hashMsgs.mensajes[i+1].level) {
numNiveles = _hashMsgs.mensajes[i].level-_hashMsgs.mensajes[i+1].level;
idMensajeCompuesto = idMensajeCompuesto.substring(0, idMensajeCompuesto.length-((_longIdMensaje+1)*numNiveles));
}
}
}
}
}
divContenedor.innerHTML = html;
mostrarError('');

}
function pintaNombreUsuario(nickname) {
var nombreUsuario = nickname;
if (_hashMsgs.perfilesUsuarios && _hashMsgs.perfilesUsuarios[nickname]) {
if (_hashMsgs.perfilesUsuarios[nickname].nombre) {
nombreUsuario = _hashMsgs.perfilesUsuarios[nickname].nombre;
}
if (_hashMsgs.perfilesUsuarios[nickname].apellidos) {
nombreUsuario += " " + _hashMsgs.perfilesUsuarios[nickname].apellidos;
}
}
return(nombreUsuario);
}
function pintaImagenUsuario(nickname) {
var strImagen = _url_imagen_usuario_por_defecto;
if (_hashMsgs.perfilesUsuarios && _hashMsgs.perfilesUsuarios[nickname]) {
if (_hashMsgs.perfilesUsuarios[nickname].pathfoto) {
strImagen = _hashMsgs.perfilesUsuarios[nickname].pathfoto;
}
}
return(strImagen);
}
function pintaNombreEvento(evento) {
var nombreEvento = evento;
if (_hashMsgs.perfilesEventos && _hashMsgs.perfilesEventos[evento]) {
if (_hashMsgs.perfilesEventos[evento].nombre) {
nombreEvento = _hashMsgs.perfilesEventos[evento].nombre;
}
}
return(nombreEvento);
}
function pintaMensaje(hashMensaje, esProvisional) {
if (typeof esProvisional == "undefined") {
esProvisional = false;
}
var html = document.getElementById(_idPlantillaMsg).innerHTML;
html = html.replace(/\n/g, '');
html = html.replace(/\r/g, '');
html = html.replace(_idPlantillaMsg, "mensaje_"+hashMensaje.idMsg);
var ahora = new Date();
var tsAhora = ahora.getTime() / 1000;
if (typeof _hashMsgs.horaActual != "undefined") {
tsAhora = _hashMsgs.horaActual;
}
var tsMensaje = hashMensaje.tsMensaje;
var fechaMensaje = new Date(hashMensaje.tsMensaje*1000);
var anyo = fechaMensaje.getFullYear();
var mes  = fechaMensaje.getMonth() + 1;
if (mes < 10) { mes = "0" + mes; }
var dia  = fechaMensaje.getDate();
if (dia < 10) { dia = "0" + dia; }
var hora = fechaMensaje.getHours();
if (hora < 10) { hora = "0" + hora; }
var min  = fechaMensaje.getMinutes();
if (min < 10) { min = "0" + min; }
var textoHora = "";
if (tsMensaje+60 > tsAhora) {
textoHora += "Menos de 1 minuto";
} else if (tsMensaje+3600 > tsAhora) {
var minutosDiff = parseInt((tsAhora-tsMensaje)/60);
textoHora += "Hace " + minutosDiff + " minuto";
if (minutosDiff > 1) {
textoHora += "s";
}
} else if (tsMensaje+3600*24 > tsAhora) {
var horasDiff = parseInt((tsAhora-tsMensaje)/3600);
textoHora += "Hace " + horasDiff + " hora";
if (horasDiff > 1) {
textoHora += "s";
}
} else {
textoHora += hora + ":" + min + ", " + dia + "-" + mes + "-" + anyo;
}
html = html.replace(/#MSG:HORA#/g, textoHora);
var relevancia_mensaje = '';
if ( (_hashExtraMsgs.mensajes) && (_hashExtraMsgs.mensajes[hashMensaje.idMsg]) ) {
var datosExtraMensaje = _hashExtraMsgs.mensajes[hashMensaje.idMsg];
relevancia_mensaje =                      '<div class="barra"><div style="width: ' + datosExtraMensaje.weight + '%;">&nbsp;</div></div><!-- === cierre div barra === -->';
relevancia_mensaje = relevancia_mensaje + '<div class="porcentaje"> <strong>' + datosExtraMensaje.weight + '%</strong> de coincidencia</div><!-- === cierre div porcentaje === -->';
}
html = html.replace(/#MSG:RELEVANCIA#/g, relevancia_mensaje);
if (esProvisional) {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#/g, '');
html = html.replace(/#MSG:FIN_MSG_PROVISIONAL#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#.*?#MSG:FIN_MSG_PROVISIONAL#/g, '');
}
if (!esProvisional && (_tablon == "2" || _tablon == "3")) {
if (typeof _hashMsgs.ultimaVisita != "undefined" &&
typeof _hashMsgs.ultimaVisita[_tablon] != "undefined" &&
tsMensaje > _hashMsgs.ultimaVisita[_tablon] && !esProvisional) {
html = html.replace(/#MSG:INI_MSG_NUEVO#/, '');
html = html.replace(/#MSG:FIN_MSG_NUEVO#/, '');
} else {
html = html.replace(/#MSG:INI_MSG_NUEVO#.*?#MSG:FIN_MSG_NUEVO#/, '');
}
} else {
html = html.replace(/#MSG:INI_MSG_NUEVO#.*?#MSG:FIN_MSG_NUEVO#/, '');
}
html = html.replace(/#MSG:ID#/g, hashMensaje.idMsg);
html = html.replace(/#MSG:FOTO_USUARIO#/, pintaImagenUsuario(hashMensaje.usuarioOrigen));
html = html.replace(/#MSG:NICKNAME_USUARIO#/g, hashMensaje.usuarioOrigen);
html = html.replace(/#MSG:NOMBRE_USUARIO#/g, pintaNombreUsuario(hashMensaje.usuarioOrigen));
var contenidoMensaje = "" + hashMensaje.contenido;
if (typeof hashMensaje.hayVideo != "undefined" && hashMensaje.hayVideo == 1) {
contenidoMensaje = pintaVideoEnMensaje(contenidoMensaje, hashMensaje.idMsg);
}
html = html.replace(/#MSG:CONTENIDO#/g, contenidoMensaje);
html = html.replace(/#MSG:ETIQUETA_INICIO_IMG#/g, '<img');
html = html.replace(/#MSG:ETIQUETA_FIN_IMG#/g,    ' />');
if (hashMensaje.idMsgRespuesta && hashMensaje.idMsgRespuesta != 0) {
if (hashMensaje.idMsgRespuesta != hashMensaje.idMsg) {
html = html.replace(/#MSG:NICKNAME_USUARIO_RESPUESTA#/g,  hashMensaje.autorMsgRespuesta);
html = html.replace(/#MSG:NOMBRE_USUARIO_RESPUESTA#/g,  pintaNombreUsuario(hashMensaje.autorMsgRespuesta));
} else {
html = html.replace(/#MSG:INI_DIV_RESPUESTA#.*?#MSG:FIN_DIV_RESPUESTA#/, '');
}
html = html.replace(/#MSG:ID_HILO#/, hashMensaje.hilo);
if (hashMensaje.hilo != hashMensaje.idMsg) {
html = html.replace(/#MSG:ID_MSG_RESPUESTA#/, hashMensaje.idMsg);
}
} else {
html = html.replace(/#MSG:INI_DIV_CONVERSACION#.*?#MSG:FIN_DIV_CONVERSACION#/, '');
}
html = html.replace(/#MSG:INI_DIV_CONVERSACION#/, '');
html = html.replace(/#MSG:FIN_DIV_CONVERSACION#/, '');
html = html.replace(/#MSG:INI_DIV_RESPUESTA#/, '');
html = html.replace(/#MSG:FIN_DIV_RESPUESTA#/, '');
html = html.replace(/#MSG:ID_HILO#/, '');
html = html.replace(/#MSG:ID_MSG_RESPUESTA#/, '');
var numTablonesAMostrar = 0;
var tablonesAMostrar    = Array();
var tablonesRespuesta   = Array();
if (hashMensaje.CopiaEnTablones) {
var tablones = hashMensaje.CopiaEnTablones.split(',');
for (var i = 0; i != tablones.length; i++) {
if (_tablon == 3 && tablones[i] != ("t3-"+_nickname)) {
if (tablones[i] != ("t3-"+hashMensaje.usuarioOrigen)) {
tablonesAMostrar[tablones[i].substring(3)] = pintaNombreUsuario(tablones[i].substring(3));
numTablonesAMostrar++;
}
tablonesRespuesta.push(tablones[i].substring(3));
} else if (/^ev-/.test(tablones[i])) {
tablonesAMostrar[tablones[i].substring(3)] = pintaNombreEvento(tablones[i].substring(3));
numTablonesAMostrar++;
tablonesRespuesta.push(tablones[i].substring(3));
}
}
if (numTablonesAMostrar > 0) {
if (_tablon == 3) {
if (_nickname == hashMensaje.usuarioOrigen) {
html = html.replace(/#MSG:INI_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:FIN_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:INI_DIV_DESTINATARIOS#/, '');
html = html.replace(/#MSG:FIN_DIV_DESTINATARIOS#/, '');
} else {
html = html.replace(/#MSG:INI_DIV_OTROS_DESTINATARIOS#/, '');
html = html.replace(/#MSG:FIN_DIV_OTROS_DESTINATARIOS#/, '');
}
var htmlDestinatarios = "<ul id=\"destinatarios_" + hashMensaje.idMsg + "\">";
var styleDisplay = "";
var contDest = 0;
for (var tablonTmp in tablonesAMostrar) {
if (_numUsuariosAMostrar != 0 &&
contDest == _numUsuariosAMostrar &&
numTablonesAMostrar > (_numUsuariosAMostrar+1)) {
styleDisplay = " style=\"display: none\" ";
htmlDestinatarios += "<li id=\"destinatarios_" + hashMensaje.idMsg + "_desplegar\"><a href=\"javascript:void(0);\" onClick=\"mostrarTodosDestinatarios('destinatarios_" + hashMensaje.idMsg + "')\" title=\"Desplegar\" class=\"resto\">Ver todos </a></li>";
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
htmlDestinatarios += "<li " + styleDisplay + "><a href=\"/m/" + tablonTmp + "\" title=\"Ver todos los mensajes de " + tablonTmp + "\">" + tablonesAMostrar[tablonTmp] + "</a></li>";
} else {
htmlDestinatarios += "<li " + styleDisplay + "><a href=\"/" + tablonTmp + "\" title=\"Ver todos los mensajes de " + tablonTmp + "\">" + tablonesAMostrar[tablonTmp] + "</a></li>";
}
contDest++;
}
htmlDestinatarios += "</ul>";
html = html.replace(/#MSG:DESTINATARIOS#/g, htmlDestinatarios);
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
} else {
var contDest = 0;
var htmlMasTemas = "";
for (var tablonTmp in tablonesAMostrar) {
if (contDest == 0) {
html = html.replace(/#MSG:TEMA#/, tablonesAMostrar[tablonTmp]);
html = html.replace(/#MSG:TEMA_NORM#/, tablonTmp);
}
if (numTablonesAMostrar > 1) {
if (contDest == 1) {
htmlMasTemas = "<ul>";
}
if (contDest != 0) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
htmlMasTemas += "<li><a href=\"/m/" + "*" + tablonTmp + "\" title=\"Ver tema\">" + tablonesAMostrar[tablonTmp] + "</a></li>";
} else {
htmlMasTemas += "<li><a href=\"/" + "*" + tablonTmp + "\" title=\"Ver tema\">" + tablonesAMostrar[tablonTmp] + "</a></li>";
}
}
}
contDest++;
}
if (numTablonesAMostrar > 1) {
htmlMasTemas += "</ul>";
html = html.replace(/#MSG:MAS_TEMAS#/, htmlMasTemas);
} else {
html = html.replace(/#MSG:INI_MAS_TEMAS#.*?#MSG:FIN_MAS_TEMAS#/, '');
}
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
html = html.replace(/#MSG:INI_DIV_DESTACADO#.*?#MSG:FIN_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:INI_DIV_DESTINATARIOS#.*?#MSG:FIN_DIV_DESTINATARIOS#/, '');
html = html.replace(/#MSG:INI_DIV_OTROS_DESTINATARIOS#.*?#MSG:FIN_DIV_OTROS_DESTINATARIOS#/g, '');
html = html.replace(/#MSG:INI_DIV_TEMA#/, '');
html = html.replace(/#MSG:FIN_DIV_TEMA#/, '');
html = html.replace(/#MSG:MAS_TEMAS#/, '');
html = html.replace(/#MSG:INI_MAS_TEMAS#/, '');
html = html.replace(/#MSG:FIN_MAS_TEMAS#/, '');
if (hashMensaje.cont_adicional && hashMensaje.cont_adicional_tipo == 'IMAGEN') {
var dimX = hashMensaje.cont_adicional_dimx;
var dimY = hashMensaje.cont_adicional_dimy;
var maxAnchoFoto = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
maxAnchoFoto = _maxAnchoFoto;
}
var dimension_maxima_imagen_x = _dimension_maxima_imagen_x;
if (dimX > maxAnchoFoto) {
var porcentajeReduccion = maxAnchoFoto/dimX;
dimX = parseInt(dimX * porcentajeReduccion);
dimY = parseInt(dimY * porcentajeReduccion);
}
if (dimX > dimension_maxima_imagen_x) {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
} else {
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
}
html = html.replace(/#MSG:FOTO#/, hashMensaje.cont_adicional);
html = html.replace(/#MSG:FOTO_WIDTH#/, dimX);
html = html.replace(/#MSG:FOTO_HEIGHT#/, dimY);
} else {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
}
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#/, '');
html = html.replace(/#MSG:FIN_FOTO_COMPLETA#/, '');
var htmlEnlaces = "";
if (_nickname != '') {
if (_nickname != hashMensaje.usuarioOrigen) {
htmlEnlaces += "<li><a href=\"javascript:void(0);\" onclick=\"javascript:notificarMensajeSpam('" + hashMensaje.idMsg + "');\" >Marcar como spam </a></li>";
htmlEnlaces += "<li><a href=\"javascript:void(0);\" onclick=\"javascript:notificarMensajeInsulto('" + hashMensaje.idMsg + "');\" >Notificar insulto </a></li>";
}
if (_tablon != 3) {
htmlEnlaces += "<li><a href=\"/" + hashMensaje.idMsg + "\" target=\"_blank\">Enlace permanente </a></li>";
}
if (_nickname == hashMensaje.usuarioOrigen) {
htmlEnlaces += "<li><a href=\"javascript:void(0);\" onClick='javascript:editarMensaje(\""+hashMensaje.idMsg+"\", \""+hashMensaje.usuarioOrigen+"\", \""+encodeURIComponent(hashMensaje.contenido)+"\")'>Editar mensaje </a></li>";
if (_tablon == 3) {
htmlEnlaces += "<li><a href=\"javascript:void(0);\"' onClick='javascript:borrarMensaje(\"" + encodeURIComponent(hashMensaje.idMsg)+"\", \"p\");'>Borrar mensaje </a></li>";
} else {
htmlEnlaces += "<li><a href=\"javascript:void(0);\"' onClick='javascript:borrarMensaje(\"" + encodeURIComponent(hashMensaje.idMsg)+"\");'>Borrar mensaje </a></li>";
}
}
if (_nickname != hashMensaje.usuarioOrigen && _tablon == 3) {
htmlEnlaces += "<li><a href=\"javascript:void(0);\"' onClick='javascript:borrarMensaje(\"" + encodeURIComponent(hashMensaje.idMsg)+"\", \"p\");'>Borrar mensaje </a></li>";
}
if (/^ev-/.test(_tablon1) &&
_nickname != "" && _nickname != hashMensaje.usuarioOrigen &&
typeof _hashMsgs.perfilesEventos != "undefined" &&
typeof _hashMsgs.perfilesEventos[_tablon] != "undefined") {
var arrayAdm = _hashMsgs.perfilesEventos[_tablon]["adm"].concat(_hashMsgs.perfilesEventos[_tablon]["prop"]);
var strAdmEvento = "," + arrayAdm.join(",") + ",";
if (strAdmEvento.search(","+_nickname+",") != -1) {
htmlEnlaces += "<li><a href=\"javascript:void(0);\"' onClick='javascript:borrarMensaje(\"" + encodeURIComponent(hashMensaje.idMsg)+"\", \"*" + _tablon + "\");'>Borrar mensaje </a></li>";
}
}
htmlEnlaces += "<li><a href=\"javascript:void(0);\" onClick='javascript:reenviarMensaje(\""+hashMensaje.idMsg+"\", \""+hashMensaje.usuarioOrigen+"\", \""+encodeURIComponent(hashMensaje.contenido)+"\")'>Reenviar mensaje</a></li>";
}
else {
htmlEnlaces += "<li><a href=\"/" + hashMensaje.idMsg + "\" target=\"_blank\">Enlace permanente </a></li>";
}
html = html.replace(/#MSG:ENLACES#/, htmlEnlaces);
if (hashMensaje.via && hashMensaje.via != "web") {
html = html.replace(/#MSG:VIA#/, "<span class=\"via\">V&iacute;a <a href=\"javascript:void(0);\" title=\"&iquest;Qu&eacute; es esto?\">" + hashMensaje.via.toUpperCase() + "</a></span>");
}
html = html.replace(/#MSG:VIA#/, "");
var htmlCmdResponder = "";
if (_nickname != '') {
if (_tablon == 3) {
htmlCmdResponder += "javascript:crearMensaje('"+hashMensaje.idMsg+"', '" + tablonesRespuesta.join("|") + "')";
} else {
var strCopiaEnTablones = "";
var idHilo = encodeURIComponent(hashMensaje.idMsg);
if (hashMensaje.hilo != 0) {
idHilo = encodeURIComponent(hashMensaje.hilo);
}
if (typeof hashMensaje.CopiaEnTablones != "undefined" &&
hashMensaje.CopiaEnTablones != 0 && hashMensaje.CopiaEnTablones.search("ev-") != -1) {
strCopiaEnTablones = hashMensaje.CopiaEnTablones;
}
htmlCmdResponder += "javascript:responderMensaje('"+hashMensaje.idMsg+"', '"+idHilo+"|"+encodeURIComponent(hashMensaje.idMsg)+"', '"+strCopiaEnTablones+"')";
}
}
else {
htmlCmdResponder += "javascript:alert('Para responder un mensaje tienes que estar autenticado')";
}
html = html.replace(/#MSG:CMD_RESPONDER#/g, htmlCmdResponder);
var mostrar_mensaje_resaltado = false;
if (_nickname != '') {
if (_nickname == hashMensaje.autorMsgRespuesta) {
mostrar_mensaje_resaltado = true;
}
var regExpRefer = new RegExp("(\s*)@(<a [^>]*>)(" + _nickname + ")(</a>*)(\s|\.\s|\.\.\.|,\s|:\s|\\?\s|!\s|\.|,|:|\\?$|!$|$)(.*)", "i");
if (regExpRefer.test(contenidoMensaje)) {
mostrar_mensaje_resaltado = true;
}
if ( !(_tablon1 == 't1-ULTIMOSMENSAJES') && !(_tablon1 == '2') && !(_tablon1.match("ev-")) ) {
mostrar_mensaje_resaltado = false;
}
if ( mostrar_mensaje_resaltado == true ) {
html = html.replace(/#MSG:INI_DIV_REFERENCIADO#/g, '');
html = html.replace(/#MSG:FIN_DIV_REFERENCIADO#/g, '');
}
}
html = html.replace(/#MSG:INI_DIV_REFERENCIADO#.*?#MSG:FIN_DIV_REFERENCIADO#/g, '');
return (html);
}
function pintaMensajeHilo(hashMensaje, esVisible, esFlotante, esProvisional) {
if (typeof esProvisional == "undefined") {
esProvisional = false;
}
if (typeof esFlotante == "undefined") {
esFlotante = false;
}
var html = document.getElementById(_idPlantillaMsgHilo).innerHTML;
html = html.replace(/\n/g, '');
html = html.replace(/\r/g, '');
html = html.replace(_idPlantillaMsgHilo, "mensaje_"+hashMensaje.idMsg);
var ahora = new Date();
var tsAhora = ahora.getTime() / 1000;
if (typeof _hashMsgs.horaActual != "undefined") {
tsAhora = _hashMsgs.horaActual;
}
var tsMensaje = hashMensaje.tsMensaje;
var fechaMensaje = new Date(hashMensaje.tsMensaje*1000);
var anyo = fechaMensaje.getFullYear();
var mes  = fechaMensaje.getMonth() + 1;
if (mes < 10) { mes = "0" + mes; }
var dia  = fechaMensaje.getDate();
if (dia < 10) { dia = "0" + dia; }
var hora = fechaMensaje.getHours();
if (hora < 10) { hora = "0" + hora; }
var min  = fechaMensaje.getMinutes();
if (min < 10) { min = "0" + min; }
var textoHora = "";
if (tsMensaje+60 > tsAhora) {
textoHora += "Menos de 1 minuto";
} else if (tsMensaje+3600 > tsAhora) {
var minutosDiff = parseInt((tsAhora-tsMensaje)/60);
textoHora += "Hace " + minutosDiff + " minuto";
if (minutosDiff > 1) {
textoHora += "s";
}
} else if (tsMensaje+3600*24 > tsAhora) {
var horasDiff = parseInt((tsAhora-tsMensaje)/3600);
textoHora += "Hace " + horasDiff + " hora";
if (horasDiff > 1) {
textoHora += "s";
}
} else {
textoHora += hora + ":" + min + ", " + dia + "-" + mes + "-" + anyo;
}
html = html.replace(/#MSG:HORA#/g, textoHora);
if (esProvisional) {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#/g, '');
html = html.replace(/#MSG:FIN_MSG_PROVISIONAL#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#.*?#MSG:FIN_MSG_PROVISIONAL#/g, '');
}
if (hashMensaje.borrado == 1) {
html = html.replace(/#MSG:INI_MSG_BORRADO#/g, '');
html = html.replace(/#MSG:FIN_MSG_BORRADO#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_BORRADO#.*?#MSG:FIN_MSG_BORRADO#/g, '');
}
html = html.replace(/#MSG:ID#/g, hashMensaje.idMsg);
html = html.replace(/#MSG:FOTO_USUARIO#/, pintaImagenUsuario(hashMensaje.usuarioOrigen));
html = html.replace(/#MSG:NICKNAME_USUARIO#/g, hashMensaje.usuarioOrigen);
html = html.replace(/#MSG:NOMBRE_USUARIO#/g, pintaNombreUsuario(hashMensaje.usuarioOrigen));
var contenidoMensaje = "" + hashMensaje.contenido;
if (typeof hashMensaje.hayVideo != "undefined" && hashMensaje.hayVideo == 1) {
contenidoMensaje = pintaVideoEnMensaje(contenidoMensaje, hashMensaje.idMsg, true);
}
html = html.replace(/#MSG:CONTENIDO#/g, contenidoMensaje);
html = html.replace(/#MSG:ETIQUETA_INICIO_IMG#/g, '<img');
html = html.replace(/#MSG:ETIQUETA_FIN_IMG#/g,    ' />');
if (esFlotante) {
html = html.replace(/#MSG:INI_NO_ES_FLOTANTE#.*?#MSG:FIN_NO_ES_FLOTANTE#/g, '');
}
html = html.replace(/#MSG:INI_NO_ES_FLOTANTE#/g, '');
html = html.replace(/#MSG:FIN_NO_ES_FLOTANTE#/g, '');
var tablonesAMostrar = Array();
var tablonesRespuesta = Array();
if (hashMensaje.CopiaEnTablones && !esFlotante) {
var tablones = hashMensaje.CopiaEnTablones.split(',');
for (var i = 0; i != tablones.length; i++) {
if (/^ev-/.test(tablones[i])) {
tablonesAMostrar.push(pintaNombreEvento(tablones[i].substring(3)));
tablonesRespuesta.push(tablones[i].substring(3));
}
}
if (tablonesAMostrar.length > 0) {
html = html.replace(/#MSG:TEMA#/, tablonesAMostrar[0]);
html = html.replace(/#MSG:TEMA_NORM#/, tablonesRespuesta[0]);
if (tablonesAMostrar.length > 1) {
var htmlMasTemas = "<ul>";
for (var contTemas = 1; contTemas != tablonesAMostrar.length; contTemas++) {
htmlMasTemas += "<li><a href=\"*" + tablonesRespuesta[contTemas] + "\" title=\"Ver tema\">" + tablonesAMostrar[contTemas] + "</a></li>";
}
htmlMasTemas += "</ul>";
html = html.replace(/#MSG:MAS_TEMAS#/, htmlMasTemas);
} else {
html = html.replace(/#MSG:INI_MAS_TEMAS#.*?#MSG:FIN_MAS_TEMAS#/, '');
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
html = html.replace(/#MSG:INI_DIV_TEMA#/, '');
html = html.replace(/#MSG:FIN_DIV_TEMA#/, '');
html = html.replace(/#MSG:MAS_TEMAS#/, '');
html = html.replace(/#MSG:INI_MAS_TEMAS#/, '');
html = html.replace(/#MSG:FIN_MAS_TEMAS#/, '');
if (hashMensaje.cont_adicional && hashMensaje.cont_adicional_tipo == 'IMAGEN') {
var dimX = hashMensaje.cont_adicional_dimx;
var dimY = hashMensaje.cont_adicional_dimy;
var maxAnchoFoto = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
maxAnchoFoto = _maxAnchoFoto;
}
var dimension_maxima_imagen_x = _dimension_maxima_imagen_x;
if (dimX > maxAnchoFoto) {
var porcentajeReduccion = maxAnchoFoto/dimX;
dimX = parseInt(dimX * porcentajeReduccion);
dimY = parseInt(dimY * porcentajeReduccion);
}
if (dimX > dimension_maxima_imagen_x) {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
} else {
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
}
html = html.replace(/#MSG:FOTO#/, hashMensaje.cont_adicional);
html = html.replace(/#MSG:FOTO_WIDTH#/, dimX);
html = html.replace(/#MSG:FOTO_HEIGHT#/, dimY);
} else {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
}
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#/, '');
html = html.replace(/#MSG:FIN_FOTO_COMPLETA#/, '');
if (!esFlotante) {
var htmlEnlaces = "";
if (_nickname != '' && _nickname != hashMensaje.usuarioOrigen) {
htmlEnlaces += "<li><a href=\"javascript:void(0);\" onclick=\"javascript:notificarMensajeSpam('" + hashMensaje.idMsg + "');\" >Marcar como spam </a></li>";
htmlEnlaces += "<li><a href=\"javascript:void(0);\" onclick=\"javascript:notificarMensajeInsulto('" + hashMensaje.idMsg + "');\" >Notificar insulto </a></li>";
}
htmlEnlaces += "<li><a href=\"/" + hashMensaje.idMsg + "\" target=\"_blank\">Enlace permanente </a></li>";
html = html.replace(/#MSG:ENLACES#/, htmlEnlaces);
if (hashMensaje.via && hashMensaje.via != "web") {
html = html.replace(/#MSG:VIA#/, "<span class=\"via\">V&iacute;a <a href=\"javascript:void(0);\" title=\"&iquest;Qu&eacute; es esto?\">" + hashMensaje.via.toUpperCase() + "</a></span>");
}
html = html.replace(/#MSG:VIA#/, "");
var htmlCmdResponder = "";
if (_nickname != '') {
var strCopiaEnTablones = "";
var idHilo = encodeURIComponent(hashMensaje.idMsg);
if (hashMensaje.hilo != 0) {
idHilo = encodeURIComponent(hashMensaje.hilo);
}
if (typeof hashMensaje.CopiaEnTablones != "undefined" &&
hashMensaje.CopiaEnTablones != 0 && hashMensaje.CopiaEnTablones.search("ev-") != -1) {
strCopiaEnTablones = hashMensaje.CopiaEnTablones;
}
htmlCmdResponder += "javascript:responderMensajeHilo('"+hashMensaje.idMsg+"', '"+idHilo+"|"+encodeURIComponent(hashMensaje.idMsg)+"', '"+strCopiaEnTablones+"')";
}
else {
htmlCmdResponder += "javascript:alert('Para responder un mensaje tienes que estar autenticado')";
}
html = html.replace(/#MSG:CMD_RESPONDER#/g, htmlCmdResponder);
}
return (html);
}
function pintaVideoEnMensaje(contenidoMensaje, idMensaje, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
if (contenidoMensaje.match(/href=\"(http(s)?:\/\/(\w+\.)?(youtube\.com|metacafe\.com|dailymotion\.com|vimeo\.com|current\.com|video\.google\.com|video\.google\.es|vids\.myspace\.com)\/([^\"]+))/i)) {
var urlVideo = RegExp.$1;
var htmlVideo = obtenerHtmlVideo(urlVideo, idMensaje, enHilo);
contenidoMensaje = contenidoMensaje.replace(/<a (target=\"_blank\" )?href=\"(http(s)?:\/\/(\w+\.)?(youtube\.com|metacafe\.com|dailymotion\.com|vimeo\.com|current\.com|video\.google\.com|video\.google\.es|vids\.myspace\.com)\/([^\"]+))">[^<]+<\/a>/i, htmlVideo);
}
return contenidoMensaje;
}
function obtenerSwfVideo(urlPaginaVideo, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
var urlBaseYoutube     = "http://www.youtube.com/v/";
var urlBaseMetacafe    = "http://www.metacafe.com/fplayer/";
var urlBaseDailymotion = "http://www.dailymotion.com/swf/";
var urlBaseVimeo       = "http://vimeo.com/moogaloop.swf?clip_id=";
var urlBaseCurrent     = "http://current.com/e/";
var urlBaseGoogle      = "http://video.google.es/googleplayer.swf?docid=";
var urlBaseMySpace     = "http://mediaservices.myspace.com/services/media/embed.aspx/m=";
if (!/(http(s)?:\/\/(\w+\.)?(youtube\.com|metacafe\.com|dailymotion\.com|vimeo\.com|current\.com|video\.google\.com|video\.google\.es|vids\.myspace\.com)\/([^\s]+))/.test(urlPaginaVideo)) {
return (urlPaginaVideo);
}
if (/https?:\/\/(\w+\.)?youtube\.com\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/v=([^&]+)/)) {
var idvideo = RegExp.$1;
return (urlBaseYoutube + idvideo);
}
}
if (/https?:\/\/(\w+\.)?metacafe\.com\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/\/watch\/([^\/]+\/[^\/]+)/)) {
var idvideo = RegExp.$1;
return (urlBaseMetacafe + idvideo + ".swf");
}
}
if (/https?:\/\/(\w+\.)?dailymotion\.com\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/\/video\/([^\?]+)/)) {
var idvideo = RegExp.$1;
return (urlBaseDailymotion + idvideo);
}
}
if (/https?:\/\/(\w+\.)?vimeo\.com\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/https?:\/\/(\w+\.)?vimeo\.com\/(\d+)/)) {
var idvideo = RegExp.$2;
return (urlBaseVimeo + idvideo);
}
}
if (/https?:\/\/(\w+\.)?current\.com\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/items\/(\d+)/)) {
var idvideo = RegExp.$1;
return (urlBaseCurrent  + idvideo);
}
}
if (/https?:\/\/video\.google\.(es|com)\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/docid=([^&]+)/)) {
var idvideo = RegExp.$1;
return (urlBaseGoogle + idvideo);
}
}
if (/https?:\/\/vids\.myspace\.com\//.test(urlPaginaVideo)) {
if (urlPaginaVideo.match(/videoid=(\d+)/)) {
var idvideo = RegExp.$1;
return (urlBaseMySpace + idvideo + ",t=1,mt=video");
}
}

return (urlPaginaVideo);
}
function obtenerHtmlVideo(urlPaginaVideo, idMsg, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
urlPaginaVideo = decodeURIComponent(urlPaginaVideo);
var urlSwfVideo = obtenerSwfVideo(urlPaginaVideo);
if (urlPaginaVideo == urlSwfVideo) {
return (urlPaginaVideo);
}
if (versionFlash >= 8) {
var default_params_Ex = {"menu":"false", "wmode":"transparent", "allowfullscreen":"true" };
var versionMinima_Ex = 7;
var dimX = _maxAnchoFotoDefecto;
var dimY = 350;
var anchoVideo = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
anchoVideo = _maxAnchoFoto;
}
if (_maxAnchoFotoDefecto > anchoVideo) {
var porcentajeReduccion = anchoVideo/_maxAnchoFotoDefecto;
dimX = parseInt(dimX * porcentajeReduccion);
dimY = parseInt(dimY * porcentajeReduccion);
}
var htmlVideo = '<span style="padding: 10px 0 10px 0; display: block; clear: both;">';
if (!enHilo && (typeof _enMensajeUnico == "undefined" ||
(typeof _enMensajeUnico != "undefined" && _enMensajeUnico != true))) {
htmlVideo = '<span id="videocapainfo_' + idMsg + '" class="recargarpaginacapaoculta" style="display:none">Puedes parar la recarga autom&aacute;tica de la p&aacute;gina pulsando el bot&oacute;n de pausa para que no te interrumpa mientras ves el v&iacute;deo.</span>' + htmlVideo + '<span class="recargarpagina"><span id="videoboton_' + idMsg + '" class="botonpausa"><a href="javascript:void(0);" onClick="javascript:iniciarPararRecarga()"></a></span><span class="explicacion"><a id="videoenlaceexplicacion_' + idMsg + '" href="javascript:void(0);" onClick="javascript:iniciarPararRecarga()" onmouseover="mostrarOcultarVideoInfo(\'' + idMsg + '\', ' + enHilo + ');" onmouseout="mostrarOcultarVideoInfo(\'' + idMsg + '\', ' + enHilo + ');">Pausar recarga de p&aacute;gina </a></span></span>';
}
if (!isIE) {
htmlVideo += '<object id="video_' + idMsg + '" data="' + urlSwfVideo + '" type="application/x-shockwave-flash" width="' + dimX + '" height="' + dimY + '"><param value="true" name="allowfullscreen"><param value="false" name="menu"><param value="transparent" name="wmode"></object>';
} else {
htmlVideo += '<object id="video_' + idMsg + '" codeBase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=7,0,0,0" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width="' + dimX + '" height="' + dimY + '"><PARAM NAME="_cx" VALUE="11430"><PARAM NAME="_cy" VALUE="9260"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="' + urlSwfVideo + '"><PARAM NAME="Src" VALUE="' + urlSwfVideo + '"><PARAM NAME="WMode" VALUE="Transparent"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE="LT"><PARAM NAME="Menu" VALUE="0"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="NoScale"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="-1"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="1174431096"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="true"></object>';
}
htmlVideo += '</span>';
return (htmlVideo);
} else {
return ("<br /><i>[Necesitas instalar una versi&oacute;n reciente del plugin de Flash para ver v&iacute;deos]</i><br />");
}
}
function mostrarOcultarVideoInfo(idMsg, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
capaInfo = document.getElementById("videocapainfo_" + idMsg);
if (capaInfo.style.display == "none") {
var spanBoton = document.getElementById("videoboton_" + idMsg);
var posBoton  = METUtils_calcAbsPositionV2(spanBoton);
var extraLeft = -2;
var extraTop  = -1;
capaInfo.style.display = "block";
capaInfo.style.left = parseInt(posBoton[0] - capaInfo.clientWidth + spanBoton.clientWidth + extraLeft) + "px";
capaInfo.style.top = parseInt(posBoton[1] - capaInfo.clientHeight + extraTop) + "px";
} else {
capaInfo.style.display = "none";
}
}
function pintaRecarga() {
var enRecarga = false;
if (_es_primera_carga || typeof _intRecarga != "undefined") {
enRecarga = true;
}
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (typeof _hashMsgs.mensajes[i]["hayVideo"] != "undefined" &&
_hashMsgs.mensajes[i]["hayVideo"] == 1) {
if (document.getElementById("videocapainfo_" + _hashMsgs.mensajes[i]["idMsg"])) {
if (enRecarga) {
document.getElementById("videocapainfo_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Puedes parar la recarga autom&aacute;tica de la p&aacute;gina pulsando el bot&oacute;n de pausa para que no te interrumpa mientras ves el v&iacute;deo.";
} else {
document.getElementById("videocapainfo_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Puedes reanudar la recarga pulsando el bot&oacute;n de play para que los nuevos mensajes aparezcan autom&aacute;ticamente.";
}
}
if (document.getElementById("videoboton_" + _hashMsgs.mensajes[i]["idMsg"])) {
if (enRecarga) {
document.getElementById("videoboton_" + _hashMsgs.mensajes[i]["idMsg"]).className = "botonpausa";
} else {
document.getElementById("videoboton_" + _hashMsgs.mensajes[i]["idMsg"]).className = "botonplay";
}
}
if (document.getElementById("videoenlaceexplicacion_" + _hashMsgs.mensajes[i]["idMsg"])) {
if (enRecarga) {
document.getElementById("videoenlaceexplicacion_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Pausar recarga de p&aacute;gina";
} else {
document.getElementById("videoenlaceexplicacion_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Reanudar la recarga";
}
}
}
}
}
function iniciarPararRecarga() {
var enRecarga = false;
if (typeof _intRecarga != "undefined") {
enRecarga = true;
}
if (!enRecarga) {
recargaRapida();
lanzaEventosRecarga();
} else {
paraEventosRecarga();
}
pintaRecarga();
}
function irAPagina(numPagina) {
location.href = location.pathname + "?p=" + numPagina;
}
function pintaPaginacion() {
if ( ( _numPagActual == 1) && (parseInt(_hashMsgs.numMensajes) <= _numMsgPag) ) {
return(false);
}
var divContenedor = document.getElementById(_idContenedorPag);
var html = "";
html += "<ul>";
if (_numPagActual == 1) {
html += "<li><span class=\"inhabilitado\" title=\"Primera p&aacute;gina\">&lt;&lt;</span></li>";
} else {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html += "<li><a href=\"javascript:void(0);\" class=\"flechadoble\" onClick=\"irAPagina(1);\" title=\"Primera p&aacute;gina\">&lt;&lt;</a></li>";
} else {
html += "<li><a href=\"javascript:void(0);\" class=\"flechadoble\" onClick=\"muestraMensajes(1, true);posicionarEnDivMensajes();\" title=\"Primera p&aacute;gina\">&lt;&lt;</a></li>";
}
}
if (_numPagActual > 1) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html += "<li><a href=\"javascript:void(0);\" onClick=\"irAPagina(" + (_numPagActual-1) + ");\" class=\"flecha\" title=\"P&aacute;gina anterior\">&lt;</a></li>";
} else {
html += "<li><a href=\"javascript:void(0);\" onClick=\"muestraMensajes(" + (_numPagActual-1) + ", true);posicionarEnDivMensajes();\" class=\"flecha\" title=\"P&aacute;gina anterior\">&lt;</a></li>";
}
} else {
html += "<li><span class=\"inhabilitado\" title=\"P&aacute;gina anterior\">&lt;</span></li>";
}
html += "<li class=\"activo\"><a href=\"javascript:void(0);\">" + _numPagActual + "</a></li>";
if (parseInt(_numPagActual*_numMsgPag) < parseInt(_hashMsgs.numMensajes)) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html += "<li><a href=\"javascript:void(0);\" onClick=\"irAPagina(" + (_numPagActual+1) + ");\" class=\"flecha\" title=\"P&aacute;gina siguiente\">&gt;</a></li>";
} else {
html += "<li><a href=\"javascript:void(0);\" onClick=\"muestraMensajes(" + (_numPagActual+1) + ", true);posicionarEnDivMensajes();\" class=\"flecha\" title=\"P&aacute;gina siguiente\">&gt;</a></li>";
}
} else {
html += "<li><span class=\"inhabilitado\" title=\"P&aacute;gina siguiente\">&gt;</span></li>";
}
html += "</ul>";
divContenedor.innerHTML = html;
divContenedor.style.display = '';
}
function comprobarDispNuevosMensajes() {
var url    = "";
var params = "rnd=" + Math.random();
url += _urlTSUpdate;
if (typeof _tablon1 != "undefined" && _tablon1 != "" && _tablon1 != "2" && _tablon1 != "3") {
params += "&t=" + _tablon1;
}
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticionUpdate = Array();
try {
eval("_hashPeticionUpdate = " + data);
} catch(e) {
_hashPeticionUpdate = Array();
}
if (_es_primera_carga ||
typeof _hashPeticionUpdate.status == "undefined" ||
typeof _hashPeticionUpdate.ultimaActualizacion == "undefined" ||
_hashPeticionUpdate.status != 1) {
recuperarInformacionMensajes();
} else {
var recuperarInformacion = false;
if ((typeof _hashPeticionUpdate.ultimaActualizacion[_tablon1] != "undefined") &&
(parseInt(_hashPeticionUpdate.ultimaActualizacion[_tablon1]) == -1 ||
parseInt(_hashPeticionUpdate.ultimaActualizacion[_tablon1]) > parseInt(_tsTablon1))) {
recuperarInformacion = true;
}
if (_nickname != '') {
if (typeof _hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname] != "undefined") {
if ((parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) == -1) ||
(parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) > parseInt(_tsTablon2))) {
if (parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) == -1) {
recuperarInformacion = true;
} else if (_tablon != "2" && _tsTablon2 != 0) {
cambiaAspectoPestana('pestana_suscripciones', true);
_tsTablon2 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]);
}
if (_tablon == "2" && parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) != -1) {
recuperarInformacion = true;
_tsTablon2 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]);
}
}
}
if (typeof _hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname] != "undefined") {
if ((parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) == -1) ||
(parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) > parseInt(_tsTablon3))) {
if (parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) == -1) {
recuperarInformacion = true;
} else if (_tablon != "3" && _tsTablon3 != 0) {
cambiaAspectoPestana('pestana_privados', true);
_tsTablon3 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]);
}
if (_tablon == "3" && parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) != -1) {
recuperarInformacion = true;
_tsTablon3 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]);
}
}
}
}
if (recuperarInformacion) {
recuperarInformacionMensajes();
}
}
} else {
recuperarInformacionMensajes();
}
}, url + "?" + params);
}
function recuperarInformacionMensajes() {
var url    = "";
var params = "rnd=" + Math.random() + "&";
url += _urlOututoi;
if (typeof _tablon1 != "undefined" && _tablon1 != "") {
params += "t=" + _tablon1 + "&p=" + _numPagCache + "&nummsg=" + _numMsgCache;
} else {
params += "t=info";
}
if (_ultimaRecargaServidor > 0) {
params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticion = Array();
try {
eval("_hashPeticion = " + data);
} catch(e) {
_hashPeticion = Array();
mostrarError("No es posible recuperar los mensajes.");
}
if ((typeof _hashPeticion.updated != "undefined") &&
(typeof _hashPeticion.updated[_tablon1] != "undefined") &&
(parseInt(_hashPeticion.updated[_tablon1]) > parseInt(_tsTablon1))) {
_tsTablon1 = parseInt(_hashPeticion.updated[_tablon1]);
}
if (_nickname != '') {
if (typeof _hashPeticion.updated != "undefined") {
if ((typeof _hashPeticion.updated["t2-"+_nickname] != "undefined") &&
(parseInt(_hashPeticion.updated["t2-"+_nickname]) > parseInt(_tsTablon2)) &&
_tablon != "2" && _tsTablon2 != 0) {
cambiaAspectoPestana('pestana_suscripciones', true);
}
if ((typeof _hashPeticion.updated["t3-"+_nickname] != "undefined") &&
(parseInt(_hashPeticion.updated["t3-"+_nickname]) > parseInt(_tsTablon3)) &&
_tablon != "3" && _tsTablon3 != 0) {
cambiaAspectoPestana('pestana_privados', true);
}
if (_ultimaRecargaServidor == 0 &&
typeof _hashPeticion.ultimaVisita != "undefined") {
if (typeof _hashPeticion.ultimaVisita["2"]        != "undefined" &&
typeof _hashPeticion.updated["t2-"+_nickname] != "undefined" &&
_hashPeticion.updated["t2-"+_nickname] > _hashPeticion.ultimaVisita["2"] &&
_tablon != "2") {
cambiaAspectoPestana('pestana_suscripciones', true);
}
if (typeof _hashPeticion.ultimaVisita["3"]        != "undefined" &&
typeof _hashPeticion.updated["t3-"+_nickname] != "undefined" &&
_hashPeticion.updated["t3-"+_nickname] > _hashPeticion.ultimaVisita["3"] &&
_tablon != "3") {
cambiaAspectoPestana('pestana_privados', true);
}
}
}
}
if ((typeof _hashPeticion.mensajes == "undefined" || _hashPeticion.mensajes.length <= 0) && _ultimaRecargaServidor == 0) {
if (typeof _tablon1 != "undefined" && _tablon1 != "") {

f_muestra_panel_ayuda(_tablon1);
mostrarError("No hay mensajes disponibles");
}
}
if (typeof _hashPeticion.horaActual != "undefined") {
_ultimaRecargaServidor = _hashPeticion.horaActual;
}
if (_es_primera_carga) {
_tsTablon1 = _ultimaRecargaServidor;
_tsTablon2 = _ultimaRecargaServidor;
_tsTablon3 = _ultimaRecargaServidor;
}
if (typeof _hashPeticion.mensajes != "undefined" && _hashPeticion.mensajes.length > 0) {
if (typeof _hashMsgs.mensajes != "undefined") {
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[i]["idMsg"])) {
return(false);
}
}
}
_hashMsgs = _hashPeticion;
muestraMensajes(_numPagActual);
}
}
if (_es_primera_carga == 1)  {
_es_primera_carga = 0;
}
}, url + "?" + params);
}
function recuperarInformacionMensajesHilo() {
var url    = _urlOututoi;
var params = "th=1&msg=" + _idHilo + "&rnd=" + Math.random();
if (_ultimaRecargaServidor > 0) {
params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
if (_idHilo != "") {
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticion = Array();
try {
eval("_hashPeticion = " + data);
} catch(e) {
_hashPeticion = Array();
}
if (typeof _hashPeticion.horaActual != "undefined") {
_ultimaRecargaServidor = _hashPeticion.horaActual;
}
if (typeof _hashPeticion.mensajes != "undefined" &&_hashPeticion.mensajes.length > 0) {
if (typeof _hashMsgs.mensajes != "undefined") {
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[i]["idMsg"])) {
return(false);
}
}
}
_hashMsgs = _hashPeticion;
muestraMensajesHilo();
}
}
}, url + "?" + params);
}
}
function lanzaEventosRecarga() {
if (window.attachEvent) {
window.attachEvent('onfocus', recargaRapida);
window.attachEvent('onblur', recargaLenta);
} else if (window.addEventListener) {
window.addEventListener('focus', recargaRapida, false);
window.addEventListener('blur', recargaLenta, false);
} else if (document.addEventListener) {
document.addEventListener('focus', recargaRapida, false);
document.addEventListener('blur', recargaLenta, false);
}
}
function paraEventosRecarga() {
if (window.detachEvent) {
window.detachEvent('onfocus', recargaRapida);
window.detachEvent('onblur', recargaLenta);
} else if (window.removeEventListener) {
window.removeEventListener('focus', recargaRapida, false);
window.removeEventListener('blur', recargaLenta, false);
} else if (document.addEventListener) {
document.removeEventListener('focus', recargaRapida, false);
document.removeEventListener('blur', recargaLenta, false);
}
clearInterval(_intRecarga);
_intRecarga = undefined;
}
function f_lanza_eventos_carga_mensajes() {
lanzaEventosRecarga();
recarga();
if (_ultimaRecargaProteccion == 0) {
recargaRapida();
}
}
function recarga() {
var f = new Date();
if ((_ultimaRecargaProteccion+(_segsMinEntreRecargas*1000))>f.getTime()) {
return(false);
}
comprobarDispNuevosMensajes();

_ultimaRecargaProteccion = f.getTime();
}
function recargaRapida() {
recarga();
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recarga, _segsRecRapida * 1000);
}
function recargaLenta() {
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recarga, _segsRecLenta * 1000);
}
function recargaHilo() {
var f = new Date();
if ((_ultimaRecargaProteccion+(_segsMinEntreRecargas*1000))>f.getTime()) {
return(false);
}
recuperarInformacionMensajesHilo();
if (_tsHilo == 0) {
_tsHilo = _ultimaRecargaServidor;
}
_ultimaRecargaProteccion = f.getTime();
}
function recargaRapidaHilo() {
recargaHilo();
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recargaHilo, _segsRecRapida * 1000);
}
function recargaLentaHilo() {
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recargaHilo, _segsRecLenta * 1000);
}
function cambiaAspectoPestana(idPestana, hayNuevo) {
if (document.getElementById(idPestana)) {
var divPestana = document.getElementById(idPestana);
if (hayNuevo) {
if (!document.getElementById("icono_"+idPestana)) {
divPestana.innerHTML += "<span class='mensajenuevo' title='Mensaje nuevo' id='icono_"+idPestana+"'>";
}
} else {
if (document.getElementById("icono_"+idPestana)) {
divPestana.removeChild(document.getElementById("icono_"+idPestana));
}
}
}
}
function mostrarOcultarMasTemas(idMensaje) {
var capaTemas = document.getElementById("capatemas_"+idMensaje);
var iconoMasTemas = document.getElementById("iconomastemas_"+idMensaje);
if (capaTemas.style.display == "none") {
capaTemas.style.display = "block";
iconoMasTemas.src = "/Iconos/v1.x/v1.0/varios/ico_todos_los_temas_2.png";
} else {
capaTemas.style.display = "none";
iconoMasTemas.src = "/Iconos/v1.x/v1.0/varios/ico_todos_los_temas.png";
}
}
function mostrarTodosDestinatarios(idUlDestinatarios) {
if (!document.getElementById(idUlDestinatarios)) {
return false;
}
var UlDestinatarios = document.getElementById(idUlDestinatarios);
for (var contChild = 0; contChild != UlDestinatarios.childNodes.length; contChild++) {
if (UlDestinatarios.childNodes[contChild].nodeName == "LI") {
UlDestinatarios.childNodes[contChild].style.display = "block";
}
}
if (document.getElementById(idUlDestinatarios + "_desplegar")) {
UlDestinatarios.removeChild(document.getElementById(idUlDestinatarios + "_desplegar"));
}
UlDestinatarios.innerHTML += "<li id=\"" + idUlDestinatarios + "_ocultar\"><a href=\"javascript:void(0);\" title=\"Ocultar\" class=\"ocultar\" onClick=\"ocultarDestinatarios('" + idUlDestinatarios + "')\">Ocultar </a></li>";
}
function ocultarDestinatarios(idUlDestinatarios) {
if (!document.getElementById(idUlDestinatarios)) {
return false;
}
var UlDestinatarios = document.getElementById(idUlDestinatarios);
var contLI = 0;
for (var contChild = 0; contChild != UlDestinatarios.childNodes.length; contChild++) {
if (UlDestinatarios.childNodes[contChild].nodeName == "LI") {
if (_numUsuariosAMostrar != 0 && contLI >= _numUsuariosAMostrar) {
UlDestinatarios.childNodes[contChild].style.display = "none";
}
contLI++;
}
}
if (document.getElementById(idUlDestinatarios + "_ocultar")) {
UlDestinatarios.removeChild(document.getElementById(idUlDestinatarios + "_ocultar"));
}
UlDestinatarios.innerHTML += "<li id=\"" + idUlDestinatarios + "_desplegar\"><a href=\"javascript:void(0);\" onClick=\"mostrarTodosDestinatarios('" + idUlDestinatarios + "')\" title=\"Desplegar\" class=\"resto\">Ver todos </a></li>";
}
function borrarMensaje(idMensaje, tablon) {
if (confirm("¿Estás seguro de borrar el mensaje?")) {
var params = "c=delete&x=" + encodeURIComponent(idMensaje);
if (typeof tablon != "undefined") {
params += "&t=" + tablon;
}
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
document.getElementById(_idContenedorMsgs).removeChild(document.getElementById("mensaje_"+idMensaje));
} else {
alert("Error tratando de borrar mensaje");
}
}, _urlInutoi + "?" + params);
}
}
function crearFormularioMensaje(idMensaje) {
var divTplForm = document.getElementById(_idContenedorForm);
var htmlForm   = divTplForm.innerHTML.replace(/#ID#/g, idMensaje);
var divMsgForm = document.createElement("DIV");
divMsgForm.id = "divform_"+idMensaje;
divMsgForm.innerHTML = htmlForm;
return divMsgForm;
}
function crearIframeTargetFormulario(idMensaje, accion, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
var divIFrameTarget = document.createElement('DIV');
divIFrameTarget.id = "diviframe_"+idMensaje;
if (!enHilo) {
divIFrameTarget.innerHTML = "<iframe style='display:none' src='about:blank' id='iframe_"+idMensaje+"' name='iframe_"+idMensaje+"' onLoad='comprobarPost(\""+idMensaje+"\", \"" + accion + "\")'></iframe>";
} else {
divIFrameTarget.innerHTML = "<iframe style='display:none' src='about:blank' id='iframe_"+idMensaje+"' name='iframe_"+idMensaje+"' onLoad='comprobarPostHilo(\""+idMensaje+"\", \"" + accion + "\")'></iframe>";
}
document.body.appendChild(divIFrameTarget);
}
function crearMensaje(idMensaje, destinoMensaje) {
if (typeof destinoMensaje == "undefined") {
destinoMensaje = "";
}
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length != 0) {
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Responder";
divContenedorFormularioMensaje.innerHTML = "";
return;
} else {
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Cancelar";
}
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
document.getElementById("c_" + idMensaje).value = "add";
document.getElementById("t_" + idMensaje).value = destinoMensaje;
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'add');
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
}
function editarMensaje(idMensaje, usuarioOrigen, contenido) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length != 0) {
return;
} else {
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Cancelar";
}
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
document.getElementById("labelresponder_"+idMensaje).innerHTML = "Edita tu mensaje";
document.getElementById("linkadjuntarimagen_"+idMensaje).innerHTML = "Cambiar/Adjuntar imagen";
document.getElementById("submitresponder_"+idMensaje).innerHTML    = "Actualizar";
document.getElementById("c_" + idMensaje).value = "edit";
document.getElementById("x_" + idMensaje).value = idMensaje;
document.getElementById("t_" + idMensaje).value = usuarioOrigen;
contenido = decodeURIComponent(contenido);
contenido = contenido.replace(/<a.*?>/g, '');
contenido = contenido.replace(/<\/a>/g, '');
var divTmpContenido = document.createElement("DIV");
divTmpContenido.innerHTML = contenido;
document.getElementById("m_" + idMensaje).value = divTmpContenido.innerHTML;
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'edit');
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
}
function reenviarMensaje(idMensaje, usuarioOrigen, contenido) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length != 0) {
return;
} else {
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Cancelar";
}
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
document.getElementById("labelresponder_"+idMensaje).innerHTML = "Mensaje";
document.getElementById("linkadjuntarimagen_"+idMensaje).innerHTML = "Cambiar/Adjuntar imagen";
document.getElementById("submitresponder_"+idMensaje).innerHTML    = "Reenviar";
document.getElementById("c_" + idMensaje).value = "add";
document.getElementById("x_" + idMensaje).value = idMensaje;
contenido = decodeURIComponent(contenido);
contenido = contenido.replace(/<a.*?>/g, '');
contenido = contenido.replace(/<\/a>/g, '');
contenido = "fwd @" + usuarioOrigen + ": " + contenido;
var divTmpContenido = document.createElement("DIV");
divTmpContenido.innerHTML = contenido;
document.getElementById("m_" + idMensaje).value = divTmpContenido.innerHTML;
f_poner_foco_campo_texto("m_" + idMensaje);
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'add');
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
}
function responderMensajeHilo(idMensaje, idsHilo, strCopiaEnTablones) {
var enHilo = true;
responderMensaje(idMensaje, idsHilo, strCopiaEnTablones, enHilo);
}
function responderMensaje(idMensaje, idsHilo, strCopiaEnTablones, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length != 0) {
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Responder";
divContenedorFormularioMensaje.innerHTML = "";
return;
} else {
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Cancelar";
}
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
document.getElementById("c_" + idMensaje).value = "reply";
document.getElementById("x_" + idMensaje).value = idsHilo;
document.getElementById("t_" + idMensaje).value = strCopiaEnTablones;
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'reply', enHilo)
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
if (strCopiaEnTablones != "") {
var divContenedorEscribirMensaje = document.getElementById("escribirmensaje_" + idMensaje);
var divTrabajando = document.createElement("DIV");
divTrabajando.id = "trabajando_" + idMensaje;
divTrabajando.className = "trabajando";
divContenedorEscribirMensaje.insertBefore(divTrabajando, divContenedorEscribirMensaje.firstChild);
f_obtener_eventos_para_escribir_en_respuesta(idMensaje, strCopiaEnTablones);
}
}
function crearMensajeTemporal(idMensaje) {
var comando     = '';
var idsHilo     = '';
var destino     = '';
var contenido   = '';
if (typeof idMensaje == 'undefined') {
comando = document.getElementById("c").value;
idsHilo = document.getElementById("x").value;
destino = document.getElementById("t").value;
contenido = document.getElementById("m").value;
}
else {
comando = document.getElementById("c_" + idMensaje).value;
idsHilo = document.getElementById("x_" + idMensaje).value;
destino = document.getElementById("t_" + idMensaje).value;
contenido = document.getElementById("m_" + idMensaje).value;
}
contenido = contenido.replace(/\n/g, '');
contenido = contenido.replace(/\r/g, '');
contenido = contenido.replace(/<b>/gi, "[b]");
contenido = contenido.replace(/<\/b>/gi, "[/b]");
contenido = contenido.replace(/<i>/gi, "[i]");
contenido = contenido.replace(/<\/i>/gi, "[/i]");
contenido = contenido.replace(/<[^>]*>/g, "");
contenido = contenido.replace(/\[b\]/gi, "<b>");
contenido = contenido.replace(/\[\/b\]/gi, "</b>");
contenido = contenido.replace(/\[i\]/gi, "<i>");
contenido = contenido.replace(/\[\/i\]/gi, "</i>");
var hashMensaje = Array();
var ahora = new Date();
var tsAhora = ahora.getTime() / 1000;
if (typeof _hashMsgs.horaActual != "undefined") {
tsAhora = _hashMsgs.horaActual;
}
hashMensaje["idMsg"] = tsAhora + "-temporal";
hashMensaje["tsMensaje"] = tsAhora;
hashMensaje["usuarioOrigen"] = _nickname;
hashMensaje["contenido"] = contenido;
return hashMensaje;
}
function cancelarMensaje(idMensaje) {
if (confirm("¿Estás seguro de cancelar el mensaje?")) {
var divIFrameTarget = document.getElementById("diviframe_"+idMensaje);
document.body.removeChild(divIFrameTarget);
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
var divMsgForm = document.getElementById("divform_"+idMensaje);
divContenedorFormularioMensaje.removeChild(divMsgForm);
}
}
function comprobarCargaIframeFormulario(idMensaje) {
var i = document.getElementById("iframe_"+idMensaje);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames["iframe_"+idMensaje].document;
}
if (d.location.href == "about:blank") {
return true;
}
if (!d.getElementById("status")) {
errorResponderMensajes(idMensaje, "Ha ocurrido un error. Por favor, int&eacute;ntalo m&aacute;s tarde.");
return false;
}
if (d.getElementById("status").innerHTML != "OK") {
errorResponderMensajes(idMensaje, d.getElementById("info").innerHTML + " (Error "+d.getElementById("code").innerHTML+")");
return false;
}
return d;
}
function comprobarPost(idMensaje, comando) {
var d = comprobarCargaIframeFormulario(idMensaje);
if (d == true || d == false) {
return d;
}
avisoResponderMensajes(idMensaje, d.getElementById("info").innerHTML);
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Responder";
var htmlMensajeTemporal = "";
if ((_tipoTablon == '1' || _tipoTablon == '2' ||_tipoTablon == '3' ||_tipoTablon == '4') ||
(_tipoTablon == '5' &&
typeof _hashDatosEvento != "undefined" &&
typeof _hashDatosEvento.estado_seguimiento != "undefined" &&
_hashDatosEvento.estado_seguimiento == 1)
) {
htmlMensajeTemporal = pintaMensaje(crearMensajeTemporal(idMensaje), true);
}
if (comando == "edit") {
var divTmpMensaje = document.createElement("DIV");
divTmpMensaje.innerHTML = htmlMensajeTemporal;
var divMensaje = document.getElementById("mensaje_" + idMensaje);
document.getElementById(_idContenedorMsgs).insertBefore(divTmpMensaje, divMensaje);
document.getElementById(_idContenedorMsgs).removeChild(divMensaje);
} else {
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg)) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + _hashMsgs.mensajes[contMsg].idMsg);
divContenedorFormularioMensaje.removeChild(document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg));
}
}
if (typeof _idContenedorMsgs != "undefined" && document.getElementById(_idContenedorMsgs)) {
var divContenedor = document.getElementById(_idContenedorMsgs);
divContenedor.innerHTML = htmlMensajeTemporal + divContenedor.innerHTML;
}
}
return true;
}
function comprobarPostHilo(idMensaje, comando) {
var d = comprobarCargaIframeFormulario(idMensaje);
if (d == true || d == false) {
return d;
}
if (d.getElementById("info").innerHTML != "") {
avisoResponderMensajes(idMensaje, d.getElementById("info").innerHTML);
}
document.getElementById("linkresponder_" + idMensaje).innerHTML = "Responder";
var htmlMensajeTemporal = "";
htmlMensajeTemporal = pintaMensajeHilo(crearMensajeTemporal(idMensaje), true, false, true);
var divMensaje = document.getElementById("mensaje_" + idMensaje);
if (comando == "edit") {
var divTmpMensaje = document.createElement("DIV");
divTmpMensaje.innerHTML = htmlMensajeTemporal;
document.getElementById(_idContenedorHilo).insertBefore(divTmpMensaje, divMensaje);
document.getElementById(_idContenedorHilo).removeChild(divMensaje);
} else {
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg)) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + _hashMsgs.mensajes[contMsg].idMsg);
divContenedorFormularioMensaje.removeChild(document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg));
}
}
var divContenedor = document.getElementById(_idContenedorHilo);
var divMensaje = null;
for (var contElem = 0; contElem != divContenedor.childNodes.length; contElem++) {
divMensaje = divContenedor.childNodes[contElem];
if (divMensaje.id.search(idMensaje) != -1) {
break;
}
}
var idMensajeTemporal = " id = '" + divMensaje.id + "|0000000000-00000000000000000000000000000tmp' ";
var divTmp = divMensaje;
var nivel = 0;
var htmlInicioEnvoltorio = "";
var htmlFinEnvoltorio    = "";
if (divTmp.firstChild.id != ("mensaje_"+idMensaje)) {
nivel++;
htmlInicioEnvoltorio = "<div " + idMensajeTemporal + " class='" + divTmp.className + "'>";
htmlFinEnvoltorio    = "</div>";
while (divTmp.firstChild && divTmp.firstChild.id != ("mensaje_"+idMensaje)) {
divTmp = divTmp.firstChild;
if (divTmp.className.search("envoltorio") == -1) {
nivel++;
if (divTmp.className.search("ultimo") != -1) {
htmlInicioEnvoltorio += "<div class='subnivel" + nivel + "transparente'>";
} else {
htmlInicioEnvoltorio += "<div class='" + divTmp.className + "'>";
}
htmlFinEnvoltorio += "</div>";
}
}
idMensajeTemporal = "";
}
var esUltimo = false;
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
if (_hashMsgs.mensajes[contMsg].idMsg == idMensaje) {
if ((contMsg+1) == _hashMsgs.mensajes.length) {
esUltimo = true;
break;
} else if ((_hashMsgs.mensajes[contMsg].level+1) != _hashMsgs.mensajes[contMsg+1].level) {
esUltimo = true;
break;
}
}
}
nivel++;
if (esUltimo) {
if (divTmp == divContenedor.firstChild) {
htmlInicioEnvoltorio += "<div " + idMensajeTemporal + " class='subnivel" + nivel + "ultimo'>";
htmlFinEnvoltorio += "</div>";
} else if (nivel == 1) {
htmlInicioEnvoltorio += "<div " + idMensajeTemporal + " class='subnivel" + nivel + "transparente'><div class='subnivel" + (nivel+1) + "ultimo'>";
htmlFinEnvoltorio += "</div></div>";
} else {
if (divTmp.className.search("envoltorio") != -1) {
divTmp = divTmp.parentNode;
}
htmlInicioEnvoltorio += "<div class='subnivel" + nivel + "ultimo'>";
htmlFinEnvoltorio += "</div>";
}
} else {
if (nivel == 1 && divTmp != divContenedor.firstChild) {
htmlInicioEnvoltorio += "<div " + idMensajeTemporal + " class='subnivel" + nivel + "transparente'>";
htmlFinEnvoltorio += "</div>";
idMensajeTemporal = "";
nivel++;
}
htmlInicioEnvoltorio += "<div " + idMensajeTemporal + " class='subnivel" + nivel + "'><div class='envoltoriosubnivel" + nivel + "'>";
htmlFinEnvoltorio += "</div></div>";
}
var divMensajeTemporal = document.createElement("DIV");
divMensajeTemporal.innerHTML = htmlInicioEnvoltorio + htmlMensajeTemporal + htmlFinEnvoltorio;
divContenedor.insertBefore(divMensajeTemporal.firstChild, divMensaje.nextSibling);
if (document.getElementById("linkrespuestas_"+idMensaje) &&
document.getElementById("linkrespuestas_"+idMensaje).className == "primero1") {
mostrarRespuestas(idMensaje, (nivel-1));
}
}
return true;
}
function submitFormularioMensaje(idMensaje) {
if (/^\s*$/.test(document.getElementById("m_"+idMensaje).value)) {
errorResponderMensajes(idMensaje, "El contenido del mensaje no puede ser vac&iacute;o");
return false;
}
if (document.getElementById("capaopciones_"+idMensaje)) {
document.getElementById("capaopciones_"+idMensaje).style.display = "none";
}
var objFormulario = document.getElementById("form_"+idMensaje);
var divContenedorEscribirMensaje = document.getElementById("escribirmensaje_" + idMensaje);
if (document.getElementById("errorresponder_"+idMensaje)) {
divContenedorEscribirMensaje.removeChild(document.getElementById("errorresponder_"+idMensaje));
}
var divTrabajando = document.createElement("DIV");
divTrabajando.id = "trabajando_" + idMensaje;
divTrabajando.className = "trabajando";
divContenedorEscribirMensaje.insertBefore(divTrabajando, divContenedorEscribirMensaje.firstChild);
objFormulario.submit();
}
function mostrarOcultarElemento(idElemento) {
var divElemento = document.getElementById(idElemento);
if (divElemento.style.display != "none") {
divElemento.style.display = "none";
} else {
divElemento.style.display = "block";
}
}
function mostrarOcultarAdjuntarImagen(idMensaje) {
var divEnlace = document.getElementById("linkadjuntarimagen_"+idMensaje);
if (divEnlace.className == "primero") {
divEnlace.className = "botonactivo";
} else {
divEnlace.className = "primero";
}
mostrarOcultarElemento("capaopciones_"+idMensaje);
}
function mostrarEnlaces(idMensaje, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
var divLinkSegundo = document.getElementById("linksegundo_"+idMensaje);
var divTipos = document.getElementById("tipos_"+idMensaje);
var posDivEnlaces = METUtils_calcAbsPosition(divLinkSegundo);
var extraLeft = 0;
var extraTop  = 0;
if (isIE) {
extraLeft--;
extraTop--;
} else {
extraTop++;
}
if (enHilo && !isIE) {
extraLeft++;
}
divTipos.style.display = "block";
divTipos.style.left = parseInt(posDivEnlaces[0] + extraLeft) + "px";
divTipos.style.top = parseInt(posDivEnlaces[1] - divTipos.clientHeight + divLinkSegundo.clientHeight + extraTop) + "px";
}
function errorResponderMensajes(idMensaje, error) {
var divEscribirMensaje = document.getElementById("escribirmensaje_"+idMensaje);
if (document.getElementById("errorresponder_"+idMensaje)) {
divEscribirMensaje.removeChild(document.getElementById("errorresponder_"+idMensaje));
}
var divError = document.createElement("DIV");
divError.id = "errorresponder_"+idMensaje;
divError.className = "error";
divError.innerHTML = "<p>" + error + "</p>";
divEscribirMensaje.appendChild(divError);
if (document.getElementById("trabajando_"+idMensaje)) {
divEscribirMensaje.removeChild(document.getElementById("trabajando_"+idMensaje));
}
}
function avisoResponderMensajes(idMensaje, aviso) {
var divContenedorTextoMensaje = document.getElementById("contenedortexto_"+idMensaje);
if (document.getElementById("avisoresponder_"+idMensaje)) {
divContenedorTextoMensaje.removeChild(document.getElementById("avisoresponder_"+idMensaje));
}
var divAviso = document.createElement("DIV");
divAviso.id = "avisoresponder_"+idMensaje;
divAviso.className = "error";
if (aviso != "") {
divAviso.innerHTML = "<p>Mensaje enviado correctamente (" + aviso + ")</p>";
} else {
divAviso.innerHTML = "<p>Mensaje enviado correctamente</p>";
}
divContenedorTextoMensaje.appendChild(divAviso);
}
function mostrarMensajeRespuesta(idMensaje) {
if (typeof _hashMsgs.mensajes == "undefined") {
return false;
}
var idMsgRespuesta = "";
var hashMensaje = null;
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
idMsgRespuesta = _hashMsgs.mensajes[i].idMsgRespuesta;
break;
}
}
if (idMsgRespuesta == "") {
return false;
}
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMsgRespuesta) {
hashMensaje = _hashMsgs.mensajes[i];
break;
}
}
if (hashMensaje == null) {
return false;
}
var divLinkRespondeA = document.getElementById("linkrespondea_"+idMensaje);
if (document.getElementById("flotante_"+idMensaje)) {
divLinkRespondeA.className = "segundo1";
divLinkRespondeA.innerHTML = "Responde a";
document.body.removeChild(document.getElementById("flotante_"+idMensaje));
} else {
var esVisible = true;
var esFlotante = true;
var htmlMensajeFlotante = pintaMensajeHilo(hashMensaje, esVisible, esFlotante);
divLinkRespondeA.className = "segundo2";
divLinkRespondeA.innerHTML = "Cerrar";
arrayPosEnlace = METUtils_calcAbsPosition(divLinkRespondeA);
var divFlotante = document.createElement("DIV");
divFlotante.id = "flotante_"+idMensaje;
divFlotante.className = "flotante";
divFlotante.innerHTML = htmlMensajeFlotante;
divFlotante.style.left = parseInt(arrayPosEnlace[0]) + "px";
divFlotante.style.top = parseInt(arrayPosEnlace[1] + divLinkRespondeA.clientHeight) + "px";
document.body.appendChild(divFlotante);
}
}
function ocultarRespuestas(idMensaje, nivel) {
if (!document.getElementById("linkrespuestas_"+idMensaje)) {
return false;
}
var divLinkRespuestas     = document.getElementById("linkrespuestas_"+idMensaje);
var divContenedorMensajes = document.getElementById(_idContenedorHilo);
var longitudId            = (nivel+2)*(_longIdMensaje+1);
var i = 0;
for (i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
break;
}
}
var numMensajesDebajo = 0;
for (var j = (i+1); j != _hashMsgs.numMensajes; j++) {
if (_hashMsgs.mensajes[j].level <= _hashMsgs.mensajes[i].level) {
break;
}
if (_hashMsgs.mensajes[j].level == (_hashMsgs.mensajes[i].level+1)) {
ocultarRespuestas(_hashMsgs.mensajes[j].idMsg, (nivel+1));
}
numMensajesDebajo++;
}
divLinkRespuestas.className = "primero1";
divLinkRespuestas.innerHTML = numMensajesDebajo + " respuestas";
eval ("divLinkRespuestas.onclick   = function() { mostrarRespuestas(\"" + idMensaje + "\", " + nivel + "); }");
for (var contElem = 0; contElem != divContenedorMensajes.childNodes.length; contElem++) {
if (divContenedorMensajes.childNodes[contElem].id.search(idMensaje) != -1) {
if (divContenedorMensajes.childNodes[contElem].id.length == longitudId) {
divContenedorMensajes.childNodes[contElem].style.display = "none";
} else if (divContenedorMensajes.childNodes[contElem].id.search("tmp") != -1) {
divContenedorMensajes.childNodes[contElem].style.display = "none";
}
}
var idMsgFlotante = divContenedorMensajes.childNodes[contElem].id.substring(divContenedorMensajes.childNodes[contElem].id.length-(_longIdMensaje));
var idFlotante = "flotante_" + idMsgFlotante;
if (document.getElementById(idFlotante)) {
mostrarMensajeRespuesta(idMsgFlotante);
}
}
}
function mostrarRespuestas(idMensaje, nivel) {
if (!document.getElementById("linkrespuestas_"+idMensaje)) {
return false;
}
var divLinkRespuestas     = document.getElementById("linkrespuestas_"+idMensaje);
var divContenedorMensajes = document.getElementById(_idContenedorHilo);
var longitudId            = (nivel+2)*(_longIdMensaje+1);
divLinkRespuestas.className = "primero2";
divLinkRespuestas.innerHTML = "Cerrar";
eval ("divLinkRespuestas.onclick   = function() { ocultarRespuestas(\"" + idMensaje + "\", " + nivel + "); }");
for (var contElem = 0; contElem != divContenedorMensajes.childNodes.length; contElem++) {
if (divContenedorMensajes.childNodes[contElem].id.length == longitudId) {
if (divContenedorMensajes.childNodes[contElem].id.search(idMensaje) != -1 ||
divContenedorMensajes.childNodes[contElem].id.search("tmp") != -1) {
divContenedorMensajes.childNodes[contElem].style.display = "block";
}
}
var idMsgFlotante = divContenedorMensajes.childNodes[contElem].id.substring(divContenedorMensajes.childNodes[contElem].id.length-(_longIdMensaje));
var idFlotante = "flotante_" + idMsgFlotante;
if (document.getElementById(idFlotante)) {
mostrarMensajeRespuesta(idMsgFlotante);
}
}
}
function posicionarEnDivMensajes() {
posicionarEnDiv(_idContenedorMsgs);
}
function posicionarEnDiv(id_contenedor) {
var posYDivMensajes = parseInt(METUtils_calcAbsPosition(document.getElementById(id_contenedor))[1]);
METUtils_posicionarScrollEnPagina(posYDivMensajes);
}
function mostrarError(textoError) {
var divContenedorError = document.getElementById(_idContenedorErr);
divContenedorError.innerHTML = "<div class='error'>" + textoError + "</div>";
if (textoError == '') {
divContenedorError.style.display = 'none';
}
else {
divContenedorError.style.display = '';
}
}
function notificarMensajeInsulto(idMensaje) {
var cadena_params = "reason=abuse&msg=" + idMensaje;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se ha podido hacer la notificación");
}
else {
var data = httpRequest.responseText;
alert(_mensaje_respuesta_notificacion_insulto);
}
}, _urlNOTIFICACIONES + "?" + cadena_params);
}
function notificarMensajeSpam(idMensaje) {
var cadena_params = "reason=spam&msg=" + idMensaje;
METUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se ha podido hacer la notificación");
}
else {
var data = httpRequest.responseText;
alert(_mensaje_respuesta_notificacion_spam);
}
}, _urlNOTIFICACIONES + "?" + cadena_params);
}
