var javaContextPath = "";
var leftOffset = 5;
var topOffset = 85;
var menuWidth = 155;
backColor   = "#003466"
activeColor = "#5AB227"
browserScript = 1;


var timerArray, aDivs, subs, gMenuIsDown=false, isInited = false;



window.onload = init; 

function init()

{

var numMenus = document.all.menuHead.length



document.menus = new Array(numMenus)



timerArray = new Array(numMenus)

aDivs = new Array(numMenus)

subs = new Array(numMenus)



isInited = true

}



function hideMenus(id)

{

for(var i=0; i<document.menus.length; i++)

 {

 if( ( document.menus[i] != null ) && ( id != i ) )

  {

  hideSubs(i)

  menuUp(i)

  }

 }

}



function doOuterLayerOver() {  hideMenus() }



function Menu(id)

{

timerArray[id] = 0

this.height = document.all.meniuri[id].children[0].children[0].offsetHeight



aDivs[id] = document.all.meniuri[id].all.item("a")

subs[id] = document.all.meniuri[id].all.item("sub")



for( var k=0; k<aDivs[id].length; k++) { aDivs[id][k].style.pixelTop = -this.height+ 35 }

for( var k=0; k<subs[id].length; k++)  { subs[id][k].style.pixelLeft = menuWidth }


var menuCorrections = new Array (-10, -20, -10, -10, -10, -10);
document.all.meniuri[id].style.pixelLeft = document.all.menuHead[id].parentElement.offsetLeft + eval(document.body.leftMargin) + leftOffset + menuCorrections[id];

document.all.meniuri[id].style.visibility = "visible"

}



function menuDown(id)

{

if( isInited )

 {

 if( document.menus[id] == null ) document.menus[id] = new Menu(id) 



 if( timerArray[id] != null )

  {

  hideMenus(id) 



  if( timerArray[id] == 0 )

   {

   clearInterval(timerArray[id])

   timerArray[id] = setInterval("slideDown("+ id +")", 5)

   }

  }

 }

}



function slideDown(id)

{

var offset = Math.floor((topOffset-aDivs[id][0].style.pixelTop)/6 + 1)



for(var j=0; j<aDivs[id].length;j++)

 aDivs[id][j].style.pixelTop += offset



if( document.all.meniuri[id].children[0].style.pixelTop >= topOffset)

 {

 for(j=0; j<aDivs[id].length; j++)

  aDivs[id][j].style.pixelTop = topOffset

  clearInterval( timerArray[id] );

  if (imC===false) document.all.outerLayer.style.visibility = "visible"
  
  gMenuIsDown = true

 }

}



function slideUp(id)

{

gMenuIsDown = false



for(var j=0; j<aDivs[id].length; j++)

 aDivs[id][j].style.pixelTop -= 40



if( document.all.meniuri[id].children[0].style.pixelTop < -(document.menus[id].height-35))

 {

 document.all.outerLayer.style.visibility = "hidden"

 clearInterval( timerArray[id] )

 timerArray[id] = 0

 }

}



var theNum

function tdOver(id)
{

if(imC!==false) {
	document.all.outerLayer.style.visibility = "visible"
	imC = false
}

if( id != null )

 hideSubs(id)

var theTable = window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].children[0]

theNum = window.event.srcElement.parentElement.rowIndex

theTable.storedBg = theTable.rows[theNum].cells[0].bgColor

theTable.rows[theNum].cells[0].bgColor = activeColor


if( window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[2] && window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[2].children.triangle )

 window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[2].children.triangle.src = "img/sageata.gif"



if( id != null )

 showSub(id)

}




function tdOut(id)

{

var theTable = window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].children[0]



window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[1].style.color = "white"



if( window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[2] && window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[2].children.triangle )

 window.event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[1].children[0].rows[theNum].cells[2].children.triangle.src = "img/sageata.gif"





theTable.rows[theNum].cells[0].bgColor = theTable.storedBg

}





function menuUp(id)

{

if( timerArray[id] != 0 )

 {

 document.all.outerLayer.style.visibility = "hidden"



 clearInterval(timerArray[id])

 timerArray[id] = setInterval("slideUp("+ id +")", 1)

 }

}



function hideSubs(id)

