function setDisplay(id, no)
{
if (no == 1) {
   id.style.display = 'block';
   } else {
   id.style.display = 'none';
   }  
}


var toBeClosed
var tm1
var tm0

function setNoteDisplay(cod, no)
{


idStr = 'theLonely' + cod
id2Str = 'theOtherLonely' + cod

id = document.getElementById(idStr)
id2 = document.getElementById(id2Str)
theTop = 400
theLeft = 200

theLeft = getAbsoluteLeft(id2Str) + 80
theTop = getAbsoluteTop(id2Str) + 1

if (no == 1) {
   
  tm1 = setTimeout("setDisplay(id, 1)", 100)
  clearTimeout(tm0)

   if (toBeClosed) {
      setDisplay(toBeClosed, 0)
   }  

   id.style.left = theLeft
   id.style.top = theTop
    id.style.display = 'block';

   } else {

   tm0 = setTimeout("setDisplay(id, 0)", 1000)
   toBeClosed = id

}	


}

function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	// Return left postion
	return oLeft
}

function getAbsoluteTop(objectId) {
	// Get an object top position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	// Return top position
	return oTop
}


function openWindow(file, w, h, scrollbar) {
NewWin=window.open(file,'NewWin', 'toolbar=no,status=no,scrollbars='+scrollbar+',width='+w+',height='+h+',left=100, top=0');
}

// sets the browser variables
if(document.getElementById){
	var ns6 = (document.all)?0:1;
}
var ns = (document.layers)?1:0;
var agt=navigator.userAgent.toLowerCase();
var mac=(agt.indexOf("mac")!=-1);

// lyrs
var lyrs = new Array(null,'computere', 'accesorii', 'prezentare', 'organizare', 'articole', 'instrumente', 'hartie', 'mobilier')
//pozitii verticale meniuri 
var lyrYPos = new Array(null,430,430,430,430,430,430,430,430);
var tmrLyrs = new Array();

var actNavi = null;
var act2ndLvl = null;
var tmrLyrs = new Array();


// seteaza stanga Meniului
var stanga;


function set_stanga() {


if (ns) {
	if (window.innerWidth>=780) {stanga=(window.innerWidth/2)-110;}
	else { stanga=600; }
} else {
	if (document.body.clientWidth>=780) {stanga=(document.body.clientWidth/2)-110;}
	else {stanga=600;}
}

return stanga;
}



function setPos(lyr,x,y){

	if(ns){
		if(x)eval("document."+lyr+".left = "+x);
		if(y)eval("document."+lyr+".top = "+y);
	} else if(ns6){
		if(x)eval("document.getElementById('"+lyr+"').style.left = "+x+"+\"px\"");
		if(y)eval("document.getElementById('"+lyr+"').style.top = "+y+"+\"px\"");
	} else if (document.all)
	{
		if(x)eval("document.all."+lyr+".style.left = "+x);
		if(y)eval("document.all."+lyr+".style.top = "+y);
	}
}

function setVis(lyr,vis){
	var sVis;
	if(ns){
		sVis = (vis)?'show':'hide';
		eval("document."+lyr+".style.Zindex = 0");
		eval("document."+lyr+".visibility = '"+sVis+"'");
	} else if(ns6){
		sVis = (vis)?'visible':'hidden';
		eval("document.getElementById('"+lyr+"').style.visibility = '"+sVis+"'");
	} else if(document.all) {
		sVis = (vis)?'visible':'hidden';
		eval("document.all."+lyr+".style.visibility = '"+sVis+"'");
	}
}

function keepAlive(sect){
	if(tmrLyrs[sect])clearTimeout(tmrLyrs[sect]);
	if(tmrLyrs[actNavi])clearTimeout(tmrLyrs[actNavi]);
}




function openNavi(sect){
	keepAlive(sect);
	if(actNavi&&actNavi!=sect){
		  setVis(lyrs[actNavi],0);
	}

   // sets the position of the layer
	setPos(lyrs[sect], set_stanga(), lyrYPos[sect]); 	 
	// sets the visibility to 1
	setVis(lyrs[sect],1);
	actNavi = sect;
}

function closeNavi(sect) {
tmrLyrs[sect] = setTimeout('setVis(lyrs['+sect+'],0)',100);
}


  function popitup(url, w, h) {
  if (!w) w = 800;
  if (!h) h = 600;
    newwindow=window.open(url,'name',' width= ' + w + ' , height= ' + h
+' ');
    if (window.focus) {newwindow.focus()}
    return false;
}
