function chgCaptcha(){
	document.getElementById('image').src='_security/securimage_show.php?sid='+Math.random();
	}
	
function hideAlert(){
 document.getElementById('idAlert').style.display = "none";
 document.getElementById('idAlertCenter').style.display = "none";
}
	function abrir(direccion, pantallacompleta, herramientas, direcciones, 
									estado, barramenu, barrascroll, cambiatamano, ancho, alto, 
									izquierda, arriba, sustituir) {
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
     var ventana = window.open(direccion,"vpopup",opciones,sustituir);
	}
	function MostrarPassword() {
		if (document.form1.changePW.checked == true) {
				document.getElementById('areaPW').style["display"] = "";
				document.getElementById('areaPW2').style["display"] = "";
		}
		else {
				document.getElementById('areaPW').style["display"] = "none";
				document.getElementById('areaPW2').style["display"] = "none";
		}
	}	
	function validar(formulario,msg1,msg2,msg3,msg4,msg5) { 
		if (formulario.Usuario.value == "") {
			alert(msg1);
			return false 
		}		
		if (document.form1.changePW.checked == true) {		
			if (formulario.pw1.value != formulario.pw2.value) {
  			alert("ERROR. Las passwords no coinciden.");
	  	  return false  						
			}		
			if (((formulario.pw1.value == "") ||	(formulario.pw2.value == "")) && formulario.pwObligatori.value == "1") {
  			alert("ERROR. Debes rellenar el campo de password.");
	  	  return false 			
			}
			if (((formulario.pw1.value.length<=4) || (formulario.pw1.value.length>10)) && formulario.pwObligatori.value == "1") {
  			alert("ERROR. La password debe tener entre 5 y 10 carácteres.");
	  	  return false 						
			}
		}
		for (var i=0; i<formulario.length; i++) { 
			if ((formulario[i].type == "text") && (formulario[i].name.indexOf("*")!=-1) && (formulario[i].value == "")) {
				alert(msg2);
				return false
			}
		}		
		if (formulario.Email.value == "" && formulario.pwUsuEsMail.value == "0") {
			alert(msg3);
			return false 
		}	
		if (formulario.pwUsuEsMail.value == "1") {
			if(echeck(formulario.Usuario.value)==false){
				alert(msg4);
				return false 
			}
		}	
		if (document.form1.confirmar.checked == false) {
  		alert(msg5);  		
	  	return false 						
		}				
	}
	
	function validarComment(formulario,msg) {
		if (formulario.cuerpo.value == "") {
			alert(msg);
			return false 
		}	
	}
	function validarCommentForo(formulario,msg) {
		if (formulario.cuerpo.value == "") {
			alert(msg);
			return false 
		}
		if (formulario.asunto.value == "") {
			alert(msg);
			return false 
		}
	}
	
	function echeck(str) {   
		var at="@"
  	var dot="."
  	var lat=str.indexOf(at)
  	var lstr=str.length
  	var ldot=str.indexOf(dot)
	  if (str.indexOf(at)==-1){
	     return false
	  }   if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	     return false
	  }   if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	      return false
	  }    if (str.indexOf(at,(lat+1))!=-1){
	      return false
	   }    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	      return false
	   }    if (str.indexOf(dot,(lat+2))==-1){
	      return false
	   }
	  
	   if (str.indexOf(" ")!=-1){
	      return false
	   }     return true     
 } 