//parameters
var State;
var opened = 0;
function showOver(me){			
		document.getElementById("menu"+me).className = 'navA';		
	}
	
function showOut(me){
	if (me==opened && me != 0){
	document.getElementById("menu"+me).className = 'navA';
	} else {
	document.getElementById("menu"+me).className = 'nav';
	}
	
}

function ChangeImg(N_Img,State){
			var myImg = N_Img;			
				
			var N_Img=document.getElementById(N_Img);				
			if(N_Img!=null){
				if (State==1)
				{		
					N_Img.src=N_Img.src.replace("off","over");
				}
				else {											
					N_Img.src=N_Img.src.replace("over","off");
				}			
			}
		}

menuWidth = 120;
menuFromTop = 0;
textClass = 'bgTD-menu';
color = '#622C91';

// creating layers - top, line, bottom, data, menu
// change table in accordance to needs

function top(iid,ileft,Lnum) 
{
	var dix;
	
	
		dix='<div id="'+iid+'" name="'+iid+'" onmouseout=init_hide("'+iid+'") style="position:absolute;'
		dix+='top:'+menuFromTop+';left:'+ileft+';width:'+menuWidth+';height:'+(Lnum*25+5)+';visibility:hidden;clip:rect(0,'+menuWidth+',0,0);z-index:1;">'
		dix+='<table width="'+menuWidth+'"border="0" cellspacing="0" cellpadding="0" style="padding:2px;">'
		document.write(dix);
	
	}
	
function line(Llink,Ltxt)
 {

	document.write('<tr><td bgcolor="'+color+'" height="15" class=nav onMouseOver=this.className="navA" onMouseOut=this.className="nav" onClick=document.location="'+Llink+'">'+Ltxt+'</td></tr>');
	
 }

function bottom() 
{

	if (document.all) {document.write('</table></div>')};
	if (document.layers) {document.write('</table></layer>')};
	
}
	

// for positioning in middle of page
	
function center(Mid) {
	
	if (document.layers) {
	
		lft=((innerWidth-650)/2)-64;
		
		}
		
	if (document.all) {

			
			lft=((cW-780)/2);
			if (document.body.clientWidth<780) lft=16;
		}
}
		
// initiating menu
			
function menu(Mid,ileft) {
	
	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 = 100;
var z;

function init_show(Lid) {
	//alert(last)
if (last != 0 ) {if (last != Lid ) {
	init_hide(last);
		}
	
	}	

	
if (document.all) {

	last = Lid;	
	lay = eval(Lid);
	down[Lid]=0;

		lay.style.Zindex = zIdx;
		lay.style.visibility = "visible";
		show(Lid);

	} 

else if (document.layers) {

	last = Lid;
	lay=eval('document.layers.'+Lid);
	down[Lid]=0;
	lay.visibility = "show";
	

	}
	

}
	
function show(Lid) {

if (document.all) {

	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);
					}

	}
	
if (document.layers) {

	lay=eval('document.layers.'+Lid);
	if (down[Lid] <= 60) {
				
				lay.clip.bottom = down[Lid];
				down[Lid]+=10;
				
				z=setTimeout('show("'+Lid+'")',30);
				}
	else        {
				clearTimeout(z);
					}

	}
}

		
function init_hide(Lid) {
										
	if (document.all) 
	{ 
		lay1 = eval(Lid);		
		if(!lay1.contains(event.toElement))
		{
			clearTimeout(z);
			hide(Lid);		}
	}  

else if (document.layers) {
	
	lay=eval('document.layers.'+Lid);
	lay.visibility = "hide";
	down[Lid]=0;
	}
}

function hide(Lid) {
if (currentNav !=Lid)showOut(Lid)	
if (document.all) {
	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);
		
		}

	}
if (document.layers) {
	var y;
	lay1 = eval('document.layers.'+Lid);
	
	up[Lid] = lay.clip.bottom;	
	if (up[Lid] > 0) {			
			up[Lid] = up[Lid]-10;
			lay1.clip.bottom = up[Lid];
			y=setTimeout('hide("'+Lid+'")',30);				
			}			
		else {		
		clearTimeout(y);		
		}
	}
}

			




  
