function OpenPano(url) {
  var owidth=350;
  var oheight=300;
  var otop=100;
  var oleft=100;
  if (screen.width) swidth=screen.width;
  if (screen.height) sheight=screen.height;
  if (swidth && sheight) {
    oleft=Math.round((swidth-owidth)/3);
    otop=Math.round((sheight-oheight)/3);
  }
  window.open(url,'panowin','width='+owidth+',height='+oheight+',top='+otop+',left='+oleft+',directories=0,location=0,menubar=0,personalbar=0,scrollbars=0,status=0,toolbar=0');
}

function detectUA() {
  var ua = navigator.userAgent.toLowerCase();

  this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
  this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

  this.isKonqueror   = (ua.indexOf('konqueror') != -1);
  this.isSafari      = (ua.indexOf('safari') != - 1);
  this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
  this.isOpera       = (ua.indexOf('opera') != -1);
  this.isIcab        = (ua.indexOf('icab') != -1);
  this.isAol         = (ua.indexOf('aol') != -1);
  this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) );
  this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
  this.isFirebird    = (ua.indexOf('firebird/') != -1);
  this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
}

var ua = new detectUA();
var pt = null;

function panoPlay() {
  if (!pt) pt = document.getElementById("ptviewer");
  if (pt) pt.startAutoPan(0.5,0.0,1.0);
}

function panoStop() {
  if (!pt) pt = document.getElementById("ptviewer");
  if (pt) pt.stopAutoPan();
}

function panoZoomP() {
  if (!pt) pt = document.getElementById("ptviewer");
  if (pt) pt.ZoomIn();
}

function panoZoomM() {
  if (!pt) pt = document.getElementById("ptviewer");
  if (pt) pt.ZoomOut();
}

function panoReset(pano_pan) {
  if (!pt) pt = document.getElementById("ptviewer");
  var pan=parseInt(pano_pan);
  if (isNaN(pan)) {
    pt.gotoView(0,0,85);
  } else {
    pt.gotoView(pan,0,85);
  }
}

