document.observe( "dom:loaded",  
	function() {
	/*
		fnG.addEvent( fnG.obtenerElemento( 'codigoConexion' ), 'keyup', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'codigoConexion' ), 'keypress', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'telefonoConexion' ), 'keyup', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'telefonoConexion' ), 'keypress', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'codigo' ), 'keyup', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'codigo' ), 'keypress', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'telefono' ), 'keyup', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'telefono' ), 'keypress', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'numeroTitular' ), 'keyup', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'numeroTitular' ), 'keypress', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'departamentoTitular' ), 'keyup', fnG.handleKeyPress, false );
		fnG.addEvent( fnG.obtenerElemento( 'departamentoTitular' ), 'keypress', fnG.handleKeyPress, false );
	*/	
	}
);

function obtenerExpReg( e ) {
	var ExpRegCSS = /[\%\=\*<>\\]/ig
	var ExpRegAceptaSoloNumeros = /[^a-z\s\b\0áéíóúäëïöüñ']/ig
	var ExpRegNoAceptaLetras = /[^0-9\b\0]/i
	var ExpRegDV = /[^k0-9\b\0]/i
	el = fnG.obtenerTarget( e );
	if ( el.id == "codigo" || el.id == "telefono" ) {
		return ExpRegAceptaSoloNumeros;
	} else {
		return ExpRegCSS;
	}
}

function check_form() {
	
	if ( document.form1.nombre.value == 0 ) {
		alert( "Debe indicar Nombre." );
		document.form1.nombre.focus();
		return false;
	}
	if ( document.form1.apellido.value == "" ) {
		alert( "Debe indicar Apellido." );
		document.form1.apellido.focus();
		return false;
	}
		
	if ( document.form1.codigo.value == "" ) {
		alert( "Debe indicar Código de Area." );
		document.form1.codigo.focus();
		return false;
	}
	
	if ( document.form1.telefono.value == "" ) {
		alert( "Debe indicar Número de Teléfono." );
		document.form1.telefono.focus();
		return false;
	}
	
	if ( document.form1.email.value == "" ) {
		alert( "Debe indicar E-mail." );
		document.form1.email.focus();
		return false;
	}
	
	if ( document.form1.email.value != "" ) {
		pat=/^[\w\_\.çñ]{2,255}@[\w]{2,255}\.[a-z]{1,3}\.?[a-z]{0,3}$/
		regExp = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if ( !regExp.test( document.form1.email.value ) ) {
			alert( "Introduzca un E-mail válido." );
			document.form1.email.focus();
			return false;
		}
	}
	
	if ( document.form1.empresa.value == "" ) {
		alert( "Debe indicar Empresa" );
		document.form1.empresa.focus();
		return false;
	}
	
	if ( document.form1.cargo.value == "" ) {
		alert( "Debe indicar Cargo" );
		document.form1.cargo.focus();
		return false;
	}
	
	if ( document.form1.areaConsulta.value == "" ) {
		alert( "Debe indicar Area de Consulta" );
		document.form1.areaConsulta.focus();
		return false;
	}
	
	if ( document.form1.consulta.value == "" ) {
		alert( "Debe indicar Consulta o Comentario" );
		document.form1.consulta.focus();
		return false;
	}
	
	return true;
}

