/*******************************************************************************
*                                                                              *
*  Web Site  :  http://www.eps.com.au/                                         *
*  Author    :  EPS                                                    *
*  Modified  :  09-Dec-2004                                                    *
*                                                                              *
*******************************************************************************/
var d = document, dE = d.documentElement;
var fixIEwidth = 0;


/* Hover support for drop downs in IE (Opera 7.23 also seems to need this too?!)
*******************************************************************************/

function menuHover() {
	var menuItems = d.getElementById("nav").getElementsByTagName("LI");

	for (var i = 0, miL = menuItems.length; i < miL; i++) {
		menuItems[i].onmouseover = function() {
			this.className = "mnhover";
		}
		menuItems[i].onmouseout = function() {
			this.className = "";
		}

		// Add alpha transparencey in IE 5.5+
		var hasSub = menuItems[i].getElementsByTagName("UL")[0];
		if (hasSub && (typeof hasSub.filters == "object")) {
			hasSub.style.filter = "alpha(opacity=100)";
		}
	}
}


/* Toggle Expandable/Expanded (ken 2005-03-17)
*******************************************************************************/
function toggleExpandable( ele ) {
    ele.className = ( ele.className == 'expanded' ) ? 'expandable':'expanded';
}

function toggleExpandableMap( ele ) {
    ele.className = ( ele.className == 'expandedmap' ) ? 'expandablemap':'expandedmap';
}

/* Perform on page load/unload
*******************************************************************************/

function init() {
	window.defaultStatus = "Electronic Productivity Solutions";
	if (d.getElementById) {
		var c = cookie.read("epsprefs");
		var title = c ? c : stylesheet.getPreferred();
		stylesheet.set(title);
	}
}

window.onload = function(e) {
	if (d.getElementById) {
		if (d.all) {
			menuHover();
		}
		// Opera wont switch css sometimes unless we do it onload! POS!
		if (navigator.userAgent.indexOf('Opera') != -1) {
			init();
			//alert("Your browser sucks!!");
		}
	
	}
};
window.onunload = function(d) {
	if (d.getElementById) {
		title = stylesheet.getActive();
		if (title != "plaintext") {
			cookie.write("epsprefs", stylesheet.getActive(), 0);
		}
	}
};

if (d.all && !window.opera && fixIEwidth == 0) {
	window.onresize = function() {
		checkMinWidth();
	};
}
