LightBox = function(container, boxWidth, boxHeight){
	var o = this;
	o.width = boxWidth, o.height = boxHeight;
	o.c = container || document.body;
	o.isIE = /microsoft|internet explorer/i.test(navigator.appName);
	(o.back = o.create("div")).style.position = "absolute";
	(o.box = o.create("div")).style.position = "absolute";
}
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);});
		clearTimeout(o.timer);
		o.locked = false;
	};
	o.show = function(){
		var o = this, b = document.body;
		if(o.locked)
			return;
		b.appendChild(o.back), b.appendChild(o.box);
		o.timer = setInterval(function(){o.fix();}, 10), o.fix();
		o.loop(function(f){addEvent(f, "focus", 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.fix = function(){
		var o = this, s = this.back.style, p = o.getOffset(o.c), x = function(c, v, r){
			var n = Math.abs(v.charAt(v.length - 1) == "%" ? parseFloat(v) / 100 * r : parseFloat(v)), c = parseFloat(c);
			return (v.charAt(0) == "-" ? c > n ? n : c : n) + "px";
		};
		s.top = p.y + "px", s.left = p.x + "px", s.width = p.w + "px", s.height = p.h + "px";
		s = o.box.style;
		o.width && (s.width = x(o.getStyle(o.box, "width"), o.width, o.back.offsetWidth));
		o.height && (s.height = x(o.getStyle(o.box, "height"), o.height, o.back.offsetHeight));
		s.left = p.x + (p.w - o.box.offsetWidth >> 1) + "px";
		s.top = p.y + (p.h - o.box.offsetHeight >> 1) + "px";
		return arguments.callee;
	};
	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;
	};
}