function getElementPosition(elemId) { var elem = document.getElementById(elemId); var w = elem.offsetWidth; var h = elem.offsetHeight; var l = 0; var t = 0; while (elem) { l += elem.offsetLeft; t += elem.offsetTop; elem = elem.offsetParent; } return {"left":l, "top":t, "width": w, "height":h}; } function getElementPosition(obj) { var elem = obj; var w = elem.offsetWidth; var h = elem.offsetHeight; var l = 0; var t = 0; while (elem) { l += elem.offsetLeft; t += elem.offsetTop; elem = elem.offsetParent; } return {"left":l, "top":t, "width": w, "height":h}; } var dd_menu_offsetL=0; var dd_menu_offsetT=0; var dd_menu_opacity='0.93'; $(document).ready(function(){ $("ul.subnav").parent().append(""); $("div.bt_t").mouseover( function() { $(this).find("ul.subnav").css('width', $(this).find("ul.subnav").width()+'px') if($(this).find("ul.subnav").width()<159) $(this).find("ul.subnav").css('width', '159px'); pos=getElementPosition(this); vm=12+dd_menu_offsetT; var h=$(this).parent().find("div.empty").height(); //$(this).parent().find("div.empty").css("height", h); //$(this).parent().find("div.empty").css("width", ($(this).parent().width()-5)+'px'); //$(this).parent().find("div.empty").css("left", dd_menu_offsetL+pos.left+'px'); //$(this).parent().find("div.empty").css("top", (pos.top+vm)+'px'); //$(this).parent().find("ul.subnav").css("left", dd_menu_offsetL+pos.left+'px'); //$(this).parent().find("ul.subnav").css("top", (pos.top+vm+h)+'px'); $(this).parent().find("ul.subnav").slideDown('fast').show(); $(this).parent().find("ul.subnav").css("opacity", dd_menu_opacity); $(this).parent().hover(function(){ },function() { $(this).parent().find("ul.subnav").slideUp('slow'); }); } ).hover(function() {}); });