var $j=jQuery.noConflict();$j.extend({getWidth:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0},getHeight:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0},getScrollHeight:function(){return document.documentElement.scrollHeight||document.body.scrollHeight},getScrollWidth:function(){return document.documentElement.scrollWidth||document.body.scrollWidth},getScrollTop:function(){return document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop||0},getScrollLeft:function(){return document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft||0},getPosition:function(el){var left=0,top=0;do{left+=el.offsetLeft||0;top+=el.offsetTop||0;el=el.offsetParent}while(el);return{'x':left,'y':top}},getCoordinates:function(el){var pos=$j.getPosition(el);var obj={'width':el.offsetWidth,'height':el.offsetHeight,'left':pos.x,'top':pos.y};obj.right=obj.left+obj.width;obj.bottom=obj.top+obj.height;return obj}});function fixPng(){var images=$j('img[@src*="png"]',document);images.each(function(){var p=this.src;this.css('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+p+'\', sizingMethod=\'\')');this.src='mambots/system/jceutils/images/blank.gif'})};function jceToolTips(options){jQuery.jceTips.init(options)};jQuery.jceTips={options:{className:'tooltip',fxSpeed:150,maxOpacity:1,tipPosition:'tr',offsets:{'x':16,'y':16}},init:function(options){for(n in options){this.options[n]=options[n]}$j('.jce_tooltip').each(function(){$j(this).bind('mouseover',function(){jQuery.jceTips.show(this)});$j(this).bind('mousemove',function(e){jQuery.jceTips.locate(e)});$j(this).bind('mouseout',function(){jQuery.jceTips.hide(this)}).bind('blur',function(){jQuery.jceTips.hide(this)});this.myText=this.title||false;this.myTitle='';$j(this).removeAttr('title');if(this.myText&&jceUtils.test('::',this.myText)){var dual=this.myText.split('::');this.myTitle=$j.trim(dual[0]);this.myText=$j.trim(dual[1])}})},show:function(el){this.toolTip=document.createElement('div');this.toolTitle=document.createElement('h4');this.toolText=document.createElement('p');$j(this.toolTip).addClass(this.options.className).css('position','absolute').appendTo('body').hide();$j(this.toolTitle).appendTo($j(this.toolTip));$j(this.toolText).appendTo($j(this.toolTip));$j(this.toolTitle).html(el.myTitle);$j(this.toolText).html(el.myText);$j(this.toolTip).animate({'opacity':this.options.maxOpacity},this.options.fxSpeed);this.exists=true},locate:function(e){if(this.exists){var page={'x':e.clientX+$j.getScrollLeft(),'y':e.clientY+$j.getScrollTop()};var tip={'x':this.toolTip.offsetWidth,'y':this.toolTip.offsetHeight};var pos={'x':e.clientX+this.options.offsets.x,'y':e.clientY+this.options.offsets.y};switch(this.options.tipPosition){case'tl':pos.x=(page.x-tip.x)-this.options.offsets.x;pos.y=(page.y-tip.y)-this.options.offsets.y;break;case'tr':pos.x=page.x+this.options.offsets.x;pos.y=(page.y-tip.y)-this.options.offsets.y;break;case'tc':pos.x=(page.x-Math.round((tip.x/2)))+this.options.offsets.x;pos.y=(page.y-tip.y)-this.options.offsets.y;break;case'bl':pos.x=(page.x-tip.x)-this.options.offsets.x;pos.y=(page.y+tip.y)-this.options.offsets.y;break;case'br':pos.x=page.x+this.options.offsets.x;pos.y=page.y+this.options.offsets.y;break;case'bc':pos.x=(page.x-Math.round((tip.x/2)))+this.options.offsets.x;pos.y=(page.y+tip.y)-this.options.offsets.y;break}$j(this.toolTip).css({top:pos.y+'px',left:pos.x+'px'})}},hide:function(el){if(this.exists){$j(this.toolTip).fadeOut(this.options.fxSpeed).remove()}}};function jceLightBox(options){jceBox.init(options)};var jceBox={anchors:[],options:{overlayOpacity:0.8,overlayColor:'#000000',resize:1,fadeSpeed:200,scaleSpeed:200,width:250,height:250},init:function(options){for(n in options){this.options[n]=options[n]}if(jceUtils.config.legacyPopup==1){$j('a').each(function(){jceUtils.convertType(this)})}$j('a.jcebox').each(function(){if(jceUtils.config.boxIcons==1){jceBox.setZoom(this)}jceBox.anchors.push(this);$j(this).click(function(){return jceBox.start(this)})})},setPNG:function(el){var s=el.src;$j(el).attr('src','mambots/system/jceutils/images/blank.gif').css('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+s+'\', sizingMethod=\'\')')},setZoom:function(el){if(el.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){$j(el).children().each(function(){if(this.nodeName.toLowerCase()=='img'){var prop=$j.getCoordinates(this);jceBox.zoomImg=document.createElement('img');$j(jceBox.zoomImg).css({top:prop.bottom-20,left:prop.right-20,zindex:this.style.zIndex+1,cursor:'pointer'}).attr({src:jceUtils.config.imagePath+'zoomImg.png',alt:'Zoom'}).click(function(){jceBox.start(el);return false}).addClass('zoomImg').appendTo('body');if(jceUtils.ie6()&&jceUtils.config.pngFix==1){jceBox.setPNG(jceBox.zoomImg)}}})}else{jceBox.zoomLink=document.createElement('img');$j(jceBox.zoomLink).attr({src:jceUtils.config.imagePath+'zoomLink.png'}).addClass('zoomLink').appendTo(el);if(jceUtils.ie6()&&jceUtils.config.pngFix==1){jceBox.setPNG(jceBox.zoomLink)}}},start:function(link){this.overlay=document.createElement('div');$j(this.overlay).attr('id','jce_lbOverlay').appendTo('body').css({opacity:'0',cursor:'pointer',backgroundColor:this.options.overlayColor});this.center=document.createElement('div');$j(this.center).attr('id','jce_lbCenter').css({width:this.options.width,height:this.options.height,marginLeft:-(this.options.width/2)}).appendTo('body').hide();this.loader=document.createElement('div');$j(this.loader).attr('id','jce_lbLoading').appendTo(this.center).hide();this.image=document.createElement('div');$j(this.image).attr('id','jce_lbImage').appendTo(this.center);$j(this.overlay).click(function(){jceBox.close()});this.bottomContainer=document.createElement('div');$j(this.bottomContainer).attr('id','jce_lbBottomContainer').appendTo('body').hide();this.bottom=document.createElement('div');$j(this.bottom).attr('id','jce_lbBottom').appendTo(this.bottomContainer);this.closeLink=document.createElement('a');$j(this.closeLink).attr({'id':'jce_lbCloseLink','href':'javascript:void(0);'}).appendTo(this.bottom).click(function(){jceBox.close()});this.caption=document.createElement('div');$j(this.caption).attr('id','jce_lbCaption').appendTo(this.bottom);this.number=document.createElement('div');$j(this.number).attr('id','jce_lbNumber').appendTo(this.bottom);$j('<div style="clear:both;"></div>').appendTo(this.bottom);if(link.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){this.type='image';this.preloadPrev=new Image();this.preloadNext=new Image();this.realImage=document.createElement('img');$j(this.realImage).appendTo(this.image);this.nav=document.createElement('div');$j(this.nav).attr('id','jce_lbNav').appendTo(this.image);this.prevLink=document.createElement('a');$j(this.prevLink).attr({'id':'jce_lbPrevLink','href':'javascript:void(0);'}).appendTo(this.nav);this.nextLink=document.createElement('a');$j(this.nextLink).attr({'id':'jce_lbNextLink','href':'javascript:void(0);'}).appendTo(this.nav);$j(this.prevLink).click(function(){jceBox.previous()});$j(this.nextLink).click(function(){jceBox.next()});if(!link.rel)return this.show(link.href,link.title);var j,imageNum,images=[];$j.each(this.anchors,function(){if(this.rel==link.rel){for(j=0;j<images.length;j++)if(images[j][0]==this.href)break;if(j==images.length){images.push([this.href,this.title]);if(this.href==link.href)imageNum=j}}});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=$j.getScrollTop()+($j.getHeight()/15);$j(this.center).css({top:this.top,display:''});$j(this.overlay).fadeTo(this.options.fadeSpeed,this.options.overlayOpacity);return this.changeImage(imageNum)},position:function(){$j(this.overlay).css({'top':$j.getScrollTop(),'height':$j.getHeight()})},setup:function(open){if($j.ie6){$j('object','select','embed').each(function(){if(open)this.lbBackupStyle=this.style.visibility;this.style.visibility=open?'hidden':el.lbBackupStyle})}if(open){$j(window).bind('scroll',function(){jceBox.position()});$j(window).bind('resize',function(){jceBox.position()});$j(document).bind('keydown',function(event){jceBox.keyboardListener(event)})}else{$j(window).unbind('scroll');$j(window).unbind('resize');$j(document).unbind('keydown')}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;$j(this.image).css('visibility','hidden');this.bottomContainer.style.display='none';$j(this.loader).show();if(this.type=='image'){this.preload=new Image();this.preload.onload=function(){return jceBox.nextEffect()};this.preload.src=this.images[imageNum][0];this.prevLink.style.display=this.nextLink.style.display='none'}if(this.type=='iframe'){this.iframe=document.createElement('iframe');$j(this.iframe).attr({frameBorder:0,title:this.images[imageNum][1],onload:function(){return jceBox.nextEffect()}}).css({width:this.images[imageNum][2],height:this.images[imageNum][3]}).appendTo(this.image).attr('src',this.images[imageNum][0])}return false},nextEffect:function(){switch(this.step++){case 1:$j(this.loader).hide();var title=this.images[this.activeImage][1]||'';if(title.indexOf('http://')!=-1)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($j.getWidth()-150);var y=Math.round($j.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);$j(this.image).width(w).height(h);$j(this.realImage).attr('src',this.images[this.activeImage][0]).width(w).height(h);$j(this.bottom).width(w);$j(this.nav).width(w+20).height(h);$j(this.caption).html(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>'}}}$j(this.number).html(h);$j('a.jce_lbNumberLink').each(function(){$j(this).click(function(){var n=parseInt($j(this).text());return jceBox.changeImage(n-1)})});$j('a.jce_lbNumberNextLink').each(function(){$j(this).click(function(){return jceBox.next()})});$j('a.jce_lbNumberPrevLink').each(function(){$j(this).click(function(){return jceBox.previous()})});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'){$j(this.image).width(this.images[this.activeImage][2]).height(this.images[this.activeImage][3]);$j(this.bottom).width($j(this.image).width());$j(this.caption).html(title)}if(this.center.clientHeight!=this.image.offsetHeight){$j(this.center).animate({height:this.image.offsetHeight},this.options.scaleSpeed,function(){return jceBox.nextEffect()});break}this.step++;case 2:if(this.center.clientWidth!=this.image.offsetWidth){$j(this.center).animate({width:this.image.offsetWidth,marginLeft:-this.image.offsetWidth/2},this.options.scaleSpeed,function(){return jceBox.nextEffect()});break}this.step++;case 3:$j(this.image).css('visibility','').fadeIn(this.options.fadeSpeed,function(){return jceBox.nextEffect()});break;case 4:$j(this.bottomContainer).css({top:this.top+this.center.clientHeight,marginLeft:-this.image.offsetWidth/2}).slideDown(this.options.scaleSpeed,function(){return jceBox.nextEffect()});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=null;this.preload=null}this.center.style.display=this.bottomContainer.style.display='none';$j(this.center).remove();$j(this.overlay).remove();return false}};$j(document).ready(function(){jceUtils.init()});
