function slides() {

	this.getSlides = function() {
		return $('div.slides');
	}

	/*this.numberSlides = function() {
		var els = document.getElementsByTagName("div");
		var elsLen = els.length;
		var pattern = new RegExp("slides");
		for (k = 0, l = 0; k < elsLen; k++) {
			if ( pattern.test(els[k].className) ) {
				l++;
				var itn = els[k].getElementsByTagName("span");
				var itnLen = itn.length;
			}
		}
	}*/

	this._prev = function() {
		this.getSlides()[this.position-1].style.display = "none";
		if (this.position <= 1) {
			this.position = this.amount;
		} else {
			this.position--;
		}
		this.getSlides()[this.position-1].style.display = "block";
	}

	this._next = function() {
		this.getSlides()[this.position-1].style.display = "none";
		if (this.position >= this.amount) {
			this.position = 1;
		} else {
			this.position++;
		}
		this.getSlides()[this.position-1].style.display = "block";
	}

	this.next = function() {
		this.autoplay = 0;
		this._next();
	}

	this.prev = function() {
		this.autoplay = 0;
		this._prev();
	}

	/* constructor */
	this.amount = this.getSlides().length;
	this.numberSlides;
	this.autoplay = 1;

	if (this.amount > 0) {
		this.position = 1;
		this.getSlides()[this.position-1].style.display = "block";
		//this.numberSlides();
	} else {
		this.position = 0;
	}

}

$(document).ready(function() {
	mySlide = new slides();
});


