function openNewWindow(aName, aPath, aWidth, aHeight) {
  popupWin = window.open(aPath, aName, "scrollbars=1,width=" + aWidth + ",height=" + aHeight + ",top=0,resizable=true");
  popupWin.focus(); // передаём фокус новому окну
}

function getBrowserInfo() {
  var t,v = undefined;

  if (window.sidebar) {  
    t = 'Mozilla';
  } else if (window.opera) {
    t = 'Opera';
  } else if (document.all) {
    t = 'IE';
    var nv = navigator.appVersion;
    var s = nv.indexOf('MSIE') + 5;
    v = nv.substring(s, s + 1);
  } else if (navigator.appName) 
    t = 'Netscape';
  return {type:t, version:v};
}
 
function AddBookmark(a){
  var url = window.document.location;
  var title = window.document.title;
  var b = getBrowserInfo();

  if (b.type == 'IE' && 7 > b.version && b.version >= 4) 
    window.external.AddFavorite(url,title);
  else if (b.type == 'Opera') {
    a.href = url;
    a.rel = "sidebar";
    a.title = url + ',' + title;
    return true;
  } else if ((b.type == "Netscape") || (b.type == "Mozilla")) {
    window.sidebar.addPanel(title, url, "");
  } else {
    alert("Press CTRL-D to add a page to the bookmarks.");
  }

  return false;
}

function openPanorama(aSightID, aWidth, aHeight) {
  if (aWidth == undefined) {
    aWidth = 800;
  }
  if (aHeight == undefined) {
    aHeight = 650;
  }

  vWindow = window.open("/data/pages/panorama.php?id=" + aSightID + "&w=" + aWidth + "&h=" + aHeight, "Panorama_" + aSightID, "width=" + aWidth + ",height=" + aHeight + ",resizable=false");
  if (vWindow != undefined) {
    vWindow.focus();
  }
  return false;
}

function openHiDefPanorama(anObjID, aWidth, aHeight) {
  if (aWidth == undefined) {
    aWidth = 900; // 640
  }
  if (aHeight == undefined) {
    aHeight = 650; // 550
  }

  vWindow = window.open("/data/pages/hidef_panorama.php?id=" + anObjID + "&w=" + aWidth + "&h=" + aHeight, "HiDefPanorama_" + anObjID, "width=" + aWidth + ",height=" + aHeight + ",resizable=false");
  if (vWindow != undefined) {
    vWindow.focus();
  }
  return false;
}
