function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function comprobarCorreo(form)
{
	var x = form.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true ;
	else {
        alert( "Por favor, escriba su dirección de correo electrónico correctamente." );
        form.email.focus();
        return false ;
    }
}

function chequeaRegistro (form){
							
	if (form.nick.value == "") {
        alert( "Por favor, escribe tu nick." );
        form.nick.focus();
        return false ;
    }
	
	var x = form.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(x)){
        alert( "Por favor, escriba su dirección de correo electrónico correctamente." );
        form.email.focus();
        return false ;
    }
	var x2 = form.email2.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(x2)){
        alert( "Por favor, escriba su dirección de correo electrónico correctamente." );
        form.email2.focus();
        return false ;
    }	

	if ((form.email.value != form.email2.value)) {
        alert( "Por favor, verifique que ha escrito su e-mail de forma idéntica en ambas ocasiones." );	
		form.email2.focus();
        return false ;
    }	
	
	if (form.usuario.value == "")  {
        alert( "Por favor, escriba su usuario." );
        form.usuario.focus();
        return false ;
    }
	
	if (form.password.value.length < 6 ) {
        alert( "Por favor, compruebe que su contraseña tiene al menos 6 caracteres." );
        form.password.value="";
        form.password2.value="";		
		form.password.focus();
        return false ;
    }			
	if ((form.password.value == "") || (form.password2.value == "") || (form.password.value != form.password2.value) || isWhitespace(form.password.value) || isWhitespace(form.password2.value)) {
        alert( "Por favor, verifique que ha escrito su contraseña de forma idéntica en ambas ocasiones." );
        form.password.value="";
        form.password2.value="";		
		form.password.focus();
        return false ;
    }

return true;
}


function chequeaNuevaSala (form)
{
	if (form.nombreSala.value == "")  {
        alert( "Por favor, elije el nombre de la sala." );
        form.nombreSala.focus();
        return false ;
	}
	if (form.descripcionSala.value == "") {
        alert( "Por favor, escribe la descripción de la sala." );
        form.descripcionSala.focus();
        return false ;
    }
	if (form.nombreConversacion.value == "")  {
        alert( "Por favor, elije el nombre de la conversación." );
        form.nombreConversacion.focus();
        return false ;
	}
	if (form.mensaje.value == "")  {
        alert( "Por favor, escribe el primer post de la conversación." );
        form.mensaje.focus();
        return false ;
	}
}
function chequeaNuevaConversacion (form)
{
	if (form.nombreConversacion.value == "")  {
        alert( "Por favor, elije el nombre de la conversación." );
        form.nombreConversacion.focus();
        return false ;
	}
	if (form.mensaje.value == "")  {
        alert( "Por favor, escribe el primer post de la conversación." );
        form.mensaje.focus();
        return false ;
	}
}
function chequeaRechazaSala (form)
{
	if (form.razon.value == "")  {
        alert( "Por favor, dale una explicación del rechazó al usuario." );
        form.razon.focus();
        return false ;
	}
}

function bloquearespuesta(){      
  if (document.all){  
   document.all["nocitita"].style.display="block";  
   document.all["nocitita"].style.visibility="visible";
   document.all["citita"].style.display="none";
   document.all["contesta"].style.display="none";
   return;     
  }     
  if (document.layers){  
   document.layers["citita"].display="none";
   document.layers["nocitita"].display="block";
   document.layers["contesta"].display="none";
   return;     
  }       
  document.getElementById("nocitita").style.visibility="visible";
  document.getElementById("nocitita").style.display="block";       
  document.getElementById("citita").style.display="none";
  document.getElementById("contesta").style.display="none";
} 

function muestraCita(){  
  if (document.all){  
   document.all["citita"].style.display="block";  
   document.all["citita"].style.visibility="visible";
   document.all["nocitita"].style.display="none";
   document.all["contesta"].style.display="none";
   document.all["formula"].style.display="block";
   document.all["formula"].style.visibility="visible";
return;     
  }     
  if (document.layers){  
   document.layers["citita"].display="block"; 
   document.layers["nocitita"].display="none";
   document.layers["contesta"].display="none";
   document.layers["formula"].display="block";
return;     
  }       
  document.getElementById("citita").style.display="block";       
  document.getElementById("citita").style.visibility="visible";
  document.getElementById("contesta").style.display="none";
  document.getElementById("nocitita").style.display="none";
  document.getElementById("formula").style.display="block";
  document.getElementById("formula").style.visibility="visible";
} 

function ocultaCita(){      
  if (document.all){  
   document.all["contesta"].style.display="block";  
   document.all["contesta"].style.visibility="visible";
   document.all["citita"].style.display="none";
   document.all["nocitita"].style.display="none";
   document.all["formula"].style.display="block";
   document.all["formula"].style.visibility="visible";
return;     
  }     
  if (document.layers){  
   document.layers["contesta"].display="block"; 
   document.layers["citita"].display="none";
   document.layers["nocitita"].display="none";
   document.layers["formula"].display="block";
   return;     
  }       
  document.getElementById("contesta").style.display="block";       
  document.getElementById("contesta").style.visibility="visible";
  document.getElementById("citita").style.display="none";
  document.getElementById("nocitita").style.display="none";
  document.getElementById("formula").style.display="block";
  document.getElementById("formula").style.visibility="visible";
} 

function citar(k,s,c) {
	form = document.respuestaRapida;
	document.getElementById("lacita").innerHTML = document.getElementById("Post"+c).innerHTML ;
	form.idc.value = k;
	form.ids.value = s;
	form.idcita.value = c;
	return true;
}

function responder(k,s,c) {
	form = document.respuestaRapida;
	form.idc.value = k;
	form.ids.value = s;
	form.idcita.value = c;
	return true;
}

function chequeaNuevoPost (form){
	if (form.mensaje.value == "")  {
        alert( "Por favor, escriba el mensaje." );
        form.mensaje.focus();
        return false ;
	}
}



