function JMENU_findObj(n,d) {
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for(i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0; !x&&d.layers&&i<d.layers.length; i++) x=JMENU_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}
function JMENU_showHideLayers() {
	var v,i,obj,args=JMENU_showHideLayers.arguments;
	for(i=0; i<document.all.length; i++) {
		if(document.all[i].id && document.all[i].id.substring(0,10) == 'topsubmenu') {
			if((obj=JMENU_findObj(document.all[i].id)) != null) {
				if(obj.style) {
					obj = obj.style;
					v = 'hidden';
					obj.visibility = v;
				}
			}
		}
	}
	if((obj=JMENU_findObj(args[0])) != null) {
		v=args[1];
		if(obj.style) {
			obj=obj.style;
			v = (v=='show') ? 'visible' : (v=='hide') ? 'hidden' : v;
		}
		obj.visibility = v;

		set_position(args[0]);
	}
}

function set_position() {
	var i,p,p2,v,obj,args=set_position.arguments;
	if((obj=JMENU_findObj(args[0])) != null) {
		i=obj.offsetLeft;
		p=obj.offsetWidth;
		v=i+p;
		if(obj.style) {
			obj=obj.style;
		}
		if(v > 800) {
			p2 = document.body.clientWidth - 800;
			obj.right=p2+"px";
		}
	}
}

