var LightboxAJC=Class.create({open:function(){this._centerWindow(this.container);this._fade('open',this.container);},close:function(){this._fade('close',this.container);},_fade:function fadeBg(userAction,whichDiv){if(userAction=='close'){new Effect.Opacity('bg_fade',{duration:.5,from:0.5,to:0,afterFinish:this._makeInvisible,afterUpdate:this._hideLayer(whichDiv)});}else{new Effect.Opacity('bg_fade',{duration:.5,from:0,to:0.5,beforeUpdate:this._makeVisible,afterFinish:this._showLayer(whichDiv)});}},_makeVisible:function makeVisible(){$("bg_fade").setStyle({'visibility':'visible'});},_makeInvisible:function makeInvisible(){$("bg_fade").setStyle({'visibility':'hidden'});},_showLayer:function showLayer(userAction){$(userAction).setStyle({'display':'block'});},_hideLayer:function hideLayer(userAction){$(userAction).setStyle({'display':'none'});},_centerWindow:function centerWindow(element){var windowHeight=parseFloat($(element).getHeight())/2;var windowWidth=parseFloat($(element).getWidth())/2;var tmp=$$('button.btn-cart')[0];if(typeof window.innerHeight!='undefined'){$(element).setStyle({'top':Math.round(tmp.cumulativeOffset()[1]-20)+'px'});}else{$(element).setStyle({'top':Math.round(tmp.cumulativeOffset()[1]-20)+'px'});}},initialize:function(containerDiv){this.container=containerDiv;if($('bg_fade')==null){var screen=new Element('div',{'id':'bg_fade'});document.body.appendChild(screen);}
new Draggable(this.container);this._hideLayer(this.container);}});
