	function Player() {
		this.imgs = new Array();
		this.path = '/wc/wcrf/';
		this.current = null;
		this.fadeTime = 0.5;
		this.delay = 2.0;
		this.transition = null;
		this.mode = 0;
		this.control = 0;

		//set fade duration between images
		this.setFadeTime = function(time) {
			this.fadeTime = time;
		}

		//set delay between image transitions
		this.setDelay = function(time) {
			this.delay = time;
		}

		//set available images
		this.setImages = function(imgs) {
			this.imgs = imgs;
		}

		//set path to images
		this.setPath = function(path) {
			this.path = path;
		}

		//return image after current displayed
		this.getNext = function() {
			if (this.current == null) {
				var src = $('wcplayer_current').src.split('/');
				this.current = src[src.length - 1];
			}
			var next = null;
			if (this.imgs.indexOf(this.current) == (this.imgs.length - 1)) {
				next = this.imgs[0];
			} else {
				next = this.imgs[this.imgs.indexOf(this.current) + 1];
			}
			return next;
		}

		//return image prior to current displayed
		this.getPrev = function() {
			if (this.current == null) {
				var src = $('wcplayer_current').src.split('/');
				this.current = src[src.length - 1];
			}
			var prev = null;
			if (this.imgs.indexOf(this.current) == 0) {
				prev = this.imgs[this.imgs.length - 1];
			} else {
				prev = this.imgs[this.imgs.indexOf(this.current) - 1];
			}
			return prev;
		}

		//preload previous and next image for smooth transitions
		this.preloadNextImg = function() {
			var nextImage = document.createElement('img');
			nextImage.setAttribute('id', 'wcplayer_next');
			nextImage.style.position = 'absolute';
			nextImage.style.zIndex = '900';
			nextImage.src = this.path+this.getNext();
			document.getElementById('wcplayer_imgwrapper').appendChild(nextImage);
		}

		this.preloadPrevImg = function() {
			var prevImage = document.createElement('img');
			prevImage.setAttribute('id', 'wcplayer_prev');
			prevImage.style.position = 'absolute';
			prevImage.style.zIndex = '900';
			prevImage.src = this.path+this.getPrev();
			document.getElementById('wcplayer_imgwrapper').appendChild(prevImage);
		}

		//clean up image ids after a transition
		this.cleanUpPlayer = function(img) {
			if ($('wcplayer_'+img) != null) {
				$('wcplayer_current').remove();
				$('wcplayer_'+img).setAttribute('id', 'wcplayer_current');
				$('wcplayer_current').style.zIndex = 1000;
				$('wcplayer_current').style.display = 'block';
			}
		}

		this.cancelTrans = function(trans) {
			if (this.transition != null) {
				this.transition.cancel();
			}
			this.cleanUpPlayer(trans);

		}
		this.prepareNextImg = function() {
			$('wcplayer_current').remove();
			$('wcplayer_next').setAttribute('id', 'wcplayer_current');
			$('wcplayer_current').style.zIndex = 1000;
			$('wcplayer_current').style.display = 'block';
			player.preloadNextImg();
			var next = this.getNext();
			this.current = next;
			setTimeout("player.play()", this.delay*1000);
		}

		//play slideshow
		this.play = function() {
			//if the slideshow is not currently playing and the play function is not in control yet
			if (this.mode == 0 && this.control == 0) {
				this.mode = 1; //set player as playing slideshow
				this.control = 1; //set the play function as the current controller
				this.preloadNextImg();
				var next = this.getNext();
				this.current = next;
				setTimeout("player.play()", this.delay*1000);
			} else {
				//if on slideshw mode play the images
				if (this.mode == 1) {
					this.transition = Effect.Fade('wcplayer_current', {duration: this.fadeTime});
					setTimeout("player.prepareNextImg()", this.fadeTime*1001);

					//this is a tmp fix to get a rround the scope bug of recurisively calling a this.play() funtion
					//setTimeout("player.play()", this.delay*1000);
				} else {
					//else we must have pressed stop so take control away now
					this.control = 0;
				}
			}
		}



		//show next image
		this.next = function(stop) {
			stop = typeof(stop) != 'undefined' ? stop : true;
			if (stop) {
				this.stop();
			}
			this.cancelTrans('next');
			this.preloadNextImg();
			var next = this.getNext();
			this.transition = Effect.Fade('wcplayer_current', {duration: this.fadeTime});
			this.cleanUpPlayer.delay((this.fadeTime + 0.1), 'next');
			this.current = next;
		}

		//show previous imag
		this.prev = function(stop) {
			stop = typeof(stop) != 'undefined' ? stop : true;
			if (stop) {
				this.stop();
			}
			this.cancelTrans('prev');
			this.preloadPrevImg();
			var prev = this.getPrev();
			this.transition = Effect.Fade('wcplayer_current', {duration: this.fadeTime});
			this.cleanUpPlayer.delay((this.fadeTime + 0.1), 'prev');
			this.current = prev;
		}

		this.last = function() {
			this.stop();
			this.cancelTrans('prev');
			this.cancelTrans('next');
			var nextImage = document.createElement('img');
			nextImage.setAttribute('id', 'wcplayer_next');
			nextImage.style.position = 'absolute';
			nextImage.style.zIndex = '900';
			nextImage.src = this.path+this.imgs[this.imgs.length - 1];
			document.getElementById('wcplayer_imgwrapper').appendChild(nextImage);
			this.transition = Effect.Fade('wcplayer_current', {duration: this.fadeTime});
			this.cleanUpPlayer.delay((this.fadeTime + 0.1), 'next');
			this.current = this.imgs[this.imgs.length - 1];
		}


		this.first = function() {
			this.stop();
			this.cancelTrans('prev');
			this.cancelTrans('next');
			var prevImage = document.createElement('img');
			prevImage.setAttribute('id', 'wcplayer_prev');
			prevImage.style.position = 'absolute';
			prevImage.style.zIndex = '900';
			prevImage.src = this.path+this.imgs[0];
			document.getElementById('wcplayer_imgwrapper').appendChild(prevImage);
			this.transition = Effect.Fade('wcplayer_current', {duration: this.fadeTime});
			this.cleanUpPlayer.delay((this.fadeTime + 0.1), 'prev');
			this.current = this.imgs[0];
		}

		//stop slide show
		this.stop = function () {
			this.mode = 0;
			$('wcplayer_stopbtn').style.display = 'none';
		}

	}