{

for(var j=0; j<subs[id].length;j++)

 {

 if(subs[id][j].style.visibility == "visible") subs[id][j].style.visibility = "hidden"

 }

}





function showSub(id)

{

if( ( subs[id][theNum] != null ) && ( gMenuIsDown ) )

 {

 subs[id][theNum].style.pixelTop = theNum*20 + topOffset

 subs[id][theNum].style.visibility = "visible"

 }

}



function doClick(url)

{

location.href = url

}

theHTML = ""

function cache(str)

{

theHTML += str

theHTML += "\n"

}



function cache_flush()

{

document.write(theHTML)
//prompt("Codul: ",theHTML);
theHTML = ""

}



menuNum = -1

function startMenu()

{

menuNum ++;

backArray = new Array()

textArray = new Array()



cache("<div id='meniuri' style='position:absolute; top:0; visibility:hidden; z-index:1024;'>")

}



function addMenuItem(text, url, sub)

{

backArray[backArray.length] = "<tr><td height=20 bgcolor="+backColor+" valign=\"bottom\"><img src='img/pxalb.gif' height='1' width="+(menuWidth-1)+" hspace='0' vspace='0' border='0' align='bottom' alt=''></td></tr>"

str = "<tr><td width=5></td><td height=20 style='font-family:Verdana, Arial; font-size:10px; color:white; font-weight:bold; cursor:hand' onclick=doClick('"+url+"') onmouseover=tdOver("+menuNum+") onmouseout=tdOut("+menuNum+")>"+text+"</td><td width=10 valign='middle'>"

if( sub )

 str += "<img src='img/sageata.gif' name=triangle>"

str += "</td></tr>"

textArray[textArray.length] = str

}



function emptySub()

{

cache("<div id=sub></div>")

}



function startSub()

{

sbackArray = new Array()

stextArray = new Array()

}



function addSubItem(text, url)

{

sbackArray[sbackArray.length] = "<tr><td height=20 bgcolor="+backColor+" valign=\"bottom\"><img src='img/pxalb.gif' height='1' width="+(menuWidth-1)+" hspace='0' vspace='0' border='0' align='bottom' alt=''></td></tr>"

stextArray[stextArray.length] = "<tr><td width=5></td><td height=20 style='font-family:Verdana, Arial; font-size:10px; color:white; font-weight:bold; cursor:hand' onclick=doClick('"+url+"') onmouseover=tdOver() onmouseout=tdOut()>"+text+"</td><td>"

}



function endSub()

{

cache("<div id=sub style='position:absolute; visibility:hidden; z-index:1025'>")

cache("<div id=b style='position:absolute'>")

cache("<table cellpadding=0 cellspacing=0 border=0 width=" + menuWidth + " id=backTable style='filter:alpha(opacity:80)'>")

for( var i=0; i<sbackArray.length; i++ )

 cache(sbackArray[i] )

cache("</table></div>")



cache("<div id=b style='position:absolute'>")

cache("<table cellpadding=0 cellspacing=0 border=0 width=" + menuWidth + ">")

for( var i=0; i<stextArray.length; i++ )

 cache(stextArray[i] )

cache("</table></div>")



cache("</div>")

}



function writeMenu()

{

cache("<div id=a style='position:absolute'>")

cache("<table cellpadding=0 cellspacing=0 border=0 width="+menuWidth+" id=backTable bgcolor="+backColor+" style='filter:alpha(opacity:80)'>")

for( var i=0; i<backArray.length; i++ )

 cache(backArray[i] )

cache("</table></div>")



cache("<div id=a style='position:absolute'>")

cache("<table cellpadding=0 cellspacing=0 border=0 width="+menuWidth+">")

for( var i=0; i<textArray.length; i++ )

 cache(textArray[i])

cache("</table></div>")

}



function writeOuterDiv()

{

document.write( "<div id=outerLayer style='position:absolute; top: 0; left:20; width:680; height:620; visibility:hidden; background-color:' onmouseover=doOuterLayerOver()></div>" )

}



function endMenu()

{

cache("</div>")

cache_flush()

}

var imC=false;

function imclick(id){
	if (imC!==id) {
		imC = id;
		menuDown(id);
	} else {
		imC = false;
		menuUp(id);
	}
}


window.onerror = handle;
function handle(){
	//return true;
}