/* 
In older browsers, place this in the markup:

<script type="text/javascript">
document.write(shortdateE) 
</script>

*/ 

// write in the header with today's date
function writedate() {

//dom detection and creating objects

	var doc,doc2,doc3,sty;

	if (document.layers) {
		doc = "document.";
		doc2 = ".document.";
		doc3 = "";
		sty = "";
	}
	else if (document.all) {
  		doc = "document.all.";
  		doc2 = "";
  		doc3 = "";
  		sty = ".style";
	}
	else if (document.getElementById) {
  		doc = "document.getElementById('";
  		doc2 ="')";
  		doc3 ="')";
  		sty = "').style";
 	} 


/* puts in date into today_date div id */
	var dayofweekE = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
	var monthE = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var today = new Date;
	var month = today.getMonth();
	var day = today.getDate();
	var thisyear = today.getYear();
	var thisyear = (thisyear < 1900) ? thisyear+= 1900 : thisyear;
	var dayofweek = today.getDay();
	var thishour = today.getHours();
	var thismin = today.getMinutes();
	var thissec = today.getSeconds();

	function putZero(ms) {
 		if(ms > 9) {return ":" + ms;}
 		return ":0"+ ms;
 	}
 
	function putZeroHr(hh) {
 		if(hh > 9) {return " " + hh;}
 		return " 0"+ hh;
 	}

	function oldhour(h) { 
		if (h > 0 && h < 13) {return(h);}
		if (h == 0) {return (12);}
		return (h - 12);
	}

	function amPM() {
		if (thishour < 12) {return " AM";} 
		return " PM";
	}

	var wkdyE = dayofweekE[dayofweek] + ', ';
	var MonDayYrE = monthE[month] + ' ' + day + ', ' + thisyear + ' ';
	var HrMinE = oldhour(thishour) + putZero(thismin);
	var SecE = putZero(thissec);
	var am = amPM();

// date in "Weekday, Month 00, 2000 00:00:00 AM/PM" format
	var fulldateE = dayofweekE[dayofweek] + ', '+monthE[month] + ' ' + day + ', ' + thisyear + ' '+oldhour(thishour) + putZero(thismin)+amPM();

//date in "Weekday, Month 00, Year"format
	var shortdateE = dayofweekE[dayofweek] + ', '+monthE[month] + ' ' + day + ', ' + thisyear

	headerLayer = eval (doc + "today_date"+doc3);
 	headertext = shortdateE;

	if (document.layers || navigator.userAgent.indexOf("Opera") != -1) {
		headerLayer.document.write(headertext);
		headerLayer.document.close();
	}
	else {
 	headerLayer.innerHTML = headertext;
 	}
}


//Netscape resize problem
function reloadpage() {
	var win_width;
	var win_height;
	
	if (document.layers) {
		win_width = innerWidth;
		win_height = innerHeight;
	}
	if (document.layers) {
		if (innerWidth != win_width || innerHeight != win_height) 
			{location.reload();
		}
  	}
 }

//Open a window centered on the screen
var newWin;
	
function makeWindow(url, winname, w, h) {
	windowleft = (screen.width - w)/2;
	windowtop = (screen.height - h)/2;
	settings = '"toolbar=yes, directories=no, menubar=yes, scrollbars=yes, resizable=yes, status=no, width='+w+', height='+h+', left='+windowleft+', top='+windowtop+'"';
	closeWindow();
	newWin = window.open(url, winname, settings);
	newWin.focus();
}

function closeWindow() {
	if (newWin && !newWin.closed) {
		newWin.close();
	}
}

