var jceUtils={config:{convert:1,overlay_opacity:0.8,resize:1,fadespeed:500,scalespeed:500,pngfix:0,tip_class:'tooltip',tip_opacity:1,tip_fxspeed:150,images_path:'mambots/system/jceutils/images/'},setConfig:function(options){for(var option in options){this.config[option]=options[option]}},init:function(){new jceBox({convert:this.config.convert,overlay_opacity:this.config.overlay_opacity,resize:this.config.resize,fadespeed:this.config.fadespeed,scalespeed:this.config.scalespeed});new jceTips({className:this.config.tip_class,fxSpeed:this.config.tip_fxspeed,maxOpacity:this.config.tip_opacity});if(this.config.pngfix==1){fixPng()}},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},parseQuery:function(query){var params={};var kv,k,v;if(!query){return params}var pairs=query.split(/[;&]/);for(var i=0;i<pairs.length;i++){kv=pairs[i].split('=');if(!kv||kv.length!=2){continue}k=unescape(kv[0]);v=unescape(kv[1]);v=v.replace(/\+/g,' ');params[k]=v}return params}};if(typeof MooTools!='undefined'){Element.extend({removeProperty:function(property){this.removeAttribute(property);return this}});function fixPng(){if(window.ie6){$$('img[src$=.png]').each(function(el){var s=el.src;el.setProperty('src',jceUtils.config.images_path+'blank.gif').setStyle('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+s+'\', sizingMethod=\'\')')})}};var jceTips=new Class({getOptions:function(){return{className:'tooltip',fxSpeed:150,maxOpacity:1}},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='';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);this.locate(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){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},locate:function(event){var event=new Event(event);if(this.exists){$(this.toolTip).setStyles({'top':Math.round(event.client.y+window.getScrollTop()+15)+'px','left':Math.round(event.client.x+window.getScrollLeft()-15)+'px'})}event.stop},hide:function(){if(this.exists){$(this.toolTip).remove()}this.exists=false}});jceTips.implement(new Events);jceTips.implement(new Options);var jceBox=new Class({getOptions:function(){return{convert:1,overlay_opacity:0.8,resize:1,fadespeed:200,scalespeed:200,zoom:1,width:250,height:250,transition:false}},initialize:function(options){this.setOptions(this.getOptions(),options);if(this.options.convert==1){$$('a').each(function(el){var matched=false;var temp='index2.php?option=com_jce&task=popup';if(el.href.contains(temp)||jceUtils.cleanupEventStr(el.getAttribute('onclick')).contains(temp)){var src=jceUtils.cleanupEventStr(el.getAttribute('onclick')).replace(/&amp;/g,'&').replace(/&#39;/g,"'");matched=true}if(el.href.contains('mosce/jscripts/tiny_mce/popupImage.php')){var src=el.href.replace(/&amp;/g,'&').replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/[\(\'\)\;]/g,'').replace(/\?/g,'&');matched=true}if(matched){var p=jceUtils.parseQuery(src);$(el).setProperties({'href':p.img,'title':p.title.replace(/_/g,' ')}).addClass('jcebox').removeProperty('target').removeProperty('onclick')}}.bind(this))}this.anchors=[];$$('a.jcebox').each(function(el){if(this.options.zoom==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',jceUtils.config.images_path+'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 dim=elm.getCoordinates();this.zoomImg=new Element('img',{'src':jceUtils.config.images_path+'zoomImg.png'});if(window.ie6){this.setPNG(this.zoomImg)}this.zoomDiv=new Element('div',{'styles':{'top':dim.bottom-20+'px','left':dim.right-20+'px','zindex':elm.style.zIndex,'position':'absolute'},'class':'zoomImg'}).injectInside($E('body')).adopt(this.zoomImg)}}.bind(this))}else{this.zoomLink=new Element('img',{'class':'zoomLink','src':jceUtils.config.images_path+'zoomLink.png'}).injectInside(el);if(window.ie6){this.setPNG(this.zoomLink)}}},click:function(link){this.overlay=new Element('div',{'id':'jce_lbOverlay'}).injectInside(document.body);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.image=new Element('div',{'id':'jce_lbImage'}).injectInside(this.center);this.prevLink=new Element('a',{'id':'jce_lbPrevLink','href':'javascript:void(0);','styles':{'display':'none'}}).injectInside(this.image);this.nextLink=this.prevLink.clone().setProperty('id','jce_lbNextLink').injectInside(this.image);this.prevLink.onclick=this.previous.bind(this);this.nextLink.onclick=this.next.bind(this);this.bottomContainer=new Element('div',{'id':'jce_lbBottomContainer','styles':{'display':'none'}}).injectInside(document.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:500}).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:500,onComplete:nextEffect}),bottom:this.bottom.effect('margin-top',{duration:400,onComplete:nextEffect})};if(link.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){this.type='image';this.preloadPrev=new Image();this.preloadNext=new Image();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(0.8);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=this.prevLink.style.display=this.nextLink.style.display='none';this.fx.image.hide();this.center.className='jce_lbLoading';if(this.type=='image'){this.preload=new Image();this.preload.onload=this.nextEffect.bind(this);this.preload.src=this.images[imageNum][0]}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.center.className='';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=this.preload.width;var h=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}}}this.image.style.backgroundImage='url('+this.images[this.activeImage][0]+')';this.image.style.width=this.bottom.style.width=w+'px';this.image.style.height=this.prevLink.style.height=this.nextLink.style.height=h+'px';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;&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;&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.style.width=this.bottom.style.width=this.images[this.activeImage][2]+'px';this.image.style.height=this.images[this.activeImage][3]+'px';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:if(this.type=='image'){this.center.style.backgroundColor='#000'}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='';if(this.activeImage!=(this.images.length-1))this.nextLink.style.display=''}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.overlay.remove();return false}});jceBox.implement(new Events);jceBox.implement(new Options);window.onDomReady(function(){jceUtils.init()})}else{var jceBox=null;var jceTips=null}