var isIE5 = 0;
if (navigator.appVersion.indexOf("MSIE 5.5")==-1 && navigator.appVersion.indexOf("MSIE 6")==-1 && navigator.appVersion.indexOf("MSIE 7")==-1 ){
	isIE5 =1 
}

function top(iid,ileft,Lnum) 
{	var dix;
	if(document.all) {
		if (isIE5) {
			dix='<div dir=rtl id="'+iid+'" name="'+iid+'" style="position:absolute;border: 0px solid black;z-index:110;'
			if(document.body.clientWidth<760){
			  ileft=(760-((760-690)/2)-ileft)
			}else{
			 ileft=document.body.clientWidth-((document.body.clientWidth-690)/2)-ileft
			}
			dix+='top:'+(menuFromTop)+';left:'+ileft+';width:'+menuWidth+';height:'+(Lnum*25+5)+';visibility:hidden;z-index:120;">'
			document.body.attachEvent('onclick',hide_all_menu)
		} else {
			dix='<div dir=rtl id="'+iid+'" name="'+iid+'" onmouseout=init_hide("'+iid+'");init_outTD() onmouseover=init_overTD() style="position:absolute;border: 0px solid black;z-index:110;'
			dix+='top:'+(menuFromTop)+';left:'+ileft+';width:'+menuWidth+';height:'+(Lnum*25+5)+';visibility:hidden;clip:rect(0,'+menuWidth+',0,0);z-index:120;">'
		}
	}
	dix+='<table style="border-bottom:1px solid #ffffff;" width="'+menuWidth+'"'
	dix+=' border="0" cellspacing="0" cellpadding="0">'
	document.write(dix);
}

function line(Llink,Ltxt){
	document.write('<tr><td align="center" height="25" onclick=location.href="'+Llink+'" bgcolor="#FF6500" onmouseover=this.bgColor="#C95000" onmouseout=this.bgColor="#FF6500" style="cursor:hand;border-top:1px solid #ffffff;"><span class="text_submenu">'+Ltxt+'</span></td></tr>');
}

function bottom() {
	if (document.all) {document.write('</table></div>')};
}		
function hide_all_menu () {
	init_hide('case1')
	init_hide('case2')
}
// initiating menu		
function menu(Mid,ileft) {
	top(Mid,ileft,((arguments.length-2)/2)+5);
	for (i=0;i<(arguments.length-2);i+=2) {	
		line(arguments[i+3],arguments[i+2]);	
		}
		bottom();
}
var upp = new Array;var up = new Array;var down = new Array;var last = 0;var zIdx = 1;var z;var MenuID_BGtemp = "";var MenuID_temp;

function init_overTD(){
	MenuID_temp.style.fontWeight='bold';
	MenuID_BGtemp = MenuID_temp.style.backgroundImage;	MenuID_temp.style.backgroundImage='url(images/menu_but_over_bg.gif)';}function init_outTD(){
	MenuID_temp.style.fontWeight='normal';	MenuID_temp.style.backgroundImage=MenuID_BGtemp;}
function init_show(Lid,MenuID){
	divTop = event.srcElement.getBoundingClientRect().top + 23 + document.body.scrollTop
	divLeft = event.srcElement.getBoundingClientRect().left + 14 + document.body.scrollLeft
	if(Lid == 'case1') {
		divTop--;
		divLeft = divLeft - 13;
	}

	if (isIE5){
		last = Lid;	lay = eval(Lid);lay.style.Zindex = ++zIdx;
		lay.style.top = divTop
		lay.style.left = divLeft
		lay.style.visibility = "visible";
		lay.style.display = "inline";
		return
	}
	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.top = divTop
		lay.style.left = divLeft
		lay.style.visibility = "visible";
		show(Lid);
	}
	if (MenuID)
	{		MenuID_BGtemp = MenuID.style.backgroundImage;		MenuID.style.backgroundImage='url(images/menu_but_over_bg.gif)';
		MenuID_temp=MenuID;		MenuID.style.fontWeight='bold';
			}
}
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);
		}
	}
}
function init_hide(Lid,MenuID) {				
	if (document.all) { 
		lay1 = eval(Lid);
		if (isIE5){
			lay1.style.Zindex = ++zIdx;lay1.style.visibility = "hidden";lay1.style.display = "none";return
		}
		if(!lay1.contains(event.toElement)){
			clearTimeout(z);hide(Lid);	
		}
	}
	if (MenuID)
	{		MenuID.style.fontWeight='normal';		MenuID.style.backgroundImage=MenuID_BGtemp;	}
}
function hide(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+'")',10);			
		} else {
			clearTimeout(y);
		}
	}
}