var theMenu = 'none';
var timeoutID = 0;
var query = window.location.search;

function setPage (p) {
	var what = query.substring(1,2);
	if (what == 'p') {
		var who = query.substring(3);
		if (p == 2) { 
			box = (document.all) ? document.all('store') : (document.getElementById) ? document.getElementById('store') : document.layers['store']; 
			box.src = "store.htm#" + who;  
		}
		else { 
			box = (document.all) ? document.all('showcase') : (document.getElementById) ? document.getElementById('showcase') : document.layers['showcase'];
			box.src = who + ((who.indexOf('.') <= 0) ? '.php' : '');  
		}
	}
}

function openMenu (x) {
	if (theMenu != 'none') closeMenu(theMenu);
	box = (document.all) ? document.all(x).style : (document.getElementById) ? document.getElementById(x).style : document.layers[x];
	box.visibility = 'visible';
	//timeoutID = setTimeout('closeMenu("' + x + '")', 5000);
	theMenu = x;
}

function closeMenu (x) {
	box = (document.all) ? document.all(x).style : (document.getElementById) ? document.getElementById(x).style : document.layers[x];
	box.visibility = 'hidden';
	//theMenu = 'none';
}

function loadParent (x, h) {
	box = (document.all) ? parent.document.all('showcase') : (document.getElementById) ? parent.document.getElementById('showcase') : parent.document.layers['showcase'];
	box.src = x + ((x.indexOf('.') < 0) ? '.php' : '') + ((h != 'undefined') ? '#' +h : '');
}

function loadPage (x, h) {
	if (theMenu != 'none') closeMenu(theMenu);
	box = (document.all) ? document.all('showcase') : (document.getElementById) ? document.getElementById('showcase') : document.layers['showcase'];
	box.src = x + ((x.indexOf('.') < 0) ? '.php' : '') + ((h != 'undefined') ? '#' +h : '');
}

function loadStore (h) {
	box = (document.all) ? document.all('store') : (document.getElementById) ? document.getElementById('store') : document.layers['store'];
	box.src = 'store.htm#' +h;
}

function openPage(x) {
	var p = x + '.htm'
	if (x.indexOf("list-") >= 0) { x = 'list'; }
	window.open(p, x);
}

function hilite (b) {
	b.className = (b.className.indexOf("on") == b.className.length -2) ? b.className.substr(0, b.className.length -2) : b.className + "on" ; 
}

function liteUp (b) {
	//b = (document.all) ? document.all(x) : (document.getElementById) ? document.getElementById(x) : document.layers[x];
	b.className = (b.className.indexOf("on") == b.className.length -2) ? b.className.substr(0, b.className.length -2) : b.className + "on" ; 
		if (theMenu != 'none') {
			clearTimeout(timeoutID);
		}
}

function liteDn (b) {
	//b = (document.all) ? document.all(x) : (document.getElementById) ? document.getElementById(x) : document.layers[x];
	b.className = (b.className.indexOf("on") == b.className.length -2) ? b.className.substr(0, b.className.length -2) : b.className + "on" ; 
	if (theMenu != 'none') {
		clearTimeout(timeoutID);
		timeoutID = setTimeout('closeMenu("' + theMenu + '")', 5000);
	}
}

function itemOn(b) {
	if (theMenu != 'none') closeMenu(theMenu);
	b.className = (b.className.indexOf("on") == b.className.length -2) ? b.className.substr(0, b.className.length -2) : b.className + "on" ;	
	if (typeof( window[b.id + 'menu'] ) != 'undefined') { openMenu(b.id + 'menu'); }
}

function itemOff(b) {
	b.className = (b.className.indexOf("on") == b.className.length -2) ? b.className.substr(0, b.className.length -2) : b.className + "on" ;	
	if (theMenu != 'none') {
		clearTimeout(timeoutID);
		timeoutID = setTimeout('closeMenu("' + theMenu + '")', 5000);
	}
}

function showMenu (x) {
	box = (document.all) ? document.all(x) : (document.getElementById) ? document.getElementById(x) : document.layers[x];
	box.className = 'menu';
}

function hideMenu (x) {
	box = (document.all) ? document.all(x) : (document.getElementById) ? document.getElementById(x) : document.layers[x];
	box.className = 'hide';
}

function setClass (b,c) {
	box = (document.all) ? document.all(b) : (document.getElementById) ? document.getElementById(b) : document.layers[b];
	box.className = c;
}
