@set @DEBUG = 0	// Program Debug Flag: ON(=1)/OFF(=0)
function makeMonthNumber(){
	var i = 0;
	this[i++] = 31; // Jan
	this[i++] = 28; // Feb: to be modified by program
	this[i++] = 31; // Mar
	this[i++] = 30; // Apr
	this[i++] = 31; // May
	this[i++] = 30; // Jun
	this[i++] = 31; // Jul
	this[i++] = 31; // Aug
	this[i++] = 30; // Sep
	this[i++] = 31; // Oct
	this[i++] = 30; // Nov
	this[i++] = 31; // Dec
	this[i	] = null;
	this.length = i;
}
var NumMonth	 = new makeMonthNumber();

function imgDateCheck(){
	var d = new Date();
	with(d){
		var tmpYear  = getFullYear();
		var tmpMonth = getMonth() + 1;
		var tmpDD	 = getDate();
	}
	tmpMonth = (tmpMonth < 10) ? ("0" + tmpMonth) : tmpMonth;
	tmpDD	 = (tmpDD	 < 10) ? ("0" + tmpDD)	  : tmpDD;
	var toDay = tmpYear + "/" + tmpMonth + "/" + tmpDD;	// yyyy/mm/dd

	if ((((tmpYear % 4 == 0) && (tmpYear % 100 != 0)) || (tmpYear % 400 == 0))){
		 NumMonth[1] = 29;	// leap year
	}

	var limitDays, lTitle;
	var coll = F.tags("IMG");
	var clen = coll.length;
	var oModDate = F[ "MDATE" ];
	if (oModDate != null){
		var curModifiedDate = oModDate.innerText.substr(0, DATE_LEN);	// yyyy/mm/dd
		var lstModifiedDate = oModDate.innerText;						// Initial Date
		var savModifiedDate = curModifiedDate;
	}
	for (var i=0; i<clen; i++){
		with(coll.item(i)){
			if ((className == "0") || (className == "") || isNaN(className)) continue;
			limitDays = (("0" > className) || (className > MAX_EXPIRY)) ? MAX_EXPIRY : className;
			startDate = title.substr(0, DATE_LEN);	// expected format:yyyy/mm/dd
			if (oModDate){
				if (curModifiedDate < startDate){
					curModifiedDate = startDate;
					lstModifiedDate = title.substr(0, DATM_LEN);
				}
			}
			limitDate = getDueDate(startDate, limitDays);
			if ((toDay < limitDate) || (title.indexOf(CONST_STR) != -1)){
				lTitle = title.toLowerCase();
				if (lTitle.indexOf(UPDATE_STR) != -1){
					 src = UPDATE_PIC;
				} else if ((src.indexOf(NEW_PIC) == -1) && (lTitle.indexOf(NEW_STR) != -1)){
					 src = NEW_PIC;
				} else if (src.indexOf(CONST_PIC) != -1){
					 src = CONST_PIC;
				}
				style.display = "";
			}
		}
	}
	if (oModDate && (curModifiedDate > savModifiedDate)){
		oModDate.innerText = lstModifiedDate;
		@if ( @DEBUG == 1 )
		window.status = "Replaced Last Modified Date As: " + lstModifiedDate;
		@end
	}
}
