LightBox = function(container, boxWidth, boxHeight, forceFixed, notExpand){
	var o = this, d = document, v, vp, lt = LightBox, ie6;
	lt.instances[o.index = lt.instances.length] = o;
	o.expand = !notExpand, o.forceFixed = forceFixed = forceFixed || 0;
	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;
	lt.p = (o.back = o.create("div")).style.position =
		(o.box = o.create("div")).style.position =
		(((ie6 = o.isIE && v < 7) || container) || lt.p == "absolute") && (!forceFixed || ie6) ? "absolute" : "fixed";
	o.box.style.zIndex = (o.back.style.zIndex = lt.instances.length * 2) + 1;

};
with({o: LightBox.prototype}){
	o.constructor.instances = [];
	o.locked = false;
	o.index = 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", e = false,
			_w = o.box.offsetWidth, _h = o.box.offsetHeight, l = _w > o.c.offsetWidth, t = _h > o.c.offsetHeight;
		(o.expand && (l || t) && !o.forceFixed) && (o.c.style.overflow = "scroll", o.box.style.position = "absolute");
		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 = (!l ? ((f && o.c.scrollLeft) + p.x + (p.w - _w >> 1)) : (Math.max(_w, p.w) - (Math.min(_w, p.w) / 2)) >> 1) + "px";
		s.top = (!t ? ((f && o.c.scrollTop) + p.y + (p.h - _h >> 1)) : (Math.max(_h, p.h) - (Math.min(_h, p.h) / 2)) >> 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";
	};
	o.setTopMost = function(){
		var o = this;
		o.box.style.zIndex = (o.back.style.zIndex = (o.constructor.instances.length + 999) * 2) + 1;
	};
}