function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) {
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}




var onmenu = 0;

function on() {onmenu=1; }

function off(name) { onmenu=0; timerID = setTimeout('hidedivs("'+name+'")', 5);}


function countThem(slf)
{
cnt=0;
z=document.getElementsByTagName('div');
for (i=0;i<z.length;i++)
{
cnt=(z[i].id.substring(0,5) == slf) ? cnt+1 : cnt;
}

return(cnt);
}


function show_menu(w,slf) {
	new_name = slf.id;
	//start = event.screenY - event.y -15 ;
	if (w.clientY!=null && w.offsetY!=null) { 
		start = w.clientY - w.offsetY + document.body.scrollTop +11;
	} else {
		start= w.pageY-w.layerY+15;
	}
	onmenu=1;	
	
	for(x=1;x<=countThem(slf.id)-1;x++)  {
		
		 DIV_name = slf.id+x;
		 MM_showHideLayers(DIV_name,'','show');
		 document.getElementById(DIV_name).style.top =  start;
		 start += 14;
	}
	MM_changeProp(slf.id,'','style.backgroundColor','#2E4359','DIV');	
}

function hidedivs(name) {
if(onmenu==1 && name!=new_name)  {
	 for(y=1;y<=countThem(name)-1;y++) {
	      	DIV_name = name+y;	      	
	      	MM_showHideLayers(DIV_name,'','hide');
	       }
	 MM_changeProp(name,'','style.backgroundColor','#2E4359','DIV');
}

if (onmenu==0) {
	      for(y=1;y<=countThem(name)-1;y++) {
	      	DIV_name = name+y;	      	
	      	MM_showHideLayers(DIV_name,'','hide');
	       }
	 MM_changeProp(name,'','style.backgroundColor','#2E4359','DIV');
}
clearTimeout(timerID);
}


