// get resolution of screen
function getSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [myWidth, myHeight];
} 

function popup_window(url,params,w,h)
{
   w = parseInt(w);
   h = parseInt(h);

   url = url+"?w=" + w + "&h=" + h;
   if(params)
      url += "&"+params;

   roz = getSize();
   l = (roz[0]-w)/2;
   t = (roz[1]-h)/2;
   window.open(url,'popup_window','toolbar=0,menubar=0,location=no,directories=no,scrollbars=1,resizable=0,status=no,left='+l+',top='+t+',width='+w+',height='+h);
   return false;
}

function popup_window2(url,params,w,h)
{
   w = parseInt(w);
   h = parseInt(h);

   url = url+"&w=" + w + "&h=" + h;
   if(params)
      url += "&"+params;

   roz = getSize();
   l = (roz[0]-w)/2;
   t = (roz[1]-h)/2;
   window.open(url,'popup_window2','toolbar=0,menubar=0,location=no,directories=no,scrollbars=1,resizable=0,status=no,left='+l+',top='+t+',width='+w+',height='+h);
   return false;
}
