	var Slider  = new function(){
		
		this.mainImage = null;
		this.selector = null;
		
		this.running = false;
		this.pageValue = 118;
		
		this.max = 0;
		this.maxImg = 3;
		this.images = 0;
		
		this.disabled = false;
		this.leftControl = null;
		this.rightControl = null;

		this.init = function(main, container, leftControl, rightControl) {
			
			this.mainImage = main;
			this.selector = container;
			this.setMaxWidth();
			
			this.leftControl = leftControl;
			this.rightControl = rightControl;
			
			
			// Hide Controls;
			if (this.images <= this.maxImg) {
				this.hideControls();
			}
			
			this.setClick();

			
		}
		
		this.getLeftLocation = function() {
			var left = this.selector.css("left");
			left = left.substring(0,left.length-2);
			return left * 1;
		};
		
		this.setMaxWidth = function() {
			
			this.images = (this.selector.children("img").length * 1);
			var max = 0;

			if (this.images <= this.maxImg) {
				this.disabled = true;
			} else {
				max = this.images - this.maxImg;
			}
			
			this.max = this.pageValue * max;
			
		};
		
		this.getMaxWidth = function() {
			return this.max;
		};

		this.isLeftBounds = function(pos) {
			
			if (this.disabled) {return true;}
			
			if ((pos*-1) >= this.max) {
				return true;
			} 
			return false;			
		};

		this.isRightBounds = function(pos) {
			if (pos > 0) {
				return true;
			}
			return false;			
		};		
		
		this.pageRight = function() {
			var l = this.getLeftLocation();
			l += (this.pageValue * -1);
			if (this.isLeftBounds(l) ) l=(this.max*-1);
			
			this.selector.animate({left: l, queue: true}, 500);
			
		};
		
		this.pageLeft = function() {
			var l = this.getLeftLocation();
			l += (this.pageValue * 1);
			if (this.isRightBounds(l)) l=0;
			this.selector.animate({left: l, queue: true}, 500);			
		};
		
		this.setClick = function() {
			$(this.selector).children().click(function(){Slider.setImage(this);});
		};
		
		this.setImage = function(selector) {
			var imageUrl = $(selector).attr("src");
			imageUrl = imageUrl.replace("imageSize=1", "imageSize=3");
			$(this.mainImage).attr({'src':imageUrl});
		}
		
		this.hideControls = function() {
			$(this.leftControl).hide();
			$(this.rightControl).hide();
		}
		
	};
