function slides() {

	this.getSlides = function() {
		elArray = new Array();
		var els = document.getElementById("slides").getElementsByTagName("img");
		var elsLen = els.length;
		for (i = 0, j = 0; i < elsLen; i++) {
			elArray[j] = els[i];
			j++;
		}

		return elArray;
	}

/*	this.numberSlides = function() {
		var els = document.getElementById("slides").getElementsByTagName("img");
		var elsLen = els.length;
		for (k = 0, l = 0; k < elsLen; k++) {
			l++;
			var itn = els[k].getElementsByTagName("span");
			var itnLen = itn.length;
			var itnPatt = new RegExp("itemno");
			for (m=0;m<itnLen;m++) {
				if ( itnPatt.test(itn[m].className) ) {
					itn[m].innerHTML=l+" of "+this.amount;
				}
			}
		}
	}
*/

	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 = 0;

	if (this.amount > 0) {
		this.position = 1;
		this.getSlides()[this.position-1].style.display = "block";
		//this.numberSlides();
		if (this.amount > 1) {
			buttons=document.getElementsByClassName("gal_nav");
			for(var ind=0;(button = buttons[ind]);ind++){
				button.style.display = "inline";
			}
		}
	} else {
		this.position = 0;
	}

}

function initslide() {
	mySlide = new slides();
	//if (mySlide.position > 0) {
	//	timer = window.setInterval("doTimer()", 5500);
	//	return true;
	//} else {
	//	return false;
	//}
}

function doTimer() {
	if (mySlide.autoplay == 1)
		mySlide._next();
}