edu=window.edu||{};edu.DropDown=new function(){var A={};var B;var E=null;this.create=function(G,H,F){F=F||{};F.width=F.width||"150px";A[G]={name:G,data:H,params:F,element:null,activeElement:null}};this.remove=function(F){delete A[F]};this.show=function(F,H){var G=$(H).offset();$(H).addClass("activeMenu");A[F].activeElement=H;this.showAt(F,G.left,G.top+$(H).outerHeight())};this.showAt=function(F,J,G){if(!B){D()}var I=A[F].element||C(F);I.css("left",J).css("top",G).css("z-index",1000).slideDown("fast");if(E){this.hide()}var H=function(K){if(K.target.nodeName=="SELECT"||K.target.nodeName=="INPUT"){$(document).one("click",K.data,H);return}else{K.data.hide()}};$(document).one("click",this,H);E=F;if(A[E].params["onMenuShow"]){A[E].params["onMenuShow"](E)}};this.hide=function(){if(E){$(A[E].element).fadeOut("fast").css("z-index",0);if(A[E].params["onMenuHide"]){A[E].params["onMenuHide"](E)}if(A[E].activeElement){$(A[E].activeElement).removeClass("activeMenu");A[E].activeElement=null}E=null}};this.attachGroup=function(F,H,G){G=G||"main";A[H].group=G;if(A[H].data.length!=0){$(F).bind("click",this,function(I){if(E!=H){I.data.show(H,F);return false}})}$(F).bind("mouseenter",this,function(I){if((E)&&(E!=H)&&(A[E].group==G)){I.data.show(H,F)}})};function D(){B=$("<div></div>").css("position","absolute").css("top","0px").css("left","0px").appendTo(document.body).click(function(I){if(E){var G=$(I.target);var F=0;while(typeof(G.data("dropDownIndex"))=="undefined"){if(F++>10){return}G=$(G.parent().get(0));if(G.data("dropDown")){return true}}var H=G.data("dropDownIndex");if(A[E].params["onItemClick"]){A[E].params["onItemClick"](A[E].data[H],H)}}})}function C(F){var K=A[F].data;var I=$("<div>").css("width",A[F].params["width"]).css("position","absolute").addClass("DropDownMenu").data("dropDownMenu",F).appendTo(B).hide();for(var H=0;(H<K.length);H++){var G=$("<a></a>");if(typeof(K[H])=="string"){G.text(K[H])}else{for(var J in K[H]){if(J=="element"){$(K[H][J]).appendTo(G)}else{if(J=="css"){$.each(K[H][J],function(L,M){G.css(L,M)})}else{if(J=="text"){G.text(K[H][J])}else{if(J=="click"){G.click(K[H][J])}else{G.attr(J,K[H][J])}}}}}}G.addClass("DropDownMenuItem").data("dropDownIndex",H).appendTo(I)}if(K.length==0){I.css({"height":"0px","border":"0"})}A[F].element=I;return I}};