// Open links in external window for XHTML 1.0 Strict compliancy
// To make a link open in external window add the "rel" attribute to the <a> tag
// and set its value to "external" example:
//     <a href="http://www.google.com" rel="external">Google</a>
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	var areas = document.getElementsByTagName("area");
	var forms = document.getElementsByTagName("form");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}
	for (var x=0; x<areas.length; x++) {
		var area = areas[x];
		if (area.getAttribute("href") &&
		area.getAttribute("rel") == "external")
		area.target = "_blank";
	}
	for (var y=0; y<forms.length; y++) {
		var form = forms[y];
		if (form.getAttribute("rel") == "external")
		form.target = "_blank";
	}
}
window.onload = externalLinks;


var hour, minute, seconds, milliseconds, weekday, day, month, yy, year, startTime, popup, field;

var months = new makeArray('January','February','March',
    'April','May','June','July','August','September',
    'October','November','December');

var weekdays = new makeArray('Sunday','Monday','Tuesday',
    'Wednesday','Thursday','Friday','Saturday');

date = new Date();
hour = date.getHours();
minute = date.getMinutes();
seconds = date.getSeconds();
milliseconds = date.getMilliseconds();
weekday  = date.getDay() + 1;
day  = date.getDate();
month = date.getMonth() + 1;
yy = date.getYear();
year = (yy < 1000) ? yy + 1900 : yy;
startTime = date.getTime();

function makeArray() {
     for (i = 0; i<makeArray.arguments.length; i++)
          this[i + 1] = makeArray.arguments[i];
}

function showDay(intDayOfWeek, intMonth, intYear, intEarliest) {
// intEarliest is the earliest day on which the holiday can occur.
// for example, if November 1st is a Thursday, then Thanksgiving
// is on the 22nd (the 4th Thursday), which is the earliest it 
// can occur. It can occur as late as the 28th.
// intDayOFWeek is the numeric day of the week. eg Thanksgiving
// is on a Thursday which is the 5th day of the week.
	for (i = intEarliest; i <= intEarliest + 6; i++) {
		dtDate = new Date(intMonth + '/' + i + '/' + intYear)
		if (dtDate.getDay() + 1 == intDayOfWeek){
			document.write(weekdays[dtDate.getDay() + 1] + ", " + months[intMonth] + " " + i + ", " + intYear); 
		}
	}
}

// showDate available formats.....
//		"mm/dd/yyyy"
//		"dd/mm/yyyy"
//		"dddd, mm dd, yyyy"
//		"dddd, mm dd, yyyy hh:ss"

function showDate (format) {
	switch (format) {
		case "mm/dd/yyyy":
			document.write(month + "/" + day + "/" + year);
			break;
		case "dd/mm/yyyy":
			document.write(day + "/" + month + "/" + year);
			break;
		case "dddd, mm dd, yyyy":
			document.write(weekdays[weekday] + ", " + months[month] + " " + day + ", " + year);
			break;
		case "dddd, mm dd, yyyy hh:ss":
			document.write(weekdays[weekday] + ", " + months[month] + " " + day + ", " + year  + " " + time);
			break;
		default:
			document.write(month + "/" + day + "/" + year);
			break;
	}
}