function tooltipHide(obj){
try{document.body.removeChild(obj);}
catch(e){}
}

function obrazPopup(picUrl, picWid, picHei, picAlt){
if(document.all){
}
try{objImage.src = 'none';}
catch(err){}
var pageScroll = new Array();
pageScroll = getPageScroll();
var pageSize = new Array();
pageSize = getPageSize();
var maxSize = pageSize[2] - 100;
var maxSize2 = pageSize[3] - 50;
if(picWid > maxSize){
picHei = maxSize * picHei/picWid;
picWid = maxSize;
}
if(picHei > maxSize2){
picWid = maxSize2 * picWid/picHei;
picHei = maxSize2;
}
picHei = Math.round(picHei);
picWid = Math.round(picWid);
var centerW = (((arrayPageSize[0] - 20 - picWid) / 2) + 'px');
var centerH = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - picHei) / 2) + 'px');
var centerW2 = (((arrayPageSize[0] - 20 - picWid) / 2) + 'px');
var centerH2 = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - picHei) / 2) + 'px');
var mainBody = document.body.childNodes;
gal = new Object();
gal.Width = picWid;
gal.Height = picHei;
gal.Ext = (document.all) ? 'gif' : 'png';
try{
if(document.getElementById('imagepop_gomedia')){
document.body.removeChild(document.getElementById('imagepop_gomedia'));
}
}catch(e){}
gal.Base = document.createElement('div');
gal.Base.id = 'imagepop_gomedia';
gal.Base.style['position'] = 'absolute';
gal.Base.style['left'] = centerW;
gal.Base.style['top'] = centerH;
gal.Base.style['zIndex'] = '100';
document.body.insertBefore(gal.Base, document.body.nextSibling);

table = document.createElement("table");
table.cellPadding = 0;
table.cellSpacing = 0;
gal.Base.appendChild(table);
tb = document.createElement("tbody");
table.appendChild(tb);
tr = document.createElement("tr");
tb.appendChild(tr);
td = document.createElement("td");
td.style['background'] = '#ffffff';
td.width = gal.Width+'px';
td.height = gal.Height+'px';
tr.appendChild(td);

image = document.createElement("img");
image.src = picUrl;
image.width = gal.Width;
image.height = gal.Height;
image.onmousedown = function(){
tooltipHide();	
galeriaClose(gal.Base, image);
}
td.appendChild(image);



}
function galeriaClose(obj){
document.body.removeChild(obj);
}
function getPageScroll(){
var yScroll;
if(self.pageYOffset) {
yScroll = self.pageYOffset;
}else if(document.documentElement && document.documentElement.scrollTop){
yScroll = document.documentElement.scrollTop;
}else if(document.body) {
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array('',yScroll)
return arrayPageScroll;
}
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) {
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}

function pokazgrupe(catId) {

		if (document.getElementById('podkat'+catId)) {
			layer = document.getElementById('podkat'+catId);
			if (layer.style.display == 'none' || !layer.style.display) {
				layer.style.display = 'block'
			} else {
				layer.style.display = 'none'
			}

		}

	}
