function check_fields(field,glosa,qq,campo) {
    if (qq==4) {
 //       validRadio(form1.uniformado) ;
        return true;
    }
    if (qq == 3) {
        if (field=='nada') {
            alert(glosa);
            aa='form1.' + campo + '.focus()';
			eval(aa);
	    return false;
        }
    }
    if (qq == 2)   {
        var valid = "0123456789kK";
    }
    if (qq == 1) {
        var valid = " áéíóúabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
    }
    var ok = "yes";
    var temp;

    if(field.value=='') {
        alert(glosa);
        field.focus();
        field.select();
       return false;
    }
    if(qq==2)
    {
        for (var i=0; i<field.value.length; i++) {
            temp = "" + field.value.substring(i, i+1);
            if (valid.indexOf(temp) == "-1") ok = "no";
            }
        if (ok == "no") {
            alert("Campo Invalido!  Solo numeros son aceptadas!");
            field.focus();
            field.select();
            return false;
        }
   }
    return true;
}

function informes(ws_var) { 
  inf=["Nomina de Productos", "Stock Bodega", "Nomina Proveedores", "Nomina Clientes", "Ventas por Período", "Ventas por Producto", "Ventas por Vendedor", "Facturas Emitidas", "Facturas Pendientes", "Reimpresión de Facturas"];
  for (var i=0; i<=9; i++) {
	document.write('<option value=' + i);
	if(i==ws_var) {document.write(' selected');}
	document.write('>' + inf[i] + '</option>');
  }
}

function dia(dd) { 

  for (var i=1; i<=31; i++) {
	document.write('<option value=' + i);
	if(i==dd) {document.write(' selected');}
	document.write('>' + i + '</option>');
  }

}

function mes(mm) {
   meses = ["nada", "ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE"]
   
   for ( var i=1; i<13; i++) {
	document.write('<option value=' + (i));
	if(mm==i) {document.write(' selected');}
	document.write('>' + meses[i] + '</option>');

   }

}

function ano(yy) { 
  for (var i=2001; i<=2010; i++) {
	if (i==yy) {
		document.write('<option value=' + (i) + ' Selected>' + (i) + '</option>');
	}
	else {
		document.write('<option value=' + (i) + '>' + (i) + '</option>');
	}
  }
}
function ano_nac(yy) { 
  for (var i=1910; i<2011; i++) {
	if (i==yy) {
		document.write('<option value=' + (i) + ' Selected>' + (i) + '</option>');
	}
	else {
		document.write('<option value=' + (i) + '>' + (i) + '</option>');
	}
  }
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function flip()
{
  var oktosubmit=true

  if (document.buscar.sel_serv.value=='nada')
  {
    oktosubmit=false;
  }

  if (oktosubmit==true)
	 buscar.busqueda.value=buscar.sel_serv.options[buscar.sel_serv.selectedIndex].text;
//     location.href="search_0001.php&busqueda=" . form1.sel_serv.options[form1.sel_serv.selectedIndex].text;
//	 document.form1.sel_serv.value
     document.buscar.submit();
}


