LightBox = function(container, boxWidth, boxHeight){
	var o = this, d = document, v, vp;
	o.width = boxWidth, o.height = boxHeight;
	o.c = container || (d.documentElement.style.height = d.body.style.height = "100%", d.documentElement);
	o.cs = o.getStyle(o.c, "overflow");
	o.isIE = /microsoft|internet explorer/i.test(navigator.appName);
	v = (vp = (v = navigator.appVersion).indexOf("MSIE ")) + 1 ? +v.substr(vp + 5, 1) : 0;
	(o.back = o.create("div")).style.position = 
	(o.box = o.create("div")).style.position = o.isIE && v < 7 ? "absolute" : "fixed";
	o.box.style.zIndex = (o.back.style.zIndex = 99) + 1;
}
with({o: LightBox.prototype}){
	o.locked = false;
	o.timer = o.ieFix = null;
	o.setClassName = function(className){
		this.back.className = className + " back";
		this.box.className = className + " box";
	};
	o.hide = function(){
		var o = this, b = document.body;
		if(!o.locked)
			return;
		b.removeChild(o.box), b.removeChild(o.back);
		if(o.isIE)
			for(var x = o.ieFix, i = x.length; i--;)
				for(var j = x[i].length; j--; x[i][j].style.visibility = "visible");
		o.loop(function(f){removeEvent(f, "focus", o.blur), removeEvent(f, "click", o.blur)});
		clearTimeout(o.timer); o.c.style.overflow = o.cs;
		o.locked = false;
	};
	o.show = function(){
		var o = this, b = document.body;
		if(o.locked) return;
		o.loop(function(f){addEvent(f, "focus", o.blur), addEvent(f, "click", o.blur)});
		if(o.isIE)
			for(var s = "getElementsByTagName", x = o.ieFix = [o.c[s]("select"), o.c[s]("iframe")], i = x.length; i--;)
				for(var j = x[i].length; j--; x[i][j].style.visibility = "hidden");
		o.locked = true;
		o.ot = o.c.scrollTop, o.ol = o.c.scrollLeft;
		b.appendChild(o.back), b.appendChild(o.box), o.c.style.overflow = "hidden";
		o.c.scrollTop = o.ot, o.c.scrollLeft = o.ol;
		o.timer = setInterval(function(){o.fix();}, 10), o.fix();
	};
	o.fix = function(){
		var o = this, s = o.back.style, p = o.getOffset(o.c), f = s.position != "fixed";
		s.width = p.w + "px", s.height = p.h + "px", s.left = (f && o.c.scrollLeft) + p.x + "px",
		s.top = (f && o.c.scrollTop) + p.y + "px", s = o.box.style;
		o.width && (s.width = o.getValue(o.getStyle(o.box, "width"), o.width, o.back.offsetWidth));
		o.height && (s.height = o.getValue(o.getStyle(o.box, "height"), o.height, o.back.offsetHeight));
		s.left = (f && o.c.scrollLeft) + p.x + (p.w - o.box.offsetWidth >> 1) + "px";
		s.top = (f && o.c.scrollTop) + p.y + (p.h - o.box.offsetHeight >> 1) + "px";
	};
	o.blur = function(){
		return this.blur(), false;
	};
	o.loop = function(c){
		for(var t, tags = ["a", "select", "input", "button", "textarea"]; t = tags.pop();)
			for(var f = this.c.getElementsByTagName(t), i = f.length; i; c(f[--i]));
	};
	o.create = function(t, p, n, b){
		var e = document.createElement(t), i;
		for(i in p)
			e[i] = p[i];
		return n ? b ? n.insertBefore(e, b) : n.appendChild(e) : e;
	};
	o.getOffset = function(o){
		for(var r = {x: o.offsetLeft, y: o.offsetTop, h: o.offsetHeight, w: o.offsetWidth}; o = o.offsetParent; r.x += o.offsetLeft, r.y += o.offsetTop);
		return r;
	};
	o.getStyle = function(o, p){
		return o.currentStyle ? o.currentStyle[p] : window.getComputedStyle ? document.defaultView.getComputedStyle(o, null).getPropertyValue(p) : null;
	};
	o.getValue = function(c, v, r){
		var n = Math.abs(v.charAt(v.length - 1) == "%" ? parseFloat(v) / 100 * r : +v), c = parseFloat(c);
		return (v.charAt(0) == "-" ? c > n ? n : c : n) + "px";
	};
}