<!-- Te perite poner solo numeros en una caja de texro	--> 
var nav4 = window.Event ? true : false;

<!-- Te perite poner solo numeros en una caja de texro	--> 
function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return ((key <= 13) || (key >= 48 && key <= 57) ||  (key ==32) ||  (key == 42) ||  (key == 40) ||  (key == 41) ||  (key == 45));
}
function acceptNum2(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}
 
function decimal()
{
var e_k = event.keyCode;
if (e_k > 33 && e_k < 45 || e_k == 47 || e_k > 57)
{
event.returnValue = false;
}
}


var reDecimalPt = /^[+-]?((\d+|\d{1,3}(\.\d{3})+)(\,\d*)?|\,\d+)$/;
var reDecimalEn = /^[+-]?((\d+|\d{1,3}(\,\d{3})+)(\.\d*)?|\.\d+)$/;
var reDecimal = reDecimalEn;

function doDecimal(pStr)
{
	charDec = ( pStr != "En"? ",": "." );
	if (reDecimal.test(pStr)) {
		pos = pStr.indexOf(charDec);
		decs = pos == -1? 0: pStr.length - pos - 1;


	} else if (pStr != null && pStr != "") {
		alert(pStr + " No es un numero decimal. utilizar punto para las décimas");
		return (false);
	}
} // doDecimal



//*  funcion para sacar espacios de la de
function trim(string) 
{ 
return string.replace(/(^\s*)|(\s*$)/g,''); 
} 

//*  validacion de perfil
function Validar_perfil(theForm)
<!-- Validacion de Formulario INGRESO PERFIL	-->
{var checkStr = theForm.codperfil.value;
  if (checkStr.length==0 )
	{
    alert("Ingrese su código de Perfil, por favor.");
    theForm.codperfil.focus();
    return (false);
	}	
	
	if(checkStr.indexOf("<")!= -1 || checkStr.indexOf(">")!= -1 || checkStr.indexOf("'")!= -1 || checkStr.indexOf('"')!= -1 || checkStr.indexOf(" ")!= -1)
	{
	alert("Ingrese su código de Perfil Válido, por favor.");
	theForm.codperfil.select();
	 return (false);
	}

 var checkStr = theForm.nombreperfil.value;
  if (checkStr.length==0)
	{
    alert("Ingrese nombre de perfil, por favor.");
    theForm.nombreperfil.focus();
    return (false);
	}	
 var checkStr = theForm.descripcionperfil.value;
	if (checkStr.length==0)
	{
    alert("Ingrese una descripcion \n  por favor.");
    theForm.descripcionperfil.focus();
    return (false);
	}
 var checkStr = theForm.descripcionperfil.value.length;
	if (checkStr>200) 
	{
    alert("Ingrese una descripcion \n no mayor de 200 caracteres.");
    theForm.descripcionperfil.focus();
    return (false);
	}	
 return (true);
}

