var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1)
              && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera') == -1)
              && (agt.indexOf('webtv') == -1));
var is_nav3up = (is_nav && (is_major >= 3));
var is_ie = (agt.indexOf('msie') != -1);
var is_ie4up = (is_ie && (is_major >= 4));
var hoverok = (is_nav3up || is_ie4up);

function makeApplet() {
if (navigator.javaEnabled()) {
 document.write('<applet width=\"' + awidth + '\" height=\"' + aheight + '\" name=\"ptviewer\" archive=\"' + alocation + 'ptviewer.jar\" code=\"ptviewer.class\" mayscript=\"true\">');
 document.write('<param name=\"wait\" value=\"' + await + '\">');
 document.write('<param name=\"bar_x\" value=\"' + bar_x + '\">');
 document.write('<param name=\"bar_y\" value=\"' + bar_y + '\">');
 document.write('<param name=\"bar_width\" value=\"' + bar_width + '\">');
 document.write('<param name=\"bar_height\" value=\"' + bar_height + '\">');
 document.write('<param name=\"barcolor\" value=\"' + barcolor + '\">');
 document.write('<param name=\"bgcolor\" value=\"' + abgcolor + '\">');
 document.write('<param name=\"file\" value=\"' + pfile + '\">');
 document.write('<param name=\"pan\" value=\"' + ppan + '">');
 document.write('<param name=\"tilt\" value=\"' + ptilt + '\">');
 document.write('<param name=\"fov\" value=\"' + pfov + '\">');
 document.write('<param name=\"fovmax\" value=\"' + pfovmax + '\">');
 document.write('<param name=\"fovmin\" value=\"' + pfovmin + '\">');
 document.write('<param name=\"tiltmin\" value=\"' + ptiltmin + '\">');
 document.write('<param name=\"tiltmax\" value=\"' + ptiltmax + '\">');
 document.write('<param name=\"auto\" value=\"0.2\">');
 if ((panmin != '') && (panmax != '')) {
  document.write('<param name=\"panmin\" value=\"' + panmin + '\">');
  document.write('<param name=\"panmax\" value=\"' + panmax + '\">');
 }
 for (j = 0;j < numhs;j++) {
  nurl = eval('newPano[' + (j+1) + ']');
  hsx = eval('xList[' + (j+1) + ']');
  hsy = eval('yList[' + (j+1) + ']');
  if (nurl == '') {
   document.write('<PARAM name=\"hotspot' + j + '\" value=\" x' + hsx + ' y' + hsy + ' u\'javascript:showDescr(' + (j+1) + ')\' \">');
  } else {
   document.write('<PARAM name=\"hotspot' + j + '\" value=\" x' + hsx + ' y' + hsy + ' u\'' + nurl + '\' \">');
  }
 }
document.write('<param name=\"inits\"	value=\"ptviewer:hideHS()\">');
 document.write('</applet>');
} else {
 document.location = "pvdiag.html";
}
}

function makeHSlist() {
 if (numhs > 0) {
  HStext = '';
  HStext += '<table border="0" cellspacing="2" cellpadding="0">\n';
  for (j = 0;j < numhs;j++) {
   curHS = j + 1;
   HStext += '<tr valign="baseline"><td>';
   HSlink = '<a href="javascript:changeView('
   b = "" + curHS;  
   HSlink += b;
   HSlink += ')" onMouseOver="window.status=\'\';return true"">';
   b = eval('nameList[' + curHS + ']');
   HSname = '<b>' + b + '</b>';
   HStext += HSlink;
   HStext += '<img src="img/hs.gif" width="11" height="11" alt="" border="0"></a>&nbsp;</td><td>';
   HStext += HSlink;
   HStext += HSname;
   HStext += '</a></td></tr>\n';
  }
  HStext += '</table>\n';
  document.write(HStext);
 }
}

function makeLink(hspos) {
 document.write('<a href=\"javascript:changeView(' + hspos + ')\"><b>');
 a = eval('nameList[' + hspos + ']');
 document.write(a);
 document.write('</b></a>');
}

