	function getClientWidth()
	{
	  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	}
	
	function getClientHeight()
	{
	  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
	}    
    
    function absPosition(obj) {
      var x = y = 0;
      while(obj) {
            x += obj.offsetLeft;
            y += obj.offsetTop;
            obj = obj.offsetParent;
      }
      return {x:x, y:y};
	}

	var tm,curlev,all_levels=10,pOut;

	function menuOver(pId) {
		if (tm) clearTimeout(tm);

		var overId = new Array; 
		$('.over').each(function(){
			$(this).attr('className');
			overId.push($(this).attr('id')); 
		});

		var overlevel = pOut+"";
		overlevel = overlevel.replace(/.*_l/,"");		
		
		var obj = document.getElementById(pId);
		var mid = pId.substr(1,pId.length);
		var level = mid;  
		level = level.replace(/.*_l/,"");		

		var itemlevel, itemCName;
		for(var i=0; i<overId.length; i++) {
			itemlevel = $('#'+overId[i]).attr('id')+"";
			itemlevel = itemlevel.replace(/.*_l/,"");
			if(overlevel <= itemlevel || level==itemlevel) {
				itemCName = $('#'+overId[i]).attr('className')+'';
				itemCName = itemCName.replace(/\sover.*/,"");
				$('#'+overId[i]).attr('className',itemCName);
			}
		}

		if(level > overlevel) {
			var cName = $('#'+pOut).attr('className');
			cName =  cName+'';
			cName = cName.replace(/\sover.*/,"");
			$('#'+pOut).attr('className',cName+' over');
		}
		
		mid = mid.replace(/_l.*/,"");
		
		var nobj = document.getElementById('m'+mid);
	
		
		var pos = absPosition(obj);
		var my,mx;
		if(level == 1) {
			my = pos.y + obj.offsetHeight;  
			mx = pos.x;
		} else {
			my = pos.y;  
			if(nobj){
				$(nobj).show();
				var width = nobj.offsetWidth;
				$(nobj).hide();
				if(document.body.clientWidth < (pos.x + obj.offsetWidth + width)) {
					mx = pos.x - width+10;
					my += 7;
 				} else {
					mx = pos.x + obj.offsetWidth;
				}
			}		
		}
		level = parseInt(level)+1;				
		for(i=level;i<all_levels;i++){
			$('div.menu.l'+i).hide();
		}						
		$('#m'+mid).css({top: my+"px", left: mx+"px"});
		$('#m'+mid).show();
		curlev = level;
	}
	
	function menuOut(pId) {
		pOut = pId;
		if (tm)
			clearTimeout(tm);
		tm=setTimeout("realMenuOut()", 500);
	}
	
	function realMenuOut() {
		$('div.menu.l1').hide();
		$('div.menu.l2').hide();
		$('div.menu.l3').hide();
		$('div.menu.l4').hide();
		$('div.menu.l5').hide();
		$('div.menu.l6').hide();
		$('div.menu.l7').hide();
		$('div.menu.l8').hide();
		$('div.menu.l9').hide();
		$('div.menu.l10').hide();
		$('div.menuline a.over').attr('className','');
		
		var cName;
		$('.over').each(function(){
			cName = $(this).attr('className');
			cName = cName.replace(/\sover.*/,"");
			$(this).attr('className',cName);
		});

		pOut = null;
	}
