var current_open_menu=false;var current_open_menu_link=false;var menu_debug=false;var menu_effect;var menu_effect_close;function showmenu(d,b,a){d=$(d);b=$(b);if(typeof(a)=="undefined"){a=""}if(d.hasClassName("menu-sub")){hidemenu(false);$$(".menu-sub").each(function(e){e.hide()});if(menu_effect_close&&menu_effect_close.state=="running"){menu_effect_close.cancel()}if(!menu_effect||menu_effect.state!="running"){menu_effect=new Effect.Move("menu-pages",{x:0,y:-30,mode:"absolute",duration:0.3})}var c=b.positionedOffset().left;if(c+d.getWidth()>960){c-=(c+d.getWidth())-960}d.style.left=c+"px";d.show()}else{if(d.hasClassName("dropdown")){hidemenu();if(a!=""){if(a>=0){d.style.left=b.positionedOffset().left-a+"px"}else{d.style.left=b.positionedOffset().left+b.getWidth()-d.getWidth()-a+"px"}}d.style.width=(b.getWidth()+1)+"px";d.show()}}b.removeClassName("dd-tab").addClassName("dd-tab-open").addClassName("color-button-active");current_open_menu=d;current_open_menu_link=b}function hidemenu(c,b,a){if(typeof(b)=="undefined"){b=current_open_menu}else{b=$(b)}if(typeof(a)=="undefined"){a=current_open_menu_link}else{a=$(a)}c=(typeof(c)=="undefined")?true:c;if(b&&b.hasClassName("menu-sub")&&c){if(menu_effect&&menu_effect.state=="running"){menu_effect.cancel()}if(!menu_effect_close||menu_effect_close.state!="running"){menu_effect_close=new Effect.Move("menu-pages",{x:0,y:0,mode:"absolute",duration:0.3})}}else{if(b){b.hide()}}if(a){a.removeClassName("dd-tab-open").removeClassName("color-button-active").addClassName("dd-tab")}}document.observe("dom:loaded",function(a){$$(".dropdown").each(function(b){b.onmouseout=function(f){if(!f){var f=window.event}var c=(f.relatedTarget)?f.relatedTarget:f.toElement;var d=c;if(typeof(c)!="undefined"){while(c&&c.tagName!="BODY"){if(c.id==this.id){return}c=c.parentNode}}if(menu_debug){alert(d+" - "+d.id+" - "+d.className)}hidemenu();return false}});$$(".menu-hide").each(function(b){b.onmouseout=function(f){if(!f){var f=window.event}var c=$((f.relatedTarget)?f.relatedTarget:f.toElement);var d=c;if(typeof(c)!="undefined"){while(c&&c.tagName!="BODY"){if(c.id==this.id||(c.hasClassName&&(c.hasClassName("dropdown")||c.hasClassName("menu-hide")))){return}c=c.parentNode}}if(menu_debug){alert(d+" - "+d.id+" - "+d.className)}hidemenu();return false}})});function update_menu(c,b){var a=$(c+"-span");while(a.firstChild){a.removeChild(a.firstChild)}a.appendChild(document.createTextNode(b.innerHTML));$(c).href=b.href;$(c).onclick=function(){return ajax_update(this.href,"post-excerpt-list")};$(b).up().style.width=$(c).getWidth()+"px";$(b).up().select("a").each(function(d){d.show()});$(b).hide();hidemenu();return false};