/*ReMooz*/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);},/** * @todo Test implementation */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: 9990,zIndexFocus: 9999,query: 'a.remooz',modal: false},assign: function(elements, options) {return $$(elements).map(function(element) {if(!element.hasClass("remooz-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);}});/** * Slimbox */var Slimbox=(function(){ var F=window,n=Browser.ie6,u,g,G=-1,o,w,E,v,y,M,s,m={},t=new Image(),K=new Image(),I,a,h,q,J,e,H,c,A,L,x,i,d,C;F.addEvent("domready",function(){$(document.body).adopt($$(I=new Element("div#lbOverlay",{events:{click:D}}),a=new Element("div#lbCenter"),H=new Element("div#lbBottomContainer")).setStyle("display","none"));h=new Element("div#lbImage").inject(a).adopt(q=new Element("div",{styles:{position:"relative"}}).adopt(J=new Element("a#lbPrevLink[href=#]",{events:{click:B}}),e=new Element("a#lbNextLink[href=#]",{events:{click:f}})));c=new Element("div#lbBottom").inject(H).adopt(new Element("a#lbCloseLink[href=#]",{events:{click:D}}),A=new Element("div#lbCaption"),L=new Element("div#lbNumber"),new Element("div",{styles:{clear:"both"}}))});function z(){ var N=F.getScroll(),O=F.getSize();$$(a,H).setStyle("left",N.x+(O.x/2));if(v){I.setStyles({left:N.x,top:N.y,width:O.x,height:O.y})}}function l(N){["object",n?"select":"embed"].forEach(function(P){Array.forEach(document.getElementsByTagName(P),function(Q){if(N){Q._slimbox=Q.style.visibility}Q.style.visibility=N?"hidden":Q._slimbox})});I.style.display=N?"":"none";var O=N?"addEvent":"removeEvent";F[O]("scroll",z)[O]("resize",z);document[O]("keydown",p)}function p(O){var N=O.code;return u.closeKeys.contains(N)?D():u.nextKeys.contains(N)?f():u.previousKeys.contains(N)?B():false}function B(){return b(w)}function f(){return b(E)}function b(N){if(N>=0){G=N;o=g[N][0];w=(G||(u.loop?g.length:0))-1;E=((G+1)%g.length)||(u.loop?0:-1);r();a.className="lbLoading";m=new Image();m.onload=k;m.src=o}return false}function k(){a.className="";d.set(0);h.setStyles({backgroundImage:"url("+o+")",display:""});q.setStyle("width",m.width);$$(q,J,e).setStyle("height",m.height);A.set("html",g[G][1]||"");L.set("html",(((g.length>1)&&u.counterText)||"").replace(/{x}/,G+1).replace(/{y}/,g.length));if(w>=0){t.src=g[w][0]}if(E>=0){K.src=g[E][0]}M=h.offsetWidth;s=h.offsetHeight;var P=Math.max(0,y-(s/2)),N=0,O;if(a.offsetHeight!=s){N=i.start({height:s,top:P})}if(a.offsetWidth!=M){N=i.start({width:M,marginLeft:-M/2})}O=function(){H.setStyles({width:M,top:P+s,marginLeft:-M/2,visibility:"hidden",display:""});d.start(1)};if(N){i.chain(O)}else{O()}}function j(){if(w>=0){J.style.display=""}if(E>=0){e.style.display=""}C.set(-c.offsetHeight).start(0);H.style.visibility=""}function r(){m.onload=null;m.src=t.src=K.src=o;i.cancel();d.cancel();C.cancel();$$(J,e,h,H).setStyle("display","none")}function D(){if(G>=0){r();G=w=E=-1;a.style.display="none";x.cancel().chain(l).start(0)}return false}Element.implement({slimbox:function(N,O){$$(this).slimbox(N,O);return this}});Elements.implement({slimbox:function(N,Q,P){Q=Q||function(R){return[R.href,R.title]};P=P||function(){return true};var O=this;O.removeEvents("click").addEvent("click",function(){var R=O.filter(P,this);return Slimbox.open(R.map(Q),R.indexOf(this),N)});return O}});return{open:function(P,O,N){u=Object.append({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeTransition:false,initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x}  {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},N||{});x=new Fx.Tween(I,{property:"opacity",duration:u.overlayFadeDuration});i=new Fx.Morph(a,Object.append({duration:u.resizeDuration,link:"chain"},u.resizeTransition?{transition:u.resizeTransition}:{}));d=new Fx.Tween(h,{property:"opacity",duration:u.imageFadeDuration,onComplete:j});C=new Fx.Tween(c,{property:"margin-top",duration:u.captionAnimationDuration});if(typeof P=="string"){P=[[P,O]];O=0}y=F.getScrollTop()+(F.getHeight()/2);M=u.initialWidth;s=u.initialHeight;a.setStyles({top:Math.max(0,y-(s/2)),width:M,height:s,marginLeft:-M/2,display:""});v=n||(I.currentStyle&&(I.currentStyle.position!="fixed"));if(v){I.style.position="absolute"}x.set(0).start(u.overlayOpacity);z();l(1);g=P;u.loop=u.loop&&(g.length>1);return b(O)}}})();Slimbox.scanPage = function() {$$("a[rel^=lightbox]").slimbox({/* Put custom options here */}, null, function(el) {return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));});};/**Roar */var Roar = new Class({Implements: [Options, Events, Chain],options: {duration: 3000,position: 'upperLeft',container: null,bodyFx: null,itemFx: null,margin: {x: 10, y: 10},offset: 10,className: 'roar',onShow: $empty,onHide: $empty,onRender: $empty},initialize: function(options) {this.setOptions(options);this.items = [];this.container = $(this.options.container) || document;},alert: function(title, message, options) {var params = Array.link(arguments, {title: String.type, message: String.type, options: Object.type});var items = [new Element('h3', {'html': $pick(params.title, '')})];if (params.message) items.push(new Element('p', {'html': params.message}));return this.inject(items, params.options);},inject: function(elements, options) {if (!this.body) this.render();options = options || {};var offset = [-this.options.offset, 0];var last = this.items.getLast();if (last) {offset[0] = last.retrieve('roar:offset');offset[1] = offset[0] + last.offsetHeight + this.options.offset;}var to = {'opacity': 1};to[this.align.y] = offset;var item = new Element('div', {'class': this.options.className,'opacity': 0}).adopt(new Element('div', {'class': 'roar-bg','opacity': 0.7}),elements);item.setStyle(this.align.x, 0).store('roar:offset', offset[1]).set('morph', $merge({unit: 'px',link: 'cancel',onStart: Chain.prototype.clearChain,transition: Fx.Transitions.Back.easeOut}, this.options.itemFx));var remove = this.remove.create({bind: this,arguments: [item],delay: 10});this.items.push(item.addEvent('click', remove));if (this.options.duration) {var over = false;var trigger = (function() {trigger = null;if (!over) remove();}).delay(this.options.duration);item.addEvents({mouseover: function() {over = true;},mouseout: function() {over = false;if (!trigger) remove();}});}item.inject(this.body).morph(to);return this.fireEvent('onShow', [item, this.items.length]);},remove: function(item) {var index = this.items.indexOf(item);if (index == -1) return this;this.items.splice(index, 1);item.removeEvents();var to = {opacity: 0};to[this.align.y] = item.getStyle(this.align.y).toInt() - item.offsetHeight - this.options.offset;item.morph(to).get('morph').chain(item.destroy.bind(item));return this.fireEvent('onHide', [item, this.items.length]).callChain(item);},empty: function() {while (this.items.length) this.remove(this.items[0]);return this;},render: function() {this.position = this.options.position;if ($type(this.position) == 'string') {var position = {x: 'center', y: 'center'};this.align = {x: 'left', y: 'top'};if ((/left|west/i).test(this.position)) position.x = 'left';else if ((/right|east/i).test(this.position)) this.align.x = position.x = 'right';if ((/upper|top|north/i).test(this.position)) position.y = 'top';else if ((/bottom|lower|south/i).test(this.position)) this.align.y = position.y = 'bottom';this.position = position;}this.body = new Element('div', {'class': 'roar-body'}).inject(document.body);if (Browser.Engine.trident4) this.body.addClass('roar-body-ugly');this.moveTo = this.body.setStyles.bind(this.body);this.reposition();if (this.options.bodyFx) {var morph = new Fx.Morph(this.body, $merge({unit: 'px',chain: 'cancel',transition: Fx.Transitions.Circ.easeOut}, this.options.bodyFx));this.moveTo = morph.start.bind(morph);}var repos = this.reposition.bind(this);window.addEvents({scroll: repos,resize: repos});this.fireEvent('onRender', this.body);},reposition: function() {var max = document.getCoordinates(), scroll = document.getScroll(), margin = this.options.margin;max.left += scroll.x;max.right += scroll.x;max.top += scroll.y;max.bottom += scroll.y;var rel = ($type(this.container) == 'element') ? this.container.getCoordinates() : max;this.moveTo({left: (this.position.x == 'right')? (Math.min(rel.right, max.right) - margin.x): (Math.max(rel.left, max.left) + margin.x),top: (this.position.y == 'bottom')? (Math.min(rel.bottom, max.bottom) - margin.y): (Math.max(rel.top, max.top) + margin.y)});}});var noobSlide=new Class({initialize:function(a){this.items=a.items;this.mode=a.mode||'horizontal';this.modes={horizontal:['left','width'],vertical:['top','height']};this.size=a.size||240;this.box=a.box.setStyle(this.modes[this.mode][1],(this.size*this.items.length)+'px');this.button_event=a.button_event||'click';this.handle_event=a.handle_event||'click';this.onWalk=a.onWalk||null;this.currentIndex=null;this.previousIndex=null;this.nextIndex=null;this.interval=a.interval||5000;this.autoPlay=a.autoPlay||false;this._play=null;this.handles=a.handles||null;if(this.handles){this.addHandleButtons(this.handles)}this.buttons={previous:[],next:[],play:[],playback:[],stop:[]};if(a.addButtons){for(var b in a.addButtons){this.addActionButtons(b,$type(a.addButtons[b])=='array'?a.addButtons[b]:[a.addButtons[b]])}}this.fx=new Fx.Tween(this.box,$extend((a.fxOptions||{duration:500,wait:false}),{property:this.modes[this.mode][0]}));this.walk((a.startItem||0),true,true)},addHandleButtons:function(a){for(var i=0;i<a.length;i++){a[i].addEvent(this.handle_event,this.walk.bind(this,[i,true]))}},addActionButtons:function(a,b){for(var i=0;i<b.length;i++){switch(a){case'previous':b[i].addEvent(this.button_event,this.previous.bind(this,[true]));break;case'next':b[i].addEvent(this.button_event,this.next.bind(this,[true]));break;case'play':b[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'next',false]));break;case'playback':b[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'previous',false]));break;case'stop':b[i].addEvent(this.button_event,this.stop.bind(this));break}this.buttons[a].push(b[i])}},previous:function(a){this.walk((this.currentIndex>0?this.currentIndex-1:this.items.length-1),a)},next:function(a){this.walk((this.currentIndex<this.items.length-1?this.currentIndex+1:0),a)},play:function(a,b,c){this.stop();if(!c){this[b](false)}this._play=this[b].periodical(a,this,[false])},stop:function(){$clear(this._play)},walk:function(a,b,c){if(a!=this.currentIndex){this.currentIndex=a;this.previousIndex=this.currentIndex+(this.currentIndex>0?-1:this.items.length-1);this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length);if(b){this.stop()}if(c){this.fx.cancel().set((this.size*-this.currentIndex)+'px')}else{this.fx.start(this.size*-this.currentIndex)}if(b&&this.autoPlay){this.play(this.interval,'next',true)}if(this.onWalk){this.onWalk((this.items[this.currentIndex]||null),(this.handles&&this.handles[this.currentIndex]?this.handles[this.currentIndex]:null))}}}});
/*GROWL*/