/*************************/
function Validar_rec_contrasena(theForm)
 {
		 /*  oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.email.value)) 
			{
			  alert("Por favor, ingrese una dirección de e-mail válida");
			  theForm.email.focus();
			  return(false);
			}*/
			
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.email.value)){
   //alert("La dirección de email " + theForm.emailusuario.value    + " es correcta.") 
   //return (true)
   }
   else {
   alert("La dirección email" + theForm.email.value    + " es incorrecta.");
   return (false);
  }
  
 return (true);
}
/*************************/
function ENVIAR_REC_CONTRASENA(VER,ENVIAR)
{
if (Validar_rec_contrasena(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.submit();

}
}


function Validar_bus_perfil(theForm)
<!-- Validacion de Formulario BUSQUEDA DE PERFIL	-->
{
	var checkStr1 = theForm.codperfil.value;
var checkStr2 = theForm.nombreperfil.value;
 
 
  if (checkStr1.length==0 && checkStr2.length==0 )
	{
    alert("Ingrese al menos una opcion de Búsqueda, por favor.");
    theForm.codperfil.focus();
    return (false);
	}	
 
 return (true);
}


function Validar_bus_usuario(theForm)
<!-- Validacion de Formulario BUSQUEDA DE USUARIO	-->
{
var checkStr1 = theForm.txt_c_usu.value;
var checkStr2 = theForm.txt_c_p_usu;
var checkStr3 = theForm.txt_n_usu.value;
var checkStr4 = theForm.txt_ap_usu.value;
var checkStr5 = theForm.txt_am_usu.value;

  if (checkStr1.length==0 && checkStr3.length==0 && checkStr4.length==0 && checkStr5.length==0 && checkStr2[0].selected == true )
	{
    alert("Ingrese al menos una opcion de Búsqueda, por favor.");
    theForm.txt_c_usu.focus();
    return (false);
	}	 
 return (true);
}

//************* sin espacios en blanco
function esp_blanco(campo)
{
	var checkStr=campo;
	if (checkStr.length!=0) {
	if (checkStr.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco");
		return (false);
		}
	}
}
	/**********/
	//*******  VALIDACION DE USUARIO CUANDO INGRESA EL ADMIN
function Validar_usuario(theForm)
<!-- Validacion de Formulario INGRESO USUARIO -->
{var checkStr = theForm.codusuario.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su código de Usuario, por favor.");
    theForm.codusuario.focus();
    return (false);
	}	


	var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú ";
			var checkStr = theForm.codusuario.value;
			var allValid = true; 
			for (i = 0; i < checkStr.length; i++) {
			ch = checkStr.charAt(i); 
			for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
			break;
			if (j == checkOK.length) { 
			allValid = false; 
			break; 
			}
			}
			if (!allValid) { 
			alert("Escriba sólo letras s/c númeroaaas en el campo Código de usuario"); 
	theForm.codusuario.focus();
	theForm.codusuario.select();
			return (false); 
			}
 
 
	 if(checkStr.indexOf("<")!= -1 || checkStr.indexOf(">")!= -1 || checkStr.indexOf("'")!= -1 || checkStr.indexOf('"')!= -1 || checkStr.indexOf(" ")!= -1)
	{
	alert("Ingrese su código de Perfil Válido sin espacios en blanco, por favor.");
	theForm.codusuario.focus();
	theForm.codusuario.select();
	 return (false);
	}
	
	var checkStr2 = theForm.codperfil;

  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un perfil, por favor.");
    theForm.codperfil.focus();
    return (false);
	}	

 var checkStr = theForm.nombreusuario.value;
  if (checkStr.length==0 || trim(checkStr)=='')
	{
    alert("Ingrese nombre de Usuario, por favor.");
    theForm.nombreusuario.focus();
	theForm.nombreusuario.select();
    return (false);
	}	

	
 var checkStr = theForm.apepaternousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese su apellido paterno por favor.");
    theForm.apepaternousuario.focus();
    return (false);
	}	
	
					if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido materno.");
				theForm.apepaternousuario.focus();
				theForm.apepaternousuario.select();
				return (false);
				}
				}
	var checkStr = theForm.apematernousuario .value;
  if (checkStr.length==0)
	{
    alert("Ingrese su apellido materno, por favor.");
    theForm.apematernousuario .focus();
    return (false);
	}	
	
					if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido materno.");
				theForm.apematernousuario.focus();
				theForm.apematernousuario.select();
				return (false);
				}
				}
 var checkStr = theForm.contra.value;
  if (checkStr.length==0)
	{
    alert("Ingrese la contraseña para este usuario, por favor.");
    theForm.contra.focus();
    return (false);
	}	
	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como contraseña.");
				theForm.contra.focus();
				theForm.contra.select();
				return (false);
				}
				}
				
 var checkStr = theForm.telefonousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese un número telefónico por favor.");
    theForm.telefonousuario.focus();
    return (false);
	}	
 // Validamos el email.

   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.emailusuario.value)){
   //alert("La dirección de email " + theForm.emailusuario.value    + " es correcta.") 
   //return (true)
   }
   else {
   alert("La dirección " + theForm.emailusuario.value    + " de email es incorrecta.");
   return (false);
  }
		   /*oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.emailusuario.value)) 
			{
			  alert("Por favor, ingrese una dirección ddde e-mail válida");
			  theForm.emailusuario.focus();
			  return(false);
			}
			
	var checkStr = theForm.empresausuario .value;
	if (checkStr.length==0)
	{
    alert("Ingrese el nombre de su empresa, por favor.");
    theForm.empresausuario  .focus();
    return (false);
	}	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como empresa del usuario.");
				theForm.empresausuario.focus();
				theForm.empresausuario.select();
				return (false);
				}
				}
	
	var checkStr = theForm.rucusuario.value;
	if (checkStr.length==0 || checkStr.length<11 )
	{
    alert("Ingrese su número de RUC válido de 11 dígitos, por favor.");
    theForm.rucusuario.focus();
    return (false);
	}	*/
	
	var checkStr2 = theForm.codsector;

  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un sector, por favor.");
    theForm.codsector.focus();
    return (false);
	}	
	
	var checkStr3 = theForm.codregion;

  if (checkStr3[0].selected == true )
	{
    alert("Selecciones una región, por favor.");
    theForm.codregion.focus();
    return (false);
	}	
	
 return (true);
}

