function imageGallery($img_name){
	this.$img_name = $img_name;
	this.$image_gal = new Array();
	this.$img_count = 0;
	this.$img_current = 0;

	this.addImage = function addImage($src, $width, $height){
		this.$image_gal[this.$img_count] = new Image();
		this.$image_gal[this.$img_count].src = $src;
		this.$image_gal[this.$img_count].width = $width;
		this.$image_gal[this.$img_count].height = $height;
		this.$img_count++;
	}

	this.imageNext = function imageNext() {
		if(++this.$img_current >= this.$img_count) {this.$img_current = 0;}
		//alert(this.$img_current + ' - ' + this.$img_count);
		this.imageChange();
	}
	this.imageSet = function imageSet($img_nr) {
		this.$img_current = $img_nr;
		this.imageChange();
	}
	this.imageChange = function imageChange(){
		$slt = document.getElementById(this.$img_name);
		$slt.src = this.$image_gal[this.$img_current].src;
		if (this.$image_gal[this.$img_current].width > 0) {$slt.width = this.$image_gal[this.$img_current].width;}
		if (this.$image_gal[this.$img_current].height >0) {$slt.height = this.$image_gal[this.$img_current].height;}
	}
	// sitos funkcijos seip nereikia ji padaryta konkreciai www.minus.lt 
	this.getCurrent = function getCurrent(){
		return this.$img_current;
	}
}
