	// remove anchor outlines from all links
	function blurAnchors(){
		if(document.getElementsByTagName){
			var a = document.getElementsByTagName("a");
			for(var i = 0; i < a.length; i++){
				a[i].onfocus = function(){this.blur()};
			}
		}
	}
	// external link(s) opens as new window
	function handleExternalLinks(){
		if (!document.getElementsByTagName) return;
		var server = document.location.protocol + '//' + document.location.hostname;
		var anchors = document.getElementsByTagName("a");
		var i, href;
		for(i=0; i < anchors.length; i++) {
			if(!anchors[i].href) continue;
			href = anchors[i].href;
			if(href.indexOf(server) == -1)
			if(href.indexOf("javascript:") == -1)
			if(!anchors[i].onclick)
			if(href.indexOf("mailto:") == -1)
			if(href.indexOf("http://") != -1)
				anchors[i].setAttribute("target","_blank");
		}
	}

	// position a footer with CSS
	// http://www.alistapart.com/articles/footers
	// http://www.alistapart.com/d/footers/footer_dom3.html
	function getWindowHeight() {
		var windowHeight = 0;
		if (typeof(window.innerHeight) == 'number') {
			windowHeight = window.innerHeight;
		}
		else {
			if (document.documentElement && document.documentElement.clientHeight) {
				windowHeight = document.documentElement.clientHeight;
			}
			else {
				if (document.body && document.body.clientHeight) {
					windowHeight = document.body.clientHeight;
				}
			}
		}
		return windowHeight;
	}
	function setFooter() {
		if (document.getElementById) {
			var windowHeight = getWindowHeight();
			if (windowHeight > 0) {
				var contentHeight = document.getElementById('container').offsetHeight;
				var footerElement = document.getElementById('footer');
				var footerHeight  = footerElement.offsetHeight;
				if (windowHeight - (contentHeight + footerHeight) >= 0) {
					footerElement.style.position = 'absolute';
					footerElement.style.top = (windowHeight - footerHeight) + 'px';
				}
				else {
					footerElement.style.position = 'static';
				}
			}
		}
	}


	// alternate form field value -- onfocus/onblur
	function alterNate(elm){
		if (!elm.base) elm.base = elm.value
		if (elm.value == elm.base) elm.value = "";
		else if (elm.value == "") elm.value = elm.base;
	}


	// date/time function
	MyDate = {
		days : ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
		months : ["January","February","March","April","May","June","July","August","September","October","November","December"],
		getHours : function(theHour){
			return (theHour>12 || theHour==0) ? Math.abs(theHour-12) : theHour;
		},
		addZero : function(theNumber){
			return (theNumber>9) ? theNumber : "0"+theNumber;
		},
		getAmPm : function(theHour){
			return (theHour<12) ? "am" : "pm";
		},
		setDate : function(){
			var now = new Date();
			this.hour = this.getHours(now.getHours());
			this.minute = this.addZero(now.getMinutes());
			this.second = this.addZero(now.getSeconds());
			this.ampm = this.getAmPm(now.getHours());
			this.day = this.days[now.getDay()];
			this.date = now.getDate();
			this.month = this.months[now.getMonth()];
			this.year = now.getFullYear();
		},
		getDate : function(){
			this.setDate();
			//return this.day+", "+this.month+" "+this.date+", "+this.year+" "+this.hour+":"+this.minute+":"+this.second+" "+this.ampm;
			return this.hour+":"+this.minute+":"+this.second+" "+this.ampm;
		}
	}

	function showDate(){
		document.getElementById("theDate").innerHTML = MyDate.getDate();
	}

	function initDate(){
		dateTimer = setInterval("showDate()",1000); /* 1-sec interval */
	}

	// preview form inputs
	function previewData(source, destination) {
		var NewText = document.getElementById(source).value;
			NewText = NewText.replace(/\n/g, '<br />');
		var DivElement = document.getElementById(destination);
			DivElement.innerHTML = NewText;
	}
	/*
	O R I G I N A L
	function ReloadTextDiv() {
		var NewText = document.getElementById("addinfo").value;
		var DivElement = document.getElementById("textDisplay");
		DivElement.innerHTML = NewText;
	}
	*/


function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}


openWin = function(url,name,width,height,xpos,ypos,chrome,scroll){
  var x, y, w, h, moveX=0, moveY=0, features="";
  chrome = chrome ? "yes" : "no";
  scroll = scroll ? "yes" : "no";
  features += "toolbar="+chrome+",location="+chrome+",status="+chrome+",menubar="+chrome;
  features += ",scrollbars="+scroll+",resizable="+scroll;
  if(width) features += ",width="+width;
  if(height) features += ",height="+height;
  if(xpos && window.screen){
    w = window.screen.availWidth;
    width = parseInt(width);
    switch(xpos){
      case "left": x = 0; break;
      case "center": x = (w-width)/2; break;
      case "right": x = w-width; break;
      default: x = xpos;
    }
    features += ",screenX="+x+",left="+x;
    var moveX = x;
  }
  if(ypos && window.screen){
    h = window.screen.availHeight;
    height = parseInt(height);
    switch(ypos){
      case "top": y = 0; break;
      case "middle": y = (h-height)/2; break;
      case "bottom": y = h-height; break;
      default: y = ypos;
    }
    features += ",screenY="+y+",top="+y;
    var moveY = y;
  }
  openWinReference = window.open(url,name,features);
  if(moveX || moveY){
    // position the window for browsers that don't recognize screenX, screenY
    openWinReference.moveTo(moveX,moveY);
  }
}
openScroll = function(url,name,width,height){
  openWin(url,name,width,height,false,false,false,"scroll");
}
openCenter = function(url,name,width,height){
  openWin(url,name,width,height,"center","middle");
}
openCenterScroll = function(url,name,width,height){
  openWin(url,name,width,height,"center","middle",false,"scroll");
}
openFull = function(url,name){
  openWin(url,name,false,false,false,false,"chrome","scroll");
}




	/* ---| body event handlers |------------------------------------ */
	window.onload = function() {
		blurAnchors();
		initDate();
		handleExternalLinks();
		setFooter();
		SetToToday('FirstSelect');
	}
	window.onresize = function() {
		setFooter();
	}