function drawAlertWindow(w, h) {
  if(!w) {w=350;} if(!h) {h=50;}
  var marginLeft=-Math.round(w/2); var marginTop=-Math.round(h/2);
  var buttonsHeight=20;

  var aWindow=document.createElement('div');
  aWindow.id='mAlertWindow';
  aWindow.className='aWindow';
  aWindow.style.width=w+'px';
  aWindow.style.height=h+'px';
  aWindow.style.marginLeft=marginLeft+'px';
  aWindow.style.marginTop=marginTop+'px';
  
  var aContent=document.createElement('div');
  aContent.id='mAlertWindowContent';
  aContent.style.height=(h-buttonsHeight)+'px';
  
  var aButtons=document.createElement('div');
  aButtons.className="aButtons";
  aButtons.style.height=buttonsHeight+'px';
  
  var okButton=document.createElement('input');
  okButton.className='btn';
  okButton.type='button';
  okButton.value='ok';
  okButton.style.width='90px';
  okButton.onclick=function() {var aWindow=document.getElementById('mAlertWindow'); aWindow.parentNode.removeChild(aWindow);};
  
  aButtons.appendChild(okButton);
  aWindow.appendChild(aContent);
  aWindow.appendChild(aButtons);
  document.body.appendChild(aWindow);
  
  return(aContent);
}

function mAlert(s, w, h) {
  aWindow=document.getElementById('mAlertWindow');
  if(aWindow) {aContent=document.getElementById('mAlertWindowContent');} else {aContent=drawAlertWindow(w, h);}
  aContent.innerHTML=s;
}

function mWindow(page, params, w, h) {
  var mAjax = new Ajax(page);
  mAjax.addParams('params', params);
  mAlert('', w, h);
  mAjax.send();
}

function mWindowCB(data) {mAlert(data);}
