function ValidDate(InputDate) { 
	//InputDate is not empty
	if (InputDate == "") {
		alert("la fecha esta vacía");
		return (false);
	}

	//InputDate must be in format dd/mm/yyyy
	if ((InputDate.substring(2, 3) != "/") || (InputDate.substring(5, 6) != "/")) {
		return (false);
	}

	//validate numeric data
	day = InputDate.substring(0, 2);
	month = InputDate.substring(3, 5);
	year = InputDate.substring(6, 10);
	if (isNaN(day) || isNaN(month) || isNaN(year)) {
		return (false);
	}

	//validate correct date
	day_n = parseInt(day, 10);
	month_n = parseInt(month, 10);
	year_n = parseInt(year, 10);
	if (year_n < 1000 || year_n > 2100) {
		return (false);
	}
	if (month_n < 1 || month_n > 12) {
		return (false);
	}
	if ((day_n < 1) || (day_n > 31)) {
		alert("el dia no es correcto");
		return (false);
	}	
	if ((day_n == 31) && ((month_n == 2) || (month_n == 4) || (month_n == 6) || (month_n == 9) || (month_n == 11))) {
		return (false);
	}	
	if ((day_n == 30) && (month_n == 2)) {
		return (false);
	}	
	if ((day_n == 29) && (month_n == 2) && (year_n % 4 != 0)) {
		return (false);
	}

	return (true);
}

// devuelve True/false si el valor es entero
function IsInteger(s) {
	if (s.length==0){
		return false;
	}
	for (var i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		if (!((c >= "0") && (c <= "9"))) {
			return false;
		}
	}
	return true;
}

function abrirVentana(TheURL,TheWidth,TheHeight)
{
	window.open(""+TheURL+"","nuevaventana","width="+TheWidth+",height="+TheHeight+",resizable=yes,scrollbars=yes");
}



// funciones que nos marcan toda una fila 
function entrar(src,color_entrada) {
src.bgColor=color_entrada;
src.style.cursor="hand";
}
// funciones que nos marcan toda una fila 
function sortir(src,color_default) {
src.bgColor=color_default;
src.style.cursor="default";
}

function abrirVentana(TheURL,TheWidth,TheHeight)
{
	window.open(""+TheURL+"","nuevaventana","width="+TheWidth+",height="+TheHeight+",resizable=yes,scrollbars=yes");
}


function redimensionar(theIdImg, theAncho){ // redimensionar imágenes
		var ancho;
		ancho = document.getElementById(""+theIdImg+"").width;
		if (ancho >=theAncho){
			document.getElementById(""+theIdImg+"").width=theAncho;
			//alert(document.getElementById(""+theIdImg+"").width);
		}
}



function imposeMaxLength(Object, MaxLen) //Es MaxLength para textarea
{
  return (Object.value.length <= MaxLen);
}
