/*
	Slimbox v1.41 - The ultimate lightweight Lightbox clone
	by Christophe Beyls (http://www.digitalia.be) - MIT-style license.
	Inspired by the original Lightbox v2 by Lokesh Dhakar.
*/

var Lightbox = {

	init: function(options){
		this.options = $extend({
			resizeDuration: 400,
			resizeTransition: false,	// default transition
			initialWidth: 250,
			initialHeight: 250,
			animateCaption: true,
			showCounter: true
		}, options || {});

		this.anchors = [];
		$each(document.links, function(el){
			if (el.rel && el.rel.test(/^lightbox/i)){
				el.onclick = this.click.pass(el, this);
				this.anchors.push(el);
			}
		}, this);
		this.eventKeyDown = this.keyboardListener.bindAsEventListener(this);
		this.eventPosition = this.position.bind(this);

		this.overlay = new Element('div', {'id': 'lbOverlay'}).injectInside(document.body);

		this.center = new Element('div', {'id': 'lbCenter', 'styles': {'width': this.options.initialWidth, 'height': this.options.initialHeight, 'marginLeft': -(this.options.initialWidth/2), 'display': 'none'}}).injectInside(document.body);
		this.image = new Element('div', {'id': 'lbImage'}).injectInside(this.center);
		this.prevLink = new Element('a', {'id': 'lbPrevLink', 'href': '#', 'styles': {'display': 'none'}}).injectInside(this.image);
		this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image);
		this.prevLink.onclick = this.previous.bind(this);
		this.nextLink.onclick = this.next.bind(this);

		this.bottomContainer = new Element('div', {'id': 'lbBottomContainer', 'styles': {'display': 'none'}}).injectInside(document.body);
		this.bottom = new Element('div', {'id': 'lbBottom'}).injectInside(this.bottomContainer);
		new Element('a', {'id': 'lbCloseLink', 'href': '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this);
		this.caption = new Element('div', {'id': 'lbCaption'}).injectInside(this.bottom);
		this.number = new Element('div', {'id': '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.resizeDuration, onComplete: nextEffect}, this.options.resizeTransition ? {transition: this.options.resizeTransition} : {})),
			image: this.image.effect('opacity', {duration: 500, onComplete: nextEffect}),
			bottom: this.bottom.effect('margin-top', {duration: 400, onComplete: nextEffect})
		};

		this.preloadPrev = new Image();
		this.preloadNext = new Image();
	},

	click: function(link){
		if (link.rel.length == 8) 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);
	},

	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.ie ? '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.bottomContainer.style.display = this.prevLink.style.display = this.nextLink.style.display = 'none';
		this.fx.image.hide();
		this.center.className = 'lbLoading';

		this.preload = new Image();
		this.preload.onload = this.nextEffect.bind(this);
		this.preload.src = this.images[imageNum][0];
		return false;
	},

	nextEffect: function(){
		switch (this.step++){
		case 1:
			this.center.className = '';
			this.image.style.backgroundImage = 'url('+this.images[this.activeImage][0]+')';
			this.image.style.width = this.bottom.style.width = this.preload.width+'px';
			this.image.style.height = this.prevLink.style.height = this.nextLink.style.height = this.preload.height+'px';

			this.caption.setHTML(this.images[this.activeImage][1] || '');
			this.number.setHTML((!this.options.showCounter || (this.images.length == 1)) ? '' : 'Imagem '+(this.activeImage+1)+' de '+this.images.length);

			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.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.center.style.marginLeft, display: ''});
			this.fx.image.start(1);
			break;
		case 4:
			if (this.options.animateCaption){
				this.fx.bottom.set(-this.bottom.offsetHeight);
				this.bottomContainer.style.height = '';
				this.fx.bottom.start(0);
				break;
			}
			this.bottomContainer.style.height = '';
		case 5:
			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);
		return false;
	}
};