/*************************/
//*******  VALIDACION DE USUARIO CUANDO INGRESA EL ADMIN
function Validar_usuario_mod(theForm)
<!-- Validacion de Formulario INGRESO USUARIO -->
{ 
	var checkStr2 = theForm.codperfil;

  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un perfil, por favor.");
    theForm.codperfil.focus();
    return (false);
	}	

 var checkStr = theForm.nombreusuario.value;
  if (checkStr.length==0 || trim(checkStr)=='')
	{
    alert("Ingrese nombre de Usuario, por favor.");
    theForm.nombreusuario.focus();
	theForm.nombreusuario.select();
    return (false);
	}	
 //************* sin espacios en blanco
 
 /*
	if (checkStr.length!=0) {
	if (checkStr.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco");
		checkStr.focus();
		checkStr.select();
		return (false);
		}
	}*/
 
	/**********/
	
 var checkStr = theForm.apepaternousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese su apellido paterno por favor.");
    theForm.apepaternousuario.focus();
    return (false);
	}	
	
					if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido materno.");
				theForm.apepaternousuario.focus();
				theForm.apepaternousuario.select();
				return (false);
				}
				}
	var checkStr = theForm.apematernousuario .value;
  if (checkStr.length==0)
	{
    alert("Ingrese su apellido materno, por favor.");
    theForm.apematernousuario .focus();
    return (false);
	}	
	
					if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido materno.");
				theForm.apematernousuario.focus();
				theForm.apematernousuario.select();
				return (false);
				}
				}
 var checkStr = theForm.contra.value;
  if (checkStr.length==0)
	{
    alert("Ingrese la contraseña para este usuario, por favor.");
    theForm.contra.focus();
    return (false);
	}	
	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como contraseña.");
				theForm.contra.focus();
				theForm.contra.select();
				return (false);
				}
				}
				
 var checkStr = theForm.telefonousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese un número telefónico por favor.");
    theForm.telefonousuario.focus();
    return (false);
	}	
 // Validamos el email.
		  /* oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.emailusuario .value)) 
			{
			  alert("Por favor, ingrese una dirección de e-mail válida");
			  theForm.emailusuario.focus();
			  return(false);
			}*/
			
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.emailusuario.value)){
   //alert("La dirección de email " + theForm.emailusuario.value    + " es correcta.") 
   //return (true)
   }
   else {
   alert("La dirección email" + theForm.emailusuario.value    + " es incorrecta.");
   return (false);
  }
  /*
	var checkStr = theForm.empresausuario .value;
	if (checkStr.length==0)
	{
    alert("Ingrese el nombre de su empresa, por favor.");
    theForm.empresausuario  .focus();
    return (false);
	}	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como empresa del usuario.");
				theForm.empresausuario.focus();
				theForm.empresausuario.select();
				return (false);
				}
				}
	
	var checkStr = theForm.rucusuario.value;
	if (checkStr.length==0 || checkStr.length<11 )
	{
    alert("Ingrese su número de RUC válido de 11 dígitos, por favor.");
    theForm.rucusuario.focus();
    return (false);
	}	
	*/
	var checkStr2 = theForm.codsector;
 
 
  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un sector, por favor.");
    theForm.codsector.focus();
    return (false);
	}	
	
	var checkStr3 = theForm.codregion;
 
 
  if (checkStr3[0].selected == true )
	{
    alert("Selecciones una región, por favor.");
    theForm.codregion.focus();
    return (false);
	}	
	
 return (true);
}

/*************************/
 
