function toggle (id) {
	el = document.getElementById(id);
	if (el.style.display == 'none') {
		el.style.display = '';
		if (id != 'new-combo') {
			el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.zIndex = 21;
		}
	} else {
		el.style.display = 'none';
		if (id != 'new-combo') {
			el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.zIndex = 20;
		}
	}
	return false;
}

function changeHelpLocation (url) {
	var helpLink = top.frames[0].document.getElementById('helpLink')
	helpLink.href = url;
}

function highlightNav (id) {
	id = (id) ? id.toLowerCase() : '';
	var menu = top.frames[0].document.getElementById('main-menu')
	if (menu) {
		var lis = menu.getElementsByTagName('li');
		for (var i=0; i<lis.length; i++) {
			if (lis[i].className == 'active')
				lis[i].className = '';
		}
		if (id != '') {
			var nav = top.frames[0].document.getElementById('nav-' + id);
			nav.className = 'active';
			menu.className = '';
		} else {
			menu.className = 'inactive';
		}
	}
}

function populateSelect (pseudo_select_id, select_id, action) {
	var value, link, li;
	var fragment = document.createDocumentFragment();
	var p_select = document.getElementById(pseudo_select_id);
	var select = document.getElementById(select_id);
	var options = select.getElementsByTagName('option');
	
	for (var i=2; i<options.length; i++) {
		value = options[i].value;
		li = document.createElement('li');
		link = document.createElement('a');
		link.href = '#';
		link.rel = value + '[][]' + select_id;
		link.title = action;
		link.onclick = function () { return submitPseudoSelect(this.rel, this.title); }
		link.innerHTML = value;
		li.appendChild(link);
		p_select.appendChild(li);
	}
	
}

function submitPseudoSelect (bundle, action) {
	var parts = bundle.split('[][]');
	var value = parts[0];
	var select_id = parts[1];
	
	var select = document.getElementById(select_id);
	var options = select.getElementsByTagName('option');

	for (var i=2; i<options.length; i++) {
		if (options[i].value == value) {
			select.selectedIndex = i;
		}
	}
	
	if (action) {
		doImageSubmit(action);
	} else {
		toggle('s2'); 
	}
	
	return false;
}

function setup () {
}	

window.onload = function () {setup(); }