var hoverTimeout=[];var showTimeout=[];var hideTimeout=[];var menus=[];function hideMenu(A){if($.browser.msie){menus[A].hide()}else{menus[A].fadeOut("fast")}hoverTimeout[A]=null}$(document).ready(function(){var K={};var I=0;var F=1000;var E=$("#middle").height()+$("#middle").offset().top-5;menus[0]=$("#dept");for(var C=1;C<=5;C++){menus[C]=$("#submenu"+C)}function H(L){var M;M=$(L).parents("div")[0].id;if(M.length>4){return parseInt(M.substring(7,M.length+1),10)+1}else{return 1}}function D(L){menus[L].unbind("mouseover").mouseover(function(){for(var M=1;M<=L;M++){if(typeof hoverTimeout[M]=="number"){clearTimeout(hoverTimeout[M]);hoverTimeout[M]=null}}}).unbind("mouseout").mouseout(function(){for(var M=1;M<=L;M++){hoverTimeout[M]=setTimeout("hideMenu("+M+")",F)}})}function G(Q,S,M){var P=H(M);if(menus[P].find("li#menu"+Q.menu[0].id).length==0){menus[P].hide()}menus[P].empty().append($("<ul></ul>"));for(var O=0;O<Q.menu.length;O++){var R=Q.menu[O];menus[P].children("ul").append($('<li id="menu'+R.id+'" class="'+(R.sub?"cat":"prod")+'"><a href="'+R.href+'">'+R.title+"</a></li>"))}menus[P].css("top",$(M).offset().top-5).css("left",$(M).offset().left+$(M).width()-5);if(parseInt(menus[P].css("top"),10)+menus[P].height()>E){menus[P].css("marginTop",E-parseInt(menus[P].css("top"),10)-menus[P].height());if(parseInt(menus[P].css("marginTop"),10)+parseInt(menus[P].css("top"))<0){menus[P].css("marginTop",(0-parseInt(menus[P].css("top")))+"px")}}else{menus[P].css("marginTop",0)}var N=0;var L=new Date().getTime();if(L-S<I){N=I-(L-S)}showTimeout[P]=setTimeout(function(){if($.browser.msie){menus[P].show()}else{menus[P].fadeIn("fast")}B(P+1);D(P);showTimeout[P]=null},N)}function J(L){var M=H(L);if(typeof hoverTimeout[M]=="number"){clearTimeout(hoverTimeout[M]);hoverTimeout[M]=null}hideTimeout[M]=setTimeout(function(){if(typeof hoverTimeout[M]=="number"){clearTimeout(hoverTimeout[M]);hoverTimeout[M]=null}var N=new Date().getTime();if(!K[L.id]){$.getJSON("json/menu.asp?CategoryId="+L.id.substring(4,L.id.length+1),function(O){G(O,N,L);K[L.id]=O})}else{G(K[L.id],N,L)}hideTimeout[M]=null},400)}function A(L){var M=H(L);if(typeof hideTimeout[M]=="number"){clearTimeout(hideTimeout[M]);hideTimeout[M]=null}hoverTimeout[M]=setTimeout(function(){menus[M].fadeOut("fast");hoverTimeout[M]=null},F)}function B(L){menus[L-1].find("li.cat").unbind("mouseover").mouseover(function(){J(this)}).unbind("mouseout").mouseout(function(){A(this)})}B(1)});
