(function(b){b.fn.lavaLamp=function(a){a=b.extend({fx:"swing",speed:500,click:function(){return true},startItem:"no",autoReturn:true,returnDelay:0,setOnClick:true,homeTop:0,homeLeft:0,homeWidth:0,homeHeight:0,returnHome:false},a||{});return this.each(function(){var m=location.pathname+location.search+location.hash;var p=new Object;var q;var l;var o;var n;if(a.homeTop||a.homeLeft){o=b('<li class="homeLava selectedLava"></li>').css({left:a.homeLeft,top:a.homeTop,width:a.homeWidth,height:a.homeHeight,position:"absolute"});b(this).prepend(o)}var k=b("li",this);if(a.startItem=="no"){p=b('li a[href$="'+m+'"]',this).parent("li")}if(p.length==0&&a.startItem=="no"&&location.hash){p=b('li a[href$="'+location.hash+'"]',this).parent("li")}if(p.length==0||a.startItem!="no"){if(a.startItem=="no"){a.startItem=0}p=b(k[a.startItem])}n=b("li.selectedLava",this)[0]||b(p).addClass("selectedLava")[0];k.mouseover(function(){if(b(this).hasClass("homeLava")){n=b(this)[0]}r(this)});l=b('<li class="backLava"><div class="leftLava"></div><div class="bottomLava"></div><div class="cornerLava"></div></li>').appendTo(this);b(this).mouseout(function(){if(a.autoReturn){if(a.returnHome&&o){r(o[0])}else{if(a.returnDelay){if(q){clearTimeout(q)}q=setTimeout(r,a.returnDelay+a.speed)}else{r()}}}});k.click(function(c){if(a.setOnClick){b(n).removeClass("selectedLava");b(this).addClass("selectedLava");n=this}return a.click.apply(this,[c,this])});if(a.homeTop||a.homeLeft){l.css({left:a.homeLeft,top:a.homeTop,width:a.homeWidth,height:a.homeHeight})}else{l.css({left:n.offsetLeft,top:n.offsetTop,width:n.offsetWidth,height:n.offsetHeight})}function r(e){if(!e){e=n}var c=0,d=0;if(!b.browser.msie){c=(l.outerWidth()-l.innerWidth())/2;d=(l.outerHeight()-l.innerHeight())/2}l.stop().animate({left:e.offsetLeft-c,top:e.offsetTop-d,width:e.offsetWidth,height:e.offsetHeight},a.speed,a.fx)}})}})(jQuery);