/*
 * LightBox Class
 * @author: 
 */
var LightBox = Class.create({ 
	initialize: function() {
		this.iterator= 0;
		this.list = null;
		
		$$(".clsZoomImages").each(function(imageList) { 
			imageList.select(".clsZoomImage").each(function(boot,index) { 
				boot.observe("click",function(event) {
					this.background = new Element("div").setStyle({position:"absolute",top:"0px",width:"100%",height:"2000px",backgroundColor:"#FFF",opacity:0.7,zIndex:"2"});
					var original = baseUrl+"/updater/image_archive/"+event.element().src.gsub(baseUrl+"/updater/image_archive","").gsub(/_(.*)_/,"");
					this.image = new Element("img").writeAttribute("src",original).writeAttribute("width","550");
					this.imageWrapper = new Element("div").setStyle({position:"absolute",overflow:"hidden",top:"200px",left:"50%",marginLeft:"-279px",width:"550px",backgroundColor:"#FFF",padding:"4px",border:"4px solid #ABABAB",zIndex:"3"});
					this.closeDiv = new Element("div").setStyle({position:"absolute",top:"3px",right:"3px",zIndex:"3",textDecoration:"underline",cursor:"pointer"}).insert("Stäng").observe("click",function() {
						this.background.remove();
						this.imageWrapper.remove();
					}.bind(this));
					$(document.body).insert({bottom:this.imageWrapper.insert(this.closeDiv).insert(this.image)});
					$(document.body).insert({bottom:this.background});
					
				});
			});
		});
	}
});

$(document).observe("dom:loaded", function() {
	var lightBox = new LightBox();
});
