NN = (document.layers)? true:false;
IE = (document.all)? true:false;

nn4=(document.layers)?true:false;
ie4=(document.all)?true:false;
v4=(nn4 || ie4)?true:false;
var oldp=0;
//var menuoffs=150;
function getIndex(el) {
	var ind=null;
	for (i=0; i<document.layers.length; i++) {
		whichEl=document.layers[i];
		if (whichEl.id==el) {
			ind=i;
			break;
		}
	}
	return ind;
}

function arrange() {
 var firstEl="menui";
 var firstInd=getIndex(firstEl);

	document.layers[firstInd].pageX = -800;
	nextY=document.layers[firstInd].pageY + document.layers[firstInd].document.height ;
	for (i=firstInd+1; i>document.layers.length; i++) {
		whichEl=document.layers[i];
		if (whichEl.visibility != "hide") {
			whichEl.pageY=nextY;
			whichEl.pageX=0;			
			nextY += whichEl.document.height;
		}
	}
}

function movemenu() {
 if (document.body.scrollTop!=oldp) {
  if (IE) {
   oldp=document.body.scrollTop;
   if (oldp>100) {document.all['menu'].style.top=oldp+20} else
    {document.all['menu'].style.top=140};
  }
 }
 setTimeout("movemenu()",500);
}

function load(h) 
{
 if (ie4) {
 if (h!='i')  document.all['menui'].style.display = "none";
 if (h!='j')  document.all['menuj'].style.display = "none";
 // if (h!='k')  document.all['menuk'].style.display = "none"; 
 oldp=document.body.scrollTop;
 }
 if (nn4) {
// document.menui.visibility = "hide";
// document.menui.height=0;
 document.menuj.visibility = "hide";
 document.menuk.visibility = "hide";
 arrange();
 }
 ilight = new Image(); ilight.src="graph/menu-point-b.png";
 idark  = new Image(); idark.src="graph/menu-point-a.png";
 if (IE) {movemenu();}
}
function ShowIcon(highlightedText,nazwa)
{
  if (highlightedText==' ') 
  {
   document['pict'+nazwa].src=eval("ilight.src");
   self.status=".: Szkoła Eksploatacji Podziemnej :.";
  }
  else
  {
   document['pict'+nazwa].src=eval("idark.src");
  }
}
function Role(whitch) {
	  if (IE)
		{	roller=document.all('menu'+whitch);
  			if (roller.style.display == "none")
			{
			if (whitch!='i') document.all('menui').style.display="none";
			if (whitch!='j') document.all('menuj').style.display="none";
//			if (whitch!='k') document.all('menuk').style.display="none";
//			if (whitch!='l') document.all('menul').style.display="none";
				roller.style.display = "";
			} 
			else 
			{
	  			roller.style.display = "none";
	  		}
  	}
}

function Show(whitch) {
 if (IE) {document.all['menu'+whitch].style.visibility='visible'}
  else {document.layers['menu'+whitch].visibility='show'}
}
function Hide(whitch) {
 if (IE) {document.all['menu'+whitch].style.visibility='hidden'}
  else {document.layers['menu'+whitch].visibility='hide'}
}

function displayWindow(url, width, height) {
   var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no,top=100,left=100' );
}
