function muestraSubmenu(objPadre){

	var ev = window.event;
	var subNodos = document.getElementById("subNodos_" + objPadre.id);

	if(subNodos){

		subNodos.style.display = "block";
	}
}

function ocultaSubmenu(objPadre){

	var ev = window.event;
	var subNodos = document.getElementById("subNodos_" + objPadre.id);

	if(subNodos){

		subNodos.style.display = "none";
	}

	if(ev.stopPropagation){

		ev.stopPropagation();
		ev.preventDefault();
	}

	else{

		ev.cancelBubble = true;
		ev.returnValue = false;
	}
}

function enviaContacto(){

	var reg = /[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/;

	var nombre = document.getElementById("nombre");
	var telefono = document.getElementById("telefono");
	var email = document.getElementById("email");
	var comentarios = document.getElementById("comentarios");

	if(nombre.value == "" || telefono.value == ""){

		alert("Los campos nombre y telefono son obligarios");
	}

	else if(!email.value.match(reg)){

		alert("Debe introducir una dirección de email valida");
	}

	else{

		document.forms["contacto"].submit();
	}
}

function confirmaPass(){

	var pass = document.getElementById("pass");
	var cpass = document.getElementById("confirmPass");
	var mensaje = document.getElementById("mensajeConfirmacion");

	if(pass.value == cpass.value){

		mensaje.style.display = "none";

		return true;
	}

	else{

		mensaje.style.display = "block";
	}
}

/* Esto deberia estar aparte */

function confirmaPassCambio(){

	var pass = document.getElementById("pass");
	var cpass = document.getElementById("pass2");
	var mensaje = document.getElementById("mensajeConfirmacion");

	if(pass.value == cpass.value){

		mensaje.style.display = "none";

		return true;
	}

	else{

		mensaje.style.display = "block";
	}
}

function enviaFormContrasenaCambio(){

	if(confirmaPassCambio()){

		document.forms["recPass"].submit();
	}
}

