/* 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 */ var milkbox = new class({ implements:[options,events], options:{//set all the options here overlayopacity:0.7, topposition:50, initialwidth:250, initialheight:250, canvasborderwidth:'0px', canvasbordercolor:'#000000', canvaspadding:'0px', resizeduration:500, resizetransition:'sine:in:out',/*function (ex. transitions.sine.easein) or string (ex. 'bounce:out')*/ autoplay:false, autoplaydelay:7, removetitle:false, autosize:true, maxheight:0,//only if autosize==true imageoftext:'of', onxmlgalleries:$empty, onclosed:$empty, onfileready:$empty }, initialize: function(options){ this.setoptions(options); this.autoplaybkup = { autoplaydelay:this.options.autoplaydelay, autoplay:this.options.autoplay }; this.fulloptionsbkup = {}; this.galleries = []; this.families = []; this.xmlfiles = []; this.loadedimages = [];//to check the preloaded images this.currentfile = null; this.currentindex = null; this.currentgallery = null; this.currentrequest = null; this.currentresponse = null; this.mode = null;//'singlefile','filegallery' this.closed = true; this.busy = true;//to control keyboard and autoplay events this.paused = true; this.fileready = false;//to prevent overlapping loadfile calls via next_prev_aux() this.eventsok = false; this.first = true;//true if it's the first file since it opened this.activated = false;//true after initmilkbox this.intobj = null; this.formtags = null; this.preparegalleries(); if(this.options.overlayopacity == 0){ this.options.overlayopacity = 0.0001 } this.saveoptions();//then use restoreoptions() //if no galleries, stop here and prevent extra memory usage. //so you can keep milkbox in every page of a site. if(this.galleries.length == 0){ return; }; this.initmilkbox(true); },//end init initmilkbox:function(checktags){ if(checktags){ this.formtags = $$('select','textarea'); } this.preparehtml(); this.prepareeffects(); this.prepareevents(); this.activated = true; }, /* ****** show/hide ****** */ //runs only 1 time per gallery openmilkbox:function(gallery,index){ this.closed = false; if(this.formtags && this.formtags.length != 0){ this.formtags.setstyle('display','none') }; this.overlay.setstyles({ 'top': -$(window).getscroll().y,'height':$(window).getscrollsize().y+$(window).getscroll().y }); this.center.setstyle('top',$(window).getscroll().y+this.options.topposition); this.currentgallery = gallery; this.currentindex = index; this.overlay.tween('opacity',this.options.overlayopacity);//oncomplete: center.tween opacity if(gallery.length == 1){ this.mode = 'singlefile'; this.loadfile(gallery[index],index); } else { this.mode = 'filegallery'; var playpausewidth = 0; //interface $$(this.prev, this.next, this.count).setstyle('display','block'); if(this.options.autoplay){ this.playpause.setstyle('display','block'); playpausewidth = this.playpause.getsize().x; } var border = this.center.getstyle('border-right-width').toint();//border-right is just ok for design purposes.. var navwidth = this.prev.getsize().x+this.next.getsize().x+this.close.getsize().x+playpausewidth+border; this.navigation.setstyle('width',navwidth); this.description.setstyle('margin-right',navwidth); //files var next = (index != gallery.length-1) ? gallery[index+1] : gallery[0]; var prev = (index != 0) ? gallery[index-1] : gallery[gallery.length-1]; var preloads = (prev == next) ? [prev] : [prev,next]; //if gallery.length == 2, then prev == next this.loadfile(gallery[index],preloads); }//end else }, loadfile:function(fileobj,preloads){ this.fileready = false; var swf = this.checkfiletype(fileobj,'swf'); if(!swf){ if(!this.loadedimages.contains(fileobj.retrieve('href'))){ this.center.addclass('mbloading'); } this.loadimage(fileobj.retrieve('href')); } else { this.loadswf(fileobj); } if(preloads){ this.preloadfiles(preloads); } }, preloadfiles:function(preloads){ preloads.each(function(fileobj,index){ var swf = this.checkfiletype(fileobj.retrieve('href'),"swf"); if(!swf){ this.preloadimage(fileobj.retrieve('href')); } },this); }, loadimage:function(file){ var imageasset = new asset.image(file, { onload:function(img){ if(!this.loadedimages.contains(file)){ this.loadedimages.push(file); };//see next/prev events this.currentfile = img; this.loadaux(this.currentfile); }.bindwithevent(this)}); }, preloadimage:function(file){ if(!this.loadedimages.contains(file)){ var imageasset = new asset.image(file, { onload:function(img){ this.loadedimages.push(file); }.bindwithevent(this)}); } }, loadswf:function(swf){ var swfobj = new swiff(swf.retrieve('href'),{ width:swf.retrieve('width').toint(), height:swf.retrieve('height').toint(), params:{ wmode:'opaque', swliveconnect:'false' } }); this.currentfile = swfobj; this.loadaux(swf); }, loadaux:function(file){ this.fileready = true; //the file is loaded and ready to be showed (see next_prev_aux()) this.fireevent('fileready'); $$(this.description,this.navigation).setstyle('visibility','hidden'); this.navigation.setstyle('height','');//reset the height setted in center.morph.oncomplete $$(this.next,this.prev,this.close).setstyle('backgroundposition','0 0'); this.showfile(file); }, showfile:function(file){ if(this.closed){ return; };//if you close the milkbox and an onload event is still running var filesize = new hash(); var centersize = new hash(); var targetsize, canvassize; var canvasaddsize, gap, b, p, d; targetsize = canvassize = {}; canvasaddsize = gap = b = p = d = 0; if(this.options.canvasborderwidth.toint() != 0 && this.canvas.getstyle('borderwidth').toint() == 0){ b = this.options.canvasborderwidth + ' solid ' + this.options.canvasbordercolor; this.canvas.setstyle('border',b); } if(this.options.canvaspadding.toint() != 0 && this.canvas.getstyle('padding').toint() == 0){ p = this.options.canvaspadding; this.canvas.setstyle('padding',p); } canvassize = this.canvas.getsize(); canvasaddsize = this.canvas.getstyle('borderwidth').toint()*2 + this.canvas.getstyle('padding').toint()*2; this.canvas.setstyles({'opacity':0, 'width':'', 'height':''}); if(!file.retrieve('width')){//is an image file filesize = filesize.extend(file.getproperties('width','height')).map(function(item){ return item.toint(); }); if(this.options.autosize){ filesize = this.computesize(filesize); file.setproperties({ 'width':filesize.width, 'height':filesize.height }); } } else {//is an swf file filesize.extend({ 'height':file.retrieve('height').toint(), 'width':file.retrieve('width').toint() }); } centersize = centersize.extend(this.center.getstyles('width','height')).map(function(item){ return item.toint(); }); if(filesize.width != centersize.width){ targetsize.width = filesize.width + canvasaddsize; targetsize.marginleft = -(targetsize.width/2).round(); } gap = (canvassize.y-canvasaddsize > 0) ? centersize.height - canvassize.y : 0; targetsize.height = filesize.height + canvasaddsize + gap; //so nav doesn't move when you click next/prev this.canvas.setstyles({'width':filesize.width, 'height':filesize.height}); this.center.removeclass('mbloading'); if(this.first){ d = 500; this.first = false; } (function(){ this.center.morph(targetsize); }).delay(d,this)//oncomplete: show all items }, computesize:function(osize){ var size = osize; var wsize = window.getsize(); var basesize = { width:wsize.x-60, height:wsize.y-68-this.options.topposition*2 };//cut out some pixels to make it better var ratio; var check; var max = math.max( basesize.height, basesize.width ); if(max == basesize.width){ ratio = max/size.width; check = 'height'; } else { ratio = max/size.height; check = 'width'; } ratio = (ratio <= 1) ? ratio : 1; size = size.map(function(item){ return math.floor(item*ratio); }); ratio = (basesize[check]/size[check] <= 1) ? basesize[check]/size[check] : 1; size = size.map(function(item){ return math.floor(item*ratio); }); if(this.options.maxheight > 0){ ratio = (this.options.maxheight/size.height < 1) ? this.options.maxheight/size.height : 1; size = size.map(function(item){ return math.floor(item*ratio); }); } return size; }, //{ gallery:'gall1', index:2, autoplay:true, delay:7 } showgallery:function(opt){ if(!opt || !opt.gallery){ return; } var fileindex = ($chk(opt.index)) ? opt.index : 0; var g = this.getgallery(opt.gallery); var auto = false; var d; if(opt.autoplay || (g['options'] && g['options'].autoplay)){ auto = true; } if(g != -1 && !this.opened){ if(auto){ d = (opt && opt.delay) ? opt.delay : (g['options'] && g['options'].delay) ? g['options'].delay : this.autoplaydelay; this.startautoplay({ gallery:g, index:fileindex, delay:d }); } else { this.openmilkbox(g,fileindex); } } }, /* ******* xml/ajax ******* */ addgalleries:function(xmlfile){ this.currentrequest = new request({ method:'get', autocancel:true, url:xmlfile, onrequest:function(){ //placeholder }.bindwithevent(this), onsuccess:function(text,xml){ var t = text.replace(/(/gi,"$1>"); this.setgalleries(new element('div',{ html:t }),xmlfile); }.bindwithevent(this), onfailure:function(transport){ alert('milkbox :: addgalleries: xml file path error or local ajax test: please test addgalleries() on-line'); } }); this.currentrequest.send(); }, setgalleries:function(container,xmlfile){ if(!this.xmlfiles.contains(xmlfile)){ this.xmlfiles.push(xmlfile); } var c = container; var galleries = c.getelements('.gallery'); var links = []; var aplist = []; galleries.each(function(gallery,i){ var obj = { gallery:gallery.getproperty('name'), autoplay:boolean(gallery.getproperty('autoplay')), delay:number(gallery.getproperty('delay')) } var l = gallery.getchildren('a'); var lx = l.map(function(link){ return link.setproperty('rel','milkbox['+obj.gallery+']'); }); links.push(lx); if(obj.autoplay){ aplist.push(obj); } }); this.preparegalleries(links.flatten()); this.setautoplay(aplist); if(!this.activated){ this.initmilkbox(); } this.fireevent('xmlgalleries'); }, /* ****** utils ****** */ checkfiletype:function(file,type){ var href = null; if($type(file) != 'string'){ href = file.retrieve('href'); } else{ href = file; } var regexp = new regexp("\.("+type+")$","i"); return href.split('?')[0].test(regexp); }, //retrieves galleries from strings like 'gall1' or 'milkbox[gall1]' or 'milkbox:gall1' getgallery:function(gallery){ var f = null; if(gallery.test(/^milkbox/i)){ f = this.families; } else { //create a temporary array with names without 'milkbox' f = this.families.map(function(item){ var trimmed = item.trim(); var name = trimmed.slice(0,trimmed.length).substr(8); var cleanname = name.replace(/(.+)]$/,"$1"); return cleanname; }); } var i = f.indexof(gallery); var g = (i != -1) ? this.galleries[i] : i; return g; }, setfileprops:function(fileobj,propstring){ var s = propstring.split(','); s.each(function(p,i){ var clean = p.trim().split(':'); fileobj.store(clean[0].trim(),clean[1].trim()) },this); }, changeoptions:function(obj){ if(!obj){ return; } this.setoptions(obj); this.center.get('morph').setoptions({ transition:this.options.resizetransition, duration:this.options.resizeduration }); }, saveoptions:function(obj){ if($chk(obj)){ this.fulloptionsbkup = obj; } else { this.fulloptionsbkup = this.options; } }, restoreoptions:function(){ this.setoptions(this.fulloptionsbkup); var b = this.options.canvasborderwidth + ' solid ' + this.options.canvasbordercolor; this.canvas.setstyles({ 'border':b, 'padding':this.options.canvaspadding}); this.center.get('morph').setoptions({ transition:this.options.resizetransition, duration:this.options.resizeduration }); }, reloadgalleries:function(){ this.galleries = []; this.families = []; //re-check for tags this.formtags = $$('select','textarea'); if(!this.activated){ this.initmilkbox(false); } //reload standard galleries this.preparegalleries(); this.removegalleriesevents(); this.setgalleriesevents(); if(this.xmlfiles.length == 0){ return; } //reload xmlgalleries this.xmlfiles.each(function(xmlfile,index){ this.addgalleries(xmlfile); }.bind(this)); }, /* ****** autoplay ****** */ //list:array of objects or an object > [ { gallery:'gall1', autoplay:true, delay:6 } ] //to permanently define autoplay options for any gallery setautoplay:function(list){ var l = ($type(list) == 'object') ? [list] : list; l.each(function(item){ var g = this.getgallery(item.gallery); if(g == -1){ return; } var a = (item.autoplay == true) ? item.autoplay : false; var d = ($chk(item.delay) && a) ? item.delay : this.options.autoplaydelay; g['options'] = { autoplay:a, delay:d } },this); }, startautoplay:function(opt){//opt: gallery, index, delay (in seconds) var g = -1; var i,d; if(opt && opt.gallery){ if($type(opt.gallery) == 'array'){ g = opt.gallery } else if($type(opt.gallery) == 'string'){ g = this.getgallery(opt.gallery); } } if(g == -1){ g = this.galleries[0]; } d = (opt && opt.delay && ($type(opt.delay) == 'number')) ? opt.delay*1000 : (g['options'] && g['options'].delay) ? g['options'].delay*1000 : this.options.autoplaydelay*1000; i = (opt && opt.index && ($type(opt.index) == 'number')) ? opt.index : 0; if(d < this.options.resizeduration*2){ d = this.options.resizeduration*2 }; this.options.autoplaydelay = d/1000;//save autoplaydelay because now it is customized if(!this.options.autoplay){ this.setoptions({ autoplay:true, autoplaydelay:this.options.autoplaydelay }); } if(this.closed){ this.openmilkbox(g,i); if(this.mode != 'filegallery'){ return; } this.addevent('fileready',function(){ //wait until the first file is loaded 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; }, /* ****** init/close ****** */ removegalleriesevents:function(){ this.galleries.each(function(gallery){ $$(gallery).removeevents('click'); },this); }, setgalleriesevents:function(){ this.galleries.each(function(gallery){ $$(gallery).addevent('click',function(e){ var button=($(e.target).match('a')) ? $(e.target) : $(e.target).getparent('a'); e.preventdefault(); var g = this.getgallery(button.rel); if(g.options && g.options.autoplay){ this.setoptions({ autoplay:g.options.autoplay, autoplaydelay:g.options.delay }); } if(this.options.autoplay){ this.startautoplay({ gallery:gallery, index:gallery.indexof(button) }); } else { this.openmilkbox(gallery, gallery.indexof(button)); } }.bindwithevent(this)); },this); }, //all the main events prepareevents:function(xml){ //galleries this.setgalleriesevents(); //next, prev, see next_prev_aux() this.next.addevent('click',this.next_prev_aux.bindwithevent(this,'next')); this.prev.addevent('click',this.next_prev_aux.bindwithevent(this,'prev')); //css hover doesn't work in ie6, so i must do it via js... $$(this.next,this.prev,this.close).addevents({ 'mouseover':function(){ this.setstyle('backgroundposition','0 -22px'); }, 'mouseout':function(){ this.setstyle('backgroundposition','0 0'); } }); //keyboard next/prev/close $(window.document).addevent('keydown',function(e){ if(this.mode != 'filegallery' || this.busy == true){ return; } if(e.key == 'right' || e.key == 'space'){ this.next_prev_aux(e,'next'); } else if(e.key == 'left'){ this.next_prev_aux(e,'prev'); } else if(e.key == 'esc'){ this.closemilkbox(); } }.bindwithevent(this)); //playpause for autoplay this.playpause.addevents({ 'mouseover':function(e){ 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 d = (this.currentgallery.options && this.currentgallery.options.delay) ? this.currentgallery.options.delay : this.options.autoplaydelay; this.startautoplay({gallery:this.currentgallery, index:this.currentindex+1, delay:d }); this.paused = false; this.playpause.setstyle('backgroundposition','0 0'); } }.bindwithevent(this) }); //overlay 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)); //center this.center.get('morph').addevent('oncomplete',function(){ if($type(this.currentfile) == "element"){//is image file this.canvas.grab(this.currentfile); } else {//object: is swf file (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); } var currentcenterheight = this.center.getstyle('height').toint(); this.navigation.setstyle('height',this.bottom.getstyle('height').toint());//to have the right-border height == total bottom height var bottomsize = this.bottom.getsize().y; //after the 1st time, currentcenterheight is always > this.canvas.getsize().y var targetoffset = (currentcenterheight > this.canvas.getsize().y) ? (this.bottom.getsize().y+this.canvas.getsize().y)-currentcenterheight : bottomsize; this.bottom.setstyle('display','none');//to avoid rendering problems during setfinalheight this.center.retrieve('setfinalheight').start(currentcenterheight,currentcenterheight+targetoffset); }.bindwithevent(this)); this.center.retrieve('setfinalheight').addevent('oncomplete',function(){ this.bottom.setstyles({'visibility':'visible','display':'block'}); $$(this.description,this.navigation).setstyle('visibility','visible'); //reset overlay height based on position and height var scrollsize = $(window).getscrollsize().y; var scrolltop = $(window).getscroll().y; this.overlay.setstyles({'height':scrollsize+scrolltop, 'top':-scrolltop }); this.busy = false; }.bindwithevent(this)); //reset overlay height and position onresize window.addevent('resize',function(){ if(this.overlay.getstyle('opacity') == 0){ return; };//resize only if visible var scrollsize = $(window).getscrollsize().y; var scrolltop = $(window).getscroll().y; this.overlay.setstyles({ 'height':scrollsize+scrolltop,'top':-scrolltop }); }.bindwithevent(this)); //close $$(this.overlay,this.close).addevent('click',this.closemilkbox.bindwithevent(this)); //check this.eventsok = true; }, next_prev_aux:function(e,direction){ if(e){ e.preventdefault(); this.stopautoplay(); } else { //if there's no event obj, than this is called by autoplay() if(this.busy || !this.fileready){ return; }//stop autoplay() } this.busy = true; //for keyboard and autoplay var i, _i; if(direction == "next"){ i= (this.currentindex != this.currentgallery.length-1) ? this.currentindex += 1 : this.currentindex = 0; _i= (this.currentindex != this.currentgallery.length-1) ? this.currentindex + 1 : 0; } else { i= (this.currentindex != 0) ? this.currentindex -= 1 : this.currentindex = this.currentgallery.length-1; _i= (this.currentindex != 0) ? this.currentindex - 1 : this.currentgallery.length-1; }; this.canvas.empty(); this.description.empty(); this.count.empty(); this.loadfile(this.currentgallery[i],[this.currentgallery[_i]]); }, 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(responseelements){ var milkbox_a = []; var a_tags = (responseelements) ? responseelements : $$('a'); a_tags.each(function(a){ //test 'milkbox' and link extension, and collect all milkbox links if(a.rel && a.rel.test(/^milkbox/i) && a.href.split('?')[0].test(/\.(gif|jpg|jpeg|png|swf)$/i)){ if(a.rel.length>7 && !this.families.contains(a.rel)){ this.families.push(a.rel); }; milkbox_a.push(a); } },this); //create an array of arrays with all galleries milkbox_a.each(function(a){ $(a).store('href',a.href); $(a).store('rel',a.rel); $(a).store('title',a.title); if(this.checkfiletype(a.href,"swf")){ this.setfileprops($(a),a.rev); } if(this.options.removetitle){ $(a).removeproperty('title'); } if(a.rel.length > 7){ this.families.each(function(f,i){ if(a.rel == f){ var gmounted = false; var index; this.galleries.each(function(g,k){ if(g[0].rel == f){ gmounted = true; index = k; return; } }); if(gmounted == true){ this.galleries[index].push($(a)); } else { this.galleries.push([$(a)]); } }; },this); } else { this.galleries.push([$(a)]); }; },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.navigation, this.description, new element('div',{'class':'mbclear'})); this.close = new element('a',{'id':'mbcloselink'}); this.next = new element('a',{'id':'mbnextlink'}); this.prev = new element('a',{'id':'mbprevlink'}); this.playpause = new element('a',{'id':'mbplaypause'}); this.count = new element('span',{'id':'mbcount'}); $$(this.next, this.prev, this.count, this.playpause).setstyle('display','none'); this.navigation.adopt(this.close, this.next, this.prev, this.playpause, new element('div',{'class':'mbclear'}), this.count); }, 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.prev, this.next, this.playpause, this.count).setstyle('display','none'); this.playpause.setstyle('backgroundposition','0 0'); var border = this.center.getstyle('border-right-width').toint(); var navwidth = this.close.getsize().x+border; this.navigation.setstyles({'width':navwidth,'height':'','visibility':'hidden'}); this.description.setstyle('margin-right',navwidth); this.description.empty(); this.bottom.setstyles({'visibility':'hidden','display':''}); this.canvas.setstyles({'opacity':0, 'width':'', 'height':''}); this.canvas.empty(); this.count.empty(); this.center.setstyles({'opacity':0,'width':this.options.initialwidth,'height':this.options.initialheight,'marginleft':-(this.options.initialwidth/2)}); this.overlay.tween('opacity',0);//see oncomplete in prepareevents() 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(); } });//end milkbox; window.addevent('domready', function(){ milkbox = new milkbox(); });