// JavaScript Document
var IE = document.all?true:false;

function showFrameWindow(msg) 
{
  if(!document.getElementById('frameWindow'))
    initFrameWindow();

  if(IE)
  {
    var poz_y = (document.documentElement.scrollTop + 150) + 'px';
  }
  else 
  {
    var poz_y = (window.pageYOffset + 150) +'px';
  }

  var poz_x = ((document.body.clientWidth/2)-190) +'px';
  document.getElementById("frameWindow").style.left = poz_x;
  document.getElementById("frameWindow").style.top = poz_y;
  document.getElementById('frameWindow').style.display = "block";
  document.getElementById('frameWindowTxt').innerHTML = msg;
}

function HideFrameWindow() 
{
  document.getElementById('frameWindow').style.display = "none";
}

function SubmitFrameWindow()
{
  var form=document.FrameWindowSubmitForm;
  setFramed(form.elements[0].value,form.elements[1].value,'frame');
  HideFrameWindow();
}

function initFrameWindow()
{
//  var windowBox='<div id="SystemMessage"><div id="SystemMessageTxt"></div><div id="SystemMessageClose"><a href="javascript:HideMessage()">zamknij</a></div></div>';

  var body=document.body;
  var div=document.createElement('div');
  div.id='frameWindow';
  body.appendChild(div);
  var smt=document.createElement('div');
  smt.id='frameWindowTxt';
  div.appendChild(smt);
  var form=document.createElement('form');
  form.name='FrameWindowSubmitForm';
  div.appendChild(form);
  var inputDiv1=document.createElement('div');
  inputDiv1.className='input';
  inputDiv1.innerHTML='szerokość: ';
  var input1=document.createElement('input');
  input1.type='text';
  input1.name='width';
  inputDiv1.appendChild(input1);
  form.appendChild(inputDiv1);
  var inputDiv2=document.createElement('div');
  inputDiv2.className='input';
  inputDiv2.innerHTML='wysokość: ';
  var input2=document.createElement('input');
  input2.type='text';
  input2.name='height';
  inputDiv2.appendChild(input2);
  form.appendChild(inputDiv2);
  var submit=document.createElement('a');
  submit.innerHTML='wybierz';
  submit.className='SubmitFrameWindow';
  submit.href='javascript:SubmitFrameWindow()';
  div.appendChild(submit);
  var smc=document.createElement('div');
  smc.id='frameWindowClose';
  div.appendChild(smc);
  var close=document.createElement('a');
  close.href='javascript:HideFrameWindow()';
  close.innerHTML='zamknij';
  smc.appendChild(close);
  
//  document.getElementsByTagName('body')[0].innerHTML+=windowBox;
}

