function popup(url, wname, width, height, top, left, scr){
  if (scr == 1) scr = 'yes';
  else scr = 'no';
  reWin=window.open(url,wname,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scr + ',resizable=yes,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left);
}
//function ResizeToImage(img_id)
//{
//     var ImgObj=document.getElementById(img_id);
//     if(parseInt(navigator.appVersion) > 3)
//     {
//          w = ImgObj.width;
//          h = ImgObj.height;
//          // for UNIX or Linux
//          if (navigator.appVersion.indexOf("X11")!=-1 || navigator.appVersion.indexOf("Linux")!=-1)
//          {
//               if(navigator.appName == "Netscape")
//               {
//                    window.outerWidth=w+3;
//                    window.outerHeight=h+5;
//               }
//               else if(navigator.appName == "Konqueror")
//               {
//                    window.resizeTo(w+15, h+35);
//               }
//               else
//                    window.resizeTo(w+10, h+26);
//          }
//          // for Windows and other
//          else
//          {
//               if(navigator.appName == "Netscape")
//               {
//                    window.outerWidth=w+6;
//                    window.outerHeight=h+36;
//               }
//               else
//                    window.resizeTo(w+10, h+29);
//          }
//     }
//}

function ResizeToImage(img_id)
{
    var imageObj = document.getElementById(img_id);
    var imageHeight = imageObj.height;
    var imageWidth = imageObj.width;

    window.resizeTo(imageWidth + 200, imageHeight + 200);
    var newWidth = 0;
    var newHeight = 0;
    // jezeli Opera, Mozilla, Safari, Netscape
    if(window.innerWidth) {
        newWidth = window.innerWidth;
        newHeight = window.innerHeight;
    }
    //jezeli IE 6+
    else if(window.document.documentElement && window.document.documentElement.clientWidth) {
        newWidth = window.document.documentElement.clientWidth;
        newHeight = window.document.documentElement.clientHeight;
    }
    //jezeli IE 4
    else if(window.document.body && window.document.body.clientWidth) {
        newWidth = window.document.body.clientWidth;
        newHeight = window.document.body.clientHeight;
    }
    if(window.opera && !document.childNodes) {
        newWidth += 16;
    }
    window.resizeTo(imageWidth + ((imageWidth + 200) - newWidth), imageHeight + ((imageHeight + 200) - newHeight));
}
