if(typeof MooTools!='undefined'){Element.extend({removeProperty:function(property){this.removeAttribute(property);return this},show:function(){this.style.display='';return this},hide:function(){this.style.display='none';return this}});function fixPng(){$$('img[src$=.png]').each(function(el){var p=el.src;el.setProperty('src','mambots/system/jceutils/images/blank.gif').setStyle('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+p+'\', sizingMethod=\'\')')})};var jceTips={init:function(options){new jceToolTips(options)}};var jceBox={init:function(options){new jceLightBox(options)}};var jceToolTips=new Class({getOptions:function(){return{className:'tooltip',fxSpeed:150,maxOpacity:1,tipPosition:'tr',offsets:{'x':16,'y':16}}},initialize:function(options){this.setOptions(this.getOptions(),options);$$('.jce_tooltip').each(function(el){this.start(el)}.bind(this))},start:function(el){el.$tmp.myText=el.title||'';el.removeAttribute('title');el.$tmp.myTitle='';el.$tmp.alt=el.alt;el.removeAttribute('alt');if(el.$tmp.myText&&el.$tmp.myText.contains('::')){var dual=el.$tmp.myText.split('::');el.$tmp.myTitle=dual[0].trim();el.$tmp.myText=dual[1].trim()}el.addEvent('mouseover',function(event){if(!this.exists){this.show(el,event)}}.bindWithEvent(this));el.addEvent('mousemove',this.locate.bindWithEvent(this));el.addEvent('mouseout',this.hide.bindWithEvent(this));el.addEvent('mousedown',this.hide.bindWithEvent(this));el.addEvent('blur',this.hide.bindWithEvent(this))},show:function(el,event){this.toolTip=new Element('div',{'styles':{'position':'absolute','top':'0','left':'0','visibility':'hidden'},'class':this.options.className}).injectInside(document.body);new Fx.Style(this.toolTip,'opacity',{duration:this.options.fxSpeed}).start(0,this.options.maxOpacity);this.toolTitle=new Element('h4').injectInside(this.toolTip).setHTML(el.$tmp.myTitle);this.toolText=new Element('p').injectInside(this.toolTip).setHTML(el.$tmp.myText);this.exists=true;this.locate(event)},locate:function(event){if(this.exists){var tip={'x':this.toolTip.offsetWidth,'y':this.toolTip.offsetHeight};var pos={'x':event.page.x+this.options.offsets.x,'y':event.page.y+this.options.offsets.y};switch(this.options.tipPosition){case'tl':pos.x=(event.page.x-tip.x)-this.options.offsets.x;pos.y=(event.page.y-tip.y)-this.options.offsets.y;break;case'tr':pos.x=event.page.x+this.options.offsets.x;pos.y=(event.page.y-tip.y)-this.options.offsets.y;break;case'tc':pos.x=(event.page.x-Math.round((tip.x/2)))+this.options.offsets.x;pos.y=(event.page.y-tip.y)-this.options.offsets.y;break;case'bl':pos.x=(event.page.x-tip.x)-this.options.offsets.x;pos.y=(event.page.y+tip.y)-this.options.offsets.y;break;case'br':pos.x=event.page.x+this.options.offsets.x;pos.y=event.page.y+this.options.offsets.y;break;case'bc':pos.x=(event.page.x-Math.round((tip.x/2)))+this.options.offsets.x;pos.y=(event.page.y+tip.y)-this.options.offsets.y;break}this.toolTip.setStyles({'top':pos.y,'left':pos.x})}event.stop},hide:function(){if(this.exists){$(this.toolTip).remove()}this.exists=false}});jceToolTips.implement(new Events);jceToolTips.implement(new Options);var jceLightBox=new Class({getOptions:function(){return{overlayOpacity:0.8,overlayColor:'#000000',resize:1,fadeSpeed:200,scaleSpeed:200,width:250,height:250,transition:false}},initialize:function(options){this.setOptions(this.getOptions(),options);if(jceUtils.config.legacyPopup==1){$$('a').each(function(el){jceUtils.convertType(el)})}this.anchors=[];$$('a.jcebox').each(function(el){if(jceUtils.config.boxIcons==1){this.setZoom(el)}el.onclick=this.click.pass(el,this);this.anchors.push(el)},this);this.eventKeyDown=this.keyboardListener.bindAsEventListener(this);this.eventPosition=this.position.bind(this)},setPNG:function(el){var s=el.src;el.setProperty('src','mambots/system/jceutils/images/blank.gif').setStyle('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+s+'\', sizingMethod=\'\')')},setZoom:function(el){if(el.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){el.getChildren().each(function(elm){if(elm.getTag()=='img'){var prop=elm.getCoordinates();this.zoomImg=new Element('img',{'styles':{'top':prop.bottom-20,'left':prop.right-20,'zindex':elm.style.zIndex+1,'cursor':'pointer'},'events':{'click':function(){this.click(el)}.bind(this)},'class':'zoomImg','src':jceUtils.config.imagePath+'zoomImg.png','alt':'Zoom'}).injectInside($E('body'));if(window.ie6&&jceUtils.config.pngFix==1){this.setPNG(this.zoomImg)}}}.bind(this))}else{this.zoomLink=new Element('img',{'class':'zoomLink','src':jceUtils.config.imagePath+'zoomLink.png'}).injectInside(el);if(window.ie6&&jceUtils.config.pngFix==1){this.setPNG(this.zoomLink)}}},click:function(link){this.overlay=new Element('div',{'id':'jce_lbOverlay'}).injectInside($E('body')).setStyles({'cursor':'pointer','backgroundColor':this.options.overlayColor});this.center=new Element('div',{'id':'jce_lbCenter','styles':{'width':this.options.width,'height':this.options.height,'marginLeft':-(this.options.width/2),'display':'none'}}).injectInside(document.body);this.loader=new Element('div',{'id':'jce_lbLoading'}).injectInside(this.center).hide();this.image=new Element('div',{'id':'jce_lbImage'}).injectInside(this.center);this.bottomContainer=new Element('div',{'id':'jce_lbBottomContainer','styles':{'display':'none'}}).injectInside($E('body'));this.bottom=new Element('div',{'id':'jce_lbBottom'}).injectInside(this.bottomContainer);new Element('a',{'id':'jce_lbCloseLink','href':'javascript:void(0);'}).injectInside(this.bottom).onclick=this.overlay.onclick=this.close.bind(this);this.caption=new Element('div',{'id':'jce_lbCaption'}).injectInside(this.bottom);this.number=new Element('div',{'id':'jce_lbNumber'}).injectInside(this.bottom);new Element('div',{'styles':{'clear':'both'}}).injectInside(this.bottom);var nextEffect=this.nextEffect.bind(this);this.fx={overlay:this.overlay.effect('opacity',{duration:this.options.fadeSpeed}).hide(),resize:this.center.effects($extend({duration:this.options.scaleSpeed,onComplete:nextEffect},this.options.transition?{transition:this.options.transition}:{})),image:this.image.effect('opacity',{duration:this.options.fadeSpeed,onComplete:nextEffect}),bottom:this.bottom.effect('margin-top',{duration:this.options.scaleSpeed,onComplete:nextEffect})};if(link.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){this.type='image';this.preloadPrev=new Image();this.preloadNext=new Image();this.nav=new Element('div',{'id':'jce_lbNav'}).injectInside(this.image);this.realImage=new Element('img').injectBefore(this.nav);this.prevLink=new Element('a',{'id':'jce_lbPrevLink','href':'javascript:void(0);'}).injectInside(this.nav);this.nextLink=new Element('a',{'id':'jce_lbNextLink','href':'javascript:void(0);'}).injectInside(this.nav);this.prevLink.onclick=this.previous.bind(this);this.nextLink.onclick=this.next.bind(this);if(!link.rel)return this.show(link.href,link.title);var j,imageNum,images=[];this.anchors.each(function(el){if(el.rel==link.rel){for(j=0;j<images.length;j++)if(images[j][0]==el.href)break;if(j==images.length){images.push([el.href,el.title]);if(el.href==link.href)imageNum=j}}},this);return this.open(images,imageNum)}else{this.type='iframe';var query=link.href.replace(/^[^\?]+\??/,'');var params=jceUtils.parseQuery(query);var url=link.href.replace('&bw='+params['bw']+'&bh='+params['bh'],'','g');var w=parseInt(params['bw'])||300;var h=parseInt(params['bh'])||300;return this.open([[url,link.title,w,h]],0)}},show:function(url,title){return this.open([[url,title]],0)},open:function(images,imageNum){this.images=images;this.position();this.setup(true);this.top=window.getScrollTop()+(window.getHeight()/15);this.center.setStyles({top:this.top,display:''});this.fx.overlay.start(this.options.overlayOpacity);return this.changeImage(imageNum)},position:function(){this.overlay.setStyles({'top':window.getScrollTop(),'height':window.getHeight()})},setup:function(open){var elements=$A(document.getElementsByTagName('object'));elements.extend(document.getElementsByTagName(window.ie6?'select':'embed'));elements.each(function(el){if(open)el.lbBackupStyle=el.style.visibility;el.style.visibility=open?'hidden':el.lbBackupStyle});var fn=open?'addEvent':'removeEvent';window[fn]('scroll',this.eventPosition)[fn]('resize',this.eventPosition);document[fn]('keydown',this.eventKeyDown);this.step=0},keyboardListener:function(event){switch(event.keyCode){case 27:case 88:case 67:this.close();break;case 37:case 80:this.previous();break;case 39:case 78:this.next()}},previous:function(){return this.changeImage(this.activeImage-1)},next:function(){return this.changeImage(this.activeImage+1)},changeImage:function(imageNum){if(this.step||(imageNum<0)||(imageNum>=this.images.length))return false;this.step=1;this.activeImage=imageNum;this.center.style.backgroundColor='';this.bottomContainer.style.display='none';this.fx.image.hide();this.loader.show();if(this.type=='image'){this.preload=new Image();this.preload.onload=this.nextEffect.bind(this);this.preload.src=this.images[imageNum][0];this.prevLink.style.display=this.nextLink.style.display='none'}if(this.type=='iframe'){this.iframe=new Element('iframe',{'styles':{'width':this.images[imageNum][2],'height':this.images[imageNum][3]},'frameborder':'0','title':this.images[imageNum][1]}).addEvent('load',function(){return this.nextEffect()}.bind(this)).injectInside(this.image).setProperty('src',this.images[imageNum][0])}return false},nextEffect:function(){switch(this.step++){case 1:this.loader.hide();var title=this.images[this.activeImage][1]||'';if(title.contains('http://'))title='<a href="'+title+'" target="_blank">'+title+'</a>';if(this.type=='image'){var w=Math.round(this.preload.width);var h=Math.round(this.preload.height);if(this.options.resize==1){var x=Math.round(window.getWidth()-150);var y=Math.round(window.getHeight()-150);if(w>x){h=h*(x/w);w=x;if(h>y){w=w*(y/h);h=y}}else if(h>y){w=w*(y/h);h=y;if(w>x){h=h*(x/w);w=x}}}w=Math.round(w);h=Math.round(h);this.realImage.setProperty('src',this.images[this.activeImage][0]).setStyles({'width':w,'height':h});this.image.setStyles({'width':w,'height':h});this.bottom.setStyle('width',w);this.nav.setStyles({'width':w+20,'height':h});this.caption.setHTML(title);var h='';if(this.images.length>1){for(var i=0;i<this.images.length;i++){var n=i+1;if(n==1&&this.activeImage!=n-1){h+='<a href="javascript:void(0);" class="jce_lbNumberPrevLink">&lt; Previous&nbsp;</a>'}var seperator=(n==this.images.length)?'':' | ';if(this.activeImage!=i){h+='<a href="javascript:void(0);" class="jce_lbNumberLink">'}h+=n;if(this.activeImage!=i){h+='</a>'}h+=seperator;if(n==this.images.length&&this.activeImage!=n-1){h+='<a href="javascript:void(0);" class="jce_lbNumberNextLink">&nbsp;Next &gt;</a>'}}}this.number.setHTML(h);$$('a.jce_lbNumberLink').each(function(el){el.addEvent('click',function(){var n=parseInt(el.getText());return this.changeImage(n-1)}.bind(this))},this);$$('a.jce_lbNumberNextLink').each(function(el){el.addEvent('click',function(){return this.next()}.bind(this))},this);$$('a.jce_lbNumberPrevLink').each(function(el){el.addEvent('click',function(){return this.previous()}.bind(this))},this);if(this.activeImage)this.preloadPrev.src=this.images[this.activeImage-1][0];if(this.activeImage!=(this.images.length-1))this.preloadNext.src=this.images[this.activeImage+1][0]}if(this.type=='iframe'){this.image.setStyles({'width':this.images[this.activeImage][2]+'px','height':this.images[this.activeImage][3]+'px'});this.bottom.setStyle('width',this.image.style.width);this.caption.setHTML(title)}if(this.center.clientHeight!=this.image.offsetHeight){this.fx.resize.start({height:this.image.offsetHeight});break}this.step++;case 2:if(this.center.clientWidth!=this.image.offsetWidth){this.fx.resize.start({width:this.image.offsetWidth,marginLeft:-this.image.offsetWidth/2});break}this.step++;case 3:this.bottomContainer.setStyles({'top':this.top+this.center.clientHeight,'height':0,'marginLeft':-this.image.offsetWidth/2,display:''});this.fx.image.start(1);break;case 4:this.fx.bottom.set(-this.bottom.offsetHeight);this.bottomContainer.style.height='';this.fx.bottom.start(0);break;case 5:if(this.type=='image'){if(this.activeImage)this.prevLink.style.display='block';if(this.activeImage!=(this.images.length-1))this.nextLink.style.display='block'}this.step=0}},close:function(){if(this.step<0)return;this.step=-1;if(this.preload){this.preload.onload=Class.empty;this.preload=null}for(var f in this.fx)this.fx[f].stop();this.center.style.display=this.bottomContainer.style.display='none';this.fx.overlay.chain(this.setup.pass(false,this)).start(0);this.center.remove();this.bottomContainer.remove();this.overlay.remove();return false}});jceLightBox.implement(new Events);jceLightBox.implement(new Options);window.onDomReady(function(){jceUtils.init()})}else{var jceLightBox=null;var jceToolTips=null}
