/* <![CDATA[ */

var newWindow = null;

function closeWindowLinks () { 
if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support 
if (!document.getElementById("mapFunctionalityLink")) {return;} // Check that the target element actually exists 

var oTarget = document.getElementById("mapFunctionalityLink");
var oLink = document.createElement('a'); 
oLink.id = 'close-link'; // Give the link an id to allow styling 
oLink.href = 'javascript:window.close()'; // Make the link focusable for keyboard users 
oLink.appendChild(document.createTextNode("Close this window"));
oTarget.replaceChild(oLink,oTarget.firstChild);
}; 

function formatCalendarNavigation() {
	//if (!document.getElementsByTagName) return;
if (!document.getElementById("calNavigationList")) return;
var ul = document.getElementById("calNavigationList");
var links = ul.getElementsByTagName("a");
var searchBottom = document.getElementById("innerSearchBottom");

/* INITIALIZE DISPLAY */
document.getElementById("calNavigationList").style.visibility = "visible";
document.getElementById("currentYearCalendarMinus1").style.display = "none";
document.getElementById("currentYearCalendarMinus2").style.display = "none";
document.getElementById("currentYearCalendar").style.display = "inline";
document.getElementById("currentYearCalendar").deleteCaption();
document.getElementById("currentYearCalendarMinus1").deleteCaption();
document.getElementById("currentYearCalendarMinus2").deleteCaption();
if (searchBottom.className == "calStyle") {
searchBottom.style.display = "block";
searchBottom.style.backgroundColor = "#E1D6E4";
}

/* CONTROLLING DISPLAY AFTER TAB CLICKS */
for (var i=0; i<links.length; i++) { 
	var anchor = links[i]; 
		anchor.onclick =  function(){

if (this.id == "currentYearLink") {
	document.getElementById("currentYearLinkMinus1").className = "calNavInActive";
	document.getElementById("currentYearLinkMinus2").className = "calNavInActive";
	document.getElementById("currentYearLink").className = "calNavActive";
	document.getElementById("currentYearCalendarMinus1").style.display = "none";
	document.getElementById("currentYearCalendarMinus2").style.display = "none";
	document.getElementById("currentYearCalendar").style.display = "block";
}
if (this.id == "currentYearLinkMinus1") {
	document.getElementById("currentYearLinkMinus1").className = "calNavActive";
	document.getElementById("currentYearLinkMinus2").className = "calNavInActive";
	document.getElementById("currentYearLink").className = "calNavInActive";
	document.getElementById("currentYearCalendarMinus1").style.display = "block";
	document.getElementById("currentYearCalendarMinus2").style.display = "none";
	document.getElementById("currentYearCalendar").style.display = "none";
}
if (this.id == "currentYearLinkMinus2") {
	document.getElementById("currentYearLinkMinus2").className = "calNavActive";
	document.getElementById("currentYearLinkMinus1").className = "calNavInActive";
	document.getElementById("currentYearLink").className = "calNavInActive";
	document.getElementById("currentYearCalendarMinus2").style.display = "block";
	document.getElementById("currentYearCalendarMinus1").style.display = "none";
	document.getElementById("currentYearCalendar").style.display = "none";
}

		return false;
		}
}
};

function rewriteMapLink() {
var newURL;
if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "mapLink"))
   {
    newURL = anchor.getAttribute("href");
    anchor.onclick =  function() {window.open(newURL,'newWin','resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width=850,height=600,top=0,left=0'); return false;}
    }
 } 
};

function addLoadEvent(func) { 
var oldonload = window.onload; 
if (typeof window.onload != 'function') { 
window.onload = func; 
} else { 
window.onload = function() { 
if (oldonload) { 
oldonload(); 
} 
func(); 
} 
} 
} 
 
addLoadEvent(formatCalendarNavigation);
addLoadEvent(closeWindowLinks);
addLoadEvent(rewriteMapLink);
// -->