function writeYear()
{
	var oCurrDate = new Date();
	var iYear = (is_ie4up) ? oCurrDate.getYear() : oCurrDate.getYear() + 1900;	//y2k fix
	var sYearString = iYear;
	document.writeln (sYearString);
	
}

function writeStyle()
{

	if (is_mac && is_nav4)
	{
		document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"common/css/styleMACNS.css\">");
		//document.write("@import url(\"common/css/styleMACNS.css\");");
	}
	else
	{
		//document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"common/css/style.css\">");
		document.write("<style type=\"text/css\">");
		document.write("@import url(\"common/css/style.css\");");
		document.write("</style>");
	}

}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

function preloadNav(prefix,maxNum)
{
	for (i=1; i <= maxNum; i++)
	{
		//alert(prefix + i + "on.src = \"images/" + prefix + i + "_r.gif\";");
		eval(prefix + i + "on = new Image();");
		eval(prefix + i + "on.src = \"images/" + prefix + i + "_r.gif\";");
	
		eval(prefix + i + "off = new Image();");
		eval(prefix + i + "off.src = \"images/" + prefix + i + ".gif\";");
	}
}

function initPage()
{
	writeStyle();
	preloadNav("nav", 15);
}

function validateSearch()
{
	var errors = false;
	var errMsg = 'Please fill in a keyword to search.\n';

	if (document.formSearch.search.value == ''){
		alert("Please fill in a keyword to search.\n");
		document.formSearch.search.focus();
		return false;
	}
	if ((document.formSearch.search.value == 'the') || (document.formSearch.search.value == 'a') || (document.formSearch.search.value == 'an') || (document.formSearch.search.value == 'and'))
	{
		alert("Your keyword is too common for this search.  Please refine your keyword(s).");
		document.formSearch.search.focus();
		return false;
	}
	if (!isNaN(document.formSearch.search.value))
	{
		alert("A number is too common to be searched for.  Please refine your search.");
		document.formSearch.search.focus();
		return false;
	}

	errMsg = '';
	return true;	
}

function pop(sPage)
{
	oWin = window.open(sPage,"oWin","top=120px,left=40px,height=200px,width=416px,location=0,status=0,scrollbars=0,toolbar=0,resizable=0");
}

function quicklinksSwitch(pURL){
	if (pURL != '')
	{
		window.document.location.href=pURL;
	}
}