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 SetVis(t,vis) {
	var tl;
	tl=(document.layers) ? t:t.style; 
	tl.visibility= vis ? "visible":"hidden";

}
function MenuSet(){ 
 //set the image over and down name convention
 document.Menu_Over="_over";
// document.Menu_Down="_down";
 var dt=false;
 if(document.getElementsByTagName){
 	dt=true;
 }
 numItems=2;
 if(document.Menu_Bar){return;}
 var i,k=-1,g,gg,tl,ts,ti,tm,tt,tsn;
 
 Menu_IM=new Array();
 Menu_SB=new Array();
 if(dt){
 	tm=document.getElementsByTagName("IMG");
 }else{
 	tm=document.images;
 }
 tm=document.images;
 tt=new Array();
 tt=tt.concat(tm);

 for(i=0;i<tm.length;i++) {
 	tl=tm[i].name;
 	if(dt&&!tl){tl=tm[i].id;}
 	if(tl && tl.indexOf("menuim")==0){
 		ts=tl.replace("menuim","");
 		tsn="menusub"+ts;
 		k++;
 		Menu_IM[k]=tl;
 		
 		g=MM_findObj(tsn);	
 		SetVis(g,false);
 		
 	}
 }

 document.menu_swapo=new Array();
 for(i=0;i<Menu_IM.length;i++){
 	g=MM_findObj(Menu_IM[i]);
 	it="../images/item"+(i+1);
 	gg=it+".gif";
 	g.menuim=gg;
 	g.menuimo=it+"_over.gif";
 	document.menu_swapo[i]=new Image();
 	document.menu_swapo[i].src=g.menuimo;
 }

 if((g=MM_findObj('Menu_H'))!=null) {
 	SetVis(g,false);
 }

 document.Menu_Bar=true;
}

function MenuOver(theButton){ 
// Called when  mouse rollover a button
	var i,g,d,tF=false;
 	for(i=0;i<numItems;i++){
  		g=MM_findObj("menusub"+(i+1)+"0");
  		d=MM_findObj(Menu_IM[i]);
  		if(Menu_IM[i]==theButton) {
 			tF=true;
 			SetVis(g,true);
  			d.src=d.menuimo;
  			if((g=MM_findObj('Menu_H'))!=null)	SetVis(g,true);
 			
 		} else {
 			SetVis(g,false);
 			d.src=d.menuim;
 		}
 	}
 	
}
function MenuOut(){ 
// Called when  mouse roll over the hidden layer
	var i,g,d;	
 	for(i=0;i<numItems;i++){
 		g=MM_findObj("menusub"+(i+1)+"0");
 		d=MM_findObj(Menu_IM[i]);
 		
 		
 		SetVis(g,false);
 		d.src=d.menuim; 		
 	} 		
 	if((g=MM_findObj('Menu_H'))!=null) SetVis(g,false); 	
}
