﻿	function clase1(elemento) {
	   document.getElementById(elemento).className=elemento+'2';
	}
	
	function clase2(elemento) {
	   document.getElementById(elemento).className=elemento+'1';
	}

	function clase3(elemento) {
		elemento.className='menuactivo';
	}
		
	function clase4(elemento) {
	   elemento.className='menureposo';
	}


	//funcion para comprobar que el email sea correcto
	function validarEmail(cad){		
		var i=0;
		var enc=false
		while(i<cad.length && !enc){
			if(cad.charAt(i)=='@')
				enc=true
			else
				i++
		}
		return enc
	}	
		
	//funcion para validar los campos del formulario de contacto
	function validar(wich){
		if(wich.nombre.value.length==0){
			alert("El campo 'Nombre' es obligatorio")
			wich.nombre.focus()
			return false
		}			
		
		if(wich.email.value.length==0){
			alert("El campo 'Email' es obligatorio")
			wich.nombre.focus()
			return false
		}			
	
		if( validarEmail(wich.email.value)==false ){
			var msg="El email no tiene un formato válido."
			alert(msg)
			wich.email.focus()
			return false
		}
		return true;
	}