//*******  VALIDACION DE USUARIO CUANDO SE REGISTRA EL USUARIO NORMAL
function Validar_usuario_publico(theForm)
<!-- Validacion de Formulario INGRESO USUARIO -->
{var checkStr = theForm.codusuario.value;
  if (checkStr.length==0)
	{
		
    alert("Ingrese su Login, por favor.");
    theForm.codusuario.focus();
    return (false);
	}	
	
	if (checkStr.length!=0) {
	if (checkStr.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.codusuario.focus();
		theForm.codusuario.select();
		return (false);
		}
	}
			var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ" + "abcdefghijklmnñopqrstuvwxyzáéíóú ";
			var checkStr = theForm.codusuario.value;
			var allValid = true; 
			for (i = 0; i < checkStr.length; i++) {
			ch = checkStr.charAt(i); 
			for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
			break;
			if (j == checkOK.length) { 
			allValid = false; 
			break; 
			}
			}
			if (!allValid) { 
			alert("Escriba sólo letras s/c números en el campo Login"); 
	theForm.codusuario.focus();
	theForm.codusuario.select();
			return (false); 
			}
 
 
	 if(checkStr.indexOf("<")!= -1 || checkStr.indexOf(">")!= -1 || checkStr.indexOf("'")!= -1 || checkStr.indexOf('"')!= -1 || checkStr.indexOf(" ")!= -1)
	{
	alert("Ingrese su código de Perfil Válido sin espacios en blanco, por favor.");
	theForm.codusuario.focus();
	theForm.codusuario.select();
	 return (false);
	}
	 
 var checkStr = theForm.nombreusuario.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su nombre, por favor.");
    theForm.nombreusuario.focus();
    return (false);
	}	

				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como nombre de usuario.");
				theForm.nombreusuario.focus();
				theForm.nombreusuario.select();
				return (false);
				}
				}
 var checkStr = theForm.apepaternousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese su apellido paterno, por favor.");
    theForm.apepaternousuario.focus();
    return (false);
	}	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido paterno de usuario.");
				theForm.apepaternousuario.focus();
				theForm.apepaternousuario.select();
				return (false);
				}
				}
	var checkStr = theForm.apematernousuario .value;
  if (checkStr.length==0)
	{
    alert("Ingrese su apellido materno, por favor.");
    theForm.apematernousuario .focus();
    return (false);
	}	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido materno de usuario.");
				theForm.apematernousuario.focus();
				theForm.apematernousuario.select();
				return (false);
				}
				}
	// Contraseña
		 var checkStr = theForm.contra.value;
		  if (checkStr.length==0)
			{
			alert("Ingrese su contraseña, por favor.");
			theForm.contra.focus();
			return (false);
			}
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como contraseña.");
				theForm.contra.focus();
				theForm.contra.select();
				return (false);
				}
				}
				
	     var checkStr = theForm.re_contra.value;
		  if (checkStr.length==0)
			{
			alert("Ingrese la verificacion de su contraseña, por favor.");
			theForm.re_contra.focus();
			return (false);
			}
 
	
 var checkStr = theForm.telefonousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese un número telefónico por favor.");
    theForm.telefonousuario .focus();
    return (false);
	}	
 // Validamos el email.
		   /*oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.emailusuario .value)) 
			{
			  alert("Por favor, ingrese una dirección de e-mail válida");
			  theForm.emailusuario.focus();
			  return(false);
			}*/
			
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.emailusuario.value)){
   //alert("La dirección de email " + theForm.emailusuario.value    + " es correcta.") 
   //return (true)
   }
   else {
   alert("La dirección email" + theForm.emailusuario.value  + " es incorrecta.");
   theForm.emailusuario.focus();
   return (false);
  }
/*
	var checkStr = theForm.empresausuario .value;
	if (checkStr.length==0)
	{
    alert("Ingrese el nombre de su empresa, por favor.");
    theForm.empresausuario  .focus();
    return (false);
	}
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como empresa del usuario.");
				theForm.empresausuario.focus();
				theForm.empresausuario.select();
				return (false);
				}
				}
	var checkStr = theForm.rucusuario.value;
	if (checkStr.length==0 || checkStr.length<11 )
	{
    alert("Ingrese su número de RUC válido de 11 dígitos, por favor.");
    theForm.rucusuario.focus();
    return (false);
	}
	*/
		var checkStr2 = theForm.codsector;

  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un sector, por favor.");
    theForm.codsector.focus();
    return (false);
	}	
	
	var checkStr3 = theForm.codregion;

  if (checkStr3[0].selected == true )
	{
    alert("Selecciones una región, por favor.");
    theForm.codregion.focus();
    return (false);
	}	
	
	var pas1 = theForm.contra.value;
	var pas2 = theForm.re_contra.value;
	 if (pas1!=pas2)
			{
			alert("Ingrese bien la validación de su contraseña, por favor.");
			theForm.re_contra.focus();
			return (false);
			}
			
 return (true);
}

