function FormValidation(elform)
{
	var result;
	result = SysNumberValidation(elform);
	return result;
} 

function SysNumberValidation(thisform)
{
	var i, cSys, fechaValida1, fechaValida2;
	with (thisform)
	{
		cSys = 0;
		for(i = 0; i<Sys.length; i++) {
			if (Sys[i].checked == true)
				cSys++;
		}
	}
	if (cSys <= 0){
		alert("No hay ningún sistema seleccionado, es imprescindible seleccionar más de un sistema");
		return false;
	} else {
		if (cSys > 40){
			alert("Ha seleccionado más de 40 sistemas, debe seleccionar menos sistemas");
			return false;
		} else {
			fechaValida1 = DateValidation(thisform.FI.value);
			fechaValida2 = DateValidation(thisform.FF.value);
			if ((fechaValida1 == false) | (fechaValida2 == false)) {
				return false;
			} else { 	
				return true;
			}
		}
	}
} 

function DateValidation(Fecha)
{
	var indice1, indice2;
	var anio, mes, dia;
	indice1 = Fecha.indexOf("-");
	if (indice1 != 2)  {
		return false;
	} else {
		indice2 = Fecha.indexOf("-", indice1 + 1);
		if (indice2 != 5) {
			return false;
		} else {
			dia = parseInt(Fecha.slice(0, 2));
			mes = parseInt(Fecha.slice(indice1 + 1, indice1 + 3));
			anio = parseInt(Fecha.slice(indice2 + 1, indice2 + 5));
			return true;
			if ((dia < 0) | (dia > 30)) {
				return false;
			} else {
				if ((mes < 0) | (mes > 12)) {
					return false;
				} else {
					if ((anio < 2000) | (anio > 2005)) {
						return false;
					} else {
						return true;
					}
				}
			}
		}
	}
} 


