var OneGallery = function (caption, path, active, teaser, myCount) {
			this.caption = caption;
			this.path = path;
			this.active = active;
			this.teaser = teaser;
			this.myCount = myCount;
			this.src = "";
			this.image = new Image();
			this.node = document.getElementById("oneGallery").cloneNode(true);
			this.imageWidth = 0;
			this.imageHeight = 0;
			this.anchorNode = null;
			this.checkImageLoaded = function () {;
				if(this.image.complete && this.image.width != 0 && this.image.height !=0) {
					this.imageWidth = this.image.width;
					this.imageHeight = this.image.height;
					return true;
				}
				return false;
			}
			this.setActive = function (active) {
				this.active = active;
				var a = this.anchorNode;
				if(a == null) {	
					return;
				}
				if(this.active) {
					a.removeAttribute("class");
					a.setAttribute(isIE7 ? "className" : "class", "galleryAnchorActive");

				}
				else {
					a.removeAttribute("class");
					a.setAttribute(isIE7 ? "className" : "class", "galleryAnchor");

				}
			}
			this.placeGallery = function (pNode) {
				var mess = calculateMessures (this.imageWidth, this.imageHeight, GALLERY_IMAGE_WIDTH, false);
				this.node.style.display="block";
				var imgNode = this.node.getElementsByTagName("img")[0];
				var im = document.createElement("img");
				
				im.setAttribute(isIE7 ? "className" : "class", "galleryImage");
				im.setAttribute("src", this.src);
				im.setAttribute("width", ""+mess[0]);
				im.setAttribute("height", ""+mess[1]);
				this.node.replaceChild(im, imgNode);
				
				this.anchorNode = this.node.getElementsByTagName("a")[0];
				var a = document.createElement("a");
				
				if(this.active) {
					a.setAttribute(isIE7 ? "className" : "class", "galleryAnchorActive");
				}
				else {
					a.setAttribute(isIE7 ? "className" : "class", "galleryAnchor");
				}
				a.setAttribute("href", "JavaScript:loadGallery('"+this.path.substring(this.path.lastIndexOf("/")+1)+"')" );
				var caption = document.createTextNode(this.caption);
				a.appendChild(caption);
				this.node.replaceChild(a, this.anchorNode);
				this.anchorNode = a;
				pNode.appendChild(this.node);
				return this.node.offsetHeight;
			}
			this.init = function(galleryPath, imageName) {
				this.src = galleryPath +"/"+ imageName;
				this.image.src = this.src;
			}
			this.toString = function () {
				return "oneImage " + this.myCount;
			}
	
			this.init(path, teaser);
		}
