function comprobar_select(formulario, campo, descripcion_campo)
{
	valor = eval("document." + formulario + "." + campo + ".options.value");
	if (valor <= 0)
	{
		alert("Kies de " + descripcion_campo + " alstublieft.");
		return false;
	}
	else
	{
		return true;
	}
}


function comprobar_input(formulario, campo, descripcion_campo)
{
	if (obligatorio("document." + formulario + "." + campo, descripcion_campo))
	{
		eval("document." + formulario + "." + campo + ".focus()");
		return false;
	}
	else
	{
		return true;
	}	
}


function fecha_existe(dia, mes, anyo, nombre_fecha)
{
	existe = true;
	if ((dia <= 0)||(dia > 31)||(mes <= 0)||(mes > 12)||(anyo == 0))
	{
		alert("De " + nombre_fecha + " bestaat niet.");
		existe = false;
	}
	if ((dia == 31)&&((mes == 4)||(mes == 6)||(mes == 9)||(mes == 11)))
	{
		if (mes == 4) 
		{
			alert("April heeft slechts 30 dagen. Wijzig de " + nombre_fecha + " alstublieft.");
			existe = false;
		}
		if (mes == 6) 
		{
			alert("Juni heeft slechts 30 dagen. Wijzig de " + nombre_fecha + " alstublieft.");
			existe = false;
		}
		if (mes == 9) 
		{
			alert("September heeft slechts 30 dagen. Wijzig de " + nombre_fecha + " alstublieft.");
			existe = false;
		}
		if (mes == 11) 
		{
			alert("November heeft slechts 30 dagen. Wijzig de " + nombre_fecha + " alstublieft.");
			existe = false;
		}
	}
	if (mes == 2)
	{
		if ((dia > 29)&&(((anyo % 4 == 0)&&(anyo % 100 != 0))||(anyo % 400 == 0)))
		{
			alert("Februari heeft in een schrikkeljaar slechts 29 dagen. Wijzig de " + nombre_fecha + " alstublieft.");
			existe = false;
		}
		if ((dia > 28)&&!(((anyo % 4 == 0)&&(anyo % 100 != 0))||(anyo % 400 == 0)))
		{
			alert("Februari heeft in een gewoon jaar slechts 28 dagen. Wijzig de " + nombre_fecha + " alstublieft.");
			existe = false;
		}
	}
	return existe;
}


function comprobar_sabado(dia, mes, anyo, tipo_dia)
{
	//COMPROBAMOS si la fecha de entrada introducida es un sábado entre junio y septiembre
		fecha = new Date(anyo, (mes - 1), dia);
		dia_semana = parseInt(fecha.getDay());
		if ((dia_semana != 6)&&((mes >= 6)&&(mes <= 9)))
		{
			distancia = 6 - dia_semana;
			nuevo_dia = dia + distancia;
			nuevo_mes = mes;
			nuevo_anyo = anyo;
			if ((nuevo_dia > 30)&&((mes == 4)||(mes == 6)||(mes == 9)||(mes == 11)))
			{
				nuevo_dia = nuevo_dia - 30;
				nuevo_mes = nuevo_mes + 1;
			}
			if ((nuevo_dia > 31)&&((mes == 1)||(mes == 3)||(mes == 5)||(mes == 7)||(mes == 8)||(mes == 10)))
			{
				nuevo_dia = nuevo_dia - 31;
				nuevo_mes = nuevo_mes + 1;
			}
			if ((nuevo_dia > 31)&&(mes == 12))
			{
				nuevo_dia = nuevo_dia - 31;
				nuevo_mes = 1;
				nuevo_anyo = nuevo_anyo + 1;
			}
			if ((nuevo_dia > 28)&&(mes == 2))
			{
				if (((anyo % 4 == 0)&&(anyo % 100 != 0))||(anyo % 400 == 0))
				{
					nuevo_dia = nuevo_dia - 29;
				}
				else
				{
					nuevo_dia = nuevo_dia - 28;
				}
				nuevo_mes = 3;
			}
			cero_dia = "";
			if (nuevo_dia < 10)
			{
				cero_dia = "0";
			}
			cero_mes = "";
			if (nuevo_mes < 10)
			{
				cero_mes = "0";
			}
			proximo_sabado = cero_dia + nuevo_dia + "/" + cero_mes + nuevo_mes + "/" + nuevo_anyo;
			alert("Van juni tot september moet de " + tipo_dia + " een zaterdag zijn. De eerste zaterdag na de door u ingevoerde datum is " + proximo_sabado + ". Wijzig de datum alstublieft.");
			return false;
		}
		else
		{
			return true;
		}
}


function comprobar_entero_positivo(formulario, campo, descripcion_campo)
{
	valor = eval("document." + formulario + "." + campo + ".value");
	valor_entero = parseInt(valor);
	if ((valor != valor_entero)||(valor_entero < 0)||(isNaN(valor_entero)))
	{
		alert("Het aantal ingevoerde " + descripcion_campo + " is niet geldig.");
		eval("document." + formulario + "." + campo + ".focus()");
		return false;
	}
	else
	{
		return true;
	}
}
