
var hdanz = {

	/*
	 * contains reference to the admin menu ul element that the script uses
	 * to show or hide on mouse over for IE because of not supporting the 
	 * :hover pesudoclass properly.
	 */
	adminMenu : null,

	startList : function() {
		if (document.getElementById("nav-second")) {
			navRoot = document.getElementById("nav-second");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					for (x=0; x<node.childNodes.length; x++) {
						y = node.childNodes[x];
						if (y.nodeName=="SPAN") {
							y.onmousedown=function() {
								hdanz.collapseAll();
								this.parentNode.className+=" over active";
							}
						}
					}
				}
			}
		}
	},

	collapseAll : function() {
		if (document.getElementById("nav-second")) {
			navRoot = document.getElementById("nav-second");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.className=node.className.replace(" over", "");
					node.className=node.className.replace(" active", "");
				}
			}
		}
	},

	/*
	 * Add the event handlers that show and hide the admin menu when the user
	 * moves the mouse over the "client login" button.
	 */
	adminMenu : function() {
		if (document.getElementById('nav-first')) {
			var menuItems = document.getElementById('nav-first').getElementsByTagName('li');
			for (var i = 0; i < menuItems.length; i++) {
				if (menuItems[i].className == 'login') {
					var adminMenu = menuItems[i].getElementsByTagName('ul');
					if (adminMenu.length == 1) {
						hdanz.adminMenu = adminMenu[0];
						menuItems[i].onmouseover = function() {
							hdanz.adminMenu.style.display = 'block';
						}
						menuItems[i].onmouseout = function() {
							hdanz.adminMenu.style.display = 'none';
						}
					}
				}
			}
		}
	},

	/**
	 * 
	 */
	printPage : function(title) {
		var i, a;
		for (i = 0; (a = document.getElementsByTagName('link')[i]); i++) {
			if (a.getAttribute('title')) {
				a.disabled = (a.getAttribute('title') == title) ? false : true;
			}
		}
	}

}

window.onload = function() {
	hdanz.startList();
	hdanz.adminMenu();
	if (document.getElementById('home')) {
		var so = new SWFObject("/includes/template/public/img/header.swf", "hdanz_flash_header", "840", "270", "7");
		so.addParam("wmode", "transparent");
		so.addParam("menu", "false");
		so.write("flash_header");
	}
}
//function popup(xid) {
//	window.open("/?stylesheet=popup&id="+xid, "popup", "width=500,height=500,scrollbars=yes,resizable=no");
//}