$(document).ready(function() {
	WM_initialize_toolbar();
});

// scripts used for tabs

/* Drop-down Scripts */
document.WM = new Object();						// these objects are used
document.WM.hirelist = new Object();			// to fix errors
document.WM.hirelist.expandos = new Array();	// that result in 
document.WM.hirelist.heights = new Array();		// Netscape Navigator 4
document.WM.hirelist.names = new Array();		// because of the <layers> tag

function WM_toggle(id) {												// toggles the menus
	if (document.all) {													// Internet Explorer
		if (document.all[id].style.display == 'none') {
			document.all[id].style.display = '';
		} 
		else {
			document.all[id].style.display = 'none';
		}
	} 
	else if (document.getElementById) {								// W3C-compliant
		if (document.getElementById(id).style.display == 'none') {
			document.getElementById(id).style.display = 'block';
		} 
		else {
			document.getElementById(id).style.display = 'none';
		}
	} 
	else if (document.layers) {										// Netscape Navigator 4
		if (parseInt(id + 1)) {
			ditem = id + 1;
		} 
		else {
			ditem = document.WM.hirelist.names[id];
		}
		
		if (document.WM.hirelist.expandos[ditem].clip.bottom == 0) {
			document.WM.hirelist.expandos[ditem].clip.bottom = document.WM.hirelist.heights[ditem];
		} 
		else {
			document.WM.hirelist.expandos[ditem].clip.bottom = 0;
		}
		
		WM_align();
	}
}

function bulletToggle(id) {											// changes the bullet on the list item
	var element = document.getElementById(id);

	if (element.className == 'open') {
		element.className = 'closed';
	}
	else {
		element.className = 'open';
	}	
}

function WM_align() {													// makes sure expansion works in Netscape Navigator 4
	var i,j,stupid_netscape_array_infinate_loop_error;
	stupid_netscape_array_infinate_loop_error = document.WM.hirelist.expandos.length;
	for (i=0; i<stupid_netscape_array_infinate_loop_error; i++) {
		j = i + 1;
		if (document.WM.hirelist.expandos[j]) {
			if (document.layers) {
				document.WM.hirelist.expandos[j].top = document.WM.hirelist.expandos[i].top + document.WM.hirelist.expandos[i].clip.bottom;
			}
		}
	}
}

function WM_initialize_toolbar() {										// hides layers when loading so you can't see them moving around in front of you
	if (document.layers) {												// Netscape Navigator 4
		for (i=0; i<document.layers['container'].document.layers.length; i++) {
			document.WM.hirelist.expandos[i] = document.layers['container'].document.layers[i];
			document.WM.hirelist.names[document.layers['container'].document.layers[i].name] = i;
			document.WM.hirelist.heights[i] = document.WM.hirelist.expandos[i].clip.bottom;
		}
		for (p=0;p<document.WM.hirelist.expandos.length;p=p+2) {
			WM_toggle(p);
		}
		document.layers['container'].visibility = 'visible';
	} 
	else if (document.all) {											// Internet Explorer
		for (i = 0; i < document.all('container').all.length; i++) {
			document.all('container').all[i].style.position = 'relative';	
			if (document.all('container').all[i].className == 'menu') {
				document.all('container').all[i].style.display = 'none';
			}
		}
		document.all('container').style.visibility = 'visible';
	} 
	else if (document.getElementsByTagName && document.getElementById) {	// W3C-compliant
		var contained = document.getElementById('container').getElementsByTagName('div');
		for (i = 0; i < contained.length; i++) {
			contained[i].style.position = 'relative';
			if (contained[i].getAttribute('class') == 'menu') {
				contained[i].style.display = 'none';
			}
		}
		document.getElementById('container').style.visibility = 'visible';
	}
}

/* Specification Tabs (unneeded)
function selectTab(tabName) {
	if (tabName == 'newTab' && document.getElementById('newTab').className != 'current') {					// select the "New Systems" tab only if it isn't already selected
		document.getElementById('newTab').className = 'current';											// change look of tabs
		document.getElementById('oldTab').className = '';
		
		WM_toggle('new_system');																				// switches tables
		WM_toggle('old_system');
		
		if (navigator.appName == 'Netscape') {																// fixes table width glitch in Netscape/Mozilla
			document.getElementById('new_system').style.display = 'table';
			document.getElementById('old_system').style.display = 'none';
		}
	}
	else if (tabName == 'oldTab' && document.getElementById('oldTab').className != 'current') {			// select the "Currently Owned Systems" tab only if it isn't already selected
		document.getElementById('newTab').className = '';													// change look of tabs
		document.getElementById('oldTab').className = 'current';
		
		WM_toggle('new_system');																				// switches table
		WM_toggle('old_system');
		
		if (navigator.appName == 'Netscape') {																// fixes table width glitch in Netscape/Mozilla
			document.getElementById('new_system').style.display = 'none';
			document.getElementById('old_system').style.display = 'table';
		}
	}
}
*/