$(function() { var $el, topPos, newHeight, $mainNav = $("#leftmenu"); $mainNav.append("
  • "); var $magicLine = $("#magic-line"); if ($("a[id^=leftNavi]").hasClass("hover")) { $("#magic-line").css("display", "block"); $magicLine.css("top", $(".hover").position().top).data("origTop", $magicLine.position().top).data("origHeight", $magicLine.height()) } }); function lineControl() { var depId = this.id; var depClass = depId.substr(0, 8); var depNum = depId.substr(8, 9); if (depClass == "leftNavi") { var $magicLine = $("#magic-line"); $magicLine.stop().animate({ top: $magicLine.data("origTop") }) } else if (depClass == "leftSubm") { var $magicLine = $("#magic-line"); $magicLine.stop().animate({ top: $magicLine.data("origTop") }) } } function depthLeft2Search(dep1, dep2) { depthLeft2HideAll(); var depId = dep1; var dep2Id = dep2 - 1; if (dep1 != 0) { $("#leftNavi" + depId).addClass("hover") } } function depthLeft2HideAll(d1n) { $("a[id^=leftNavi]").each(function() { $(this).removeClass("hover"); $(this).siblings("div").children().children("ul").css("display", "none"); $("#leftbg").stop().animate({ "left": "0" }); $(".hiddenBg").stop().animate({ "margin-left": "-185px" }); $("#magic-line").css("display", "none") }) } function depthLeft2View() { var depId = this.id; var depClass = depId.substr(0, 8); var depNum = depId.substr(8, 9); depthLeft2HideAll(); if (depClass == "leftNavi") { targetDiv = $(this); targetDiv.addClass("hover").siblings("div").children().children("ul").css("display", "block"); $("#leftbg").stop().animate({ "left": "175px" }); $(".hiddenBg").stop().animate({ "margin-left": "0" }, 400); var $magicLine = $("#magic-line"); $el = $(this); topPos = $el.position().top; $magicLine.stop().animate({ top: topPos }) } else if (depClass == "leftSubm") { targetDiv = $(this).parent().parent().siblings("a"); targetDiv.addClass("hover").siblings("div").children().children("ul").css("display", "block"); $("#leftbg").stop().animate({ "left": "175px" }); $(".hiddenBg").stop().animate({ "margin-left": "0" }, 400); var $magicLine = $("#magic-line"); $el = $(this).parent().parent().siblings("a"); topPos = $el.position().top; $magicLine.stop().animate({ top: topPos }) } $("#magic-line").css("display", "block") } function initLeftMenu(dep1, dep2) { if (dep1 != 0) { depthLeft2Search(dep1, dep2) } $("a[id^=leftNavi]").each(function() { $(this).mouseover(depthLeft2View).focus(depthLeft2View).mouseout(lineControl).mouseout(function() { depthLeft2Search(dep1, dep2) }) }); $("ul[id^=leftSubm]").each(function() { $(this).mouseover(depthLeft2View).focus(depthLeft2View).mouseout(lineControl).mouseout(function() { depthLeft2Search(dep1, dep2) }) }) }