function SlideManager(elements,visibleIndex,numberID, totalID) {
	if (SlideManager.__instance) {
		return SlideManager.__instance;
	}
	SlideManager.__instance = this;
	this.slideElements = elements;
	this.visibleIndex = visibleIndex||0;
	this.numberID = numberID;
	this.totalID = totalID;
	this.refresh = function() {
		for (var i=0;i<this.slideElements.length;i++) {
			if (i != this.visibleIndex) {
				$(this.slideElements[i]).hide();
			} else {
				$(this.slideElements[i]).show();
			}
		}
		$("#" + numberID).html(this.visibleIndex + 1);
		$("#" + totalID).html(this.slideElements.length);
	}
	this.next = function() {
		this.visibleIndex++;
		if (this.visibleIndex > this.slideElements.length - 1) {
			this.visibleIndex = 0;
		}
		this.refresh();
	}
	this.previous = function() {
		this.visibleIndex--;
		if (this.visibleIndex < 0) {
			this.visibleIndex = (this.slideElements.length - 1);
		}
		this.refresh();
	}
	this.refresh();
}

