function swapImage(img, newImg) {
	if (typeof(newImg) == 'string') {
		document.getElementById(img).src = newImg;
	} else if (typeof(newImg) != 'undefined') {
		document.getElementById(img).src = newImg.src;
	}
}

function swapMapImage(state) {
	var imgName = '/images/map/system-map' + ((state) ? '-' + state : '') + '.gif';
	swapImage('svcmap', imgName);
}

function fixIe6Menus() {
	var ul;
	if (document.all && navigator.userAgent.indexOf('MSIE 6') != -1) {
		var el = document.getElementById('nav');
		for (i = 0; i < el.childNodes.length; ++i) {
			if (el.childNodes[0].nodeName.toUpperCase() == 'UL') {
				ul = el.childNodes[0];
				break;
			}
		}
		if (ul) fixListNodes(ul);
	}
}

function ieHover() {
	var el = window.event.srcElement;
	while (el.parentNode) {
		if (el.nodeName.toUpperCase() == 'LI') {
			el.className = 'iehover';
		}
		el = el.parentNode;
	}
}
function ieBlur() {
	var el = window.event.srcElement;
	while (el.parentNode) {
		if (el.nodeName.toUpperCase() == 'LI') {
			el.className = '';
		}
		el = el.parentNode;
	}
}

function fixListNodes(listNode) {
	var i;
	for (i = 0; i < listNode.childNodes.length; ++i) {
		if (listNode.childNodes[i].nodeName.toUpperCase() == 'LI') {
			listNode.childNodes[i].onmouseover = ieHover;
			listNode.childNodes[i].onmouseout  = ieBlur;
			for (j = 0; j < listNode.childNodes[i].childNodes.length; ++j) {
				if (listNode.childNodes[i].childNodes[j].nodeName.toUpperCase() == 'UL') {
					fixListNodes(listNode.childNodes[i].childNodes[j]);
				}
			}
		}
	}
}

function doEverything() {
	//fixIe6Menus();
	startTicker(); // from ticker.js
}