function windowOpenCenter(wndURL,wndTitle,nWidth,nHeight,wndOptions)
{
   var xMax = 640;
   var yMax = 460; 
   var cOptions, topPos, leftPos;

   if (document.all || document.layers) {
      xMax = screen.availWidth;
      yMax = screen.availHeight;
   }

   leftPos =  (xMax-nWidth )/2;
   topPos = (yMax-nHeight)/2;

   if (wndOptions.length > 0)
      cOptions = wndOptions+","
   else
      cOptions = "";
      
   cOptions+= "width="+nWidth+",height="+nHeight+",top="+topPos+",left="+leftPos;

   parent.openPopUpWin=window.open(wndURL,wndTitle,cOptions)
   if ( parent.openPopUpWin.opener == null)  parent.openPopUpWin.opener = self;

//   msgWindow.focus();
   
   return parent.openPopUpWin;
}

function windowExist( winHandle )
{
   if(winHandle) {
      if(winHandle.closed)
         return 0
      else
         return 1;
   } else 
      return 0;
}
