/* JSCmprsd Hash:e53d3872cd28c6d515188e306e294283 */
/** Copyright **/
/*
	Milkbox v2.3 by Luca Reghellin (http://www.reghellin.com) August 2009, MIT-style license.
	Modified for education.com by Graham McNicoll.
	Inspiration Lokesh Dhakar (http://www.lokeshdhakar.com/projects/lightbox2/)
*/
/** End Copyright **/
var Milkbox=new Class({Implements:[Options,Events],options:{overlayOpacity:0.7,topPosition:50,initialWidth:250,initialHeight:250,minCanvasWidth:300,canvasBorderWidth:"0px",canvasBorderColor:"#000000",canvasPadding:"0px",resizeDuration:500,resizeTransition:"sine:in:out",fadeDuration:"short",initialDelay:500,editcaptionlink:"(edit&nbsp;caption)",editcaptiontitle:"edit this photo's caption",showtitle:true,autoPlay:false,autoPlayDelay:7,removeTitle:false,autoSize:true,maxHeight:0,imageOfText:"of",onXmlGalleries:$empty,onClosed:$empty,onFileReady:$empty,onOpen:$empty,onRequest:$empty,onShow:$empty},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.reported=[];this.owner=[];this.loadedImages=[];this.currentFile=null;this.currentIndex=null;this.currentGallery=null;this.currentRequest=null;this.currentResponse=null;this.mode=null;this.closed=true;this.busy=true;this.paused=true;this.fileReady=false;this.eventsok=false;this.first=true;this.typing=false;this.intObj=null;this.formtags=null;this.prepareGalleries();if(this.galleries.length==0){return }this.initMilkbox();this.saveOptions()},initMilkbox:function(){this.prepareHTML();this.prepareEffects();this.prepareEvents();this.formtags=$$("select","textarea");this.activated=true;this.center.addEvent("fix_height",this.fix_height.bind(this))},openMilkbox:function(B,D){this.closed=false;this.hideAds();this.fireEvent("open",B[D]);if(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=B;this.currentIndex=D;this.overlay.tween("opacity",this.options.overlayOpacity);this.setTitle(this.currentIndex);if(B.length==1){this.mode="singleFile";this.loadFile(B[D],D)}else{this.mode="fileGallery";var A=0;$$(this.prev,this.next,this.count).setStyle("display","block");if(this.options.autoPlay){this.playpause.setStyle("display","block");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;this.navigation.setStyle("width",H);this.description.setStyle("margin-right",H);this.subdescription.setStyle("margin-right",H);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.fireEvent("request",[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,this.subdescription).setStyle("visibility","hidden");this.navigation.setStyle("height","");$$(this.next,this.prev,this.close).setStyle("backgroundPosition","0 0");this.showFile(A)},hideAds:function(){$$("div.ad").each(function(A){A.setStyle("visibility","hidden")})},showAds:function(){$$("div.ad").each(function(A){A.setStyle("visibility","visible")})},showFile:function(B){if(this.closed){return }var D=new Hash();var I=new Hash();var E,J;var C,H,G,A,F;E=J={};C=H=G=A=F=0;if(this.options.canvasBorderWidth.toInt()!=0&&this.canvas.getStyle("borderWidth").toInt()==0){G=this.options.canvasBorderWidth+" solid "+this.options.canvasBorderColor;this.canvas.setStyle("border",G)}if(this.options.canvasPadding.toInt()!=0&&this.canvas.getStyle("padding").toInt()==0){A=this.options.canvasPadding;this.canvas.setStyle("padding",A)}J=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(K){return K.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()})}I=I.extend(this.center.getStyles("width","height")).map(function(K){return K.toInt()});if(D.width!=I.width){E.width=D.width+C;if(E.width<this.options.minCanvasWidth){E.width=this.options.minCanvasWidth}E.marginLeft=-(E.width/2).round()}H=(J.y-C>0)?I.height-J.y:0;E.height=D.height+C+H;this.canvas.setStyles({width:D.width,height:D.height});this.center.removeClass("mbLoading");if(this.first){F=this.options.initialDelay;this.first=false}(function(){this.center.morph(E)}).delay(F,this);this.fireEvent("show",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 C=($chk(A.index))?A.index:0;var B=this.getGallery(A.gallery);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)}}},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.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.canvas.setStyles({border:A,padding:this.options.canvasPadding});this.center.get("morph").setOptions({transition:this.options.resizeTransition,duration:this.options.resizeDuration})},reloadGalleries:function(){this.galleries=[];this.families=[];this.formtags=$$("select","textarea");this.prepareGalleries();this.removeGalleriesEvents();this.setGalleriesEvents();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.next.addEvent("click",this.next_prev_aux.bindWithEvent(this,"next"));this.prev.addEvent("click",this.next_prev_aux.bindWithEvent(this,"prev"));$$(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"){if(!this.typing){this.next_prev_aux(B,"next")}}else{if(B.key=="left"){if(!this.typing){this.next_prev_aux(B,"prev")}}else{if(B.key=="esc"){this.closeMilkbox()}}}}.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 H=(!(this.mode=="showThisImage"))?this.get_title():this.specialDescription;if($chk(H)){if($type(H)=="element"){this.description.adopt(H)}else{this.description.innerHTML=H}}var C=$(this.currentGallery[this.currentIndex].get("id")+"-desc");if(C){var E=C.get("html");if(E=='" "'||E==" "){this.subdescription.set("html","")}else{this.subdescription.set("html",C.get("html"))}if(this.currentGallery[this.currentIndex].retrieve("owner")){this.addButtons()}if(!this.reported.contains(G)){if(this.subdescription.getElement(".reportInappropriateLink")){var B=this.subdescription.getElement(".reportInappropriateLink");var G=B.get("rel").toInt();B.addEvent("click",function(J){J.stop();if(!this.reported.contains(G)){this.reportImg(B,G)}}.bind(this))}}}if(this.mode=="fileGallery"){this.count.appendText((this.currentIndex+1)+" "+this.options.imageOfText+" "+this.currentGallery.length)}var D=this.center.getStyle("height").toInt();this.navigation.setStyle("height",this.bottom.getStyle("height").toInt());var I=this.bottom.getSize().y;var F=(D>this.canvas.getSize().y)?(this.bottom.getSize().y+this.canvas.getSize().y+this.toparea.getSize().y)-D:I+this.toparea.getSize().y;this.bottom.setStyle("display","none");this.center.retrieve("setFinalHeight").start(D,D+F)}.bindWithEvent(this));this.center.retrieve("setFinalHeight").addEvent("onComplete",function(){this.bottom.setStyles({visibility:"visible",display:"block"});$$(this.description,this.navigation,this.subdescription).setStyle("visibility","visible");var B=$(window).getScrollSize().y;var C=$(window).getScroll().y;this.overlay.setStyles({height:B+C,top:-C});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+C,top:-C})}.bindWithEvent(this));$$(this.overlay,this.close).addEvent("click",this.closeMilkbox.bindWithEvent(this));this.eventsok=true},reportImg:function(A,B){new Request.JSON({url:"/",method:"get",onSuccess:function(D){if(D.responseCode){if(D.responseCode==1){A.set("text",D.msg);if(!this.reported.contains(B)){this.reported.push(B)}var E=new Element("span",{html:A.get("html"),"class":A.className,style:A.style,rel:A.get("rel")});if(E.hasClass("comment-flag")){E.removeClass("comment-flag")}E.inject(A.getParent());var C=$(this.currentGallery[this.currentIndex].get("id")+"-desc");if(C){E.clone().replaces(C.getElement(".reportInappropriateLink"))}A.destroy()}else{A.setText(D.msg)}}}.bind(this)}).get({__json:"Modal_GalleryManager",fn:"reportAsInappropriate",fid:B})},get_title:function(){var A=$(this.currentGallery[this.currentIndex].get("id")+"-title");if(A){return A.get("html")}if(this.currentGallery[this.currentIndex].retrieve("title")){var B=this.currentGallery[this.currentIndex].retrieve("title");if(this.currentGallery[this.currentIndex].retrieve("owner")){return this.makeEditableTitle(B)}return B}else{if(this.currentGallery[this.currentIndex].retrieve("owner")){return this.makeEditableTitle("")}}return""},addButtons:function(){var A=new Element("a",{href:"#",html:"delete image","class":"floatright",events:{click:function(E){E.stop();this.subovly=new Element("div",{styles:{opacity:0,visibility:"hidden",position:"absolute",width:this.center.getSize().x,height:this.center.getSize().y,top:-this.center.getStyle("padding-top").toInt(),left:-this.center.getStyle("padding-left").toInt(),"background-color":"#ffffff"}}).inject(this.center);this.questionwrap=new Element("div",{styles:{opacity:0,visibility:"hidden","background-color":"#ffffff",position:"absolute",top:0,left:0,"font-size":"12px",padding:"10px","text-align":"center"}}).inject(this.center);var B=new Element("div",{html:"Are you sure you want to delete this image?",styles:{"padding-bottom":"5px","text-align":"center"}}).inject(this.questionwrap);var H=new Element("div",{styles:{"text-align":"center"}}).inject(this.questionwrap);var G=new Element("a",{html:"Nevermind",href:"#",events:{click:function(I){I.stop();this.subovly.fade(0);this.questionwrap.get("tween").start("opacity",0).chain(function(){this.subovly.destroy();this.questionwrap.destroy()}.bind(this))}.bind(this)}}).inject(H);var F=new Element("a",{html:"Yes, delete it",href:"#",styles:{"margin-left":"18px"},events:{click:function(I){I.stop();H.setStyle("height",H.getSize().y).set("html","").adopt(new Element("img",{src:"/themes/sky/i/widgets/loader-arrow-orange.gif"}));B.set("html","Deleteing, please wait...");var J={};J.__json="Modal_GalleryManager";J.fn="deleteFile";J.fid=this.currentGallery[this.currentIndex].retrieve("fid");new Request.JSON({url:"/",method:"post",onSuccess:function(K){this.questionwrap.set("html",K.msg);if(K&&K.responseCode==1){this.currentGallery[this.currentIndex].setStyle("display","none");if(this.options.containerClassName){this.currentGallery[this.currentIndex].getParent("."+this.options.containerClassName).setStyle("display","none")}delete this.currentGallery[this.currentIndex];delete this.galleries[this.currentIndex];this.currentGallery=this.currentGallery.clean();this.galleries=this.galleries.clean();if(this.filmLinks&&this.filmLinks[this.currentIndex]){this.filmLinks[this.currentIndex].get("tween").start("opacity",0)}this.canvas.getElement("img").get("tween").start("opacity",0);(function(){if(this.filmLinks&&this.filmLinks[this.currentIndex]){this.filmLinks[this.currentIndex].destroy();delete this.filmLinks[this.currentIndex];this.filmLinks=this.filmLinks.clean();var L=this.currentIndex;if(L>=this.filmLinks.length){L=this.currentIndex-1}if(!this.currentGallery[L]){this.closeMilkbox()}else{this.loadFilmStrip(this.currentGallery,L);this.jumpTo(L)}}else{}}).delay(1500,this)}else{(function(){this.subovly.fade(0);this.questionwrap.get("tween").start("opacity",0).chain(function(){this.subovly.destroy();this.questionwrap.destroy()}.bind(this))}).delay(2000,this)}}.bind(this),onFailure:function(){(function(){this.subovly.fade(0);this.questionwrap.get("tween").start("opacity",0).chain(function(){this.subovly.destroy();this.questionwrap.destroy()}.bind(this))}).delay(2000,this)}}).send(Hash.toQueryString(J))}.bind(this)}}).inject(H);var C=this.subovly.getSize();var D=this.questionwrap.getSize();if(D.x>C.x){this.questionwrap.setStyle("width",C.x);D=this.questionwrap.getSize()}else{this.questionwrap.setStyle("width",D.x)}this.questionwrap.setStyles({top:((C.y/2)-(D.y/2)),left:((C.x/2)-(D.x/2))});this.subovly.fade(0.7);(function(){this.questionwrap.fade("in")}).delay(300,this)}.bind(this)}});A.inject(this.subdescription,"bottom");new Element("br").inject(A,"before")},makeEditableTitle:function(D){var C=new Element("div",{styles:{position:"relative"},"class":"iefix"});var B=new Element("span",{"class":"thedesc",html:D,styles:{"margin-right":5}}).inject(C);var A=new Element("a",{href:"#",title:this.options.editcaptiontitle,html:this.options.editcaptionlink,"class":"",styles:{margin:"0",clear:"left"},events:{click:function(E){E.stop();this.openEditTitle(C,B)}.bind(this)}}).inject(C);new Element("div",{styles:{clear:"left",height:"1px","line-height":"1px","font-size":"1px"}}).inject(C);return C},openEditTitle:function(A,G){this.typing=true;var E=new Element("div",{styles:{width:A.getSize().x,height:20,position:"absolute",top:0,left:0}});var D=new Element("textarea",{html:G.get("text"),styles:{width:A.getSize().x-6,height:10,top:0,left:0}});var B=new Element("span",{});var C=new Element("div",{styles:{width:300,color:"#be1b1b",display:"none","float":"left",clear:"left","background-color":"#ffffff"},html:"Characters remaining: "}).adopt(B);var H=new Element("a",{href:"#",html:"cancel","class":"floatright",styles:{"margin-right":8},events:{click:function(J){J.stop();D.tween("height",0);E.get("tween").start("height",0).chain(function(){E.destroy()}.bind(this));$$(this.description.getElement(".thedesc"),this.subdescription).fade("in");this.fix_height()}.bind(this)}});var F=new Element("a",{"class":"floatright",html:"Save",href:"#",events:{click:function(K){K.stop();var L={};L.__json="Modal_GalleryManager";L.fn="updateFile";L.fid=this.currentGallery[this.currentIndex].retrieve("fid");L.desc=D.get("value");var J=new Element("div",{"class":"mbLoading",styles:{opacity:0.7,"background-color":"#ffffff",position:"absolute",top:0,left:0,width:E.getSize().x,height:E.getSize().y}}).inject(A);new Request.JSON({url:"/",method:"post",onSuccess:function(M){this.typing=false;if(M.responseCode&&M.responseCode==1){C.set("html",M.msg).setStyles({color:"green",display:""});A.getElement(".thedesc").set("html",M.desc);this.currentGallery[this.currentIndex].store("title",M.desc);F.destroy();H.destroy()}else{C.set("html",M.msg)}J.destroy();(function(){D.tween("height",0);E.get("tween").start("height",0).chain(function(){E.destroy()}.bind(this));this.fix_height();$$(this.description.getElement(".thedesc"),this.subdescription).fade("in")}.bind(this)).delay(2000)}.bind(this),onFailure:function(){D.tween("height",0);E.get("tween").start("height",0).chain(function(){E.destroy()}.bind(this));this.fix_height();$$(this.description.getElement(".thedesc"),this.subdescription).fade("in")}}).send(Hash.toQueryString(L))}.bind(this)}});E.adopt(D,F,H,C).inject(A);D.tween("height",60);E.tween("height",90);this.center.tween("height",(this.center.getStyle("height").toInt()+40));$$(this.description.getElement(".thedesc"),this.subdescription).fade("out");var I=new textlimiter({inputdiv:D,limit:160,numberdiv:B,showlimit:50,showdiv:C})},fix_height:function(){var B=this.bottom.getSize().y.toInt()+this.bottom.getStyle("padding-top").toInt()+this.center.getStyle("padding-bottom").toInt();if(B<53){B=53}var A=(B+this.canvas.getSize().y.toInt());this.center.retrieve("setFinalHeight").start(A)},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.subdescription.empty();this.count.empty();if(this.subovly){this.subovly.destroy()}if(this.questionwrap){this.questionwrap.destroy()}this.loadFile(this.currentGallery[A],[this.currentGallery[B]])},prepareEffects:function(){this.overlay.set("tween",{duration:this.options.fadeDuration,link:"cancel"});this.center.set("tween",{duration:this.options.fadeDuration,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:this.options.fadeDuration}));this.canvas.set("tween",{link:"chain"})},prepareGalleries:function(B){var E=[];var D;if(B){var C=B}else{var A="";if(this.options.parentElementId){A+="#"+this.options.parentElementId+" "}if(this.options.containerClassName){A+="."+this.options.containerClassName+" "}A+="a";if(this.options.linkClassName){A+="."+this.options.linkClassName}var C=$$(A)}C.each(function(F){if(F.rel&&F.rel.test(/^milkbox/i)&&F.href.split("?")[0].test(/\.(gif|jpg|jpeg|png|swf)$/i)){if(F.rel.length>7&&!this.families.contains(F.rel)){this.families.push(F.rel)}E.push(F)}},this);E.each(function(F){$(F).store("href",F.href);$(F).store("rel",F.rel);$(F).store("title",F.title);$(F).store("fid",F.get("id").replace("cimg-",""));if($(F.get("id")+"-owner")){$(F).store("owner",true)}else{$(F).store("owner",false)}if(this.checkFileType(F.href,"swf")){this.setFileProps($(F),F.rev)}if(this.options.removeTitle){$(F).removeProperty("title")}if(F.rel.length>7){this.families.each(function(J,I){if(F.rel==J){var G=false;var H;this.galleries.each(function(L,K){if(L[0].rel==J){G=true;H=K;return }});if(G==true){this.galleries[H].push($(F))}else{this.galleries.push([$(F)])}}},this)}else{this.galleries.push([$(F)])}},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.toparea=new Element("div",{id:"mbTop","class":"containme",visibility:"hidden",opacity:0}).inject(this.center);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.subdescription=new Element("div",{id:"mbSubDesc","class":"containme"}).setStyle("visibility","hidden");this.bottom.adopt(this.navigation,this.description,this.subdescription,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.next,this.prev,this.playpause,new Element("div",{"class":"mbClear"}),this.count);this.toparea.adopt(this.close)},setTitle:function(A){if(this.options.showtitle){if(!this.gallerytitle){this.gallerytitle=new Element("div",{id:"mbTitle"}).inject(this.toparea)}this.gallerytitle.set("html",this.currentGallery[A].get("rel").replace(/^milkbox:/i,""));(function(){this.toparea.get("tween",{duration:this.options.fadeDuration}).start("opacity",1)}).delay((this.options.fadeDuration*5),this)}},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 A=this.center.getStyle("border-right-width").toInt();var B=this.navigation.getSize().x+A;this.navigation.setStyles({width:B,height:"",visibility:"hidden"});this.toparea.setStyles({visibility:"hidden"});this.description.setStyle("margin-right",B);this.description.empty();this.subdescription.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.get("tween").start("opacity",0).chain(function(){this.showAds()}.bind(this));if(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()},destroy:function(){if(this.overlay){this.overlay.destroy()}if(this.center){this.center.destroy()}}});var FilmStripMilkbox=new Class({Extends:Milkbox,options:{showFilmStrip:true,initialFilmWidth:500,initialFilmHeight:60,pxOffBottom:14,filmOpacity:0.5,numberToShow:false,showPointer:true,thumbnailDrawMethod:"none",thumbnailWidth:"auto",thumbnailHeight:"auto"},initialize:function(A){this.parent(A);this.thumbHeightMax=0;this.ie6FudgeWidth=10},prepareHTML:function(){this.parent();this.filmStrip=new Element("div",{id:"mbFilmstrip",styles:{position:"absolute",left:"50%",bottom:(-1*(this.options.initialFilmHeight+this.options.pxOffBottom)),"z-index":"119",overflow:"hidden",width:this.options.initialFilmWidth,height:this.options.initialFilmHeight,opacity:0}}).inject(this.center);this.filmLeftArrow=new Element("a",{href:"#","class":"mbFilmArrow mbFilmArrowLeft",events:{click:function(A){A.stop();if(this.filmStripOverflow){this.paginate("prev")}}.bind(this)},html:"prev"});this.filmStripLeft=new Element("div",{id:"mbFilmstripLeft",styles:{"float":"left"}}).adopt(this.filmLeftArrow).inject(this.filmStrip);this.filmRightArrow=new Element("a",{href:"#","class":"mbFilmArrow mbFilmArrowRight",events:{click:function(A){A.stop();if(this.filmStripOverflow){this.paginate("next")}}.bind(this)},html:"next"});this.filmStripRight=new Element("div",{id:"mbFilmstripRight",styles:{"float":"right"}}).adopt(this.filmRightArrow).inject(this.filmStrip);this.filmStripInnerWrap=new Element("div",{id:"mbFilmstripInnerWrap",styles:{position:"relative",overflow:"hidden",left:0,"z-index":"120",width:(this.options.initialFilmWidth-this.filmStripLeft.getSize().x-this.filmStripRight.getSize().x),height:this.options.initialFilmHeight,marginLeft:this.filmStripLeft.getSize().x}}).inject(this.filmStrip);this.filmStripInner=new Element("div",{id:"mbFilmstripInner",styles:{position:"absolute",left:0,"z-index":"120",width:4000,height:this.options.initialFilmHeight}}).inject(this.filmStripInnerWrap);this.filmLeftFade=new Element("div",{styles:{position:"absolute","z-index":130,top:0,left:this.filmStripLeft.getSize().x},"class":"mbFilmstripFade mbFilmstripFadeLeft"}).inject(this.filmStrip);this.filmRightFade=new Element("div",{styles:{position:"absolute","z-index":130,top:0,right:this.filmStripRight.getSize().x},"class":"mbFilmstripFade mbFilmstripFadeRight"}).inject(this.filmStrip);if(this.options.showPointer){this.filmStripPointer=new Element("div",{"class":"mbFilmstripPointer",styles:{position:"absolute",left:0,"z-index":141}});this.filmStripPointerWrap=new Element("div",{"class":"mbFilmstripPointerWrap",styles:{position:"absolute",left:0,bottom:0,"z-index":140}}).adopt(this.filmStripPointer).inject(this.filmStripInner)}this.overlay.setStyle("height",this.overlay.getStyle("height").toInt()+this.options.initialFilmHeight);if(Browser.Engine.trident4){this.filmStrip.addClass("png-ie6");this.filmStripInnerWrap.setStyle("width",(this.filmStripInnerWrap.getStyle("width").toInt()-this.ie6FudgeWidth))}},prepareEffects:function(){this.parent();this.filmStrip.set("tween",{duration:this.options.fadeDuration,link:"chain"});this.filmStripInner.set("tween",{duration:this.options.fadeDuration,link:"chain"});this.filmStripPointer.set("tween",{duration:this.options.fadeDuration,link:"chain"})},openMilkbox:function(A,B){this.parent(A,B);if(A.length>1){this.loadFilmStrip(A,B)}},closeMilkbox:function(){this.parent();this.filmStrip.setStyles({display:"none"})},loadFilmStrip:function(B,D){this.filmLinks=[];this.filmWidth=0;this.filmStrip.setStyles({display:""});this.filmStripInner.getElements(".mbFilmimgWrap").destroy();B.each(function(G,K){if(this.options.thumbnailDrawMethod=="crop"){var J=G.getElement("img").get("src");var I=new Element("span",{"class":"mbFilmimg mbFilmimgCrop",styles:{"background-image":"url("+G.getElement("img").get("src").replace("50x50_scaledown.","120x120_scaledown.")+")",width:this.options.thumbnailWidth,height:this.options.thumbnailHeight,display:"block","background-repeat":"no-repeat","background-color":"transparent","background-position":"50% 50%"}})}else{if(this.options.thumbnailDrawMethod=="squeeze"){var I=new Element("img",{src:G.getElement("img").get("src").replace("50x50_scaledown.","120x120_scaledown."),"class":"mbFilmimg mbFilmimgSqueeze",styles:{width:this.options.thumbnailWidth,height:this.options.thumbnailHeight}})}else{var I=G.getElement("img").clone().set("class","mbFilmimg")}}var H=new Element("a",{href:G.get("href"),"class":"mbFilmLink",events:{click:function(L){L.stop();this.jumpTo(K)}.bind(this),mouseenter:function(L){if(this.currentIndex!=K){H.setStyle("opacity",1);H.addClass("hovering")}}.bind(this),mouseleave:function(L){if(this.currentIndex!=K){H.setStyle("opacity",this.options.filmOpacity)}H.removeClass("hovering")}.bind(this)},opacity:this.options.filmOpacity});this.filmLinks[K]=new Element("div",{"class":"mbFilmimgWrap",styles:{"float":"left"}}).adopt(H.adopt(I)).inject(this.filmStripInner);var F=this.filmLinks[K].getSize();this.filmWidth+=F.x.toInt();if(F.y>this.thumbHeightMax){this.thumbHeightMax=F.y}}.bind(this));this.filmLeftFade.setStyle("height",this.thumbHeightMax);this.filmRightFade.setStyle("height",this.thumbHeightMax);this.filmStripInner.setStyles({width:this.filmWidth,height:"auto"});if(this.options.showPointer){var E=((this.thumbHeightMax+this.filmStripPointerWrap.getSize().y)>this.filmLeftArrow.getSize().y)?(this.thumbHeightMax+this.filmStripPointerWrap.getSize().y):this.filmLeftArrow.getSize().y;this.filmStripInnerWrap.setStyle("height",E);this.filmStripPointer.setStyles({left:(-1*(this.filmStripPointer.getSize().x/2))})}else{var E=(this.thumbHeightMax>this.filmLeftArrow.getSize().y)?this.thumbHeightMax:this.filmLeftArrow.getSize().y}this.filmStrip.setStyle("height",E);var C=0;if(Browser.Engine.trident4){C=this.ie6FudgeWidth}if(this.options.numberToShow){var A=(this.options.numberToShow<B.length)?(this.options.numberToShow.toInt()*this.filmLinks[0].getSize().x):(B.length*this.filmLinks[0].getSize().x);this.filmStripInnerWrap.setStyle("width",A);this.filmStrip.setStyle("width",(this.filmStripLeft.getSize().x+this.filmStripRight.getSize().x+A+C))}this.filmStripOverflow=false;if(this.filmWidth>this.filmStripInnerWrap.getSize().x){this.filmStripOverflow=true}else{this.disableEdges()}this.filmStrip.setStyle("margin-left",-1*(this.filmStrip.getSize().x/2));this.filmStrip.tween("opacity",1);if(this.filmLinks[D]){this.centerize(D)}},centerize:function(B){this.filmLinks.each(function(E){E.removeClass("viewing");E.getElement("a").setOpacity(this.options.filmOpacity)}.bind(this));this.filmLinks[B].addClass("viewing");this.filmLinks[B].getElement("a").setOpacity(1);var D=this.filmLinks[B].getPosition(this.filmStripInner);if(this.filmStripOverflow){this.resetEdges();var A=((this.filmStripInnerWrap.getSize().x/2)-((this.filmLinks[B].getSize().x)/2));var C=A-D.x;if(C>0){C=0;this.atLeftEdge()}if(C*(-1)>(this.filmWidth-this.filmStripInnerWrap.getSize().x)){C=(-1)*(this.filmWidth-this.filmStripInnerWrap.getSize().x);this.atRightEdge()}this.filmStripInner.tween("left",C)}if(this.options.showPointer){this.filmStripPointerWrap.tween("left",(D.x+((this.filmLinks[B].getSize().x)/2)))}},jumpTo:function(C){this.centerize(C);this.canvas.empty();this.description.empty();this.subdescription.empty();this.count.empty();if(this.subovly){this.subovly.destroy()}if(this.questionwrap){this.questionwrap.destroy()}var A=this.currentIndex=C;var B=A-1;if(A==0){B=this.currentGallery.length-1}if(A==this.currentGallery.length-1){B=0}this.loadFile(this.currentGallery[A],[this.currentGallery[B]])},next_prev_aux:function(B,A){this.parent(B,A);this.centerize(this.currentIndex)},paginate:function(B){var A=this.filmStripInnerWrap.getSize().x;this.resetEdges();if(B=="next"){var C=this.filmStripInner.getStyle("left").toInt()-A;if(C*(-1)>(this.filmWidth-A)){C=(-1)*(this.filmWidth-A);this.atRightEdge()}}else{var C=this.filmStripInner.getStyle("left").toInt()+A;if(C>0){C=0;this.atLeftEdge()}}this.filmStripInner.tween("left",C)},disableEdges:function(){this.disableLeftEdge();this.disableRightEdge()},resetEdges:function(){this.filmRightArrow.removeClass("disabled");this.filmLeftArrow.removeClass("disabled");this.filmRightFade.setStyle("display","");this.filmLeftFade.setStyle("display","")},atLeftEdge:function(){this.disableLeftEdge();this.filmRightArrow.removeClass("disabled");this.filmRightFade.setStyle("display","")},atRightEdge:function(){this.disableRightEdge();this.filmLeftArrow.removeClass("disabled");this.filmLeftFade.setStyle("display","")},disableLeftEdge:function(){this.filmLeftArrow.addClass("disabled");this.filmLeftFade.setStyle("display","none")},disableRightEdge:function(){this.filmRightArrow.addClass("disabled");this.filmRightFade.setStyle("display","none")}});