buffalo.nectar=function(){var a=document.getElementsByTagName('body')[0];var b='';b+='<div id="nectarBackground">&#160;</div>';b+='<div id="nectarWrapper"></div>';document.write(b);this.back=$('nectarBackground');this.wrapper=$('nectarWrapper');this.nectar=$('nectar');this.bar=$('nectarBar');this.wrapper.appendChild(this.nectar);if(document.all)this.back.style.filter='alpha(opacity=50)';this.back.style.MozOpacity=0.5;this.back.style.opacity=0.5;buffalo.utils.events.add(this.wrapper,'click',function(){nectar.hideDisplay();return false})};buffalo.nectar.prototype.setHeightToPage=function(a){var b=new Array(document.documentElement.scrollHeight,document.body.scrollHeight);a.style.height=(b[0]>b[1]?b[0]:b[1])+'px'};buffalo.nectar.prototype.showDisplay=function(a){this.back.style.display='block';this.wrapper.style.display='block';this.setHeightToPage(this.back);a.margin=a.margin?a.margin:4;a.barHeight=a.barHeight?a.barHeight:30;var b=document.getElementsByTagName('select');for(var i=0;i<b.length;i++)b[i].style.visibility='hidden';var c=document.getElementsByTagName('object');for(var i=0;i<c.length;i++)c[i].style.visibility='hidden';this.newImage=document.createElement('img');this.newImage.alt=a.title;this.newImage.title=a.title;this.newImage.id='nectarImage';if($('nectarTitle'))$('nectarTitle').innerHTML=a.title;this.newImage.style.visibility='hidden';this.nectar.insertBefore(this.newImage,this.bar);this.newImage.options=a;buffalo.utils.events.add(this.newImage,'load',this.resizeDisplay);this.newImage.src=a.image};buffalo.nectar.prototype.hideDisplay=function(){this.back.style.display='none';this.wrapper.style.display='none';this.bar.style.display='none';this.nectar.style.backgroundImage='url(/img/misc/loading.gif)';buffalo.utils.events.remove(this.newImage,'load',this.resizeDisplay);if(this.newImage.parentNode)this.nectar.removeChild(this.newImage);var a=document.getElementsByTagName('select');for(var i=0;i<a.length;i++)a[i].style.visibility='visible';var b=document.getElementsByTagName('object');for(var i=0;i<b.length;i++)b[i].style.visibility='visible'};buffalo.nectar.prototype.resizeDisplay=function(){var a=$('nectar');var b=new buffalo.honey(a,15);var c=(this.width+(this.options.margin*2))<100?100:this.width+(this.options.margin*2);a.style.backgroundImage='none';var d=50;var e=50;var f=document.body.clientHeight>document.documentElement.clientHeight?document.body.clientHeight:document.documentElement.clientHeight;var g=document.body.scrollTop>document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;if(this.height>f||this.height+d+d+g>f)a.style.marginTop=(f-(this.height+e))+'px';else a.style.marginTop=(d+g)+'px';b.changeSize({dir:1,alter:document.all?15:7,max:this.height+(this.options.margin*2),after:this.options.variable+".showImage(false, true)"});b.changeSize({dir:0,alter:document.all?15:7,max:c,after:this.options.variable+".showImage(true, false)"})};buffalo.nectar.prototype.showImage=function(a,b){if(a)this.width=true;if(b)this.height=true;if(this.width&&this.height){this.newImage.style.visibility='visible';var c=new buffalo.honey(this.nectar,15);this.width=this.height=false;$('nectarBar').style.display='block';c.changeSize({dir:1,alter:document.all?7:2,max:parseInt(this.nectar.style.height)+this.newImage.options.barHeight,after:this.newImage.options.variable+".buttonFocus()"})}};buffalo.nectar.prototype.buttonFocus=function(){if($('nectarClose'))$('nectarClose').focus()};buffalo.nectar.prototype.setDisplay=function(a,b,c){var d=document.getElementsByTagName('a');var e=new Array();var f=new RegExp(b,'g');for(var i=0;i<d.length;i++)if(d[i].rel==a&&d[i].firstChild.nodeName.toLowerCase()=='img')e[e.length]=d[i];for(var i=0;i<e.length;i++){e[i].onclick=function(){return false};buffalo.utils.events.add(e[i],'click',function(){nectar.showDisplay({variable:a,image:this.firstChild.src.replace(f,c),title:this.firstChild.title});return false})}};