
function Validar_bus_mype(theForm)
{
var checkStr1 = theForm.txt_nombreusuario.value;
var checkStr2 = theForm.txt_institucionusuario.value;
 
if (checkStr2.length!=0) {
	if (checkStr2.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.txt_institucionusuario.focus();
		theForm.txt_institucionusuario.select();
		return (false);
	}
}

if (checkStr1.length!=0) {
	if (checkStr1.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.txt_nombreusuario.focus();
		theForm.txt_nombreusuario.select();
		return (false);
	}
}

if (checkStr1.length==0 && checkStr2.length==0)
	{
    alert("Ingrese al menos una opcion de Búsqueda, por favor.");
    theForm.txt_nombreusuario.focus();
    return (false);
	}	
	
 return (true);
}

function Validar_mype(theForm)
{
	var checkStr = theForm.institucionusuario.value;
	if (checkStr.length!=0) {
		if (checkStr.replace(/ /g, '') == '')
		{
			alert("No se aceptan espacios en blanco.");
			theForm.institucionusuario.focus();
			theForm.institucionusuario.select();
			return (false);
		}
	}
	
    var checkStr = theForm.institucionusuario.value;
    if (checkStr.length==0)
	{
    alert("Ingrese un Institución, por favor.");
    theForm.institucionusuario.focus();
    return (false);
	}	
	
	var checkStr = theForm.cuentausuariovoip.value;
	if (checkStr.length!=0) {
		if (checkStr.replace(/ /g, '') == '')
		{
			alert("No se aceptan espacios en blanco.");
			theForm.cuentausuariovoip.focus();
			theForm.cuentausuariovoip.select();
			return (false);
		}
	}

	var checkStr = theForm.cuentausuariovoip.value;
	if (checkStr.length==0) 
	{
    alert("Ingrese una cuenta, por favor.");
	theForm.cuentausuariovoip.focus();
    return (false);
	}	
	
	var checkStr = theForm.emailusuario.value;
	if (checkStr.length!=0) {
		if (checkStr.replace(/ /g, '') == '')
		{
			alert("No se aceptan espacios en blanco.");
			theForm.emailusuario.focus();
			theForm.emailusuario.select();
			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 de e-mail válida");
	  theForm.emailusuario.focus();
	  return(false);
	}
	
 return (true);
}

/*************************/

function editar_mype(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 modificar_mype(VER,ENVIAR)
{
if (Validar_mype(window.document.formulario))
{
	window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
 window.document.formulario.submit();

}
} 
 /*************************/

function limpiar_mype()
{
  window.document.formulario.institucionusuario.value="";
  window.document.formulario.cuentausuariovoip.value="";
  window.document.formulario.emailusuario.value="";
  window.document.formulario.telefonousuario.value="";

}
/*************************/

function Limpiar_bus_mype()
{
  window.document.formulario.txt_nombreusuario.value="";
  window.document.formulario.txt_institucionusuario.value="";
  window.document.formulario.txt_nombreusuario.focus();

}
/*************************/

function detalles_mype(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 buscar_mype(VER,ENVIAR)
{
 if (Validar_bus_mype(window.document.formulario))
 {
    window.document.formulario.enviar.value=ENVIAR;
	window.document.formulario.ver_opt.value=VER;
	window.document.formulario.submit();

 }
}
/************************   **************/ 

function Ver_usuarios(ver,codigo)
{
   window.document.formulario.ver_opt.value=ver;
   window.document.formulario.cod_reg.value=codigo;
   window.document.formulario.tip_empresa.value='';
   window.document.formulario.submit();
}

