var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name){
	if (document.getElementById) {
    this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

function openPopup(imgName){
  //var imgName = 'images/popup/'.img;
  var myImage = new Image();
  myImage.name = imgName;
  myImage.onload = showDiv;
  //myImage.onerror = loadFailure;
  myImage.src = imgName;
}

function showDiv() {
  var x = new getObj('popup');
  x.obj.innerHTML = "<img src=\""+this.name+"\" border=\"0\" alt=\"Kliknij aby zamknąć\" title=\"Kliknij aby zamknąć\" onclick=\"hideDiv();\">";
  
	//x.style.border = '1px solid #000000';
  x.style.width = this.width;
	x.style.height = this.height;
	x.style.top =  200;
	x.style.left =  Math.round( (screen.width - this.width) / 2 );
	x.style.visibility = 'visible';
  return true;
}

function hideDiv() {
  var x = new getObj('popup');
	x.style.visibility = 'hidden'
  return true;
}

function loadFailure() {
    //alert("'" + this.name + "' failed to load.");
    return true;
}


