function fechaCorrecta(fecha){

	// dd / mm / yyyy

	tmp  = fecha.split("/");

	if ( tmp.length != 3 || isNaN(tmp[0]) || isNaN(tmp[1]) || isNaN(tmp[2]) ) return false;
	if ( tmp[0].length != 2 || tmp[1].length < 1 || tmp[1].length > 2 || tmp[2].length != 4 ) return false;
	
	dia  = parseInt(tmp[0],10);
	mes  = parseInt(tmp[1],10);
	anyo = parseInt(tmp[2],10);

	dias = new Array("0","31","29","31","30","31","30","31","31","30","31","30","31")

	if ( isNaN(dia) || dia < 1 || dia > 31 ) return false;
	if ( isNaN(mes) || mes < 1 || mes > 12 ) return false;
	if ( isNaN(anyo) || dia > parseInt(dias[mes],10) ) return false;
	
	return true;
}

// -----------------------------------------------------------------
function fechasCorrectas(ini_date, fin_date){

	if (!fechaCorrecta(ini_date)) return false;
	if (!fechaCorrecta(fin_date)) return false;
	
	// inicio
	tmp = ini_date.split("/");
	ini_d = parseInt(tmp[0],10);
	ini_m = parseInt(tmp[1],10);
	ini_y = parseInt(tmp[2],10);
	
	// fin
	tmp = fin_date.split("/");
	fin_d = parseInt(tmp[0],10);
	fin_m = parseInt(tmp[1],10);
	fin_y = parseInt(tmp[2],10);
	
	if (fin_y < ini_y) return false;
	if (fin_y == ini_y && fin_m < ini_m) return false;
	if (fin_y == ini_y && fin_m == ini_m && fin_d <= ini_d) return false;
	return true;
}

