function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function buttonHover(id) {
		document.getElementById(id).style.backgroundColor = "rgb(247,172,0)";
	}

function buttonNoHover(id) {
		document.getElementById(id).style.backgroundColor = "rgb(68,95,194)";
	}

/** New functions **/
function btnImageHover(id, path) {
		document.getElementById(id).style.backgroundImage = "url(" + path + "common/images/nav_btn_hover.gif)";
	}
function btnImageNoHover(id, path) {
		document.getElementById(id).style.backgroundImage = "url(" + path + "common/images/nav_btn.gif)";
	}
		
function divbuttonHover(id, path) {
		document.getElementById(id).style.backgroundImage = "url(" + path + "common/images/div_btn_hover.gif)";
	}	

function divbuttonNoHover(id, path) {
		document.getElementById(id).style.backgroundImage = "url(" + path + "common/images/div_btn.gif)";
	}
/** End new functions **/	

function mouseHover(id, source, path) {
	if (document.images) {
		document.getElementById(id).src=path + "common/images/buttons/" + source + ".gif";
	}
}

function mouseClick(id, source, path) {
	if (document.images) {
		document.getElementById(id).src=path + "common/images/buttons/" + source + ".jpg";
	}
}

function btnFocus(id) {
	if (document.images) {
		document.getElementById(id).style.border = "2px solid rgb(210,0,0)";
	}	
}

function btnBlur(id) {
	if (document.images) {
		document.getElementById(id).style.border = "none";
	}	
}

function mouseOver(id, source, path) {
	if (document.images) {
		document.getElementById(id).src=path + "common/images/buttons/" + source + ".gif";
	}
}

function mouseOut(id, source, path) {
	if (document.images) {
		document.getElementById(id).src=path + "common/images/buttons/" + source + ".gif";
	}
}

function mouseOverG(id, source) {
	document.getElementById(id).src="../../images/buttons/" + source + ".gif";
}

function mouseOutG(id, source) {
		document.getElementById(id).src="../../images/buttons/" + source + ".gif";
}

function hover(element) {
	element.style.color="#DC143C";
}

function hoverOff(element) {
	element.style.color="";
}

function getNumber(total) {
	date = new Date();
	num = date.getDate();
	num = num % total;

	return(num);
}

function newBrowser(id, high, wide, type) {
	var page = new String("./" + id + "." + type);
	params = "fullscreen=no,toolbar=no,menubar=no,alwaysRaised=yes,location=no,resizable=no,status=no,directories=no,scrollbars=yes,width=" + wide + ",height=" + high;

	objWin = window.open(page, id, params, 'true');

	objWin.moveTo((screen.availWidth - wide)/2,((screen.availHeight - high)/3) - 5);

}

function openGlossary(id, alpha, high, wide, type, gpath) {
	if (gpath == 'norm') {
		var path = new String('./common/terms/');
	}
	if (gpath == 'in') {
		var path = new String('../');
	}
	if (gpath == 'out') {
		var path = new String('../common/terms/');
	}
	var page = new String(path + alpha + "/" + id + "." + type);
	params = "fullscreen=no,toolbar=no,menubar=no,alwaysRaised=yes,location=no,resizable=no,status=no,directories=no,scrollbars=yes,width=" + wide + ",height=" + high;

//	alert(path);
//	alert(page);

	objWin = window.open(page, id, params, 'true');

	objWin.moveTo((screen.availWidth - wide)/2,((screen.availHeight - high)/3) - 5);

}

var oldArchive = 'current';

function showArchive(id) {
	document.getElementById(oldArchive).style.display="none";
	document.getElementById(id).style.display="block";
	oldArchive = id;
}

function fluNav(id) {
	var address = new String('flu.asp' + document.getElementById(id).value);
	if (address == '') {
		alert('Select a question...');
	}
	else {
		window.location=address;
	}
}

