function getClass(obj) {
	var classes = ""
	if ((typeof obj.getAttribute("class") !== "undefined") && (obj.getAttribute("class") !== null)) { 
		classes = obj.getAttribute("class") 
	}
	if ((typeof obj.getAttribute("className") !== "undefined") && (obj.getAttribute("className") !== null)) { 
		classes = obj.getAttribute("className") 
	}
	return classes;
}

function zoomInit() {
	var all=new Object();
	var classes = "";
	all=document.getElementsByTagName("div");
	for (var i=0; i<all.length; i++) {
		classes = getClass(all[i]);		
		if (classes != "") {
			if (classes.indexOf("image overflow") != -1)  {
				img=all[i].getElementsByTagName("img");
				//img[0].setAttribute('onclick', 'zoomImg("'+img[0].alt+'")'); //nefunguje v IE7 
				img[0].onclick = function() {
					var fname = this.src;
					var fext = "";
					var posDot = -1;
					var HTMLversion = "5";
					if (classes.indexOf("html4") != -1)  {
						HTMLversion = "4"
					}
					while (fname.indexOf("_s.", posDot+1) > 0) {
						//hleda posledni vyskyt
						posDot = fname.indexOf("_s.", posDot+1);
					};
					//pozice+3 znaky je pripona
					fext = fname.substr(posDot+3);
					fname = fname.substr(0, posDot);
					zoomImg(fname+"."+fext, HTMLversion);
				};
			}
		}
	}
}

function zoomInitSWF() {
	var all=new Object();
	var classes = "";
	all=document.getElementsByTagName("div");
	for (var i=0; i<all.length; i++) {
		classes = getClass(all[i]);
		if (classes != "") {
			if (classes.indexOf("divSWF overflow") != -1) {
				img=all[i].getElementsByTagName("img");
				//img[0].setAttribute('onclick', 'zoomImg("'+img[0].alt+'")'); //nefunguje v IE7 
				img[0].onclick = function() {
					var fname = this.src;
					var fext = "";
					var posDot = -1;
					var HTMLversion = "5";
					if (classes.indexOf("html4") != -1)  {
						HTMLversion = "4"
					}
					while (fname.indexOf("_thumb.", posDot+1) > 0) {
						//hleda posledni vyskyt 
						posDot = fname.indexOf("_thumb.", posDot+1);
					};
					//pozice+7 znaky je pripona
					fext = fname.substr(posDot+7);
					if (fext.indexOf("gif",0) >= 0) {
						fext = fext.replace("gif","swf");
					}
					fname = fname.substr(0, posDot);
					zoomSWF(fname+"."+fext, HTMLversion);
				};
			}
		}
	}
}

function getSizeH() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
    return myHeight; 
}

function getSizeW() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
    return myWidth; 
}
  
function zoomImg(obj, HTMLversion) {
	var iw = window.open ( '../shared/image.html?img='+obj+'&w='+getSizeW()+'&h='+getSizeH(), 'ImageViewer','resizable=1,menubar=0,titlebar=1,toolbar=0,status=0,scrollbars=1' );
	iw.focus();
}

function zoomSWF(obj, HTMLversion) {
	var iw = window.open ( '../shared/flash'+HTMLversion+'.html?movie='+obj+'&wWindow='+getSizeW()+'&hWindow='+getSizeH(), 'SWFViewer','resizable=1,menubar=0,titlebar=1,toolbar=0,status=0,scrollbars=1' );
	iw.focus();
}