/*************************/
//*******  VALIDACION DE USUARIO CUANDO SE REGISTRA EL USUARIO NORMAL
function Validar_modi_usuario_publico(theForm)
<!-- Validacion de Formulario INGRESO USUARIO -->
{
	 
 var checkStr = theForm.nombreusuario.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su nombre, por favor.");
    theForm.nombreusuario.focus();
    return (false);
	}	

				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como nombre de usuario.");
				theForm.nombreusuario.focus();
				theForm.nombreusuario.select();
				return (false);
				}
				}
 var checkStr = theForm.apepaternousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese su apellido paterno, por favor.");
    theForm.apepaternousuario.focus();
    return (false);
	}	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido paterno de usuario.");
				theForm.apepaternousuario.focus();
				theForm.apepaternousuario.select();
				return (false);
				}
				}
	var checkStr = theForm.apematernousuario .value;
  if (checkStr.length==0)
	{
    alert("Ingrese su apellido materno, por favor.");
    theForm.apematernousuario .focus();
    return (false);
	}	
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como apellido materno de usuario.");
				theForm.apematernousuario.focus();
				theForm.apematernousuario.select();
				return (false);
				}
				}
	// Contraseña
		 var checkStr = theForm.contra.value;
		  if (checkStr.length==0)
			{
			alert("Ingrese su contraseña, por favor.");
			theForm.contra.focus();
			return (false);
			}
				if (checkStr.length!=0) {
				if (checkStr.replace(/ /g, '') == '')
				{
				alert("No se aceptan espacios en blanco como contraseña.");
				theForm.contra.focus();
				theForm.contra.select();
				return (false);
				}
				}
				
	     var checkStr = theForm.re_contra.value;
		  if (checkStr.length==0)
			{
			alert("Ingrese la verificacion de su contraseña, por favor.");
			theForm.re_contra.focus();
			return (false);
			}
 
	
 var checkStr = theForm.telefonousuario.value;
	if (checkStr.length==0)
	{
    alert("Ingrese un número telefónico por favor.");
    theForm.telefonousuario .focus();
    return (false);
	}	

			
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.emailusuario.value)){
   //alert("La dirección de email " + theForm.emailusuario.value    + " es correcta.") 
   //return (true)
   }
   else {
   alert("La dirección email" + theForm.emailusuario.value  + " es incorrecta.");
   return (false);
  }

		var checkStr2 = theForm.codsector;
 
 
  if (checkStr2[0].selected == true )
	{
    alert("Selecciones un sector, por favor.");
    theForm.codsector.focus();
    return (false);
	}	
	
	var checkStr3 = theForm.codregion;

  if (checkStr3[0].selected == true )
	{
    alert("Selecciones una región, por favor.");
    theForm.codregion.focus();
    return (false);
	}	
	
	var pas1 = theForm.contra.value;
	var pas2 = theForm.re_contra.value;
	 if (pas1!=pas2)
			{
			alert("Ingrese bien la validación de su contraseña, por favor.");
			theForm.re_contra.focus();
			return (false);
			}
			
 return (true);
}

/*************************/
/************************   OPCIONES VER GENERAL **************/ 
/*************************/

function Ir_interna(VER)
{
    window.document.formulario.ver_opt.value="";
    window.document.formulario.ver_opt.value=VER;
	window.document.formulario.nom_seccion.value="";
	window.document.formulario.submit();
}

function Ir(VER)
{
    window.document.formulario.ver_opt.value="";
    window.document.formulario.ver_opt.value=VER;
	window.document.formulario.submit();

}

function Ir_recontra_home(VER)
{
    window.document.rec_contra.ver_opt.value="";
    window.document.rec_contra.ver_opt.value=VER;
	window.document.rec_contra.submit();
}
 /************************   OPCIONES VER GENERAL **************/ 
/*************************/

function Ir_fl(VER,DERECHO)
{

	document.forms[0].elements[0].value = DERECHO;
	document.forms[0].elements[1].value = VER;
	document.forms[0].elements[2].value = VER;
	document.forms[0].submit();

} 

/*************************/
/************************   OPCIONES DE PERFIL **************/ 
/*************************/
function EDITAR(VER,CODIGO,ENVIAR)
{
 	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 	window.document.formulario.submit();

} 
 /*************************/
