<!--

function sync_day3_buttons() {

	imgf = "../images/btns/bg/ice/";

	str = "";
	if (at_beginning_of_time()) { str = "_off"; }
	document.images["prev"].src = imgf + "prev" + str + ".gif";

	str = ""; if (at_end_of_time()) { str = "_off"; }
	document.images["next"].src = imgf + "next" + str + ".gif";
}


function at_beginning_of_time() {

	if (year > yearStart) return 0;

	if (month < monthStart) return 1;
	if (month == monthStart) {
		if (day <= dayStart) return 1;
	}

	return 0;
}

function at_end_of_time() {

	if (year < yearEnd) return 0;

	if (month > monthEnd) return 1;
	if (month == monthEnd) {
		if (day >= dayEnd) return 1;
	}

	return 0;
}


function sync_buttons() {
	sync_day3_buttons();
}


function next_day() {
	if (at_end_of_time()) return;

	otherDisplay = true;
	day++;

	if (!valid_day(day)) {
		day = 1; month++;
		if (month == 13) {year++; sync_year(); month = 1;}
		sync_month();
	}
	sync_day();

	if (!exist_data(sat_num) || is_gap(sat_num) ) {
		next_satellite();
		if (!satellite_found) {
			no_satellite_message("next"); message_given = 1;
			next_day(); return;
		}
	}

	update_display();
	message_given = 0;

}


function previous_day() {
	if (at_beginning_of_time()) return;

	otherDisplay = true;
	day--;

	if (day == 0) {
		month--;
		if (month == 0) {year--; sync_year(); month = 12;}
		if (month == 2) {day = get_Feb_length()}
		else {day = month_lengths[month]}
		sync_month();
	}
	sync_day();

	if (!exist_data(sat_num) || is_gap(sat_num) ) {
		next_satellite();
		if (!satellite_found) {
			no_satellite_message("prev"); message_given = 1;
			previous_day(); return;
		}
	}

	update_display();
	message_given = 0;
}


function set_day3_within_range() {

	if (year == yearStart) {
		if ( (month < monthStart) || (month == monthStart && day < dayStart) ) {
			out_of_range_msg(-1, "nearest");
			month = monthStart; sync_month();
			day = dayStart; sync_day();
		}
	}

	if (year == yearEnd) {
		if ( (month > monthEnd) || (month == monthEnd && day > dayEnd) ) {
			out_of_range_msg(1, "nearest");
			month = monthEnd; sync_month();
			day = dayEnd; sync_day();
		}
	}

}



// -->
