		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]});
			//check	
			img.setProperty('src', this.loader.src);

			if (this.options.captions)
			{
				img.setProperty('alt', this.options.captions[this.current[0]]);
				img.setProperty('title', this.options.captions[this.current[0]]);
			}

			
			
			if (this.options.urls) {
				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 && 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({left: 'auto', top: 'auto', right: 'auto', bottom: 'auto'});

				arr = ['left top', 'right top', 'left bottom', 'right bottom'][this.current[1] % 4].split(' ');
				if((this.options.type).test(/zoom|combo/)) {
					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.St