function DETALLE_PERFIL(VER,CODIGO,ENVIAR)
{

 	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 	window.document.formulario.submit();

} 
/*************************/
function GUARDAR_MODI(VER,CODIGO,ENVIAR)
{
if (Validar_perfil(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 	window.document.formulario.submit();

}

}
/*************************/
function GUARDAR_PERFIL(VER,CODIGO,ENVIAR)
{
if (Validar_perfil(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 	window.document.formulario.submit();

}

}
/*************************/
function ENVIAR_DERECHOS(VER,CODIGO,ENVIAR)
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
	window.document.formulario.submit();
}
/*************************/
 
function ING_DERECHO(VER,CODIGO,ENVIAR,NOMBRE)
{
	window.document.formulario.nombreperfil.value=NOMBRE;
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
	window.document.formulario.id_pre.value=CODIGO;
	window.document.formulario.submit();

}
/*************************/
function Paginar(CODIGO,VER) {
 window.document.formulario.int_pag.value=CODIGO;
 window.document.formulario.ver_opt.value=VER;
 window.document.formulario.submit();

}


/*************************/
function Paginar_res(CODIGO,VER,VER2) {
 window.document.formulario.int_pag.value=CODIGO;
 window.document.formulario.ver_opt.value=VER;
 window.document.formulario.ver_opt2.value=VER2;
 
 window.document.formulario.submit();

}

function BUSCAR_PERFIL(VER,ENVIAR)
{
if (Validar_bus_perfil(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
	window.document.formulario.submit();

}
}
/*************************/
/************************  OPCIONES DE USUARIO **************/ 
/*************************/

function EDITAR_USUARIO(VER,CODIGO,ENVIAR)
{

	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
	window.document.formulario.id_pre.value=CODIGO;
	window.document.formulario.submit();

} 
 /*************************/
function pregunta_elimina_usuario(CODIGO,ENVIAR,VER){ 
   if (confirm('¿Estas seguro de ELIMINAR este USUARIO?')){ 
 
	document.formulario.enviar.value=ENVIAR;   
	document.formulario.id_pre.value=CODIGO;
	window.document.formulario.ver_opt.value=VER;
	document.formulario.submit();
    } 
} 
/*************************/
function GUARDAR_MODI_USUARIO_ADM(VER,CODIGO,ENVIAR)
{
if (Validar_usuario_mod(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 	window.document.formulario.submit();

}

}

/*************************/
function GUARDAR_MODI_USUARIO_PUBLICO(VER,CODIGO,ENVIAR)
{
if (Validar_modi_usuario_publico(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 //	 alert(ENVIAR);
 //alert(VER);
 //alert(CODIGO);
 window.document.formulario.submit();

}

}

 /*************************/
function DETALLE_USUARIO(VER,CODIGO,ENVIAR)
{

 window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.id_pre.value=CODIGO;
 //	 alert(VER);
 //alert(CODIGO);
 window.document.formulario.submit();

}
/*************************/
/*************************/
function GUARDAR_USUARIO(VER,ENVIAR)
{
if (Validar_usuario(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;

 window.document.formulario.submit();

}
}

/*************************/
function GUARDAR_USUARIO_PUBLICO(VER,ENVIAR)
{
if (Validar_usuario_publico(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;

 window.document.formulario.submit();

}
}

function BUSCAR_USUARIO(VER,ENVIAR)
{
if (Validar_bus_usuario(window.document.formulario))
{
  window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
	//alert(ENVIAR);
// alert(VER);
	window.document.formulario.submit();

}
}
/************************   **************/ 
/*************************/
function Datos(VER)
{
	 
if (Validar(window.document.formulario))
	window.document.formulario.ver_opt.value=VER;
	//window.document.formulario.submit();

}

function Datos_usuario()
{
if (Validar_usuario(window.document.formulario))
	window.document.formulario.submit();

}



function Datos_bus_usuario()
{
if (Validar_bus_usuario(window.document.formulario))
	window.document.formulario.submit();

}

function enviar_derechos()
{
//if (Validar_bus_perfil(window.document.formulario))
	window.document.formulario.submit();

}

function focus(){
	window.document.formulario.login.focus();
}
 
 

function pregunta_elimina_usuario_XXX(CODIGO){ 
    if (confirm('¿Estas seguro de ELIMINAR este USUARIO?')){ 
 document.formulario.codigo_id_pres.value=CODIGO;
 document.formulario.submit();
    } 
} 


