//parameters

menuWidth = 130;
menuFromTop = 48;
textClass = 'text12nav';
color = '#D9EADD';


// creating layers - top, line, bottom, data, menu
// change table in accordance to needs

function top(iid,ileft,Lnum) 
{
var dynLeft = ((document.body.clientWidth - 780)/2);
if (document.body.clientWidth < 780){
dynLeft = 0;
}
	var dix;
		dix='<div id="'+iid+'" name="'+iid+'" onmouseout=init_hide("'+iid+'") style="position:absolute;border: 0px solid black;'
		dix+='top:'+menuFromTop+';left:'+(ileft+dynLeft)+';width:'+menuWidth+';height:'+(Lnum*25+5)+';visibility:hidden;clip:rect(0,'+menuWidth+',0,0);z-index:1;">'	
		dix+='<img src="images/pix.gif" width="10" height="17" border="0" alt=""><br><table cellpadding="0" cellspacing="0" style="border:1px solid black;"><tr><td><table width="'+menuWidth+'"'
		dix+=' border="0" cellspacing="0" cellpadding="0">'	
		dix+='<tr><td bgcolor="'+color+'"><img src="images/pix.gif" width="10" height="3" border="0" alt=""></td>'
		dix+='<Td bgcolor="'+color+'" rowspan="'+Lnum+'" width="4"><img src="images/pix.gif" width="4" height="2" border="0" alt=""></td></tr>'
	
	document.write(dix);
	
	}
	
function line(Llink,Ltxt)
 {

	document.write('<tr><td bgcolor="'+color+'" align="right" height="15"><a href="'+Llink+'" class="text">&nbsp;'+Ltxt+'</a></td></tr>');
	
 }

function bottom() 
{document.write('<tr bgcolor="'+color+'"><Td colspan="2><img src="images/pix.gif" width="4" height="5" border="0" alt=""></td></tr></table></td></tr></table></div>')};
	
// for positioning in middle of page
	
function center(Mid) {			
			var cW=document.body.clientWidth;
			alert(cW);		
			lft=((cW-640)/2);
			if (document.body.clientWidth<780) lft=16;		
}
		
// initiating menu
	
function menu(Mid,ileft) {
//var dynLeft = ((document.body.clientWidth - 780)/2 + ileft);	
//alert (dynLeft);
top(Mid,ileft,((arguments.length-2)/2)+2);	
	for (i=0;i<(arguments.length-2);i+=2) {		
		line(arguments[i+3],arguments[i+2]);		
		}			
	bottom();				
	}


	
// creating actions - 
	
var upp = new Array;
var up = new Array;
var down = new Array;
var last = 0;
var zIdx = 1;
var z;

function init_show(Lid) {
	
if (last != 0 ) {
	if (last != Lid ) {
		init_hide(last);
		}
	}
	last = Lid;	
	lay = eval(Lid);
	down[Lid]=0;

	lay.style.Zindex = ++zIdx;
	lay.style.visibility = "visible";
	show(Lid);
}
	
function show(Lid) {
	lay = eval(Lid);
	if (down[Lid] <= parseInt(lay.style.height)) {

				eval('lay.style.clip = "rect(0px '+menuWidth+'px '+down[Lid]+'px 0px)"');
				down[Lid]+=10;
					
				z=setTimeout('show("'+Lid+'")',30);	

					}				
		else        {
				clearTimeout(z);
					}

	
}

		
function init_hide(Lid) {	
		lay1 = eval(Lid);
		
		
		if(!lay1.contains(event.toElement))
		{
			clearTimeout(z);
			hide(Lid);	
		}
	
}

function hide(Lid) {
	var y;
	lay1 = eval(Lid);
	
	upp[Lid] = lay1.style.clip.split(" ");
	up[Lid] = parseInt(upp[Lid][2]);
	
	if (up[Lid] > 0) {
			
			up[Lid] = up[Lid]-10;
			eval('lay1.style.clip = "rect(0px '+menuWidth+'px '+ up[Lid] +'px 0px)"');
			y=setTimeout('hide("'+Lid+'")',30);				
			}			
		else {		
		clearTimeout(y);		
		}	
}




  
