  var UploadLayer = {
    show : function() {

      if (self.innerWidth) {
        frameWidth = self.innerWidth;
	frameHeight = self.innerHeight;
      }	else if (document.documentElement && document.documentElement.clientWidth) {
	frameWidth = document.documentElement.clientWidth;
	frameHeight = document.documentElement.clientHeight;
      } else if (document.body) {
	frameWidth = document.body.clientWidth;
	frameHeight = document.body.clientHeight;
      } else return;
       var size = getPageSize();
       var parent = getElem("page");
       var layer  = document.createElement("div");
       layer.innerHTML = "&nbsp;";
       layer.id = "layer";

       layer.className = "layer-background";
       layer.style.width  = size[0]+'px';
       layer.style.height = size[1]+'px';

       var panelWidth  = 350;
       var panelHeight = 45;
       var panel = document.createElement("div");
       panel.id = "layer-panel";
       panel.className = "layer-panel";
       panel.innerHTML = "<img src=\"http://www.zakulisi.cz/_face/loading2.gif\" alt=\"loading...\"/><div class=\"message\"><strong>Nahrávám soubor(y) na server</strong><br />Tento process může trvat několik minut. <br />Prosím nezavírejte okno.</div>";
       panel.style.left = ((frameWidth  / 2) - panelWidth  / 2) + 'px';
       panel.style.top  = ((frameHeight / 2) - panelHeight / 2) + 'px';
       panel.style.width  = panelWidth +'px';
       panel.style.height = panelHeight+'px';
       layer.appendChild(panel);

       insertChild(parent, layer);
    }
  }

window.onresize = function() {
  if (self.innerWidth) {
        frameWidth = self.innerWidth;
	frameHeight = self.innerHeight;
  }	else if (document.documentElement && document.documentElement.clientWidth) {
	frameWidth = document.documentElement.clientWidth;
	frameHeight = document.documentElement.clientHeight;
  } else if (document.body) {
	frameWidth = document.body.clientWidth;
	frameHeight = document.body.clientHeight;
  } else return;
  var panelWidth  = 350;
  var panelHeight = 45;
  var elm = getElem("layer-panel");
  if(elm){
       var size = getPageSize();
       elm.style.left = ((frameWidth  / 2) - panelWidth  / 2) + 'px';
       elm.style.top  = ((frameHeight / 2) - panelHeight / 2) + 'px';

       layer.style.width  = size[0]+'px';
       layer.style.height = size[1]+'px';

  }
}


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){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}