/* $Id: milkbox.js,v 1.3 2010/02/13 22:34:57 Mario Exp $ */
/*
  Milkbox v2.3.2 - required: mootools.js v1.2.3 core + more 1.2.3.1: Assets

  by Luca Reghellin (http://www.reghellin.com) August 2009, MIT-style license.
  Inspiration Lokesh Dhakar (http://www.lokeshdhakar.com/projects/lightbox2/)
  AND OF COURSE, SPECIAL THANKS TO THE MOOTOOLS DEVELOPERS

  ------------------------------------------------------------------------------
  Customized and fixed for clubkart.it by Mario Cimento (cimario@tiscali.it)
  Feb 2010, MIT-style license.
*/
var Milkbox=new Class({Implements:[Options,Events],options:{overlayOpacity:0.7,topPosition:50,initialWidth:250,initialHeight:250,canvasBorderWidth:"0px",canvasBorderColor:"#000000",canvasPadding:"0px",resizeDuration:500,resizeTransition:"sine:in:out",autoPlay:false,autoPlayDelay:7,removeTitle:false,autoSize:false,maxHeight:0,imageOfText:"di",onXmlGalleries:$empty,onClosed:$empty,onFileReady:$empty,myMinWidth:400,myMaxWidth:640,myMaxHeight:480},initialize:function(A){this.setOptions(A);this.autoPlayBkup={autoPlayDelay:this.options.autoPlayDelay,autoPlay:this.options.autoPlay};this.fullOptionsBkup={};this.galleries=[];this.families=[];this.xmlFiles=[];this.Jgalleries=[];this.loadedImages=[];this.currentFile=null;this.currentIndex=null;this.currentGallery=null;this.currentRequest=null;this.currentResponse=null;this.marker="lightboxGallery";this.mode=null;this.closed=true;this.busy=true;this.paused=true;this.fileReady=false;this.eventsok=false;this.first=true;this.activated=false;this.intObj=null;this.formtags=null;this.prepareGalleries();if(this.options.overlayOpacity==0){this.options.overlayOpacity=0.0001}this.saveOptions();if(this.galleries.length==0){return }this.initMilkbox(true)},initMilkbox:function(A){if(A){this.formtags=$$("select","textarea")}this.prepareHTML();this.prepareEffects();this.prepareEvents();this.activated=true},openMilkbox:function(B,D){this.closed=false;if(this.formtags&&this.formtags.length!=0){this.formtags.setStyle("display","none")}this.overlay.setStyles({"top":0,"height":$(window).getScrollSize().y});this.center.setStyle("top",$(window).getScroll().y+this.options.topPosition);this.currentGallery=B;this.currentIndex=D;this.overlay.tween("opacity",this.options.overlayOpacity);if(B.length==1){this.mode="singleFile";this.loadFile(B[D],D)}else{this.mode="fileGallery";this.title.setProperty("html",B.title);B.each(function(I,K){var J=new Element("option",{value:K,html:((K+1)+" - "+I.title)}).inject(this.select)}.bind(this));var A=0;$$(this.zoom,this.prev,this.next,this.count,this.select,this.title).setStyle("display","block");if($chk(B.archive)&&($type(B.archive)=="array")&&($type(B.archive[0])=="string")&&B.archive[0].length){this.archive.setProperty("html",'<a href="'+B.archive[0]+'" target="_blank" class="mbArchive">archivio completo ('+B.archive[1]+")</a>");this.archive.setStyle("display","block")}if(this.options.autoPlay){this.playpause.setStyle("display","block");if(this.paused==false){this.playpause.setStyle("backgroundPosition","0 0")}else{this.playpause.setStyle("backgroundPosition","0 -44px")}A=this.playpause.getSize().x}var C=this.center.getStyle("border-right-width").toInt();var H=this.prev.getSize().x+this.next.getSize().x+this.close.getSize().x+A+C;var F=(D!=B.length-1)?B[D+1]:B[0];var G=(D!=0)?B[D-1]:B[B.length-1];var E=(G==F)?[G]:[G,F];this.loadFile(B[D],E)}},loadFile:function(C,B){this.fileReady=false;var A=this.checkFileType(C,"swf");if(!A){if(!this.loadedImages.contains(C.retrieve("href"))){this.center.addClass("mbLoading")}this.loadImage(C.retrieve("href"))}else{this.loadSwf(C)}if(B){this.preloadFiles(B)}},preloadFiles:function(A){A.each(function(D,B){var C=this.checkFileType(D.retrieve("href"),"swf");if(!C){this.preloadImage(D.retrieve("href"))}},this)},loadImage:function(B){var A=new Asset.image(B,{onload:function(C){if(!this.loadedImages.contains(B)){this.loadedImages.push(B)}this.currentFile=C;this.loadAux(this.currentFile)}.bindWithEvent(this)})},preloadImage:function(B){if(!this.loadedImages.contains(B)){var A=new Asset.image(B,{onload:function(C){this.loadedImages.push(B)}.bindWithEvent(this)})}},loadSwf:function(B){var A=new Swiff(B.retrieve("href"),{width:B.retrieve("width").toInt(),height:B.retrieve("height").toInt(),params:{wMode:"opaque",swLiveConnect:"false"}});this.currentFile=A;this.loadAux(B)},loadAux:function(A){this.fileReady=true;this.fireEvent("fileReady");$$(this.description,this.navigation).setStyle("visibility","hidden");this.navigation.setStyle("height","");$$(this.zoom,this.next,this.prev,this.close).setStyle("backgroundPosition","0 0");this.showFile(A)},showFile:function(B){if(this.closed){return }var D=new Hash();var J=new Hash();var E,K;var C,I,H,A,G;E=K={};C=I=H=A=G=0;if(this.options.canvasBorderWidth.toInt()!=0&&this.canvas.getStyle("borderWidth").toInt()==0){H=this.options.canvasBorderWidth+" solid "+this.options.canvasBorderColor}if(this.options.canvasPadding.toInt()!=0&&this.canvas.getStyle("padding").toInt()==0){A=this.options.canvasPadding}K=this.canvas.getSize();C=this.canvas.getStyle("borderWidth").toInt()*2+this.canvas.getStyle("padding").toInt()*2;this.canvas.setStyles({"opacity":0,"width":"","height":""});if(!B.retrieve("width")){D=D.extend(B.getProperties("width","height")).map(function(L){return L.toInt()});if(this.options.autoSize){D=this.computeSize(D);B.setProperties({"width":D.width,"height":D.height})}}else{D.extend({"height":B.retrieve("height").toInt(),"width":B.retrieve("width").toInt()})}var F=D.width/D.height;if(D.width>this.options.myMaxWidth){D.width=this.options.myMaxWidth;D.height=(this.options.myMaxWidth/F);B.setProperties({"width":D.width,"height":D.height})}if(D.height>this.options.myMaxHeight){D.width=(this.options.myMaxHeight*F);D.height=this.options.myMaxHeight;B.setProperties({"width":D.width,"height":D.height})}J=J.extend(this.center.getStyles("width","height")).map(function(L){return L.toInt()});if(D.width!=J.width){E.width=D.width+C;E.marginLeft=-(E.width/2).round()}if(E.width<this.options.myMinWidth){E.width=this.options.myMinWidth;E.marginLeft=-(E.width/2).round()}I=(K.y-C>0)?J.height-K.y:0;E.height=D.height+C+I;this.canvas.setStyles({"height":D.height});this.center.removeClass("mbLoading");if(this.first){G=500;this.first=false}(function(){this.center.morph(E)}).delay(G,this)},computeSize:function(G){var D=G;var B=window.getSize();var F={width:B.x-60,height:B.y-68-this.options.topPosition*2};var E;var C;var A=Math.max(F.height,F.width);if(A==F.width){E=A/D.width;C="height"}else{E=A/D.height;C="width"}E=(E<=1)?E:1;D=D.map(function(H){return Math.floor(H*E)});E=(F[C]/D[C]<=1)?F[C]/D[C]:1;D=D.map(function(H){return Math.floor(H*E)});if(this.options.maxHeight>0){E=(this.options.maxHeight/D.height<1)?this.options.maxHeight/D.height:1;D=D.map(function(H){return Math.floor(H*E)})}return D},showGallery:function(A){if(!A||!A.gallery){return }var B;if(($type(A.gallery)=="array")&&((($type(A.gallery[0])=="array")&&(A.gallery[0][0]==this.marker))||(($type(A.gallery[0][0])=="array")&&(A.gallery[0][0][0]==this.marker)))){B=this.getGallery(A.gallery.title);if(B==-1){this.addJGallery(A.gallery);B=this.getGallery(A.gallery.title)}}else{B=this.getGallery(A.gallery)}var C=($chk(A.index))?A.index:0;var E=false;var D;if(A.autoplay||(B["options"]&&B["options"].autoplay)){E=true}if(B!=-1&&!this.opened){if(E){D=(A&&A.delay)?A.delay:(B["options"]&&B["options"].delay)?B["options"].delay:this.autoPlayDelay;this.startAutoPlay({gallery:B,index:C,delay:D})}else{this.openMilkbox(B,C)}}},addJGallery:function(E){if(!$chk(E)){return }var D=this.getGallery(E.title);if(D!=-1){var C=this.galleries.indexOf(D);this.families.erase(this.families[C]);this.galleries.erase(D);this.Jgalleries.erase(E)}var B=[];var A=[];if($type(E[0][0])=="array"){E.each(function(G,F){this.prepareJgallery(G,B,A)},this)}else{this.prepareJgallery(E,B,A)}this.prepareGalleries(B.flatten());this.setAutoPlay(A);D=this.getGallery(E.title);if(D!=-1){D.archive=($type(E.archive)==false)?"":E.archive;D.path=($type(E.path)==false)?"":E.path;D.title=($type(E.title)==false)?"":E.title;if(!this.Jgalleries.contains(E)){this.Jgalleries.push(E)}}if(!this.activated){this.initMilkbox()}},prepareJgallery:function(E,C,B){if(E[0][0]!=this.marker){return }var D=false;var A=0;if($chk(E.autoplay)){D=Boolean(E.autoplay)}if($chk(E.delay)){A=Boolean(E.delay)}var G={gallery:E.title,autoplay:D,delay:A};var F=($type(E.path)=="string")?E.path.trim():"";E.each(function(I,K){if(K==0){return }var H=new Element("a");var L=I[0].trim();var J=I[1].trim();H.setProperty("href",F+L);if(!J.length){J=L.substring(L.lastIndexOf("/")+1,L.lastIndexOf("."))}H.setProperty("title",J);H.setProperty("rel","milkbox["+G.gallery+"]");C.push(H)});if(G.autoplay){B.push(G)}},addGalleries:function(A){this.currentRequest=new Request({method:"get",autoCancel:true,url:A,onRequest:function(){}.bindWithEvent(this),onSuccess:function(D,B){var C=D.replace(/(<a.+)\/>/gi,"$1></a>");this.setGalleries(new Element("div",{html:C}),A)}.bindWithEvent(this),onFailure:function(B){alert("Milkbox :: addGalleries: XML file path error or local Ajax test: please test addGalleries() on-line")}});this.currentRequest.send()},setGalleries:function(C,E){if(!this.xmlFiles.contains(E)){this.xmlFiles.push(E)}var F=C;var B=F.getElements(".gallery");var D=[];var A=[];B.each(function(H,I){var K={gallery:H.getProperty("name"),autoplay:Boolean(H.getProperty("autoplay")),delay:Number(H.getProperty("delay"))};var G=H.getChildren("a");var J=G.map(function(L){return L.setProperty("rel","milkbox["+K.gallery+"]")});D.push(J);if(K.autoplay){A.push(K)}});this.prepareGalleries(D.flatten());this.setAutoPlay(A);if(!this.activated){this.initMilkbox()}this.fireEvent("xmlGalleries")},checkFileType:function(B,C){var A=null;if($type(B)!="string"){A=B.retrieve("href")}else{A=B}var D=new RegExp(".("+C+")$","i");return A.split("?")[0].test(D)},getGallery:function(A){var D=null;if(A.test(/^milkbox/i)){D=this.families}else{D=this.families.map(function(G){var H=G.trim();var E=H.slice(0,H.length).substr(8);var F=E.replace(/(.+)]$/,"$1");return F})}var B=D.indexOf(A);var C=(B!=-1)?this.galleries[B]:B;return C},setFileProps:function(C,A){var B=A.split(",");B.each(function(F,E){var D=F.trim().split(":");C.store(D[0].trim(),D[1].trim())},this)},changeOptions:function(A){if(!A){return }this.setOptions(A);this.autoPlayBkup={autoPlayDelay:this.options.autoPlayDelay,autoPlay:this.options.autoPlay};if($chk(this.center)){this.center.get("morph").setOptions({transition:this.options.resizeTransition,duration:this.options.resizeDuration})}},saveOptions:function(A){if($chk(A)){this.fullOptionsBkup=A}else{this.fullOptionsBkup=this.options}},restoreOptions:function(){this.setOptions(this.fullOptionsBkup);var A=this.options.canvasBorderWidth+" solid "+this.options.canvasBorderColor;this.center.get("morph").setOptions({transition:this.options.resizeTransition,duration:this.options.resizeDuration})},reloadGalleries:function(){this.galleries=[];this.families=[];this.formtags=$$("select","textarea");if(!this.activated){this.initMilkbox(false)}this.prepareGalleries();this.removeGalleriesEvents();this.setGalleriesEvents();this.Jgalleries.each(function(B,A){this.addJGallery(B)}.bind(this));if(this.xmlFiles.length==0){return }this.xmlFiles.each(function(B,A){this.addGalleries(B)}.bind(this))},setAutoPlay:function(B){var A=($type(B)=="object")?[B]:B;A.each(function(E){var D=this.getGallery(E.gallery);if(D==-1){return }var C=(E.autoplay==true)?E.autoplay:false;var F=($chk(E.delay)&&C)?E.delay:this.options.autoPlayDelay;D["options"]={autoplay:C,delay:F}},this)},startAutoPlay:function(B){var C=-1;var A,D;if(B&&B.gallery){if($type(B.gallery)=="array"){C=B.gallery}else{if($type(B.gallery)=="string"){C=this.getGallery(B.gallery)}}}if(C==-1){C=this.galleries[0]}D=(B&&B.delay&&($type(B.delay)=="number"))?B.delay*1000:(C["options"]&&C["options"].delay)?C["options"].delay*1000:this.options.autoPlayDelay*1000;A=(B&&B.index&&($type(B.index)=="number"))?B.index:0;if(D<this.options.resizeDuration*2){D=this.options.resizeDuration*2}this.options.autoPlayDelay=D/1000;if(!this.options.autoPlay){this.setOptions({autoPlay:true,autoPlayDelay:this.options.autoPlayDelay})}if(this.closed){this.openMilkbox(C,A);if(this.mode!="fileGallery"){return }this.addEvent("fileReady",function(){this.intObj=this.next_prev_aux.periodical(D,this,[null,"next"]);this.removeEvents("fileReady")}.bindWithEvent(this))}else{if(!this.closed){this.next_prev_aux(null,"next")}this.intObj=this.next_prev_aux.periodical(D,this,[null,"next"])}this.paused=false},stopAutoPlay:function(){if(this.intObj){$clear(this.intObj);this.intObj=null}this.playpause.setStyle("backgroundPosition","0 -44px");this.paused=true},removeGalleriesEvents:function(){this.galleries.each(function(A){$$(A).removeEvents("click")},this)},setGalleriesEvents:function(){this.galleries.each(function(A){$$(A).addEvent("click",function(D){var B=($(D.target).match("a"))?$(D.target):$(D.target).getParent("a");D.preventDefault();var C=this.getGallery(B.rel);if(C.options&&C.options.autoplay){this.setOptions({autoPlay:C.options.autoplay,autoPlayDelay:C.options.delay})}if(this.options.autoPlay){this.startAutoPlay({gallery:A,index:A.indexOf(B)})}else{this.openMilkbox(A,A.indexOf(B))}}.bindWithEvent(this))},this)},prepareEvents:function(A){this.setGalleriesEvents();this.zoom.addEvent("click",function(B){this.zoomImage(this.currentIndex)}.bindWithEvent(this));this.next.addEvent("click",this.next_prev_aux.bindWithEvent(this,"next"));this.prev.addEvent("click",this.next_prev_aux.bindWithEvent(this,"prev"));this.select.addEvent("change",function(B){this.currentIndex=(this.select.selectedIndex!=0)?this.select.selectedIndex-1:this.currentGallery.length-1;this.next_prev_aux(B,"next")}.bindWithEvent(this));$$(this.zoom,this.next,this.prev,this.close).addEvents({"mouseover":function(){this.setStyle("backgroundPosition","0 -22px")},"mouseout":function(){this.setStyle("backgroundPosition","0 0")}});$(window.document).addEvent("keydown",function(B){if(this.mode!="fileGallery"||this.busy==true){return }if(B.key=="right"||B.key=="space"){this.next_prev_aux(B,"next")}else{if(B.key=="left"){this.next_prev_aux(B,"prev")}else{if(B.key=="esc"){this.closeMilkbox()}else{if(B.key=="z"){this.zoomImage(this.currentIndex)}}}}}.bindWithEvent(this));this.playpause.addEvents({"mouseover":function(B){if(this.paused==false){this.playpause.setStyle("backgroundPosition","0 -22px")}else{this.playpause.setStyle("backgroundPosition","0 -66px")}}.bindWithEvent(this),"mouseout":function(){if(this.paused==false){this.playpause.setStyle("backgroundPosition","0 0")}else{this.playpause.setStyle("backgroundPosition","0 -44px")}}.bindWithEvent(this),"click":function(){if(this.paused==false){this.stopAutoPlay();this.paused=true;this.playpause.setStyle("backgroundPosition","0 -66px")}else{var B=(this.currentGallery.options&&this.currentGallery.options.delay)?this.currentGallery.options.delay:this.options.autoPlayDelay;this.startAutoPlay({gallery:this.currentGallery,index:this.currentIndex+1,delay:B});this.paused=false;this.playpause.setStyle("backgroundPosition","0 0")}}.bindWithEvent(this)});this.overlay.get("tween").addEvent("onComplete",function(){if(this.overlay.getStyle("opacity")==this.options.overlayOpacity){this.center.tween("opacity",1)}else{if(this.overlay.getStyle("opacity")==0){this.overlay.setStyles({"height":0,"top":""})}}}.bindWithEvent(this));this.center.get("morph").addEvent("onComplete",function(){if($type(this.currentFile)=="element"){this.canvas.grab(this.currentFile)}else{(function(){this.canvas.grab(this.currentFile)}).delay(500,this)}this.canvas.tween("opacity",1);var D=(!(this.mode=="showThisImage"))?this.currentGallery[this.currentIndex].retrieve("title"):this.specialDescription;if($chk(D)){this.description.innerHTML=D}if(this.mode=="fileGallery"){this.count.appendText((this.currentIndex+1)+" "+this.options.imageOfText+" "+this.currentGallery.length);this.select.selectedIndex=this.currentIndex}var B=this.center.getStyle("height").toInt();var E=this.description.getSize().y+this.navigation.getSize().y+3;var C=(B>this.canvas.getSize().y)?(E+this.canvas.getSize().y)-B:E;this.bottom.setStyle("display","none");this.center.retrieve("setFinalHeight").start(B,B+C)}.bindWithEvent(this));this.center.retrieve("setFinalHeight").addEvent("onComplete",function(){this.bottom.setStyles({"visibility":"visible","display":"block"});$$(this.description,this.navigation).setStyle("visibility","visible");var B=$(window).getScrollSize().y;var C=$(window).getScroll().y;this.overlay.setStyles({"height":B,"top":0});this.busy=false}.bindWithEvent(this));window.addEvent("resize",function(){if(this.overlay.getStyle("opacity")==0){return }var B=$(window).getScrollSize().y;var C=$(window).getScroll().y;this.overlay.setStyles({"height":B,"top":0})}.bindWithEvent(this));$$(this.overlay,this.close).addEvent("click",this.closeMilkbox.bindWithEvent(this));this.eventsok=true},next_prev_aux:function(D,C){if(D){D.preventDefault();this.stopAutoPlay()}else{if(this.busy||!this.fileReady){return }}this.busy=true;var A,B;if(C=="next"){A=(this.currentIndex!=this.currentGallery.length-1)?this.currentIndex+=1:this.currentIndex=0;B=(this.currentIndex!=this.currentGallery.length-1)?this.currentIndex+1:0}else{A=(this.currentIndex!=0)?this.currentIndex-=1:this.currentIndex=this.currentGallery.length-1;B=(this.currentIndex!=0)?this.currentIndex-1:this.currentGallery.length-1}this.canvas.empty();this.description.empty();this.count.empty();this.loadFile(this.currentGallery[A],[this.currentGallery[B]])},prepareEffects:function(){this.overlay.set("tween",{duration:"short",link:"cancel"});this.center.set("tween",{duration:"short",link:"chain"});this.center.set("morph",{duration:this.options.resizeDuration,link:"chain",transition:this.options.resizeTransition});this.center.store("setFinalHeight",new Fx.Tween(this.center,{property:"height",duration:"short"}));this.canvas.set("tween",{link:"chain"})},prepareGalleries:function(A){var C=[];var B=(A)?A:$$("a");B.each(function(D,E){if(D.rel&&D.rel.test(/^milkbox/i)&&D.href.split("?")[0].test(/\.(gif|jpg|jpeg|png|swf)$/i)){if(D.rel.length>7&&!this.families.contains(D.rel)){this.families.push(D.rel)}C.push(D)}},this);C.each(function(D){$(D).store("href",D.href);$(D).store("rel",D.rel);$(D).store("title",D.title);if(this.checkFileType(D.href,"swf")){this.setFileProps($(D),D.rev)}if(this.options.removeTitle){$(D).removeProperty("title")}if(D.rel.length>7){this.families.each(function(H,G){if(D.rel==H){var E=false;var F;this.galleries.each(function(J,I){if(J[0].rel==H){E=true;F=I;return }});if(E==true){this.galleries[F].push($(D))}else{this.galleries.push([$(D)])}}},this)}else{this.galleries.push([$(D)])}},this)},prepareHTML:function(){this.overlay=new Element("div",{"id":"mbOverlay","styles":{"opacity":0,"visibility":"visible","height":0,"overflow":"hidden"}}).inject($(document.body));this.center=new Element("div",{"id":"mbCenter","styles":{"width":this.options.initialWidth,"height":this.options.initialHeight,"marginLeft":-(this.options.initialWidth/2),"opacity":0}}).inject($(document.body));this.canvas=new Element("div",{"id":"mbCanvas"}).inject(this.center);this.bottom=new Element("div",{"id":"mbBottom"}).inject(this.center).setStyle("visibility","hidden");this.navigation=new Element("div",{"id":"mbNavigation"}).setStyle("visibility","hidden");this.description=new Element("div",{"id":"mbDescription"}).setStyle("visibility","hidden");this.bottom.adopt(this.description,new Element("div",{"class":"mbClear"}),this.navigation);this.zoom=new Element("a",{"id":"mbZoomLink","title":"zoom [z]"});this.close=new Element("a",{"id":"mbCloseLink","title":"chiudi [ESC]"});this.next=new Element("a",{"id":"mbNextLink","title":"successiva [>]"});this.prev=new Element("a",{"id":"mbPrevLink","title":"precedente [<]"});this.playpause=new Element("a",{"id":"mbPlayPause","title":"play/pausa"});this.count=new Element("div",{"id":"mbCount"});this.select=new Element("select",{"id":"mbSelect"});this.title=new Element("div",{"id":"mbTitle"});this.archive=new Element("div",{"id":"mbArchive","title":"scarica l'archivio con tutte le immagini"});$$(this.zoom,this.next,this.prev,this.count,this.select,this.title,this.archive,this.playpause).setStyle("display","none");this.navigation.adopt(this.title,this.close,this.next,this.prev,this.playpause,this.zoom,this.count,new Element("div",{"class":"mbClear"}),this.archive,this.select)},closeMilkbox:function(){this.cancelAllEffects();this.stopAutoPlay();this.setOptions(this.autoPlayBkup);this.currentFile=null;this.currentIndex=null;this.currentGallery=null;this.currentRequest=null;this.currentResponse=null;$$(this.zoom,this.prev,this.next,this.playpause,this.count,this.select,this.title,this.archive).setStyle("display","none");this.playpause.setStyle("backgroundPosition","0 0");var A=this.center.getStyle("border-right-width").toInt();var B=this.close.getSize().x+A;this.navigation.setStyles({"height":"","visibility":"hidden"});this.description.empty();this.bottom.setStyles({"visibility":"hidden","display":""});this.canvas.setStyles({"opacity":0,"width":"","height":""});this.canvas.empty();this.count.empty();this.select.empty();this.title.empty();this.archive.empty();this.center.setStyles({"opacity":0,"width":this.options.initialWidth,"height":this.options.initialHeight,"marginLeft":-(this.options.initialWidth/2)});this.overlay.tween("opacity",0);if(this.formtags&&this.formtags.length!=0){this.formtags.setStyle("display","")}this.mode=null;this.closed=true;this.first=true;this.fileReady=false;this.fireEvent("closed")},cancelAllEffects:function(){this.overlay.get("tween").cancel();this.center.get("morph").cancel();this.center.get("tween").cancel();this.center.retrieve("setFinalHeight").cancel();this.canvas.get("tween").cancel()},zoomImage:function(A){if((A<0)||(A>(this.currentGallery.length-1))){return }window.open(this.currentGallery[this.currentIndex].retrieve("href"),"_blank","width="+screen.availWidth+",height="+screen.availHeight+",resizable=1,status=0,scrollbars=1,location=0,top=0,left=0")}});function myLightboxStart(B){milkbox.changeOptions({autoPlay:true,autoPlayDelay:3});var A={gallery:B};milkbox.showGallery(A)}window.addEvent("domready",function(){milkbox=new Milkbox()})