function hoverbt(imName, over) {
 if (hoverok) {
  var theImage = FindImage(document, imName, 0);
  if (theImage) {
  	imHL = imName + "_1";
   imBL = imName + "_0";
  	theImage.src = "img/" + (over ? imHL : imBL) + ".gif";
  }
 }
}

function FindImage(doc, name, j) {
 var theImage = false;
 if (doc.images) {
  theImage = doc.images[name];
 }
 if (theImage) {
  return theImage;
 }
 if (doc.layers) {
  for (j = 0; j < doc.layers.length; j++) {
   theImage = FWFindImage(doc.layers[j].document, name, 0);
   if (theImage) {
    return (theImage);
   }
  }
 }
 return (false);
}

function DoPanLeft() {
 if (document.ptviewer.getAutoPan()) {
  document.ptviewer.stopAutoPan();
 }
 document.ptviewer.PanLeft();
}
function DoPanRight() {
 if (document.ptviewer.getAutoPan()) {
  document.ptviewer.stopAutoPan();
 }
 document.ptviewer.PanRight();
}
function DoTiltUp() {
 if (document.ptviewer.getAutoPan()) {
  document.ptviewer.stopAutoPan();
 }
 document.ptviewer.PanUp();
}
function DoTiltDown() {
 if (document.ptviewer.getAutoPan()) {
  document.ptviewer.stopAutoPan();
 }
 document.ptviewer.PanDown();
}
function DoZoomIn() {
 if (document.ptviewer.getAutoPan()) {
  document.ptviewer.stopAutoPan();
 }
 document.ptviewer.startAutoPan(0.0,0.0,1.0/1.05);
}
function DoZoomOut() {
 if (document.ptviewer.getAutoPan()) {
  document.ptviewer.stopAutoPan();
 }
 document.ptviewer.startAutoPan(0.0,0.0,1.05);
}
function DoShowHideHotspots() {
	document.ptviewer.toggleHS();
}
function DoReset() {
	document.ptviewer.gotoView(0,0,80);
}

function changeView(poshs) {
 nurl = eval('newPano[' + poshs + ']');
 if (nurl != '') {
  window.location = nurl;
 } else {
  npan = eval('panList[' + poshs + ']');
  ntilt = eval('tiltList[' + poshs + ']');
  nfov = eval('fovList[' + poshs + ']');
  document.ptviewer.moveTo(npan,ntilt,nfov,25);
  showDescr(poshs);
 }
}

var dofade=true;
var centertext=false;

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var descr;
var isloaded=false;
var ieop=0;
var op_id=0;

function do_nothing(){
}

function showindiv(text){
if(NS4){
descr.document.open();
descr.document.write(text);
descr.document.close();
}
if(W3C||IE4)descr.innerHTML=text;
}

//**** END UTILITY FUNCTIONS ****//

function showDescr(hsnum){
if(isloaded){
if(hsnum!=0){
text='<img src="img/_yl.gif" width="180" height="7" alt=""><br><b>' + descrList[hsnum] + '</b>';
if(NS4)text='<div class="hsDescr">'+((centertext)?'<center>':'')+text+((centertext)?'</center>':'')+'</div>';
showindiv(text);
if(NS4)descr.visibility="show";
if(W3C||IE4)descr.style.visibility="visible";
if((W3C || IE4) && dofade){
ieop=0;
incropacity();
}}else{
if(NS4)descr.visibility="hide";
if(IE4||W3C){
if(dofade)clearTimeout(op_id);
descr.style.visibility="hidden";
}
showindiv('');
}}}

function incropacity(){
if(ieop<=100){
ieop+=10;
if(IE4 || IE5)descr.style.filter="alpha(opacity="+ieop+")";
if(NS6)descr.style.MozOpacity=ieop/100;
op_id=setTimeout('incropacity()', 50);
}}

window.onload=function(){
  descr=(NS4)? document.layers['descr'] : (IE4)? document.all['descr'] : (W3C)? document.getElementById('descr') : null;
  isloaded=true;
  if((W3C || IE4) && centertext)descr.style.textAlign="center";
  if(IE4 || IE5 && dofade)descr.style.filter="alpha(opacity=0)";
  }

