var PanelBehavior={initialize:function(){if($$(".panels")[0]){var a=new Element("table",{cellspacing:"0",cellpadding:"0"});var c=new Element("tr");a.appendChild(c);$$(".panels")[0].appendChild(a);$$(".panel").each(function(d){var e=new Element("td");e.appendChild(d);c.appendChild(e)})}var b=$$(".panel a");b.addEvent("mouseover",function(d){this.parentNode.className+=" active-panel";$$(".panel").each(function(e){e.tween("opacity",(e.className.match("active"))?1:0.3)})});b.addEvent("mouseout",function(d){this.parentNode.className=this.parentNode.className.replace(/\s*active-panel/,"")});$$(".panel").set("tween",{duration:200});$$(".panels").addEvent("mouseout",function(d){PanelBehavior.timeout=PanelBehavior.showAll.delay(200)})},showAll:function(){if($$(".active-panel").length==0){$$(".panel").each(function(a){a.tween("opacity",1)})}},timeout:null};var PhotoBehavior={initialize:function(){var b=$("photos");if(b){var a=new Element("table",{cellspacing:"0",cellpadding:"0"});var c=new Element("tr");a.appendChild(c);b.appendChild(a);b.getElements("img").each(function(e){var f=new Element("td");f.appendChild(new Element("div",{"class":"photo"}).wraps(e));c.appendChild(f)})}var d=$$(".photo");if(d.length>1){d.addEvent("click",function(g){if(this.className.match(/active-photo/)){this.className=this.className.replace(/\s*active-photo/,"");var f=$(this).getElement("img");f.morph({"margin-left":(this.className.match("active"))?0:-f.width/2})}else{$$(".active-photo").each(function(i){i.className=i.className.replace(/\s*active-photo/,"");var e=i.getElement("img");i.morph({opacity:(i.className.match("active"))?1:0.3,width:(i.className.match("active"))?e.width:50});e.morph({"margin-left":(i.className.match("active"))?0:-e.width/2})});this.className+=" active-photo"}var h=this.getElement("img").width;this.morph({opacity:(this.className.match("active"))?1:0.3,width:(this.className.match("active"))?h:50});var f=$(this).getElement("img");f.morph({"margin-left":(this.className.match("active"))?0:-f.width/2})});d.set("opacity",0.3);d.setStyle("cursor","pointer");d.set("morph",{duration:200});$$(".photo img").each(function(e){e.set("morph",{duration:200});e.morph({"margin-left":-e.width/2})})}else{if(d.length==1){d[0].className+=" active-photo";d[0].style.width="auto"}}}};var MenuTree={initialize:function(){var b=$$("#menu-root > li");if(b){var a=this.listItems([],b[0],0);this.processItemLevels(a);this.markActive(b[0])}},listItems:function(g,h,b){var k=h.childNodes;for(var e=k.length-1;e>=0;e--){var a=k[e];if(a.nodeName=="UL"){var c=a.childNodes;for(var d=c.length-1;d>=0;d--){var f=c[d];if(f.nodeName=="LI"){lines=this.listItems(g,f,b+1)}}}}g.push([b,h]);return g},processItemLevels:function(d){var h=0;for(var f=0;f<d.length;f++){if(d[f][0]>h){h=d[f][0]}}var l=[];for(var f=0;f<=h;f++){l[f]=false}for(var f=0;f<d.length;f++){var b=d[f][0];var k=d[f][1];var g=$(k).getChildren("a")[0];var c=new Element("span",{"class":"nodetext",html:g.innerHTML});g.empty();c.inject(g);for(var e=h;e>=0;e--){if(b<e&&l[e]){new Element("span",{"class":"node node-no-lb"}).inject(g,"top")}else{if(b<e){new Element("span",{"class":"node"}).inject(g,"top")}else{if(l[e]&&e==b){if(l[e+1]){new Element("span",{"class":"node node-map-cl-trb"}).inject(g,"top");l[e+1]=false}else{new Element("span",{"class":"node node-map-cl-tb"}).inject(g,"top")}}else{if(e==b){if(l[e+1]){if(b==0){new Element("span",{"class":"node node-map-cl-r"}).inject(g,"top")}else{new Element("span",{"class":"node node-map-cl-tr"}).inject(g,"top")}l[e+1]=false}else{new Element("span",{"class":"node node-map-cl-t"}).inject(g,"top")}l[e]=true}else{if(l[e]){new Element("span",{"class":"node node-no-tb"}).inject(g,"top")}else{new Element("span",{"class":"node"}).inject(g,"top")}}}}}}}},markActive:function(a){var b=a.getElements("a");for(var c=0;c<b.length;c++){if(document.location.href.contains(b[c].href)){b[c].className="active";b[c].parentNode.className="active"}else{b[c].parentNode.className="inactive"}}}};window.addEvent("domready",function(){PanelBehavior.initialize();PhotoBehavior.initialize();MenuTree.initialize()});
