/*
=============================
Undergroundhouse.net
Standard JavaScript Functions
=============================

Jason Sims (jason@symmetriq.net)

Created: 2005-03-29
Modified: 2005-09-29

*/

// preload "lit up" icons
pre_comment = new Image(14,14); pre_comment.src = UGH.SkinImages + '/comment_on.gif';
pre_listen = new Image(14,12); pre_listen.src = UGH.SkinImages + '/listen_on.gif';

function mouseover(icon) {
	icon.src = icon.src.replace(/_off/, '_on');
}

function normal(icon) {
	icon.src = icon.src.replace(/_on/, '_off');
}

//-------------------------
// User Controls
//-------------------------

// preload the other tabs
pre_uctab1 = new Image(33,30);
pre_uctab1.src = UGH.SkinImages + '/uctab_main_off.gif';
pre_uctab2 = new Image(33,30);
pre_uctab2.src = UGH.SkinImages + '/uctab_search_on.gif';

var VisibleTab = 'uc_main';
function uc_switch_tab() {
	switch (VisibleTab) {
		case 'uc_main':
			on = document.getElementById('uc_search');
			off = document.getElementById('uc_main');
			VisibleTab = 'uc_search';
			break;
		case 'uc_search':
			on = document.getElementById('uc_main');
			off = document.getElementById('uc_search');
			VisibleTab = 'uc_main';
			break;
	}
	on.style.display = 'block';
	off.style.display = 'none';
}

//-------------------------
// Navbar
//-------------------------

// preload navbar hover image
pre_nav = new Image(1,30);
pre_nav.src = UGH.SkinImages + '/navbar_hover_bg.gif';

// make subnav work in IE
// (Opera userAgent string contains MSIE but this buggers up Opera 8 and isn't needed for 7)
if (navigator.userAgent.search(/MSIE/) != -1 && navigator.userAgent.search(/Opera/) == -1) {
	startList = function() {
		if (document.all && document.getElementById) {
			navRoot = document.getElementById("nav");
			for (i = 0; i < navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName == "LI") {
					node.onmouseover = function() {
						this.className += " over";
					}
					node.onmouseout = function() {
						this.className = this.className.replace(" over", "");
					}
				}
			}
		}
	}
	window.onload = startList;
}

// We need this fix for Opera 7 only; it screws up Opera 8
/* if (navigator.userAgent.search(/Opera 7/) != -1) { */
/* 	fixOpera = function() { */
/* 		navRoot = document.getElementById("nav"); */
/* 		navRoot.style.width = "100%"; */
/* 	} */
/* 	window.onload = fixOpera; */
/* } */