// powered by ROTFL & LOL
pm={
	start:function(){
		new pm.menu(jso.gI("menu"))
		if(jso.gI("contactMap"))
			new pm.contactMap(jso.gI("contactMap"),jso.gI("container"));
		else
			new pm.mybox(jso.gI("container"));
		new pm.index(document.body.className == "index")
		switch(document.body.className){
			case "article":
			case "news":
			case "project":
			case "contact":
			case "employees":
				new pm.scroll(jso.gAV("div",jso.gI("content"),"className","scroll")[0]);
				break;
			default:
				break;
		}
		new pm.news(jso.gI("footer_news"))
		new pm.news(jso.gI("footer_project"))
		new pm.gallery(jso.gI("projects_list"),{maxWidth:116,maxHeight:67,minWidth:100,minHeight:60})
		new pm.employees(jso.gI("employees"),jso.gI("employees_list"))
		new pm.project(document.body.className == "project")
	},
	index:function(warunek){
		if(warunek){
			// funkcyje
			this.itemClick = function(){
				var i = this.index
				if(!i.interval){
					this.item.plus = false
					this.item.interval = true
					i.imageIntervalEnd = this.item
					i.list.style.zIndex = -1
					i.active = this.item
					i.interval = window.setInterval(function(){i.intervalFunction.call(i)},24)
				}
				return false
			}
			this.itemOver = function(){
				if(!this.index.imageIntervalEnd){
					this.item.plus = true
					this.item.interval = true
					this.item.image.style.display="block"
				}
				return false
			}
			this.itemOut = function(){
				if(!this.index.imageIntervalEnd){
					this.item.plus = false
					this.item.interval = true
				}
				return false
			}
			this.imageIntervalFunction = function(){
				for(var i=0;i<this.items.length;i++){
					var item = this.items[i]
					if(item.interval){
						if((item.plus && item.scale == 100) || (!item.plus && item.scale == 0)){
							item.interval = false
							if(item.scale == 0)
								item.image.style.display = "";
							if(this.imageIntervalEnd == item){
								window.clearInterval(this.imageInterval)
								this.imageInterval = false
							}
						}else{
							item.scale += item.plus?5:-5
							item.image.style.zIndex = item.scale
							item.image.style.filter="alpha(opacity="+item.scale+")"
							item.image.style.opacity= item.scale / 100
						}
					}
				}
			}
			this.intervalFunction = function(){
				if(!this.imageInterval){
					if(this.procent < 1){
						this.procent += 0.025
						this.header.style.top =  230 + Math.round(this.procent * 90) + "px";
						this.header.style.height = 125 - Math.round(this.procent * 50) + "px"
						this.anachor.style.top = 25 - Math.round(this.procent * 25) + "px"
						this.list.style.opacity = 1 - this.procent
						this.list.style.filter="alpha(opacity="+Math.round(100 - 100 * this.procent)+")"
					}else{
						window.clearInterval(this.interval)
						delete(this.interval)
						document.location = this.active.anachor.href
					}
				}
			}
			// zmienne
			this.interval = false
			this.imageIntervalEnd = false
			this.procent = 0
			// dom
			this.list = jso.gI("menu")
			this.list.index = this
			this.header = jso.gI("header")
			this.header.index = this
			this.anachor = jso.gT("a",this.header)[0]
			this.anachor.index = this
			this.items = []
			var items = jso.gT("li",this.list)
			for(var i=0;i<items.length;i++){
				var item = this.items[i] = {
					li:items[i],
					anachor:jso.gT("a",items[i])[0],
					interval:false,
					scale:0,
					plus:false
				}
				item.li.index=this
				item.li.item=item
				item.anachor.index=this
				item.anachor.item=item
				item.anachor.onclick = this.itemClick
				item.anachor.onmouseover = this.itemOver
				item.anachor.onmouseout = this.itemOut
				item.image = jso.gI("index_"+item.anachor.firstChild.nodeValue.toLowerCase())
				item.image.index = this
				item.image.item = item
			}
			var i = this
			this.imageInterval = window.setInterval(function(){i.imageIntervalFunction.call(i)},12);
		}
	},
	news:function(container){
		if(this.container = container){
			// funkcyje
			this.headerClick = function(){
				var i = this.news
				i.plus = !i.plus
				i.header.className = i.plus?"active":"";
				if(!i.interval)
					i.interval = window.setInterval(function(){i.intervalFunction.call(i)},24);
			}
			this.intervalFunction = function(){
				this.value += this.plus?10:-10;
				this.scroll.style.height = this.value + "px"
				this.scroll.style.opacity = Math.round(this.value / 7 * 5)/100;
				this.scroll.style.filter="alpha(opacity="+Math.round(100 * this.value / 140)+")"
				if(!this.plus && !this.value){
					window.clearInterval(this.interval)
					delete(this.interval)
				}else if(this.plus && this.value == 140){
					window.clearInterval(this.interval)
					delete(this.interval)
					if(!this.scroll.scroll)
						new pm.scroll(this.scroll,{top:15,bottom:15,hide:false});
				}
			}
			// zmienne
			this.interval = false
			this.plus = false
			this.value = 0
			// dom
			this.container.news = this
			this.header = jso.gT("h2",this.container)[0]
			this.header.news = this
			this.header.onclick = this.headerClick
			this.scroll = jso.gT("div",this.container)[0]
			this.scroll.news = this
			this.list = jso.gT("ul",this.container)[0]
			this.list.news = this
			this.closeButton = jso.cE("img",{src:"/images/close.png",className:"newsClose",news:this,onclick:this.headerClick},0,this.scroll)
		}
	},
	scroll:function(container,options){
		options = options || {};
		if(this.container = container){
			if(!document.body.onmousedown){
				document.body.onmousedown = function(){pm.scroll.mouse = true}
				document.body.onmouseup = function(){pm.scroll.mouse = false}
			}
			// funkcyje
			this.scrollAreaMouseMove = function(e){
				e=e||window.event
				if(this.scroll.mouse && pm.scroll.mouse){
					var Y = e.layerY || (e.y) || 0;
					if(Y > this.scroll.top && Y < (this.scroll.scrollBar.offsetHeight - this.scroll.bottom)){
						this.scroll.scrollBar.style.backgroundPosition="0 "+Y+"px";
						this.scroll.scrollArea.scrollTop = (Y-this.scroll.top) / (this.scroll.scrollBar.offsetHeight - this.scroll.bottom - this.scroll.top) * (this.scroll.scrollArea.scrollHeight - this.scroll.scrollArea.offsetHeight);
					}
				}
				return false
			}
			this.arrowFunction = function(){
				pm.scroll.mouse = true
				var i = this.scroll
				if(i.arrowUp == this)
					i.plus = -5;
				else if(i.arrowDown == this)
					i.plus = 5;
				else
					i.plus = 0;
				if(!i.interval)
					i.interval = window.setInterval(function(){i.arrowFunctionInterval.call(i)},24);
			}
			this.whellFunction = function(value) {
				value = this.scrollArea.scrollTop + ((value < 0)?10:-10);
				this.scrollToFunction.call(this,value)
			}
			this.whellEvent = function(e){
				e = e||window.event
				var value = 0
				if(this.scroll)
					var i = this.scroll;
				else{
					var item = jso.gE(e)
					if(item.scroll)
						var i = item.scroll;
				}
				if(e.wheelDelta)
					value = e.wheelDelta;
				else if(e.detail)
					value = -e.detail;
				if(value)
					i.whellFunction.call(i,value);
				if(e.preventDefault)
					e.preventDefault();
				e.returnValue = false;
			}
			this.arrowFunctionInterval = function(){
				if(this.plus){
					this.scrollToFunction.call(this,(this.scrollArea.scrollTop+this.plus))
				}
				if(!pm.scroll.mouse || !this.plus || !this.scrollArea.scrollTop || this.scrollArea.scrollTop == (this.scrollArea.scrollHeight - this.scrollArea.offsetHeight)){
					this.plus = 0
					window.clearInterval(this.interval)
					delete(this.interval)
				}
			}
			this.scrollAreaMouseDown = function(){
				this.scroll.mouse = true
				return false
			}
			this.scrollToFunction = function(place){
				this.scrollArea.scrollTop = place;
				var Y = Math.round(this.scrollArea.scrollTop / (this.scrollArea.scrollHeight - this.scrollArea.offsetHeight) * (this.scrollBar.offsetHeight - this.bottom - this.top -2)) + this.top +1
				this.scrollBar.style.backgroundPosition="0 "+Y+"px";
			}
			// zmienne
			this.top = options.top || 15;
			this.bottom = options.bottom || 15;
			this.interval = false
			this.plus = 0
			// dom
			this.container.scroll = this
			this.scrollArea = jso.gAV(0,this.container,"className","scrollArea")[0];
			this.contentTitle = jso.gAV("h2",this.container,"className","content_title")[0];
			if(this.contentTitle){
				this.contentTitle.scroll = this;
				this.contentTitle.style.position = "absolute";
				this.contentTitle.style.top = "0";
				this.contentTitle.style.left = "0";
				this.contentTitle.style.width =  this.scrollArea.offsetWidth + "px";
				this.contentTitle.style.margin = "0";
				var tmp = jso.cE("div")
				tmp.style.height = this.contentTitle.offsetHeight + 5 + "px";
				this.scrollArea.insertBefore(tmp,this.contentTitle);
			}else{
				this.contentTitle = false;
			}
			this.scrollArea.scroll = this
			if(!options.forceScroll && this.scrollArea.offsetHeight >= this.scrollArea.scrollHeight)
				return;
			if(window.addEventListener)
				jso.aE(this.container,'DOMMouseScroll',this.whellEvent);
			this.container.onmousewheel = this.whellEvent;
			this.scrollBar = jso.cE("div",{
					className:"scrollBar",
					scroll:this,
					onmousemove:this.scrollAreaMouseMove,
					onmousedown:this.scrollAreaMouseDown
				},[
					this.arrowUp = jso.cE("div",{className:"arrowUp",scroll:this,onmousedown:this.arrowFunction}),
					this.arrowDown = jso.cE("div",{className:"arrowDown",scroll:this,onmousedown:this.arrowFunction})
				],this.container)
			if(options.hide){
				this.topHide = jso.cE("div",{className:"topHide",scroll:this},0,this.container)
				this.bottomHide = jso.cE("div",{className:"bottomHide",scroll:this},0,this.container)
			}
		}
	},
	project:function(warunek){
		if(warunek){
			if(!document.body.onmousedown){
				document.body.onmousedown = function(){pm.scroll.mouse = true}
				document.body.onmouseup = function(){pm.scroll.mouse = false}
			}
			// funkcyje
			this.itemClick = function(){
				this.project.image.a.item = this.item
				this.project.image.img.src = this.rev
				return false;
			}
			// funkcyje
			this.arrowFunction = function(){
				pm.scroll.mouse = true
				var i = this.project
				if(i.arrowLeft == this)
					i.plus = -5;
				else if(i.arrowRight == this)
					i.plus = 5;
				else
					i.plus = 0;
				if(!i.interval)
					i.interval = window.setInterval(function(){i.arrowFunctionInterval.call(i)},24);
			}
			this.whellFunction = function(value) {
				value = (value < 0)?10:-10
				this.scroll.scrollLeft += value
			}
			this.whellEvent = function(e){
				e = e||window.event
				var value = 0
				if(this.project)
					var i = this.project;
				else{
					var item = jso.gE(e)
					if(item.project)
						var i = item.project;
				}
				if(e.wheelDelta)
					value = e.wheelDelta;
				else if(e.detail)
					value = -e.detail;
				if(value && i)
					i.whellFunction.call(i,value);
				if(e.preventDefault)
					e.preventDefault();
				e.returnValue = false;
			}
			this.arrowFunctionInterval = function(){
				if(this.plus){
					this.scroll.scrollLeft += this.plus;
				}
				if(!pm.scroll.mouse || !this.plus || !this.scroll.scrollLeft || this.scroll.scrollLeft == (this.scroll.scrollWidth - this.scroll.offsetWidth)){
					this.plus = 0
					window.clearInterval(this.interval)
					delete(this.interval)
				}
			}
			// zmienne
			this.interval = false
			this.plus = 0
			// dom
			this.image = {
				a:jso.gT("a",jso.gI("project_image"))[0],
				img:jso.gT("img",jso.gI("project_image"))[0]
			}
			this.container = jso.gI("project_image_list")
			this.list = jso.gT("ul",this.container)[0]
			this.items = []
			var items = jso.gT("a",this.list)
			for(var i=0;i<items.length;i++){
				items[i].project = this
				items[i].onclick = this.itemClick
			}
			this.scroll = jso.gT("div",this.container)[0]
			if(this.scroll){
				if(window.addEventListener)
					jso.aE(this.container,'DOMMouseScroll',this.whellEvent);
				this.container.onmousewheel = this.whellEvent
				this.arrowLeft = jso.cE("div",{className:"arrowLeft",project:this,onmousedown:this.arrowFunction},0,this.container)
				this.arrowRight = jso.cE("div",{className:"arrowRight",project:this,onmousedown:this.arrowFunction},0,this.container)
			}
		}
	},
	gallery:function(container,options){
		options = options || {};
		if(this.container = container){
			// funkcyje
			this.intervalFunction = function(){
				for(var i=0;i<this.items.length;i++){
					var item = this.items[i]
					if(item.interval){
						if((item.plus && item.scale == 100) || (!item.plus && item.scale ==0)){
							item.interval = false
						}else{
							item.scale += item.plus?5:-5;
							var procent = item.scale / 100
							item.anachor.style.top =  Math.round( - (this.maxHeight - this.minHeight) / 2 * procent) + "px"
							item.anachor.style.left = Math.round( - (this.maxWidth - this.minWidth) / 2 * procent) + "px"
							item.anachor.style.filter="alpha(opacity="+Math.round(item.scale*0.25+75)+")";
							item.anachor.style.opacity= item.scale / 100 * 0.25 + 0.75
							item.image.style.width =  Math.round( this.minWidth + (this.maxWidth - this.minWidth) * procent ) + "px"
							item.image.style.height = Math.round( this.minHeight + (this.maxHeight - this.minHeight) * procent ) + "px"
							item.li.style.zIndex = item.scale
						}
					}
				}
			}
			this.start = function(index){
				var item = this.items[index]
				item.li.style.visibility = "visible"
				item.interval = true
				item.scale = 100
			}
			// zmienne
			this.interval = false
			this.maxWidth = options.maxWidth
			this.maxHeight = options.maxHeight
			this.minWidth = options.minWidth
			this.minHeight = options.minHeight
			// dom
			this.container.gallery = this
			this.list = jso.gT("ul",this.container)[0]
			this.items = []
			var items = jso.gT("li",this.list)
			for(var i=0;i<items.length;i++){
				var item = this.items[i] = {
					index:i,
					plus:false,
					scale:0,
					interval:false,
					li:items[i],
					anachor:jso.gT("a",items[i])[0],
					image:jso.gT("img",items[i])[0]
				}
				item.li.gallery = this
				item.li.item = item
				item.anachor.gallery = this
				item.anachor.item = item
				item.image.gallery = this
				item.image.item = item
				item.li.onmouseover=function(){
					this.item.plus = true
					this.item.interval = true
				}
				item.li.onmouseout=function(){
					this.item.interval = true
					this.item.plus = false
				}
				var f = function(g,h){return function(){g.start.call(g,h)}}
				window.setTimeout(f(this,item.index),item.index*200);
			}
			var g = this
			this.interval = window.setInterval(function(){g.intervalFunction.call(g)},6);
		}
	},
	employees:function(container,list){
		if((this.container = container) && (this.list = list)){
			// funkcyje
			this.intervalFunction = function(){
				for(var i=0;i<this.items.length;i++){
					var item = this.items[i]
					if(item.interval&&(!this.currentItem||!this.currentItem.interval||this.currentItem == item)){
						if((item.plus && item.scale == 100) || (!item.plus && item.scale ==0)){
							item.interval = false
							if(!item.plus)
								item.imageBig.style.display="";
						}else{
							if(item.menuItem)
								item.menuItem.className = item.plus?"active":"";
							if(this.currentItem != item){
								this.currentItem.plus = false;
								this.currentItem.interval = true;
								this.currentItem = false;
							}
							item.imageBig.style.display = "block"
							item.scale += item.plus?2:-2;
							item.imageBig.style.filter="alpha(opacity="+item.scale+")"
							item.imageBig.style.opacity= item.scale / 100
							item.li.style.zIndex = (item.plus?40:0) + item.scale / 2
						}
					}else{
						item.interval = false;
					}
				}
			}
			this.itemOver = function(){
				if(this.image){
					var scroll = this.employees.list.parentNode.scroll
					if(scroll && scroll.scrollBar){
						var value = this.item.menuItem.offsetTop + this.item.menuItem.offsetHeight - scroll.scrollArea.offsetHeight
						if(value < 0)
							value = 0;
						scroll.scrollToFunction.call(scroll,value);
					}else{
						this.jestemObrazkiem = false
					}
				}
				this.item.plus = true
				this.item.interval = true
			}
			this.itemOut = function(){
				this.item.interval = true
				this.item.plus = false
			}
			// zmienne
			this.interval = false
			// dom
			this.container.employees = this
			this.list.employees = this
			this.items = []
			var items = jso.gT("li",this.container)
			var menuItems = jso.gT("li",this.list)
			var currentItem = document.location.hash.replace("#","")
			this.currentItem = false;
			for(var i=0;i<items.length;i++){
				var item = this.items[i] = {
					index:i,
					plus:false,
					scale:0,
					interval:false,
					li:items[i],
					anachor:jso.gT("a",items[i])[0],
					imageSmall:jso.gT("img",items[i])[0],
					imageBig:jso.gT("img",items[i])[1],
					menuItem:menuItems[i]
				}
				item.li.employees = this
				item.li.item = item
				item.anachor.employees = this
				item.anachor.item = item
				item.anachor.image = true
				item.imageSmall.employees = this
				item.imageSmall.item = item
				item.imageSmall.image = true
				if(item.menuItem){
					item.menuItem.employees = this
					item.menuItem.item = item
					item.menuItem.image = false
				}
				if(item.imageBig){
					item.imageBig.employees = this
					item.imageBig.item = item
					item.imageBig.image = true
					item.li.onmouseover = this.itemOver
					item.li.onmouseout = this.itemOut
					item.li.image = true
					if(item.menuItem){
						item.menuItem.onmouseover = this.itemOver
						item.menuItem.onmouseout = this.itemOut
					}
					if(item.imageBig.title == currentItem){
						this.itemOver.call(item.li);
						this.currentItem = item;
					}
				}
			}
			var i = this
			this.interval = window.setInterval(function(){i.intervalFunction.call(i)},6);
		}
	},
	menu:function(container){
		if(this.container = container){
			this.container.menu = this
			// funkcyje
			this.itemClick=function(start){
				var news = jso.gI("footer_news")
				if(news && news.news && news.news.plus)
					news.news.headerClick.call(news);
				news = jso.gI("footer_project");
				if(news && news.news && news.news.plus)
					news.news.headerClick.call(news);
				if(start !== true && this.menu.active == this.item){
					return true;
				}else{
					if(start !== true)
						this.menu.hideActive.call(this.menu);
					this.menu.active = this.item
					this.menu.showActive.call(this.menu)
					return false;
				}
			}
			this.hideActive=function(){
				var items = jso.gAV("a",this.container,"className","active")
				for(var i=0;i<items.length;i++){
					var item = items[i]
					if(item.item){
						if(item.item.a)
							item.item.a.className = "";
						if(item.item.ul)
							item.item.ul.className = "";
					}else{
						item.className = "";
					}
				}
			}
			this.showActive=function(){
				var item = this.active
				while(item){
					if(item.a)
						item.a.className = "active";
					if(item.ul){
						item.ul.className = "active";
						if(!item.ul.scroll && item.ul.nodeName.toLowerCase() == "div"){
							new pm.scroll(item.ul,{forceScroll:true});
							var active = jso.gAV("a",item.ul,"className","active")[0]
							if(active){
								item.ul.scroll.scrollToFunction.call(item.ul.scroll,active.parentNode.offsetTop)
							}
						}
					}
					if(item.li)
						item = item.li.parentNode.item;
					else
						item = false;
				}
				item = this.active
				var size = 10,last = 0;
				while(item){
					if(item.li)
						last = item.li.offsetHeight;
					if(item.ul)
						size += item.ul.offsetHeight;
					if(item.li)
						item = item.li.parentNode.item;
					else
						item = false;
				}
				size += last
				this.container.style.height = size + "px"
			}
			// dom
			this.items = []
			this.list = jso.gT("ul",this.container)[0]
			var items = jso.gAV("li",this.container,"className","catalog")
			for(var i=0;i<items.length;i++){
				var item = this.items[i] = {
					li:items[i],
					a:jso.gT("a",items[i])[0],
					ul:jso.gT("ul",items[i])[0]
				}
				item.li.menu = this
				item.li.item = item
				if(item.a){
					item.a.menu = this
					item.a.item = item
					item.a.onclick = this.itemClick
					if(item.a.className == "active")
						this.active = item;
				}
				if(item.ul){
					item.ul.menu = this
					item.ul.item = item
					if(item.ul.parentNode.nodeName.toLowerCase() == "div"){
						item.ul = item.ul.parentNode
						item.ul.menu = this
						item.ul.item = item
					}
				}
			}
			if(this.active)
				this.itemClick.call(this.active.a,true)
		}
	},
	contactMap:function(thumb,container){
		if((this.thumb = thumb) && (this.container = container)){
			// funkcyje
			this.thumbClick = function(){
				this.contactMap.plus = !this.contactMap.plus
				var i = this.contactMap
				if(this.contactMap.plus)
					this.contactMap.selects.call(this.contactMap);
				if(!this.contactMap.interval)
					this.contactMap.interval = window.setInterval(function(){i.intervalFunction.call(i)},24);
				return false
			}
			this.show = function(){
				this.contactMap.image.src = this.image
				return false;
			}
			this.intervalFunction = function(){
				this.zoom += (this.plus ? 10 : - 10)
				this.mybox.style.opacity = this.zoom / 100
				this.mybox.style.filter="alpha(opacity="+this.zoom+")"
				this.mybox.style.display = "block"
				if(this.zoom == 0 && !this.plus){
					this.mybox.style.display = ""
					window.clearInterval(this.interval)
					this.active = false
					delete(this.interval)
					this.selects.call(this)
				}else if(this.zoom == 100 && this.plus){
					window.clearInterval(this.interval)
					delete(this.interval)
					this.selects.call(this)
				}
			}
			this.selects = function(){
				var selects = jso.gT("select")
				for(var i in selects){
					selects[i].style.visibility = this.plus?"hidden":"";
				}
			}
			// zmienne
			this.plus = 0
			this.zoom = 0
			this.interval = false
			this.active = false
			// dom
			this.thumb.contactMap = this
			this.thumb.onclick = this.thumbClick

			this.mybox = jso.cE("div",{id:"mybox",contactMap:this},[
				this.table = jso.cE("table",{className:"contactMap items"},[
					jso.cE("tbody",0,[
						jso.cE("tr",0,[
							jso.cE("td",{className:"prev"},[" "]),
							jso.cE("td",{className:"image",contactMap:this},[
								this.imageConteiner = jso.cE("p",0,[
									this.info = jso.cE("span",{className:"items",mybox:this},[
										this.center = jso.cE("a",{href:"#center",className:"center",contactMap:this,image:"/images/contact/center.png",onclick:this.show},[i18n.centerButton]),
										this.city = jso.cE("a",{href:"#city",className:"city",contactMap:this,image:"/images/contact/city.png",onclick:this.show},[i18n.cityButon])
									]),
									this.close = jso.cE("a",{href:"#close",className:"close",onclick:this.thumbClick,contactMap:this},[i18n.closeButton]),
									this.image = jso.cE("img",{src:"/images/contact/center.png",contactMap:this})
								])
							]),
							jso.cE("td",{className:"next"},[" "])
						])
					])
				])
			],this.container)
		} else {
			return false;
		}
	},
	mybox:function(container){
		if(this.container = container){
			// funkcyje
			this.show = function(){
				this.imageConteiner.style.visibility = "hidden"
				this.imageConteiner.style.width = ""
				var tmp = jso.cE("img",{src:this.active.href,mybox:this})
				this.image.parentNode.replaceChild(tmp,this.image)
				this.image = tmp
				this.image.onload = this.onLoadImage
				// this.onLoadImage.call(this.image)
				this.mybox.style.display = "block"
				var i = this
				window.setTimeout(function(){i.onLoadImage.call(i.image)},2000)
				if(this.items.length > 1){
					this.table.className = "items"
					if(this.active.index > 0)
						this.table.className += " prev";
					if(this.active.index < this.items.length-1)
						this.table.className += " next";
					this.info.firstChild.nodeValue = (this.active.index + 1)+" / "+this.items.length
				}
				this.nextprev = false
			}
			this.onLoadImage = function(){
				this.mybox.imageConteiner.style.width = this.offsetWidth + "px";
//				this.mybox.mybox.style.height = "expression(document.body.offsetHeight+'px')"
				this.mybox.mybox.style.height = ((this.mybox.container.offsetHeight>this.mybox.imageConteiner.offsetHeight)?"":(this.mybox.imageConteiner.offsetHeight+34)+"px");
				this.mybox.imageConteiner.style.visibility = "visible"
			}
			this.itemClick = function(){
				var i = this.mybox
				if(!this.mybox.active){
					this.mybox.active = this.item
					this.mybox.show.call(this.mybox)
				}
				this.mybox.plus = !this.mybox.plus
				if(this.mybox.plus)
					this.mybox.selects.call(this.mybox);
				if(!this.mybox.interval)
					this.mybox.interval = window.setInterval(function(){i.intervalFunction.call(i)},24);
				return false
			}
			this.nextItem = function(){
				if(this.mybox.items[this.mybox.active.index+1]){
					this.mybox.active = this.mybox.items[this.mybox.active.index+1]
					this.mybox.nextprev = true
					this.mybox.show.call(this.mybox)
				}
			}
			this.prevItem = function(){
				if(this.mybox.items[this.mybox.active.index-1]){
					this.mybox.active = this.mybox.items[this.mybox.active.index-1]
					this.mybox.nextprev = true
					this.mybox.show.call(this.mybox)
				}
			}
			this.intervalFunction = function(){
				this.zoom += (this.plus ? 10 : - 10)
				this.mybox.style.opacity = this.zoom / 100
				this.mybox.style.filter="alpha(opacity="+this.zoom+")"
				if(this.zoom == 0 && !this.plus){
					this.mybox.style.display = ""
					window.clearInterval(this.interval)
					this.active = false
					this.selects.call(this);
					delete(this.interval)
				}else if(this.zoom == 100 && this.plus){
					window.clearInterval(this.interval)
					delete(this.interval)
					this.selects.call(this);
				}
			}
			this.selects = function(){
				var selects = jso.gT("select")
				for(var i in selects){
					selects[i].style.visibility = this.plus?"hidden":"";
				}
			}
			this.start = function(){
				this.items = []
				var items = jso.gAV("a",this.container,"rel","lightbox")
				for(var i=0;i<items.length;i++){
					var ok = true
					for(var j=0;j<this.items.length;j++){
						if(this.items[j].href == items[i].href){
							ok = false
							break
						}
					}
					if(ok){
						j = this.items.length
						var item = this.items[j] = {a:items[i],href:items[i].href,index:j}
						item.a.mybox = this
						item.a.item = item
						item.a.onclick = this.itemClick
					}else{
						var item = this.items[j]
						items[i].mybox = this
						items[i].item = item
						items[i].onclick = this.itemClick
					}
				}
			}
			// zmienne
			this.plus = 0
			this.zoom = 0
			this.interval = false
			this.active = false
			// dom
			this.container.mybox = this
			this.start.call(this)
			this.mybox = jso.cE("div",{id:"mybox",mybox:this},[
				this.table = jso.cE("table",0,[
					jso.cE("tbody",0,[
						jso.cE("tr",0,[
							jso.cE("td",{className:"prev",onclick:this.prevItem,mybox:this},[" "]),
							jso.cE("td",{className:"image",mybox:this},[
								this.imageConteiner = jso.cE("p",0,[
									this.info = jso.cE("span",{className:"items",mybox:this},[" / "]),
									this.close = jso.cE("a",{href:"#close",onclick:this.itemClick,className:"close",mybox:this},[i18n.closeButton]),
									this.image = jso.cE("img",{src:"/images/throbber-big.gif",mybox:this})
								])
							]),
							jso.cE("td",{className:"next",onclick:this.nextItem,mybox:this},[" "])
						])
					])
				])
			],this.container)
		}
	}
}
window.onload=pm.start
try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
