/*VALIDA BUSQUEDA DE INSTRUMENTOS*/

function ValidaBusquedaInstrumentos(form)
{
	
   if (form.instrumento.selectedIndex==0)
   {
		alert('Por favos seleccione un instrumento para la búsqueda.');
		form.instrumento.focus();
        return false;
    }
		
	return;
}



/*VALIDA SISTEMA DE BUSQUEDA*/

function VerifyLogin() {

 var f = document.form_login;
 var err_str = '';

 if (f.username.value.length==0) {
   f.username.style.borderColor='red';
   err_str += 'Ingrese Nombre Usuario por favor\n';
   f.username.focus();
 }

 if (err_str) {
   alert(err_str);
   return false;
 } else {
   return true;
 }

}

function VerifyRegister() {

 var f = document.form_register;
 var err_str = '';

 if (f.username.value.length==0) {
   f.username.style.borderColor='red';
   err_str += 'Ingrese nombre de usuario por favor.\n';
   f.username.focus();
 }

 if (f.name.value.length==0) {
   f.name.style.borderColor='red';
   err_str += 'Ingrese su nombre por favor\n';
   f.name.focus();
 }

 if (f.country.value.length==0) {
   f.country.style.borderColor='red';
   err_str += 'Ingrese pais por favor\n';
   f.country.focus();
 }

 var email = f.email.value;
 if ((email.indexOf("@") < 1)                       // Needs @ (not in start)
  || (email.indexOf("@") != email.lastIndexOf("@")) // Can not use 2 @
  || (email.indexOf(".") < 1)                       // Must have dot (not in start)
  || (email.lastIndexOf(".") == email.length-1)     // Can not end with dot.
  || (email.indexOf("..") > -1)                     // Can not have 2 sequential dots
  || (email.indexOf("@.") > -1)                     // Can not have '@.'
  || (email.indexOf("@") > email.lastIndexOf("."))  // Must have some '.' after @
   ) {
   f.email.style.borderColor='red';
   err_str += 'Preencha o campo E-Mail corretamente\n';
   f.email.focus();
 }


 if (err_str) {
   alert(err_str);
   return false;
 } else {
   return true;
 }

}