window.addEvent('domready', Lightbox.init.bind(Lightbox));
/*
// JoomlaWorks "Tabs & Slides" Plugin for Joomla! 1.5.x - Version 2.4
// License: http://www.gnu.org/copyleft/gpl.html
// Copyright (c) 2006 - 2008 JoomlaWorks, a Komrade LLC company.
// More info at http://www.joomlaworks.gr
// Developers: Fotis Evangelou
// ***Last update: May 20th, 2008***
*/

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7.2k(\'<l 2y="2j/2a">.1Z{E:15;}<\\/l>\');5 10={\'1u\':Y,\'x\':"2W",\'1o\':6(a){5 t=a.z;5 i;4(t.p){t.x=t.p+t.x}i=2h(1c(t.x));4(2c(i)){h}t.W(i)},\'18\':6(a){5 c=a.z.x;5 i=a.1p;1V(c,i)}};6 1V(a,b,c,d,e,f){7.x=a+"="+2D(b)+((c)?"; 1I="+c.2x():"")+((d)?"; 1H="+d:"")+((e)?"; 1E="+e:"")+((f)?"; 2t":"")}6 1c(a){5 b=7.x;5 c=a+"=";5 d=b.1g("; "+c);4(d==-1){d=b.1g(c);4(d!=0)h 11}F{d+=2}5 e=7.x.1g(";",d);4(e==-1){e=b.s}h 2f(b.2e(d+c.s,e))}6 2d(a,b,c){4(1c(a)){7.x=a+"="+((b)?"; 1H="+b:"")+((c)?"; 1E="+c:"")+"; 1I=2b, 1t-29-27 1s:1s:1t 24"}}6 v(a){5 b;3.m=11;3.1r="1Z";3.1q="2S";3.1X="2Q";3.1U="2K";3.1S="2H";3.1m="2F";3.1P="2E";3.1k=[\'2C\',\'2B\',\'2z\',\'2w\',\'2v\'];3.1G=Y;3.1F=Y;3.1D=j;3.1n=\'<1R>2r<1T>\';B(b 2m a){3[b]=a[b]}3.1f=y L(\'\\\\b\'+3.1r+\'\\\\b\',\'o\');3.2i=y L(\'\\\\b\'+3.1q+\'\\\\b\',\'o\');3.1x=y L(\'\\\\b\'+3.1X+\'\\\\b\',\'o\');3.1w=y L(\'\\\\b\'+3.1U+\'\\\\b\',\'o\');3.1e=y L(\'\\\\b\'+3.1m+\'\\\\b\',\'o\');3.k=y 2g();4(3.m){3.1v(3.m);3.m=11}}v.C.1v=6(e){5 a,i,M,t,1h=0,N,T,u,q,16;4(!7.Q){h j}4(e.p){3.p=e.p}3.k.s=0;a=e.28;B(i=0;i<a.s;i++){4(a[i].8&&a[i].8.X(3.1x)){t=y 26();t.m=a[i];3.k[3.k.s]=t;4(a[i].8.X(3.1w)){1h=3.k.s-1}}}N=7.1a("25");N.8=3.1S;B(i=0;i<3.k.s;i++){t=3.k[i];t.r=t.m.19;4(3.1F){t.m.19=\'\'}4(!t.r){B(M=0;M<3.1k.s;M++){16=t.m.Q(3.1k[M])[0];4(16){t.r=16.23;4(3.1G){t.r.w(/<22>/o," ");t.r=t.r.w(/<[^>]+>/g,"")}21}}}4(!t.r){t.r=i+1}T=7.1a("U");t.U=T;u=7.1a("a");u.17(7.20(t.r));u.2V="2U:2R(11);";u.19=t.r;u.1Y=3.1W;u.z=3;u.G=i;4(3.1D&&3.1n){q=3.1n;q=q.w(/<1R>/o,3.p);q=q.w(/<2P>/o,i);q=q.w(/<1T>/o,i+1);q=q.w(/<2O>/o,t.r.w(/[^a-2N-2L-9\\-]/o,\'\'));u.p=q}T.17(u);N.17(T)}e.2J(N,e.2I);e.8=e.8.w(3.1f,3.1q);3.W(1h);4(K 3.1o==\'6\'){3.1o({z:3})}h 3};v.C.1W=6(b){5 c,a,H,G,Z;a=3;4(!a.z){h j}H=a.z;G=a.G;a.2G();4(K H.18==\'6\'){Z={\'z\':H,\'1p\':G,\'1l\':b};4(!b){Z.1l=R.1l}c=H.18(Z);4(c===j){h j}}H.W(G);h j};v.C.1Q=6(){5 i;B(i=0;i<3.k.s;i++){3.1O(i)}};v.C.1O=6(a){5 b;4(!3.k[a]){h j}b=3.k[a].m;4(!b.8.X(3.1e)){b.8+=\' \'+3.1m}3.1N(a);h 3};v.C.W=6(a){5 b;4(!3.k[a]){h j}3.1Q();b=3.k[a].m;b.8=b.8.w(3.1e,\'\');3.1y(a);4(K 3.1A==\'6\'){3.1A({\'z\':3,\'1p\':a})}h 3};v.C.1y=6(a){3.k[a].U.8=3.1P;h 3};v.C.1N=6(a){3.k[a].U.8=\'\';h 3};6 1j(a){5 b,D,i;4(!a){a={}}b=y v(a);D=7.Q("m");B(i=0;i<D.s;i++){4(D[i].8&&D[i].8.X(b.1f)){a.m=D[i];D[i].z=y v(a)}}h 3}6 1i(a){5 b;4(!a){a={}}b=R.13;4(K R.13!=\'6\'){R.13=6(){1j(a)}}F{R.13=6(){b();1j(a)}}}4(K 10==\'2A\'){1i()}F{4(!10[\'1u\']){1i(10)}}5 A=j;5 I=j;6 1B(e,a){4(!a)a=3.p;a=a+\'\';5 b=a.w(/[^0-9]/g,\'\');5 c=7.P(\'O\'+b);A=j;4(!c.l.E||c.l.E==\'15\'){4(I&&I!=b){A=b;J(I,(12*-1))}F{c.l.E=\'1M\';c.l.1L=\'1J\';J(b,12)}}F{J(b,(12*-1));I=j}}6 J(a,b){5 c=7.P(\'O\'+a);5 d=7.P(\'1K\'+a);n=c.2u;n=n+b;14=Y;4(n>d.V){n=d.V;14=j}4(n<=1){n=1;14=j}c.l.n=n+\'1b\';5 e=n-d.V;4(e>0)e=0;d.l.1C=e+\'1b\';4(14){2s(\'J(\'+a+\',\'+b+\')\',2M)}F{4(n<=1){c.l.E=\'15\';4(A&&A!=a){7.P(\'O\'+A).l.E=\'1M\';7.P(\'O\'+A).l.1L=\'1J\';J(A,12)}}F{I=a}}}6 2q(){5 a=7.Q(\'1d\');5 b=1;B(5 c=0;c<a.s;c++){4(a[c].8==\'2p\'){a[c].1Y=1B;a[c].p=\'2o\'+b;5 d=a[c].1z;2n(d&&d.2T!=\'1d\'){d=d.1z}d.p=\'O\'+b;S=d.Q(\'1d\')[0];S.l.1C=0-S.V+\'1b\';S.8=\'2l\';S.p=\'1K\'+b;d.l.E=\'15\';d.l.n=\'2X\';b++}}}',62,184,'|||this|if|var|function|document|className|||||||||return||false|tabs|style|div|height|gi|id|aId|headingText|length||DOM_a|tabberObj|replace|cookie|new|tabber|objectIdToSlideDown|for|prototype|divs|display|else|tabberIndex|self|jwts_activeId|slideContent|typeof|RegExp|i2|DOM_ul|jwts_a|getElementById|getElementsByTagName|window|contentDiv|DOM_li|li|offsetHeight|tabShow|match|true|onClickArgs|tabberOptions|null|jwts_slideSpeed|onload|rerunFunction|none|headingElement|appendChild|onClick|title|createElement|px|getCookie|DIV|REclassTabHide|REclassMain|indexOf|defaultTab|tabberAutomaticOnLoad|tabberAutomatic|titleElements|event|classTabHide|linkIdFormat|onLoad|index|classMainLive|classMain|00|01|manualStartup|init|REclassTabDefault|REclassTab|navSetActive|nextSibling|onTabDisplay|showHideContent|top|addLinkId|domain|removeTitle|titleElementsStripHTML|path|expires|visible|jwts_ac|visibility|block|navClearActive|tabHide|classNavActive|tabHideAll|tabberid|classNav|tabnumberone|classTabDefault|setCookie|navClick|classTab|onclick|jwts_tabber|createTextNode|break|br|innerHTML|GMT|ul|Object|70|childNodes|Jan|css|Thu|isNaN|deleteCookie|substring|unescape|Array|parseInt|REclassMainLive|text|write|jwts_slidecontent|in|while|jwts_q|jwts_title|initShowHideDivs|nav|setTimeout|secure|clientHeight|h6|h5|toGMTString|type|h4|undefined|h3|h2|escape|jwts_tabberactive|jwts_tabbertabhide|blur|jwts_tabbernav|firstChild|insertBefore|jwts_tabbertabdefault|Z0|jwts_timer|zA|tabtitle|tabnumberzero|jwts_tabbertab|void|jwts_tabberlive|tagName|javascript|href|jwts_tabcookie|1px'.split('|'),0,{}))/*
// JoomlaWorks "Tabs & Slides" Plugin for Joomla! 1.5.x - Version 2.4
// License: http://www.gnu.org/copyleft/gpl.html
// Copyright (c) 2006 - 2008 JoomlaWorks, a Komrade LLC company.
// More info at http://www.joomlaworks.gr
// Developers: Fotis Evangelou
// ***Last update: May 20th, 2008***
*/

// Default Loader
function init_jwTS() {
    if (arguments.callee.done) return;
    arguments.callee.done = true;
	initShowHideDivs();
	tabberAutomatic(tabberOptions);
	//showHideContent(false,1);});	// Automatically expand first item - disabled by default
};
// DOM2
if ( typeof window.addEventListener != "undefined" ) {
	window.addEventListener( "load", init_jwTS, false );
// IE 
} else if ( typeof window.attachEvent != "undefined" ) {
	window.attachEvent( "onload", init_jwTS );
} else {
	if ( window.onload != null ) {
		var oldOnload = window.onload;
		window.onload = function ( e ) {
			oldOnload( e );
			init_jwTS();
		};
	} else {
		window.onload = init_jwTS;
	}
}