﻿function Gallery(fullPictureId, captionId)
{
	this.fullPicture = document.getElementById(fullPictureId);
	this.caption = document.getElementById(captionId);
}

Gallery.prototype.SetPicture = function(link)
{
	var Img = new Image();
	
	this.CaptionText = "";
	
	if(arguments.length > 1)
		this.CaptionText = arguments[1];
	
	Img.gallery = this;
	Img.onload = this.OnImageLoad;
	Img.src = link.href;
	
	return false;
}

Gallery.prototype.OnImageLoad = function()
{
	this.gallery.fullPicture.setAttribute("src", this.src);
	this.gallery.fullPicture.setAttribute("alt", this.gallery.CaptionText);
	this.gallery.fullPicture.setAttribute("width", this.width);
	this.gallery.fullPicture.setAttribute("height", this.height);
	this.gallery.caption.innerHTML = this.gallery.CaptionText;
}