
function overdiv_message_destroy(){



   document.body.removeChild(document.getElementById('overdiv_message'));
   document.body.removeChild(document.getElementById('overdiv_underlay'));
}





function display_overdiv_message(text,width,height,background,border,font,style_class) {


var IE = document.all ? true : false;


if (IE){var winWidth = window.document.body.offsetWidth;winHeight = window.document.body.offsetHeight;}else{winWidth = window.innerWidth;winHeight = window.innerHeight;}

var Scroll = document.documentElement.scrollTop;if (Scroll == 0) var Scroll = document.body.scrollTop;

pH = (winWidth-width)/2;
pV = ((winHeight-height)/2)+(Scroll+height);
pV -= height;
pV -= 5;

text = '<p style="text-align:right; margin:0;padding:0;color:'+((font == "") ? "black" : font)+'"><a href="javascript:void(overdiv_message_destroy())">(zamknij)</a></p>'+text;


   var dis = document.getElementById('overdiv_message');

   if (!dis)
   {

      var underlay = document.createElement('div');
      underlay.id = 'overdiv_underlay';
      underlay.style.position = 'absolute';
      underlay.style.backgroundColor = '#000';
      underlay.style.zIndex = 100;
      underlay.style.left = 0;
      underlay.style.top = 0;
      underlay.style.width = 100+'%';
      underlay.style.opacity = 25/100;
	
      underlay.setAttribute('onclick', 'overdiv_message_destroy()');

      
      var body = document.body,html = document.documentElement;
      var theight = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
      underlay.style.height = theight+'px';
      document.body.appendChild(underlay);



      

      var dis = document.createElement('div');
      dis.id = 'overdiv_message';
      dis.style.left = pH+'px';
      dis.style.top = pV+'px';
      dis.style.position = 'absolute';
      dis.innerHTML = text;
      dis.style.overflow = 'auto';
      dis.style.zIndex = 100000;


      document.body.appendChild(dis);

   }
   else
   {
      dis.style.left = pH+'px';
      dis.style.top = pV+'px';
      dis.innerHTML = text;
   }
   if (style_class != '')
      dis.className = style_class;
   else
      dis.className = null;

   if (width != '')
      dis.style.width = width+'px';
   else
      dis.style.width = null;
   if (height != '')
      dis.style.height = height+'px';
   else
      dis.style.height = null;
   if (background != '')
      dis.style.background = background;
   else
      dis.style.background = null;
   if (border != '')
      dis.style.border = '1px solid '+border;
   else
      dis.style.border = null;
   if (font != '')
      dis.style.color = font;
   else
      dis.style.color = null;
   if (text == '')
      dis.style.display = 'none';
   else
      dis.style.display = 'block';


}

