
	function
	
	ImageWindow(resizeFactor)
	{
		if(arguments.length>=1) this.resizeFactor = resizeFactor;
	}
	
	ImageWindow.prototype.resizeFactor = 1;
	ImageWindow.prototype.target = null;
	
	ImageWindow.prototype.countOfImages = function(imageNodes) 
	{
		var count = 0;
	
		for(var index=0;index<imageNodes.length;index++)
		{
			if(imageNodes[index].nodeName.toLowerCase()=="img") count++;
		}
	
		return count;
	}
	
	ImageWindow.prototype.hide = function() 
	{
		if(this.target!=null) this.target.close();
	}
	
	ImageWindow.prototype.show = function(nodes,imageNodeIndex) 
	{
		var imageCount = 0;
	
		for(var index=0;index<nodes.length;index++)
		{
			if(nodes[index].nodeName.toLowerCase()=="img")
			{
				if(imageNodeIndex==(imageCount++)) this.showImage(nodes[index]);
			}
		}
		
		throw new Error("Image number "+number+" does not exist");
	}
	
	ImageWindow.prototype.showFirst = function(nodes) { this.show(nodes,0); }
	
	ImageWindow.prototype.showLast = function(nodes) { this.show(nodes,this.countOfImages(nodes)-1); }
	
	ImageWindow.prototype.showImage = function(imageNode) 
	{
		if(imageNode==null)
			throw new Error("The first argument of ImageWindow.show() must be an element node containing images!");
		else
		{
			var width = Math.ceil(imageNode.width*this.resizeFactor) , height = Math.ceil(imageNode.height*this.resizeFactor);
			var url = imageNode.src.replace("_thumb","");
	
			this.target = window.open(url,"imageWindow",(window.innerWidth&&window.innerHeight?('innerHeight='+height+',innerWidth='+width):('height='+height+',width='+width)) +',location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no');
		//	this.target.document.open();
			this.target.document.write
			(
				"<html>"
			+		"<head>"
			+			"<title>"
			+				(imageNode.title?imageNode.title:url) + " (Click image to close window)"
			+			"</title>"
			+		"</head>"
			+		"<body style='margin:0px 0px 0px 0px;background-image:url(" + url + ");background-repeat:no-repeat;width:100%;height:100%;' onClick='window.close();'>"
			+		"</body>"
			+	"</html>"
			);
			this.target.document.close();
			this.target.focus();
			this.resize(width,height);
		}
	}
	
	
	ImageWindow.prototype.resize = function(width,height)
	{				
		if(window.innerWidth&&window.innerHeight)
		{
			this.target.innerWidth = width;
			this.target.innerHeight = height;
		}
		else if (window.resizeTo)
		{
			this.target.resizeTo(width+10,height+35);
		}
		else
		{}
	}