
// Check Browser CSS Compatibility
	
// alert(document.compatMode);
	
// Supress BOM Script Errors	
	
function errorsuppressor(){
return true;
}

if(location.href.indexOf("localhost") == -1){
	window.onerror = errorsuppressor;
}

// Multiple Onload Utility

function addLoadEvent(func) {

	var oldonload = window.onload;

	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		oldonload();
		func();
		}
	}
}

// Insert-after Function

function insertAfter(newElement, targetElement) {

var parent = targetElement.parentNode;

if (parent.lastChild == targetElement) {
	parent.appendChild(newElement);
} else {
	parent.insertBefore(newElement, targetElement.nextSibling);
	}
}


// Toggle, Show/Hide Element(s)

function toggleElement(val, obj){

	if(document.getElementById(val).style.display == "none") { 

		obj.className = "expandon";
		document.getElementById(val).style.display = "block";

	} else {

		obj.className = "expand";
		document.getElementById(val).style.display = "none";
	}
}

// Global Pop-up (parse through DOM, if viewpage class exists, append event)

function newWinLinks() {

	for (var i=0; i < document.links.length; i++) {
		
		if (document.links[i].className == "newwindow") {
		document.links[i].onclick = displayNewWindow;
		}

	}
	
}

addLoadEvent(newWinLinks);

function displayNewWindow() {

	var featureWindow = window.open(this.href,"win", 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=yes,resizable=1,top=100,left=100,width=800,height=600');
	featureWindow.focus();
	return false;
}


// Primary Nav (IE 6 only)

	primarynavhover = function() {

		if (!document.getElementById) return false;
		if (!document.getElementById("primarynav")) return false;

		var listElements = document.getElementById("primarynav").getElementsByTagName("li");

		for (var i=0; i < listElements.length; i++) {

			listElements[i].onmouseover = function() {
			this.className+=" iehover";
			}

			listElements[i].onmouseout = function() {
			this.className = this.className.replace(new RegExp(" iehover\\b"));
			}

		}
	}

	if (window.attachEvent) window.attachEvent("onload", primarynavhover);

function addOptionTitle() { 

// Add title attribute to all select boxes for usability
	
if (!document.getElementsByTagName("select")) return false;

var list = document.getElementsByTagName("select");
	
for(var i = 0; i < list.length; i++) {
	
	var option = list[i].getElementsByTagName("option")

		for(var j = 0; j < option.length; j++) {
			option[j].setAttribute("title", option[j].text);
		}
	}
}
	
addLoadEvent(addOptionTitle);