function redesignNav(id) {
	var address = new String(document.getElementById(id).value);
	if (address == '') {
		alert('Please select a page...');
	}
	else {
		window.location=address;
	}
}

// Dates section ******************************************************

function lastMod() {
	if (Date.parse(document.lastModified) != 0);
		var d = document.lastModified;
		var lastMod = new Date(d);
		document.write("This page last modified on " + (lastMod.getMonth() + 1) + "/" + lastMod.getDate() + "/" + lastMod.getFullYear());
}

function getCurYear() {
	var thisYear = new Date();
	return thisYear.getFullYear();
}

function month(d, abbreviate) {
	var dt = new Date(d);
	switch (dt.getMonth()) {
		case 0: return (abbreviate == true)?"Jan.":"January";
		case 1: return (abbreviate == true)?"Feb.":"Febrary";
		case 2: return (abbreviate == true)?"Mar.":"March";
		case 3: return (abbreviate == true)?"Apr.":"April";
		case 4: return (abbreviate == true)?"May":"May";
		case 5: return (abbreviate == true)?"Jun.":"June";
		case 6: return (abbreviate == true)?"Jul.":"July";
		case 7: return (abbreviate == true)?"Aug.":"August";
		case 8: return (abbreviate == true)?"Sep.":"September";
		case 9: return (abbreviate == true)?"Oct.":"October";
		case 10: return (abbreviate == true)?"Nov.":"November";
		case 11: return (abbreviate == true)?"Dec.":"December";
	}
}

function day(d) {
	var dt = new Date(d);
	switch (dt.getDay()) {
		case 0: return "Sunday";
		case 1: return "Monday";
		case 2: return "Tuesday";
		case 3: return "Wednesday";
		case 4: return "Thursday";
		case 5: return "Friday";
		case 6: return "Saturday";
	}
}

function dateSuffix() {
	var dt = new Date();
	switch (dt.getDate()) {
		case 1: return "<sup>st</sup>";
		case 2: return "<sup>nd</sup>";
		case 3: return "<sup>rd</sup>";
		case 4: return "<sup>th</sup>";
		case 5: return "<sup>th</sup>";
		case 6: return "<sup>th</sup>";
		case 7: return "<sup>th</sup>";
		case 8: return "<sup>th</sup>";
		case 9: return "<sup>th</sup>";
		case 10: return "<sup>th</sup>";
		case 11: return "<sup>th</sup>";
		case 12: return "<sup>th</sup>";
		case 13: return "<sup>th</sup>";
		case 14: return "<sup>th</sup>";
		case 15: return "<sup>th</sup>";
		case 16: return "<sup>th</sup>";
		case 17: return "<sup>th</sup>";
		case 18: return "<sup>th</sup>";
		case 19: return "<sup>th</sup>";
		case 20: return "<sup>th</sup>";
		case 21: return "<sup>st</sup>";
		case 22: return "<sup>nd</sup>";
		case 23: return "<sup>rd</sup>";
		case 24: return "<sup>th</sup>";
		case 25: return "<sup>th</sup>";
		case 26: return "<sup>th</sup>";
		case 27: return "<sup>th</sup>";
		case 28: return "<sup>th</sup>";
		case 29: return "<sup>th</sup>";
		case 30: return "<sup>th</sup>";
		case 31: return "<sup>st</sup>";
	}
}

function longDate() {
	var dt = new Date();
	return day(dt) + ", " + month(dt) + " " + dt.getDate() + ", " + dt.getFullYear();
}

function shortDate(d) {
	var dt = new Date(d);
	return (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
}

function mediumDate(d) {
	var dt = new Date(d);
	return dt.getDate() + "-" + month(dt, true) + "-" + dt.getFullYear();
}

function dayMonthDate() {
	var dt = new Date();
	return day(dt) + ", " + month(dt, true) + " " + dt.getDate() + "<u>" + dateSuffix(dt) + "</u>";
}
