/*
 * JCE Utilities 1.5.0
 *
 * Copyright (c) 2007 - 2008 Ryan Demmer (www.cellardoor.za.net)
 * Licensed under the GPL (http://www.gnu.org/licenses/licenses.html#GPL)license.
 * JCE Tooltips based on Mootools Tips plugin - http://www.mootools.net
 * JCE Lightbox plugin based on Slimbox - http://www.digitalia.be/software/slimbox - and Thickbox - http://jquery.com/demo/thickbox/
 */
jQuery.noConflict();(function(A){A.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(B){var D=0,C=0;do{D+=B.offsetLeft||0;C+=B.offsetTop||0;B=B.offsetParent}while(B);return{"x":D,"y":C}},getCoordinates:function(B){var D=A.getPosition(B);var C={"width":B.offsetWidth,"height":B.offsetHeight,"left":D.x,"top":D.y};C.right=C.left+C.width;C.bottom=C.top+C.height;return C}});A.jceUtilities=function(B){return A.jceUtilities.init(B)};A.jceUtilities.init=function(B){this.options=A.extend({legacyPopup:1,boxConvert:0,boxOverlayOpacity:0.8,boxOverlayColor:"#000000",boxResize:1,boxIcons:1,boxFadeSpeed:500,boxScaleSpeed:500,toLightBox:0,tipClass:"tooltip",tipOpacity:1,tipFxspeed:150,tipPosition:"tr",tipOffsets:{"x":16,"y":16},pngFix:0,imagePath:"mambots/system/jceutilities/img/"},B);if(this.options.boxConvert>0){A("a").each(function(){A.jceUtilities.convertType(this)})}else{A.jceUtilities.tooltip.init({className:this.options.tipClass,fxSpeed:this.options.tipFxspeed,maxOpacity:this.options.tipOpacity,tipPosition:this.options.tipPosition,offsets:this.options.tipOffsets});A.jceUtilities.lightbox.init({icons:this.options.boxIcons,overlayOpacity:this.options.boxOverlayOpacity,overlayColor:this.options.boxOverlayColor,resize:this.options.boxResize,fadeSpeed:this.options.boxFadeSpeed,scaleSpeed:this.options.boxScaleSpeed})}if(this.options.pngFix==1&&A.browser.ie6){this.pngFix()}};A.jceUtilities.cleanupEventStr=function(B){B=""+B;B=B.replace("function anonymous()\n{\n","");B=B.replace("\n}","");B=B.replace(/^return true;/gi,"");return B};A.jceUtilities.parseQuery=function(G){var H={},F,C,B;if(!G){return H}var E=G.split(/[;&]/);for(var D=0;D<E.length;D++){F=E[D].split("=");if(!F||F.length!=2){continue}C=unescape(F[0]);B=unescape(F[1]);B=B.replace(/\+/g," ");H[C]=B}return H};A.jceUtilities.convertType=function(F){if(A.jceUtilities.options.legacyPopup==1){var C=false;var E="index2.php?option=com_jce&task=popup";if(F.href.indexOf(E)!=-1||A.jceUtilities.cleanupEventStr(F.getAttribute("onclick")).indexOf(E)!=-1){var H=A.jceUtilities.cleanupEventStr(F.getAttribute("onclick")).replace(/&amp;/g,"&").replace(/&#39;/g,"'");C=true}if(F.href.indexOf("mosce/jscripts/tiny_mce/popupImage.php")!=-1){var H=F.href.replace(/&amp;/g,"&").replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/[\(\'\)\;]/g,"").replace(/\?/g,"&");C=true}if(C){var G=A.jceUtilities.parseQuery(H);F.setAttribute("href",G.img);F.setAttribute("title",G.title.replace(/_/g," "));F.className="jcelightbox";F.removeAttribute("target");F.setAttribute("onclick","");F.removeAttribute("onclick")}}if(A.jceUtilities.options.boxConvert>0){if(F.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){var D="";var B=F.rel;switch(A.jceUtilities.options.boxConvert){case 1:if(!B){B="lightbox"}else{B="lightbox["+B+"]"}break;case 2:D="thickbox";if(!B){B=""}break;case 3:if(!B){B="rokzoom"}else{B="rokzoom["+B+"]"}F.setAttribute("rel",B);break}F.setAttribute("rel",B);F.className=F.className.replace(/jcelightbox/gi,D);if(F.className==""){F.removeAttribute("class")}if(F.rel==""){F.removeAttribute("rel")}}}return F};A.jceUtilities.pngFix=function(){var B=A('img[@src*="png"]',document);B.each(function(){var C=this.src;this.css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+C+"', sizingMethod='')");this.src="mambots/system/jceutilities/img/blank.gif"})};A.jceUtilities.tooltip={options:{className:"tooltip",fxSpeed:150,maxOpacity:1,tipPosition:"br",offsets:{"x":16,"y":16}},init:function(C){var B=this;A.extend(this.options,C);A(".jce_tooltip").each(function(){A(this).bind("mouseover",function(){B.show(this)});A(this).bind("mousemove",function(E){B.locate(E)});A(this).bind("mouseout",function(){B.hide(this)}).bind("blur",function(){B.hide(this)});this.myText=this.title||false;this.myTitle="";A(this).removeAttr("title");if(this.myText&&/::/gi.test(this.myText)){var D=this.myText.split("::");this.myTitle=A.trim(D[0]);this.myText=A.trim(D[1])}})},show:function(B){var C=document;this.tip=C.createElement("div");this.title=C.createElement("h4");this.text=C.createElement("p");A(this.tip).addClass(this.options.className).css("position","absolute").appendTo("body").hide();A(this.title).appendTo(A(this.tip));A(this.text).appendTo(A(this.tip));A(this.title).html(B.myTitle);A(this.text).html(B.myText);A(this.tip).animate({"opacity":this.options.maxOpacity},this.options.fxSpeed).show();this.exists=true},locate:function(D){if(this.exists){var C={"x":D.clientX+A.getScrollLeft(),"y":D.clientY+A.getScrollTop()};var B={"x":this.tip.offsetWidth,"y":this.tip.offsetHeight};var E={"x":D.clientX+this.options.offsets.x,"y":D.clientY+this.options.offsets.y};switch(this.options.tipPosition){case"tl":E.x=(C.x-B.x)-this.options.offsets.x;E.y=(C.y-B.y)-this.options.offsets.y;break;case"tr":E.x=C.x+this.options.offsets.x;E.y=(C.y-B.y)-this.options.offsets.y;break;case"tc":E.x=(C.x-Math.round((B.x/2)))+this.options.offsets.x;E.y=(C.y-B.y)-this.options.offsets.y;break;case"bl":E.x=(C.x-B.x)-this.options.offsets.x;E.y=(C.y+B.y)-this.options.offsets.y;break;case"br":E.x=C.x+this.options.offsets.x;E.y=C.y+this.options.offsets.y;break;case"bc":E.x=(C.x-Math.round((B.x/2)))+this.options.offsets.x;E.y=(C.y+B.y)-this.options.offsets.y;break}A(this.tip).css({top:E.y+"px",left:E.x+"px"})}},hide:function(B){if(this.exists){A(this.tip).fadeOut(this.options.fxSpeed).remove()}}};A.jceUtilities.lightbox={options:{icons:1,overlayOpacity:0.8,overlayColor:"#000000",resize:1,fadeSpeed:200,scaleSpeed:200,width:250,height:250},anchors:[],init:function(C){var B=this;A.extend(this.options,C);if(A.jceUtilities.options.legacyPopup==1){var E="index2.php?option=com_jce&task=popup";var D="mosce/jscripts/tiny_mce/popupImage.php";A("a[onclick.contains("+E+")][onclick.contains("+D+")][href.contains("+E+")]").each(function(){A.jceUtilities.convertType(this)})}A("a.jcebox, a.jcelightbox").each(function(){if(B.options.icons==1){B.setZoom(this)}B.anchors.push(this);A(this).click(function(){return B.start(this)})})},setPNG:function(C){var B=C.src;A(C).attr("src","mambots/system/jceutilities/img/blank.gif").css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+B+"', sizingMethod='')")},setZoom:function(C){var B=this;A(C).each(function(){if(this.firstChild.nodeName.toLowerCase()=="img"){var E=this.firstChild;var D=document.createElement("img");A(D).css({marginTop:A(E).height()-16,marginLeft:A.browser.opera?A(E).width()-16:-26,cursor:"pointer"}).attr({src:A.jceUtilities.options.imagePath+"zoomImg.png",alt:"Zoom"}).addClass("zoomImg").insertAfter(A(E));if(A.browser.msie&&A.browser.version<7&&A.jceUtilities.options.pngFix==1){B.setPNG(D)}}else{D=document.createElement("img");A(D).attr({src:A.jceUtilities.options.imagePath+"zoomLink.png"}).addClass("zoomLink").appendTo(C);if(A.browser.msie&&A.browser.version<7&&A.jceUtilities.options.pngFix==1){B.setPNG(D)}}})},trigger:function(C,B){var D={};if(typeof C=="object"){D={"href":C.href||C.src,"title":C.title||""}}else{D={"href":C,"title":B||""}}return this.start(D)},start:function(I){var F=document,K=this;this.overlay=F.createElement("div");A(this.overlay).attr("id","jcelightbox-overlay").appendTo("body").css({opacity:"0",cursor:"pointer",backgroundColor:this.options.overlayColor,width:A.getWidth()}).click(function(){K.close()});this.center=F.createElement("div");A(this.center).attr("id","jcelightbox-center").css({width:this.options.width,height:this.options.height,marginLeft:-(this.options.width/2)}).appendTo("body").hide();this.loader=F.createElement("div");A(this.loader).attr("id","jcelightbox-loading").appendTo(this.center).hide();this.image=F.createElement("div");A(this.image).attr("id","jcelightbox-image").appendTo(this.center);this.bottom=F.createElement("div");A(this.bottom).attr("id","jcelightbox-bottom").appendTo(this.center).hide();this.closeLink=F.createElement("a");A(this.closeLink).attr({"id":"jcelightbox-close","href":"javascript:void(0);"}).appendTo(this.bottom).click(function(){K.close()});this.caption=F.createElement("div");A(this.caption).attr("id","jcelightbox-caption").appendTo(this.bottom);this.number=F.createElement("div");A(this.number).attr("id","jcelightbox-number").appendTo(this.bottom);if(I.href.toLowerCase().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp/g)){this.type="image";this.preloadPrev=new Image();this.preloadNext=new Image();this.realImage=F.createElement("img");A(this.realImage).attr("id","jcelightbox-realimage").appendTo(this.image);this.nav=F.createElement("div");A(this.nav).attr("id","jcelightbox-nav").appendTo(this.image);this.prevLink=F.createElement("a");A(this.prevLink).attr({"id":"jcelightbox-navPrev","href":"javascript:void(0);"}).appendTo(this.nav);this.nextLink=F.createElement("a");A(this.nextLink).attr({"id":"jcelightbox-navNext","href":"javascript:void(0);"}).appendTo(this.nav);A(this.prevLink).click(function(){K.previous()});A(this.nextLink).click(function(){K.next()});var D=0,H=[];if(!I.rel){H.push([I.href,I.title||""])}else{A.each(this.anchors,function(){if(this.rel==I.rel){for(var L=0;L<H.length;L++){if(H[L][0]==this.href){break}}if(L==H.length){H.push([this.href,this.title]);if(this.href==I.href){D=L}}}})}return this.open(H,D)}else{this.type="iframe";var G=I.href.replace(/^[^\?]+\??/,"");var E=A.jceUtilities.parseQuery(G);var B=I.href.replace("&bw="+E["bw"]+"&bh="+E["bh"],"","g");var C=parseInt(E["bw"])||300;var J=parseInt(E["bh"])||300;return this.open([[B,I.title||"",C,J]],0)}},open:function(B,C){this.images=B;this.position();this.setup(true);this.top=A.getScrollTop()+(A.getHeight()/15);A(this.center).css({top:this.top,display:""});A(this.overlay).fadeTo(this.options.fadeSpeed,this.options.overlayOpacity);return this.changeImage(C)},position:function(){A(this.overlay).css({"top":A.getScrollTop(),"height":A.getHeight()})},setup:function(C){var B=this;if(A.browser.msie&&A.browser.version<7){A("object","select","embed").each(function(){if(C){this.lbBackupStyle=this.style.visibility}this.style.visibility=C?"hidden":el.lbBackupStyle})}if(C){A(window).bind("scroll",function(){B.position()});A(window).bind("resize",function(){B.position()});A(document).bind("keydown",function(D){B.keyboardListener(D)})}else{A(window).unbind("scroll");A(window).unbind("resize");A(document).unbind("keydown")}this.step=0},keyboardListener:function(B){switch(B.keyCode){case 27:case 88:case 67:this.close();break;case 37:case 80:this.previous();break;case 39:case 78:this.next()}},nextImage:function(C){if(A.browser.opera||(A.browser.msie&&A.browser.version<7)){A(this.bottom).hide();A(this.image).hide();return this.changeImage(C)}else{var B=this;A(this.bottom).fadeOut(this.options.fadeSpeed,function(){A(B.image).fadeTo(B.options.fadeSpeed,0,function(){return B.changeImage(C)})})}},previous:function(){return this.nextImage(this.activeImage-1)},next:function(){return this.nextImage(this.activeImage+1)},changeImage:function(C){var B=this;if(this.step||(C<0)||(C>=this.images.length)){return false}this.step=1;this.activeImage=C;A(this.image).css({visibility:"hidden",opacity:0}).show();A(this.loader).show();if(this.type=="image"){this.preload=new Image();this.preload.onload=function(){return B.nextEffect()};this.preload.src=this.images[C][0];this.prevLink.style.display=this.nextLink.style.display="none"}if(this.type=="iframe"){this.iframe=document.createElement("iframe");A(this.iframe).attr({frameBorder:0,title:this.images[C][1],onload:function(){return B.nextEffect()}}).css({width:this.images[C][2],height:this.images[C][3]}).appendTo(this.image).attr("src",this.images[C][0])}return false},nextEffect:function(){var K=this;switch(this.step++){case 1:A(this.loader).hide();var H=this.images[this.activeImage][1]||"";if(H.indexOf("http://")!=-1){H='<a href="'+H+'" target="_blank">'+H+"</a>"}if(this.type=="image"){var J=this.preload.width;var D=this.preload.height;if(this.options.resize==1){var I=Math.round(A.getWidth()-150);var G=Math.round(A.getHeight()-150);if(J>I){D=D*(I/J);J=I;if(D>G){J=J*(G/D);D=G}}else{if(D>G){J=J*(G/D);D=G;if(J>I){D=D*(I/J);J=I}}}}J=Math.round(J);D=Math.round(D);A(this.image).width(J).height(D);A(this.realImage).attr({"src":this.images[this.activeImage][0],"width":J,"height":D});A(this.nav).width(J+20).height(D);A(this.caption).html(H);var E="";if(this.images.length>1){for(var C=0;C<this.images.length;C++){var B=C+1;if(B==1&&this.activeImage!=B-1){E+='<a href="javascript:void(0);" class="jcelightbox-numberPrev">&lt;&nbsp;</a>'}var F=(B==this.images.length)?"":" | ";if(this.activeImage!=C){E+='<a href="javascript:void(0);" class="jcelightbox-numberLink">'}E+=B;if(this.activeImage!=C){E+="</a>"}E+=F;if(B==this.images.length&&this.activeImage!=B-1){E+='<a href="javascript:void(0);" class="jcelightbox-numberNext">&nbsp;&gt;</a>'}}}A(this.number).html(E);A("a.jcelightbox-numberLink").each(function(){A(this).click(function(){var L=parseInt(A(this).text());return K.nextImage(L-1)})});A("a.jcelightbox-numberNext").each(function(){A(this).click(function(){return K.next()})});A("a.jcelightbox-numberPrev").each(function(){A(this).click(function(){return K.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"){A(this.image).width(this.images[this.activeImage][2]).height(this.images[this.activeImage][3]);A(this.caption).html(H)}if(this.center.clientHeight!=this.image.offsetHeight){A(this.center).animate({height:this.image.offsetHeight},this.options.scaleSpeed,function(){return K.nextEffect()});break}this.step++;case 2:if(this.center.clientWidth!=this.image.offsetWidth){A(this.center).animate({width:this.image.offsetWidth,marginLeft:-this.image.offsetWidth/2},this.options.scaleSpeed,function(){return K.nextEffect()});break}this.step++;case 3:A(this.image).css("visibility","visible").fadeTo(this.options.fadeSpeed,1,function(){return K.nextEffect()});break;case 4:A(this.center).animate({height:A(this.center).height()+50},this.options.scaleSpeed,function(){return K.nextEffect()});break;case 5:if(A.browser.opera||(A.browser.msie&&A.browser.version<7)){A(this.bottom).show()}else{A(this.bottom).fadeIn(this.options.fadeSpeed)}if(this.type=="image"){if(this.activeImage){A(this.prevLink).show()}if(this.activeImage!=(this.images.length-1)){A(this.nextLink).show()}}this.step=0}},close:function(){var B=this;if(this.step<0){return }this.step=-1;if(this.preload){this.preload.onload=null;this.preload=null}A(this.bottom).hide();A(this.center).fadeOut(this.options.fadeSpeed,function(){A(B.overlay).fadeOut(B.options.fadeSpeed,function(){A(B.center).remove();A(B.overlay).remove()})});return false}}})(jQuery);var jceutilities=jQuery.jceUtilities;var jcelightbox=jceutilities.lightbox
