Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(B,A){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=$(B);this.parent(A);var C=this.element.retrieve("wrapper");this.wrapper=C||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},set:function(A){this.element.setStyle(this.margin,A[0]);this.wrapper.setStyle(this.layout,A[1]);return this;},compute:function(E,D,C){var B=[];var A=2;A.times(function(F){B[F]=Fx.compute(E[F],D[F],C);});return B;},start:function(B,E){if(!this.check(arguments.callee,B,E)){return this;}this[E||this.options.mode]();var D=this.element.getStyle(this.margin).toInt();var C=this.wrapper.getStyle(this.layout).toInt();var A=[[D,C],[0,this.offset]];var G=[[D,C],[-this.offset,0]];var F;switch(B){case"in":F=A;break;case"out":F=G;break;case"toggle":F=(this.wrapper["offset"+this.layout.capitalize()]==0)?A:G;}return this.parent(F[0],F[1]);},slideIn:function(A){return this.start("in",A);},slideOut:function(A){return this.start("out",A);},hide:function(A){this[A||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(A){this[A||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(A){return this.start("toggle",A);}});Element.Properties.slide={set:function(B){var A=this.retrieve("slide");if(A){A.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},B));},get:function(A){if(A||!this.retrieve("slide")){if(A||!this.retrieve("slide:options")){this.set("slide",A);}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(D,E){D=D||"toggle";var B=this.get("slide"),A;switch(D){case"hide":B.hide(E);break;case"show":B.show(E);break;case"toggle":var C=this.retrieve("slide:flag",B.open);B[(C)?"slideOut":"slideIn"](E);this.store("slide:flag",!C);A=true;break;default:B.start(D,E);}if(!A){this.eliminate("slide:flag");}return this;}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(B,A){this.element=this.subject=$(B);this.parent(A);var D=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=$(this.element.getDocument().body);}var C=this.element;if(this.options.wheelStops){this.addEvent("start",function(){C.addEvent("mousewheel",D);},true);this.addEvent("complete",function(){C.removeEvent("mousewheel",D);},true);}},set:function(){var A=Array.flatten(arguments);this.element.scrollTo(A[0],A[1]);},compute:function(E,D,C){var B=[];var A=2;A.times(function(F){B.push(Fx.compute(E[F],D[F],C));});return B;},start:function(C,H){if(!this.check(arguments.callee,C,H)){return this;}var E=this.element.getSize(),F=this.element.getScrollSize();var B=this.element.getScroll(),D={x:C,y:H};for(var G in D){var A=F[G]-E[G];if($chk(D[G])){D[G]=($type(D[G])=="number")?D[G].limit(0,A):A;}else{D[G]=B[G];}D[G]+=this.options.offset[G];}return this.parent([B.x,B.y],[D.x,D.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");},toElement:function(B){var A=$(B).getPosition(this.element);return this.start(A.x,A.y);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(B,A){this.elements=this.subject=$$(B);this.parent(A);},compute:function(G,H,I){var C={};for(var D in G){var A=G[D],E=H[D],F=C[D]={};for(var B in A){F[B]=this.parent(A[B],E[B],I);}}return C;},set:function(B){for(var C in B){var A=B[C];for(var D in A){this.render(this.elements[C],D,A[D],this.options.unit);}}return this;},start:function(C){if(!this.check(arguments.callee,C)){return this;}var H={},I={};for(var D in C){var F=C[D],A=H[D]={},G=I[D]={};for(var B in F){var E=this.prepare(this.elements[D],B,F[B]);A[B]=E.from;G[B]=E.to;}}return this.parent(H,I);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var B=Array.link(arguments,{options:Object.type,element:$defined});this.element=$(B.element);this.document=this.element.getDocument();this.setOptions(B.options||{});var A=$type(this.options.handle);this.handles=(A=="array"||A=="collection")?$$(this.options.handle):$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this;},start:function(C){if(this.options.preventDefault){C.preventDefault();}this.fireEvent("beforeStart",this.element);this.mouse.start=C.page;var A=this.options.limit;this.limit={x:[],y:[]};for(var D in this.options.modifiers){if(!this.options.modifiers[D]){continue;}if(this.options.style){this.value.now[D]=this.element.getStyle(this.options.modifiers[D]).toInt();}else{this.value.now[D]=this.element[this.options.modifiers[D]];}if(this.options.invert){this.value.now[D]*=-1;}this.mouse.pos[D]=C.page[D]-this.value.now[D];if(A&&A[D]){for(var B=2;B--;B){if($chk(A[D][B])){this.limit[D][B]=$lambda(A[D][B])();}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(A){if(this.options.preventDefault){A.preventDefault();}var B=Math.round(Math.sqrt(Math.pow(A.page.x-this.mouse.start.x,2)+Math.pow(A.page.y-this.mouse.start.y,2)));if(B>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",this.element).fireEvent("snap",this.element);}},drag:function(A){if(this.options.preventDefault){A.preventDefault();}this.mouse.now=A.page;for(var B in this.options.modifiers){if(!this.options.modifiers[B]){continue;}this.value.now[B]=this.mouse.now[B]-this.mouse.pos[B];if(this.options.invert){this.value.now[B]*=-1;}if(this.options.limit&&this.limit[B]){if($chk(this.limit[B][1])&&(this.value.now[B]>this.limit[B][1])){this.value.now[B]=this.limit[B][1];}else{if($chk(this.limit[B][0])&&(this.value.now[B]<this.limit[B][0])){this.value.now[B]=this.limit[B][0];}}}if(this.options.grid[B]){this.value.now[B]-=(this.value.now[B]%this.options.grid[B]);}if(this.options.style){this.element.setStyle(this.options.modifiers[B],this.value.now[B]+this.options.unit);}else{this.element[this.options.modifiers[B]]=this.value.now[B];}}this.fireEvent("drag",this.element);},cancel:function(A){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(A){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(A){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(A){this.fireEvent("complete",this.element);}}});Element.implement({makeResizable:function(A){return new Drag(this,$merge({modifiers:{x:"width",y:"height"}},A));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false},initialize:function(C,B){this.parent(C,B);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=$(this.container.getDocument().body);}C=this.element;var D=C.getStyle("position");var A=(D!="static")?D:"absolute";if(C.getStyle("left")=="auto"||C.getStyle("top")=="auto"){C.position(C.getPosition(C.offsetParent));}C.setStyle("position",A);this.addEvent("start",function(){this.checkDroppables();},true);},start:function(B){if(this.container){var D=this.element,J=this.container,E=J.getCoordinates(D.offsetParent),F={},A={};["top","right","bottom","left"].each(function(K){F[K]=J.getStyle("padding-"+K).toInt();A[K]=D.getStyle("margin-"+K).toInt();},this);var C=D.offsetWidth+A.left+A.right,I=D.offsetHeight+A.top+A.bottom;var H=[E.left+F.left,E.right-F.right-C];var G=[E.top+F.top,E.bottom-F.bottom-I];this.options.limit={x:H,y:G};}this.parent(B);},checkAgainst:function(B){B=B.getCoordinates();var A=this.mouse.now;return(A.x>B.left&&A.x<B.right&&A.y<B.bottom&&A.y>B.top);},checkDroppables:function(){var A=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=A){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);}if(A){this.overed=A;this.fireEvent("enter",[this.element,A]);}else{this.overed=null;}}},drag:function(A){this.parent(A);if(this.droppables.length){this.checkDroppables();}},stop:function(A){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed]);this.overed=null;return this.parent(A);}});Element.implement({makeDraggable:function(A){return new Drag.Move(this,A);}});Hash.Cookie=new Class({Extends:Cookie,options:{autoSave:true},initialize:function(B,A){this.parent(B,A);this.load();},save:function(){var A=JSON.encode(this.hash);if(!A||A.length>4096){return false;}if(A=="{}"){this.dispose();}else{this.write(A);}return true;},load:function(){this.hash=new Hash(JSON.decode(this.read(),true));return this;}});Hash.Cookie.implement((function(){var A={};Hash.each(Hash.prototype,function(C,B){A[B]=function(){var D=C.apply(this.hash,arguments);if(this.options.autoSave){this.save();}return D;};});return A;})());var Color=new Native({initialize:function(B,C){if(arguments.length>=3){C="rgb";B=Array.slice(arguments,0,3);}else{if(typeof B=="string"){if(B.match(/rgb/)){B=B.rgbToHex().hexToRgb(true);}else{if(B.match(/hsb/)){B=B.hsbToRgb();}else{B=B.hexToRgb(true);}}}}C=C||"rgb";switch(C){case"hsb":var A=B;B=B.hsbToRgb();B.hsb=A;break;case"hex":B=B.hexToRgb(true);break;}B.rgb=B.slice(0,3);B.hsb=B.hsb||B.rgbToHsb();B.hex=B.rgbToHex();return $extend(B,this);}});Color.implement({mix:function(){var A=Array.slice(arguments);var C=($type(A.getLast())=="number")?A.pop():50;var B=this.slice();A.each(function(D){D=new Color(D);for(var E=0;E<3;E++){B[E]=Math.round((B[E]/100*(100-C))+(D[E]/100*C));}});return new Color(B,"rgb");},invert:function(){return new Color(this.map(function(A){return 255-A;}));},setHue:function(A){return new Color([A,this.hsb[1],this.hsb[2]],"hsb");},setSaturation:function(A){return new Color([this.hsb[0],A,this.hsb[2]],"hsb");},setBrightness:function(A){return new Color([this.hsb[0],this.hsb[1],A],"hsb");}});function $RGB(C,B,A){return new Color([C,B,A],"rgb");}function $HSB(C,B,A){return new Color([C,B,A],"hsb");}function $HEX(A){return new Color(A,"hex");}Array.implement({rgbToHsb:function(){var B=this[0],C=this[1],J=this[2];var G,F,H;var I=Math.max(B,C,J),E=Math.min(B,C,J);var K=I-E;H=I/255;F=(I!=0)?K/I:0;if(F==0){G=0;}else{var D=(I-B)/K;var A=(I-C)/K;var L=(I-J)/K;if(B==I){G=L-A;}else{if(C==I){G=2+D-L;}else{G=4+A-D;}}G/=6;if(G<0){G++;}}return[Math.round(G*360),Math.round(F*100),Math.round(H*100)];},hsbToRgb:function(){var C=Math.round(this[2]/100*255);if(this[1]==0){return[C,C,C];}else{var A=this[0]%360;var E=A%60;var F=Math.round((this[2]*(100-this[1]))/10000*255);var D=Math.round((this[2]*(6000-this[1]*E))/600000*255);var B=Math.round((this[2]*(6000-this[1]*(60-E)))/600000*255);switch(Math.floor(A/60)){case 0:return[C,B,F];case 1:return[D,C,F];case 2:return[F,C,B];case 3:return[F,D,C];case 4:return[B,F,C];case 5:return[C,F,D];}}return false;}});String.implement({rgbToHsb:function(){var A=this.match(/\d{1,3}/g);return(A)?hsb.rgbToHsb():null;},hsbToRgb:function(){var A=this.match(/\d{1,3}/g);return(A)?A.hsbToRgb():null;}});var Group=new Class({initialize:function(){this.instances=Array.flatten(arguments);this.events={};this.checker={};},addEvent:function(B,A){this.checker[B]=this.checker[B]||{};this.events[B]=this.events[B]||[];if(this.events[B].contains(A)){return false;}else{this.events[B].push(A);}this.instances.each(function(C,D){C.addEvent(B,this.check.bind(this,[B,C,D]));},this);return this;},check:function(C,A,B){this.checker[C][B]=true;var D=this.instances.every(function(F,E){return this.checker[C][E]||false;},this);if(!D){return;}this.checker[C]={};this.events[C].each(function(E){E.call(this,this.instances,A);},this);}});var Asset=new Hash({javascript:function(F,D){D=$extend({onload:$empty,document:document,check:$lambda(true)},D);var B=new Element("script",{src:F,type:"text/javascript"});var E=D.onload.bind(B),A=D.check,G=D.document;delete D.onload;delete D.check;delete D.document;B.addEvents({load:E,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){E();}}}).setProperties(D);if(Browser.Engine.webkit419){var C=(function(){if(!$try(A)){return;}$clear(C);E();}).periodical(50);}return B.inject(G.head);},css:function(B,A){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:B},A)).inject(document.head);},image:function(C,B){B=$merge({onload:$empty,onabort:$empty,onerror:$empty},B);var D=new Image();var A=$(D)||new Element("img");["load","abort","error"].each(function(E){var F="on"+E;var G=B[F];delete B[F];D[F]=function(){if(!D){return;}if(!A.parentNode){A.width=D.width;A.height=D.height;}D=D.onload=D.onabort=D.onerror=null;G.delay(1,A,A);A.fireEvent(E,A,1);};});D.src=A.src=C;if(D&&D.complete){D.onload.delay(1);}return A.setProperties(B);},images:function(D,C){C=$merge({onComplete:$empty,onProgress:$empty},C);if(!D.push){D=[D];}var A=[];var B=0;D.each(function(F){var E=new Asset.image(F,{onload:function(){C.onProgress.call(this,B,D.indexOf(F));B++;if(B==D.length){C.onComplete();}}});A.push(E);});return new Elements(A);}});var Slider=new Class({Implements:[Events,Options],options:{onTick:function(A){if(this.options.snap){A=this.toPosition(this.step);}this.knob.setStyle(this.property,A);},snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(E,A,D){this.setOptions(D);this.element=$(E);this.knob=$(A);this.previousChange=this.previousEnd=this.step=-1;this.element.addEvent("mousedown",this.clickedElement.bind(this));if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement.bindWithEvent(this));}var F,B={},C={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";this.property="top";F="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";F="offsetWidth";}this.half=this.knob[F]/2;this.full=this.element[F]-this.knob[F]+(this.options.offset*2);this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle("position","relative").setStyle(this.property,-this.options.offset);C[this.axis]=this.property;B[this.axis]=[-this.options.offset,this.full-this.options.offset];this.drag=new Drag(this.knob,{snap:0,limit:B,modifiers:C,onDrag:this.draggedKnob.bind(this),onStart:this.draggedKnob.bind(this),onComplete:function(){this.draggedKnob();this.end();}.bind(this)});if(this.options.snap){this.drag.options.grid=Math.ceil(this.stepWidth);this.drag.options.limit[this.axis][1]=this.full;}},set:function(A){if(!((this.range>0)^(A<this.min))){A=this.min;}if(!((this.range>0)^(A>this.max))){A=this.max;}this.step=Math.round(A);this.checkStep();this.end();this.fireEvent("tick",this.toPosition(this.step));return this;},clickedElement:function(C){var B=this.range<0?-1:1;var A=C.page[this.axis]-this.element.getPosition()[this.axis]-this.half;A=A.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+B*this.toStep(A));this.checkStep();this.end();this.fireEvent("tick",A);},scrolledElement:function(A){var B=(this.options.mode=="horizontal")?(A.wheel<0):(A.wheel>0);this.set(B?this.step-this.stepSize:this.step+this.stepSize);A.stop();},draggedKnob:function(){var B=this.range<0?-1:1;var A=this.drag.value.now[this.axis];A=A.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+B*this.toStep(A));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("change",this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"");}},toStep:function(A){var B=(A+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(B-=B%this.stepSize):B;},toPosition:function(A){return(this.full*Math.abs(this.min-A))/(this.steps*this.stepSize)-this.options.offset;}});var Scroller=new Class({Implements:[Events,Options],options:{area:20,velocity:1,onChange:function(A,B){this.element.scrollTo(A,B);}},initialize:function(B,A){this.setOptions(A);this.element=$(B);this.listener=($type(this.element)!="element")?$(this.element.getDocument().body):this.element;this.timer=null;this.coord=this.getCoords.bind(this);},start:function(){this.listener.addEvent("mousemove",this.coord);},stop:function(){this.listener.removeEvent("mousemove",this.coord);this.timer=$clear(this.timer);},getCoords:function(A){this.page=(this.listener.get("tag")=="body")?A.client:A.page;if(!this.timer){this.timer=this.scroll.periodical(50,this);}},scroll:function(){var B=this.element.getSize(),A=this.element.getScroll(),E=this.element.getPosition(),D={x:0,y:0};for(var C in this.page){if(this.page[C]<(this.options.area+E[C])&&A[C]!=0){D[C]=(this.page[C]-this.options.area-E[C])*this.options.velocity;}else{if(this.page[C]+this.options.area>(B[C]+E[C])&&B[C]+B[C]!=A[C]){D[C]=(this.page[C]-B[C]+this.options.area-E[C])*this.options.velocity;}}}if(D.y||D.x){this.fireEvent("change",[A.x+D.x,A.y+D.y]);}}});;var ReMooz=new Class({Implements:[Events,Options,Chain],options:{link:null,type:'image',container:null,className:null,centered:false,dragging:true,closeOnClick:true,shadow:(Browser.Engine.trident)?'onOpenEnd':'onOpen',resize:true,margin:20,resizeFactor:0.95,resizeLimit:false,fixedSize:false,cutOut:true,addClick:true,opacityLoad:0.6,opacityResize:1,opacityTitle:0.9,resizeOptions:{},fxOptions:{},closer:true,parse:false,parseSecure:false,temporary:false,onBuild:$empty,onLoad:$empty,onOpen:$empty,onOpenEnd:$empty,onClose:$empty,onCloseEnd:$empty,generateTitle:function(el){var text=el.get('title');if(!text)return false;var title=text.split(' :: ');var head=new Element('h6',{'html':title[0]});return(title[1])?[head,new Element('p',{'html':title[1]})]:head;}},initialize:function(element,options){this.element=$(element);this.setOptions(options);if(this.options.parse){var obj=this.element.getProperty(this.options.parse);if(obj&&(obj=JSON.decode(obj,this.options.parseSecure)))this.setOptions(obj);}
var origin=this.options.origin;this.origin=((origin)?$(origin)||this.element.getElement(origin):null)||this.element;this.link=this.options.link||this.element.get('href')||this.element.get('src');this.container=$(this.options.container)||this.element.getDocument();this.bound={'click':function(e){this.open.delay(1,this);return false;}.bind(this),'close':this.close.bind(this),'dragClose':function(e){if(e.rightClick)return;this.close();}.bind(this)};if(this.options.addClick)this.bindToElement();},destroy:function(){if(this.box)this.box.destroy();this.box=this.tweens=this.body=this.content=null;},bindToElement:function(element){($(element)||this.element).addClass('remooz-element').addEvent('click',this.bound.click);return this;},getOriginCoordinates:function(){var coords=this.origin.getCoordinates();delete coords.right;delete coords.bottom;return coords;},open:function(e){if(this.opened)return(e)?this.close():this;this.opened=this.loading=true;if(!this.box)this.build();this.coords=this.getOriginCoordinates();this.coords.opacity=this.options.opacityLoad;this.coords.display='';this.tweens.box.set(this.coords);this.box.addClass('remooz-loading');ReMooz.open(this.fireEvent('onLoad'));this['open'+this.options.type.capitalize()]();return this;},finishOpen:function(){this.tweens.fade.start(0,1);this.drag.attach();this.fireEvent('onOpenEnd').callChain();},close:function(){if(!this.opened)return this;this.opened=false;ReMooz.close(this.fireEvent('onClose'));if(this.loading){this.box.setStyle('display','none');return this;}
this.drag.detach();this.tweens.fade.cancel().set(0).fireEvent('onComplete');if(this.tweens.box.timer)this.tweens.box.clearChain();var vars=this.getOriginCoordinates();if(this.options.opacityResize!=1)vars.opacity=this.options.opacityResize;this.tweens.box.start(vars).chain(this.closeEnd.bind(this));return this;},closeEnd:function(){if(this.options.cutOut)this.element.setStyle('visibility','visible');this.box.setStyle('display','none');this.fireEvent('onCloseEnd').callChain();if(this.options.temporary)this.destroy();},openImage:function(){var tmp=new Image();tmp.onload=tmp.onabort=tmp.onerror=function(fast){this.loading=tmp.onload=tmp.onabort=tmp.onerror=null;if(!tmp.width||!this.opened){this.fireEvent('onError').close();return;}
var to={x:tmp.width,y:tmp.height};if(!this.content)this.content=$(tmp).inject(this.body);else tmp=null;this[(this.options.resize)?'zoomRelativeTo':'zoomTo'].create({'delay':(tmp&&fast!==true)?1:null,'arguments':[to],'bind':this})();}.bind(this);tmp.src=this.link;if(tmp&&tmp.complete&&tmp.onload)tmp.onload(true);},openElement:function(){this.content=this.content||$(this.link)||$E(this.link);if(!this.content){this.fireEvent('onError').close();return;}
this.content.inject(this.body);this.zoomTo({x:this.content.scrollWidth,y:this.content.scrollHeight});},zoomRelativeTo:function(to){var scale=this.options.resizeLimit;if(!scale){scale=this.container.getSize();scale.x*=this.options.resizeFactor;scale.y*=this.options.resizeFactor;}
for(var i=2;i--;){if(to.x>scale.x){to.y*=scale.x/to.x;to.x=scale.x;}else if(to.y>scale.y){to.x*=scale.y/to.y;to.y=scale.y;}}
return this.zoomTo({x:to.x.toInt(),y:to.y.toInt()});},zoomTo:function(to){to=this.options.fixedSize||to;var box=this.container.getSize(),scroll=this.container.getScroll();var pos=(!this.options.centered)?{x:(this.coords.left+(this.coords.width/2)-to.x/2).toInt().limit(scroll.x+this.options.margin,scroll.x+box.x-this.options.margin-to.x),y:(this.coords.top+(this.coords.height/2)-to.y/2).toInt().limit(scroll.y+this.options.margin,scroll.y+box.y-this.options.margin-to.y)}:{x:scroll.x+((box.x-to.x)/2).toInt(),y:scroll.y+((box.y-to.y)/2).toInt()};if(this.options.cutOut)this.element.setStyle('visibility','hidden');this.box.removeClass('remooz-loading');var vars={left:pos.x,top:pos.y,width:to.x,height:to.y};if(this.options.opacityResize!=1)vars.opacity=[this.options.opacityResize,1];else this.box.set('opacity',1);this.tweens.box.start(vars).chain(this.finishOpen.bind(this));this.fireEvent('onOpen');},build:function(){this.addEvent('onBlur',function(){this.focused=false;this.box.removeClass('remooz-box-focus').setStyle('z-index',ReMooz.options.zIndex);},true);this.addEvent('onFocus',function(){this.focused=true;this.box.addClass('remooz-box-focus').setStyle('z-index',ReMooz.options.zIndexFocus);},true);var classes=['remooz-box','remooz-type-'+this.options.type,'remooz-engine-'+Browser.Engine.name+Browser.Engine.version];if(this.options.className)classes.push(this.options.className);this.box=new Element('div',{'class':classes.join(' '),'styles':{'display':'none','top':0,'left':0,'zIndex':ReMooz.options.zIndex}});this.tweens={'box':new Fx.Morph(this.box,$merge({'duration':400,'unit':'px','transition':Fx.Transitions.Quart.easeOut,'chain':'cancel'},this.options.resizeOptions)),'fade':new Fx.Tween(null,$merge({'property':'opacity','duration':(Browser.Engine.trident)?0:300,'chain':'cancel'},this.options.fxOptions)).addEvents({'onComplete':function(){if(!this.element.get('opacity'))this.element.setStyle('display','none');},'onStart':function(){if(!this.element.get('opacity'))this.element.setStyle('display','');}})};this.tweens.fade.element=$$();if(this.options.shadow){if(Browser.Engine.webkit420){this.box.setStyle('-webkit-box-shadow','0 0 10px rgba(0, 0, 0, 0.7)');}else if(!Browser.Engine.trident4){var shadow=new Element('div',{'class':'remooz-bg-wrap'}).inject(this.box);['n','ne','e','se','s','sw','w','nw'].each(function(dir){new Element('div',{'class':'remooz-bg remooz-bg-'+dir}).inject(shadow);});this.tweens.bg=new Fx.Tween(shadow,{'property':'opacity','chain':'cancel'}).set(0);this.addEvent(this.options.shadow,this.tweens.bg.set.bind(this.tweens.bg,1),true);this.addEvent('onClose',this.tweens.bg.set.bind(this.tweens.bg,0),true);}}
if(this.options.closer){var closer=new Element('a',{'class':'remooz-btn-close','events':{'click':this.bound.close}}).inject(this.box);this.tweens.fade.element.push(closer);}
this.body=new Element('div',{'class':'remooz-body'}).inject(this.box);var title=this.options.title||this.options.generateTitle.call(this,this.element);if(title){var title=new Element('div',{'class':'remooz-title'}).adopt(new Element('div',{'class':'remooz-title-bg','opacity':this.options.opacityTitle}),new Element('div',{'class':'remooz-title-content'}).adopt(title)).inject(this.box);this.tweens.fade.element.push(title);}
this.tweens.fade.set(0).fireEvent('onComplete');this.drag=new Drag.Move(this.box,{'snap':15,'preventDefault':true,'onBeforeStart':function(){if(!this.focused&&!this.loading)ReMooz.focus(this);else if(this.loading||this.options.closeOnClick)this.box.addEvent('mouseup',this.bound.dragClose);}.bind(this),'onSnap':function(){this.box.removeEvent('mouseup',this.bound.dragClose);if(!this.options.dragging)this.drag.stop();else this.box.addClass('remooz-box-dragging');}.bind(this),'onComplete':function(){this.box.removeClass('remooz-box-dragging');}.bind(this)});this.drag.detach();this.fireEvent('onBuild',this.box,this.element);this.box.inject(this.element.getDocument().body);}});ReMooz.factory=function(extended){return $extend(this,extended);};ReMooz.factory(new Options).factory({options:{zIndex:41,zIndexFocus:42,query:'a.remooz',modal:false},assign:function(elements,options){return $$(elements).map(function(element){return new ReMooz(element,options);},this);},stack:[],open:function(obj){var last=this.stack.getLast();this.focus(obj);if(last&&this.options.modal)last.close();},close:function(obj){var length=this.stack.length-1;if(length>1&&this.stack[length]==obj)this.focus(this.stack[length-1]);this.stack.erase(obj);},focus:function(obj){var last=this.stack.getLast();obj.fireEvent('onFocus',[obj]);if(last==obj)return;if(last)last.fireEvent('onBlur',[last]);this.stack.erase(obj).push(obj);}});;function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);};Element.implement({getPosition:function(relative){if(isBody(this))return{x:0,y:0};var el=this,position={x:0,y:0};while(el){position.x+=el.offsetLeft;position.y+=el.offsetTop;el=el.offsetParent;}
var rpos=(relative)?$(relative).getPosition():{x:0,y:0};return{x:position.x-rpos.x,y:position.y-rpos.y};}});var gallery={Implements:[Events,Options],options:{showArrows:true,showCarousel:true,showInfopane:false,embedLinks:false,showmoreinfo:true,fadeDuration:500,timed:false,delay:9000,preloader:true,preloaderImage:true,preloaderErrorImage:true,manualData:[],populateFrom:false,populateData:true,destroyAfterPopulate:true,elementSelector:"div.imageElement",titleSelector:"h3",subtitleSelector:"p",linkSelector:"a.open",imageSelector:"img.full",thumbnailSelector:"img.thumbnail",defaultTransition:"fade",slideInfoZoneOpacity:0.7,slideInfoZoneSlide:true,carouselMinimizedOpacity:0.4,carouselMinimizedHeight:20,carouselMaximizedOpacity:0.9,thumbHeight:110,thumbWidth:165,thumbSpacing:24,thumbIdleOpacity:0.2,textShowCarousel:'Pictures',showCarouselLabel:true,thumbCloseCarousel:true,useThumbGenerator:false,thumbGenerator:'resizer.php',useExternalCarousel:false,carouselElement:false,carouselHorizontal:true,activateCarouselScroller:true,carouselPreloader:true,textPreloadingCarousel:'Loading...',baseClass:'jdGallery',withArrowsClass:'withArrows',useHistoryManager:false,customHistoryKey:false,useReMooz:false},initialize:function(element,options){this.setOptions(options);this.fireEvent('onInit');this.currentIter=0;this.lastIter=0;this.maxIter=0;this.galleryElement=element;this.galleryData=this.options.manualData;this.galleryInit=1;this.galleryElements=Array();this.thumbnailElements=Array();this.galleryElement.addClass(this.options.baseClass);if(this.options.useReMooz&&(this.options.defaultTransition=="fade"))
this.options.defaultTransition="crossfade";this.populateFrom=element;if(this.options.populateFrom)
this.populateFrom=this.options.populateFrom;if(this.options.populateData)
this.populateData();element.style.display="block";if(this.options.useHistoryManager)
this.initHistory();if((this.options.embedLinks)|(this.options.useReMooz))
{this.currentLink=new Element('a').addClass('open').setProperties({href:'#',title:''}).injectInside(element);if((!this.options.showArrows)&&(!this.options.showCarousel))
this.galleryElement=element=this.currentLink;else
this.currentLink.setStyle('display','none');}
this.constructElements();if((this.galleryData.length>1)&&(this.options.showArrows))
{var leftArrow=new Element('a').addClass('left').addEvent('click',this.prevItem.bind(this)).injectInside(element);var rightArrow=new Element('a').addClass('right').addEvent('click',this.nextItem.bind(this)).injectInside(element);this.galleryElement.addClass(this.options.withArrowsClass);}
this.loadingElement=new Element('div').addClass('loadingElement').injectInside(element);if(this.options.showInfopane)this.initInfoSlideshow();if(this.options.showCarousel)this.initCarousel();this.doSlideShow(1);},populateData:function(){currentArrayPlace=this.galleryData.length;options=this.options;var data=$A(this.galleryData);data.extend(this.populateGallery(this.populateFrom,currentArrayPlace));this.galleryData=data;this.fireEvent('onPopulated');},populateGallery:function(element,startNumber){var data=[];options=this.options;currentArrayPlace=startNumber;element.getElements(options.elementSelector).each(function(el){elementDict=$H({image:el.getElement(options.imageSelector).getProperty('src'),number:currentArrayPlace,transition:this.options.defaultTransition});if((options.showInfopane)|(options.showCarousel))
elementDict.extend({title:el.getElement(options.titleSelector).innerHTML});if((options.embedLinks)|(options.useReMooz))
elementDict.extend({link:el.getElement(options.linkSelector).href||false,linkTitle:el.getElement(options.linkSelector).title||false,linkTarget:el.getElement(options.linkSelector).getProperty('target')||false});if((!options.useThumbGenerator)&&(options.showCarousel))
elementDict.extend({thumbnail:el.getElement(options.thumbnailSelector).getProperty('src')});else if(options.useThumbGenerator)
elementDict.extend({thumbnail:options.thumbGenerator+'?imgfile='+elementDict.image+'&max_width='+options.thumbWidth+'&max_height='+options.thumbHeight});data.extend([elementDict]);currentArrayPlace++;if(this.options.destroyAfterPopulate)
el.dispose();});return data;},constructElements:function(){el=this.galleryElement;if(this.options.embedLinks&&(!this.options.showArrows))
el=this.currentLink;this.maxIter=this.galleryData.length;var currentImg;for(i=0;i<this.galleryData.length;i++)
{var currentImg=new Fx.Morph(new Element('div').addClass('slideElement').setStyles({'position':'absolute','left':'0px','right':'0px','margin':'0px','padding':'0px','backgroundPosition':"center center",'opacity':'0'}).injectInside(el),{duration:this.options.fadeDuration});if(this.options.preloader)
{currentImg.source=this.galleryData[i].image;currentImg.loaded=false;currentImg.load=function(imageStyle,i){if(!imageStyle.loaded){this.galleryData[i].imgloader=new Asset.image(imageStyle.source,{'onload':function(img,i){img.element.setStyle('backgroundImage',"url('"+img.source+"')")
img.loaded=true;img.width=this.galleryData[i].imgloader.width;img.height=this.galleryData[i].imgloader.height;}.pass([imageStyle,i],this)});}}.pass([currentImg,i],this);}else{currentImg.element.setStyle('backgroundImage',"url('"+this.galleryData[i].image+"')");}
this.galleryElements[parseInt(i)]=currentImg;}},destroySlideShow:function(element){var myClassName=element.className;var newElement=new Element('div').addClass('myClassName');element.parentNode.replaceChild(newElement,element);},startSlideShow:function(){this.fireEvent('onStart');this.loadingElement.style.display="none";this.lastIter=this.maxIter-1;this.currentIter=0;this.galleryInit=0;this.galleryElements[parseInt(this.currentIter)].set({opacity:1});if(this.options.showInfopane)
this.showInfoSlideShow.delay(1000,this);if(this.options.useReMooz)
this.makeReMooz.delay(1000,this);var textShowCarousel=formatString(this.options.textShowCarousel,this.currentIter+1,this.maxIter);if(this.options.showCarousel&&(!this.options.carouselPreloader)&&(!this.options.useExternalCarousel))
this.carouselBtn.set('html',textShowCarousel).setProperty('title',textShowCarousel);this.prepareTimer();if(this.options.embedLinks)
this.makeLink(this.currentIter);},nextItem:function(){this.fireEvent('onNextCalled');this.nextIter=this.currentIter+1;if(this.nextIter>=this.maxIter)
this.nextIter=0;this.galleryInit=0;this.goTo(this.nextIter);},prevItem:function(){this.fireEvent('onPreviousCalled');this.nextIter=this.currentIter-1;if(this.nextIter<=-1)
this.nextIter=this.maxIter-1;this.galleryInit=0;this.goTo(this.nextIter);},goTo:function(num){this.clearTimer();if(this.options.preloader)
{this.galleryElements[num].load();if(num==0)
this.galleryElements[this.maxIter-1].load();else
this.galleryElements[num-1].load();if(num==(this.maxIter-1))
this.galleryElements[0].load();else
this.galleryElements[num+1].load();}
if(this.options.embedLinks)
this.clearLink();if(this.options.showInfopane)
{this.slideInfoZone.clearChain();this.hideInfoSlideShow().chain(this.changeItem.pass(num,this));}else
this.currentChangeDelay=this.changeItem.delay(500,this,num);if(this.options.embedLinks)
this.makeLink(num);this.prepareTimer();},changeItem:function(num){this.fireEvent('onStartChanging');this.galleryInit=0;if(this.currentIter!=num)
{for(i=0;i<this.maxIter;i++)
{if((i!=this.currentIter))this.galleryElements[i].set({opacity:0});}
gallery.Transitions[this.galleryData[num].transition].pass([this.galleryElements[this.currentIter],this.galleryElements[num],this.currentIter,num],this)();this.currentIter=num;if(this.options.useReMooz)
this.makeReMooz();}
var textShowCarousel=formatString(this.options.textShowCarousel,num+1,this.maxIter);if((this.options.showCarousel)&&(!this.options.useExternalCarousel))
this.carouselBtn.set('html',textShowCarousel).setProperty('title',textShowCarousel);this.doSlideShow.bind(this)();this.fireEvent('onChanged');},clearTimer:function(){if(this.options.timed)
$clear(this.timer);},prepareTimer:function(){if(this.options.timed)
this.timer=this.nextItem.delay(this.options.delay,this);},doSlideShow:function(position){if(this.galleryInit==1)
{imgPreloader=new Image();imgPreloader.onload=function(){this.startSlideShow.delay(10,this);}.bind(this);imgPreloader.src=this.galleryData[0].image;if(this.options.preloader)
this.galleryElements[0].load();}else{if(this.options.showInfopane)
{if(this.options.showInfopane)
{this.showInfoSlideShow.delay((500+this.options.fadeDuration),this);}
else
{if((this.options.showCarousel)&&(this.options.activateCarouselScroller))
this.centerCarouselOn(position);}}}},createCarousel:function(){var carouselElement;if(!this.options.useExternalCarousel)
{var carouselContainerElement=new Element('div').addClass('carouselContainer').injectInside(this.galleryElement);this.carouselContainer=new Fx.Morph(carouselContainerElement,{transition:Fx.Transitions.Expo.easeOut});this.carouselContainer.normalHeight=carouselContainerElement.offsetHeight;this.carouselContainer.set({'opacity':this.options.carouselMinimizedOpacity,'top':(this.options.carouselMinimizedHeight-this.carouselContainer.normalHeight)});this.carouselBtn=new Element('a').addClass('carouselBtn').setProperties({title:this.options.textShowCarousel}).injectInside(carouselContainerElement);if(this.options.carouselPreloader)
this.carouselBtn.set('html',this.options.textPreloadingCarousel);else
this.carouselBtn.set('html',this.options.textShowCarousel);this.carouselBtn.addEvent('click',function(){this.carouselContainer.cancel();this.toggleCarousel();}.bind(this));this.carouselActive=false;carouselElement=new Element('div').addClass('carousel').injectInside(carouselContainerElement);this.carousel=new Fx.Morph(carouselElement);}else{carouselElement=$(this.options.carouselElement).addClass('jdExtCarousel');}
this.carouselElement=new Fx.Morph(carouselElement,{transition:Fx.Transitions.Expo.easeOut});this.carouselElement.normalHeight=carouselElement.offsetHeight;if(this.options.showCarouselLabel)
this.carouselLabel=new Element('p').addClass('label').injectInside(carouselElement);carouselWrapper=new Element('div').addClass('carouselWrapper').injectInside(carouselElement);this.carouselWrapper=new Fx.Morph(carouselWrapper,{transition:Fx.Transitions.Expo.easeOut});this.carouselWrapper.normalHeight=carouselWrapper.offsetHeight;this.carouselInner=new Element('div').addClass('carouselInner').injectInside(carouselWrapper);if(this.options.activateCarouselScroller)
{this.carouselWrapper.scroller=new Scroller(carouselWrapper,{area:100,velocity:0.2})
this.carouselWrapper.elementScroller=new Fx.Scroll(carouselWrapper,{duration:400,onStart:this.carouselWrapper.scroller.stop.bind(this.carouselWrapper.scroller),onComplete:this.carouselWrapper.scroller.start.bind(this.carouselWrapper.scroller)});}},fillCarousel:function(){this.constructThumbnails();this.carouselInner.normalWidth=((this.maxIter*(this.options.thumbWidth+this.options.thumbSpacing+2))+this.options.thumbSpacing)+"px";if(this.options.carouselHorizontal)
this.carouselInner.style.width=this.carouselInner.normalWidth;},initCarousel:function(){this.createCarousel();this.fillCarousel();if(this.options.carouselPreloader)
this.preloadThumbnails();},flushCarousel:function(){this.thumbnailElements.each(function(myFx){myFx.element.dispose();myFx=myFx.element=null;});this.thumbnailElements=[];},toggleCarousel:function(){if(this.carouselActive)
this.hideCarousel();else
this.showCarousel();},showCarousel:function(){this.fireEvent('onShowCarousel');this.carouselContainer.start({'opacity':this.options.carouselMaximizedOpacity,'top':0}).chain(function(){this.carouselActive=true;this.carouselWrapper.scroller.start();this.fireEvent('onCarouselShown');this.carouselContainer.options.onComplete=null;}.bind(this));},hideCarousel:function(){this.fireEvent('onHideCarousel');var targetTop=this.options.carouselMinimizedHeight-this.carouselContainer.normalHeight;this.carouselContainer.start({'opacity':this.options.carouselMinimizedOpacity,'top':targetTop}).chain(function(){this.carouselActive=false;this.carouselWrapper.scroller.stop();this.fireEvent('onCarouselHidden');this.carouselContainer.options.onComplete=null;}.bind(this));},constructThumbnails:function(){element=this.carouselInner;var go_left=0;for(i=0;i<this.galleryData.length;i++)
{if(i%3==0)
{var seperate=new Element('div').addClass('thumb_block').injectInside(element);}
var currentImg=new Fx.Morph(new Element('div').addClass("thumbnail").setStyles({backgroundImage:"url('"+this.galleryData[i].thumbnail+"')",backgroundPosition:"center center",backgroundRepeat:'no-repeat',marginLeft:this.options.thumbSpacing+"px",marginBottom:"10px",width:this.options.thumbWidth+"px",height:this.options.thumbHeight+"px"}).injectInside(seperate),{duration:200}).start({'opacity':this.options.thumbIdleOpacity});currentImg.element.addEvents({'mouseover':function(myself){myself.cancel();myself.start({'opacity':0.99});this.clearTimer();if(this.options.showCarouselLabel)
$(this.carouselLabel).set('html','<span class="number">'+(myself.relatedImage.number+1)+"/"+this.maxIter+":</span> "+myself.relatedImage.title);}.pass(currentImg,this),'mouseout':function(myself){this.clearThumbnailsHighlights();myself.cancel();this.prepareTimer();myself.start({'opacity':this.options.thumbIdleOpacity});}.pass(currentImg,this),'click':function(myself){this.goTo(myself.relatedImage.number);this.clearTimer();if(this.options.thumbCloseCarousel&&(!this.options.useExternalCarousel))
this.hideCarousel();}.pass(currentImg,this)});currentImg.relatedImage=this.galleryData[i];this.thumbnailElements[parseInt(i)]=currentImg;}},log:function(value){if(console.log)
console.log(value);},preloadThumbnails:function(){var thumbnails=[];for(i=0;i<this.galleryData.length;i++)
{thumbnails[parseInt(i)]=this.galleryData[i].thumbnail;}
this.thumbnailPreloader=new Preloader();if(!this.options.useExternalCarousel)
this.thumbnailPreloader.addEvent('onComplete',function(){var textShowCarousel=formatString(this.options.textShowCarousel,this.currentIter+1,this.maxIter);this.carouselBtn.set('html',textShowCarousel).setProperty('title',textShowCarousel);}.bind(this));this.thumbnailPreloader.load(thumbnails);},clearThumbnailsHighlights:function()
{for(i=0;i<this.galleryData.length;i++)
{this.thumbnailElements[i].cancel();this.thumbnailElements[i].start({'opacity':this.options.thumbIdleOpacity});}},changeThumbnailsSize:function(width,height)
{for(i=0;i<this.galleryData.length;i++)
{this.thumbnailElements[i].cancel();this.thumbnailElements[i].element.setStyles({'width':width+"px",'height':height+"px"});}},centerCarouselOn:function(num){if(!this.carouselWallMode)
{var carouselElement=this.thumbnailElements[num];var position=carouselElement.element.offsetLeft+(carouselElement.element.offsetWidth/2);var carouselWidth=this.carouselWrapper.element.offsetWidth;var carouselInnerWidth=this.carouselInner.offsetWidth;var diffWidth=carouselWidth/2;var scrollPos=position-diffWidth;scrollPos=scrollPos+90;this.clearThumbnailsHighlights();this.thumbnailElements[num].cancel();this.thumbnailElements[num].start({'opacity':1});this.carouselWrapper.elementScroller.start(scrollPos,0);}},initInfoSlideshow:function(){this.slideInfoZone=new Fx.Morph(new Element('div').addClass('slideInfoZone').injectInside($(this.galleryElement))).set({'opacity':0});var slideInfoZoneTitle=new Element('h2').injectInside(this.slideInfoZone.element);this.slideInfoZone.normalHeight=this.slideInfoZone.element.offsetHeight;this.slideInfoZone.normalWidth=this.slideInfoZone.element.offsetWidth;this.slideInfoZone.element.setStyle('opacity',0);},changeInfoSlideShow:function()
{this.hideInfoSlideShow.delay(10,this);this.showInfoSlideShow.delay(500,this);},showInfoSlideShow:function(){this.fireEvent('onShowInfopane');this.slideInfoZone.cancel();element=this.slideInfoZone.element;element.getElement('h2').set('html',this.galleryData[this.currentIter].title);if(this.options.slideInfoZoneSlide)
this.slideInfoZone.start({'opacity':[0,this.options.slideInfoZoneOpacity],'left':[-420,0]});else
this.slideInfoZone.start({'opacity':[0,this.options.slideInfoZoneOpacity]});if(this.options.showCarousel)
this.slideInfoZone.chain(this.centerCarouselOn.pass(this.currentIter,this));return this.slideInfoZone;},hideInfoSlideShow:function(){this.fireEvent('onHideInfopane');this.slideInfoZone.cancel();if(this.options.slideInfoZoneSlide)
this.slideInfoZone.start({'opacity':0,'left':-420});else
this.slideInfoZone.start({'opacity':0});return this.slideInfoZone;},makeLink:function(num){this.currentLink.setProperties({href:this.galleryData[num].link,title:this.galleryData[num].linkTitle,target:this.galleryData[num].linkTarget})
if(!((this.options.embedLinks)&&(!this.options.showArrows)&&(!this.options.showCarousel)))
this.currentLink.setStyle('display','block');},clearLink:function(){this.currentLink.setProperties({href:'',title:''});if(!((this.options.embedLinks)&&(!this.options.showArrows)&&(!this.options.showCarousel)))
this.currentLink.setStyle('display','none');},makeReMooz:function(){this.currentLink.setProperties({href:'#'});this.currentLink.setStyles({'display':'block'});this.galleryElements[this.currentIter].element.set('title',this.galleryData[this.currentIter].title);this.ReMooz=new ReMooz(this.galleryElements[this.currentIter].element,{link:this.galleryData[this.currentIter].link,shadow:false,dragging:false,addClick:false,resizeOpacity:1});var img=this.galleryElements[this.currentIter];var coords=img.element.getCoordinates();delete coords.right;delete coords.bottom;widthDiff=coords.width-img.width;heightDiff=coords.height-img.height;coords.width=img.width;coords.height=img.height;coords.left+=Math.ceil(widthDiff/2)+1;coords.top+=Math.ceil(heightDiff/2)+1;this.ReMooz.getOriginCoordinates=function(coords){return coords;}.bind(this,coords);this.currentLink.onclick=function(){this.ReMooz.open.bind(this.ReMooz)();return false;}.bind(this);},flushGallery:function(){this.galleryElements.each(function(myFx){myFx.element.dispose();myFx=myFx.element=null;});this.galleryElements=[];},changeData:function(data){this.galleryData=data;this.clearTimer();this.flushGallery();if(this.options.showCarousel)this.flushCarousel();this.constructElements();if(this.options.showCarousel)this.fillCarousel();if(this.options.showInfopane)this.hideInfoSlideShow();this.galleryInit=1;this.lastIter=0;this.currentIter=0;this.doSlideShow(1);},initHistory:function(){this.fireEvent('onHistoryInit');this.historyKey=this.galleryElement.id+'-picture';if(this.options.customHistoryKey)
this.historyKey=this.options.customHistoryKey;this.history=new History.Route({defaults:[1],pattern:this.historyKey+'\\((\\d+)\\)',generate:function(values){return[this.historyKey,'(',values[0],')'].join('')}.bind(this),onMatch:function(values,defaults){if(parseInt(values[0])-1<this.maxIter)
this.goTo(parseInt(values[0])-1);}.bind(this)});this.addEvent('onChanged',function(){this.history.setValue(0,this.currentIter+1);this.history.defaults=[this.currentIter+1];}.bind(this));this.fireEvent('onHistoryInited');}};gallery=new Class(gallery);gallery.Transitions=new Hash({fade:function(oldFx,newFx,oldPos,newPos){oldFx.options.transition=newFx.options.transition=Fx.Transitions.linear;oldFx.options.duration=newFx.options.duration=this.options.fadeDuration;if(newPos>oldPos)newFx.start({opacity:1});else
{newFx.set({opacity:1});oldFx.start({opacity:0});}},crossfade:function(oldFx,newFx,oldPos,newPos){oldFx.options.transition=newFx.options.transition=Fx.Transitions.linear;oldFx.options.duration=newFx.options.duration=this.options.fadeDuration;newFx.start({opacity:1});oldFx.start({opacity:0});},fadebg:function(oldFx,newFx,oldPos,newPos){oldFx.options.transition=newFx.options.transition=Fx.Transitions.linear;oldFx.options.duration=newFx.options.duration=this.options.fadeDuration/2;oldFx.start({opacity:0}).chain(newFx.start.pass([{opacity:1}],newFx));}});var Preloader=new Class({Implements:[Events,Options],options:{root:'',period:100},initialize:function(options){this.setOptions(options);},load:function(sources){this.index=0;this.images=[];this.sources=this.temps=sources;this.total=this.sources.length;this.fireEvent('onStart',[this.index,this.total]);this.timer=this.progress.periodical(this.options.period,this);this.sources.each(function(source,index){this.images[index]=new Asset.image(this.options.root+source,{'onload':function(){this.index++;if(this.images[index])this.fireEvent('onLoad',[this.images[index],index,source]);}.bind(this),'onerror':function(){this.index++;this.fireEvent('onError',[this.images.splice(index,1),index,source]);}.bind(this),'onabort':function(){this.index++;this.fireEvent('onError',[this.images.splice(index,1),index,source]);}.bind(this)});},this);},progress:function(){this.fireEvent('onProgress',[Math.min(this.index,this.total),this.total]);if(this.index>=this.total)this.complete();},complete:function(){$clear(this.timer);this.fireEvent('onComplete',[this.images]);},cancel:function(){$clear(this.timer);}});function formatString(){var num=arguments.length;var oStr=arguments[0];for(var i=1;i<num;i++){var pattern="\\{"+(i-1)+"\\}";var re=new RegExp(pattern,"g");oStr=oStr.replace(re,arguments[i]);}
return oStr;}
Element.implement({appendHTML:function(html,where){return this.grab(new Element('text',{'html':html}),where);}});;var comboBoo=new Class({Implements:[Options,Events],options:{className:'comboBoo'},initialize:function(el,options){this.setOptions(options);this.oldCombo=$(el);this.oldCombo.set('opacity','0');this.bOpen=false;var pos=el.getCoordinates();top_shift=0;left_shift=0;this.comboLink=new Element('a',{'class':this.options.className+'-label','id':el.name}).setStyles({top:(pos.top+top_shift)+'px',left:(pos.left+left_shift)+'px',width:pos.width+'px'}).inject(document.body).set('html',el.options[el.options.selectedIndex].text);this.comboList=new Element('ul',{'class':this.options.className+'-list','id':'choices-'+el.name}).setStyles({display:'none',top:(pos.top+top_shift)+'px',left:(pos.left+left_shift)+'px',width:pos.width+10+'px'}).injectAfter(this.comboLink);this.comboLink.setStyle('background-color','#fff');this.comboList.set('opacity','0');this.addComboLinkEvents(this.comboLink);this.addComboListEvents(this.comboList);this.build(el);this.comboList.setStyle('display','');},build:function(el){for(i=0;i<el.length;i++){var el2=new Element('li',{'id':i}).set('html',el.options[i].text);this.addChoiceEvents(el2).injectInside(this.comboList);};},click:function(el){if(this.bOpen){this.bOpen=false;this.comboList.tween('opacity','0');}else{this.bOpen=true;this.comboList.tween('opacity','1');}},comboOver:function(){if(!this.bOpen)this.comboLink.tween('background-color','#CBCBCB');},comboOut:function(el){if(!this.bOpen)this.comboLink.tween('background-color','#fff');},comboListOut:function(el){this.bOpen=false;this.comboList.tween('opacity','0');this.comboLink.tween('background-color','#fff');},choiceOver:function(el){if(this.selected)this.selected.removeClass('choice-selected');this.selected=el.addClass('choice-selected');},choiceSelect:function(el){this.bOpen=false;this.comboLink.tween('background-color','#fff');this.comboList.tween('opacity','0');this.comboLink.set('html',el.get('text'));this.oldCombo.selectedIndex=el.id;if(el.getParent().getProperty('id')=='choices-region')
{change_region();var bodyElement=$(document.body);bodyElement.removeChild($('location'));bodyElement.removeChild($('choices-location'));new comboBoo($('location_simple'));}
if(el.getParent().getProperty('id')=='choices-order')
{location=this.oldCombo.options[this.oldCombo.selectedIndex=el.id].value;}},addComboLinkEvents:function(el){return el.addEvents({click:this.click.bind(this,[el]),mouseover:this.comboOver.bind(this,[el]),mouseleave:this.comboOut.bind(this,[el])});},addComboListEvents:function(el){return el.addEvents({mouseleave:this.comboListOut.bind(this,[el])});},addChoiceEvents:function(el){return el.addEvents({mouseover:this.choiceOver.bind(this,[el]),mousedown:this.choiceSelect.bind(this,[el])});}});comboBoo.implement(new Events,new Options);
