var topMenu=null;
var topMenuId=null;
var topMenuTimeOut=null;
var topMenuTop=null;
var prevtopMenuTop=null;
var prevtopMenu=null;
function showTopMenu(id,obj){
	var maxY=parseInt(jQuery("#header").width())+parseInt(jQuery("#header").offset().left);
	if (topMenuId!=id){
		if (prevtopMenu!=null){
			if (topMenuTimeOut!=null) window.clearTimeout(topMenuTimeOut);
			jQuery(prevtopMenuTop).css('color','#ffffff');
			var topMenu1=jQuery(prevtopMenu);
			topMenu1.fadeOut("fast");		
		}
		topMenuId=id;
		topMenu=jQuery('#'+id);
		if (jQuery('#'+id)&&topMenu){
			if (topMenu.parent()!=jQuery(document.body)){
				var t=topMenu.appendTo(jQuery(document.body));
				topMenu.mouseover(function(){
					if (topMenuTimeOut!=null) window.clearTimeout(topMenuTimeOut);
				});
				topMenu.mouseout(function(){
					if (topMenuTimeOut!=null) window.clearTimeout(topMenuTimeOut);
					topMenuOutStart(topMenuId);
				});
			}
			topMenu.css('position','absolute');
			topMenu.css('top',parseInt(jQuery(obj).offset().top+jQuery(obj).height())+5+'px');
			topMenu.css('left',(parseInt(jQuery(obj).offset().left)-23)+'px');
			if (maxY-parseInt(topMenu.width())-(parseInt(jQuery(obj).offset().left)-23)<0){
				topMenu.css('left',(maxY-parseInt(topMenu.width()))+'px');
			}
			prevtopMenu=topMenu;
			topMenu.slideDown("normal");
		}
		topMenuTop=obj;
		prevtopMenuTop=topMenuTop;
		jQuery(topMenuTop).css('color','#e0ac0c');
	}else
	if (topMenuId==id){
		window.clearTimeout(topMenuTimeOut);
	}
}

function topMenuOutStart(id){
	if (id==topMenuId){
		topMenuTimeOut=window.setTimeout("topMenuOutInit()",500)
	}
}

function topMenuOutInit(id){
		jQuery(topMenuTop).css('color','#ffffff');
		if (topMenuTimeOut!=null) {window.clearTimeout(topMenuTimeOut);}
		var topMenu1=jQuery('#'+topMenuId);
		topMenuId=null;
		topMenu=null;
		topMenu1.fadeOut("fast");
}
