// Javasrcipt Document
var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}

var statusDiv;
var imgPath;

var statusContent = "<table border='0' cellpadding='0' cellspacing='0' style='width:456px;height:205px;padding:5px 5px 5px 5px; background-color:#ccc; vertical-align:middle;' align='center'><tr><td align='center'><img src='http://www.peterfayandsons.com/pano/loader.gif' id='loader' align='middle'><br>loading panorama image...</td></tr></table></table>";

function panoload(id) {
  http.abort();
  var statusDiv = document.getElementById('pano');
  http.open("GET", "http://"+ window.location.host +"/pano/pano.php?id=" + id, true);
  http.onreadystatechange=function() {
    if (http.readyState == 1){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 2){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 3){ statusDiv.innerHTML = statusContent; }
	if(http.readyState == 4) {
      document.getElementById('pano').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

function panoload3(id) {
  var imgPath = "http://"+ window.location.host +"/pano/h3_plan/images/";
  if (id == 2) { 
  document.getElementById('h3_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot2').src = imgPath + "pulse.gif"; 
  document.getElementById('h3_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot4').src = imgPath + "spacer.gif";
  }
  if (id == 3) { 
  document.getElementById('h3_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot3').src = imgPath + "pulse.gif";
  document.getElementById('h3_spot4').src = imgPath + "spacer.gif";
  }
  if (id == 4) { 
  document.getElementById('h3_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot4').src = imgPath + "pulse.gif";
  }
  http.abort();
  var statusDiv = document.getElementById('pano');
  http.open("GET", "http://"+ window.location.host +"/pano/pano.php?id=h3" + id, true);
  http.onreadystatechange=function() {
    if (http.readyState == 1){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 2){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 3){ statusDiv.innerHTML = statusContent; }
	if(http.readyState == 4) {
      document.getElementById('pano').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

function panoload32(fname) {
	http.abort();
	if (fname == "h3_plan") {
	var hid = 3;
	var fnameid = 2;
	var spotid = 2;
	}
	if (fname == "h3_hplan") {
	var hid = 3;
	var fnameid = 6;
	var spotid = 6;
	}
	if (fname == "h1_hplan") {
	var hid = 1;
	var fnameid = 5;
	var spotid = 5;
	}
	if (fname == "h2_hplan") {
	var hid = 2;
	var fnameid = 1;
	var spotid = 1;
	}
  var statusDiv = document.getElementById('pano');
  http.open("GET", "http://"+ window.location.host +"/pano/pano.php?id=h" + hid+fnameid, true);
  http.onreadystatechange=function() {
    if (http.readyState == 1){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 2){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 3){ statusDiv.innerHTML = statusContent; }
	if(http.readyState == 4) {
      document.getElementById('pano').innerHTML = http.responseText;
	  document.getElementById('h' + hid +'_spot' + spotid).src = "http://www.peterfayandsons.com/pano/h3_plan/images/pulse.gif";
    }
  }
  http.send(null);
}

function siteplan(fname) {
  http.abort();
  http.open("GET", "http://"+ window.location.host +"/pano/" + fname + "/" + fname +".htm", true);
  http.onreadystatechange=function() {
	if(http.readyState == 4) {
      document.getElementById('panoPlan').innerHTML = http.responseText;
	  panoload32(fname);
    }
  }
  http.send(null);
  
}

function panoload3h(id) {
  var imgPath = "http://"+ window.location.host +"/pano/h3_hplan/images/";
  if (id == 5) { 
  document.getElementById('h3_spot5').src = imgPath + "pulse.gif";
  document.getElementById('h3_spot6').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot7').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot8').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot9').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot10').src = imgPath + "spacer.gif";
  }
  if (id == 6) { 
  document.getElementById('h3_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot6').src = imgPath + "pulse.gif"; 
  document.getElementById('h3_spot7').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot8').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot9').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot10').src = imgPath + "spacer.gif";
  }
  if (id == 7) { 
  document.getElementById('h3_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot6').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot7').src = imgPath + "pulse.gif";
  document.getElementById('h3_spot8').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot9').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot10').src = imgPath + "spacer.gif";
  }
  if (id == 8) { 
  document.getElementById('h3_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot6').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot7').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot8').src = imgPath + "pulse.gif";
  document.getElementById('h3_spot9').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot10').src = imgPath + "spacer.gif";
  }
  if (id == 9) { 
  document.getElementById('h3_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot6').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot7').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot8').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot9').src = imgPath + "pulse.gif";
  document.getElementById('h3_spot10').src = imgPath + "spacer.gif";
  }
  if (id == 10) { 
  document.getElementById('h3_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot6').src = imgPath + "spacer.gif"; 
  document.getElementById('h3_spot7').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot8').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot9').src = imgPath + "spacer.gif";
  document.getElementById('h3_spot10').src = imgPath + "pulse.gif";
  }
  http.abort();
  var statusDiv = document.getElementById('pano');
  http.open("GET", "http://"+ window.location.host +"/pano/pano.php?id=h3" + id, true);
  http.onreadystatechange=function() {
    if (http.readyState == 1){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 2){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 3){ statusDiv.innerHTML = statusContent; }
	if(http.readyState == 4) {
      document.getElementById('pano').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

function panoload1h(id) {
  var imgPath = "http://"+ window.location.host +"/pano/h1_hplan/images/";
  if (id == 1) { 
  document.getElementById('h1_spot1').src = imgPath + "pulse.gif";
  document.getElementById('h1_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h1_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot4').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot6').src = imgPath + "spacer.gif";
  }
  if (id == 2) { 
  document.getElementById('h1_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot2').src = imgPath + "pulse.gif"; 
  document.getElementById('h1_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot4').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot6').src = imgPath + "spacer.gif";
  }
  if (id == 3) { 
  document.getElementById('h1_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h1_spot3').src = imgPath + "pulse.gif";
  document.getElementById('h1_spot4').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot6').src = imgPath + "spacer.gif";
  }
  if (id == 4) { 
  document.getElementById('h1_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h1_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot4').src = imgPath + "pulse.gif";
  document.getElementById('h1_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot6').src = imgPath + "spacer.gif";
  }
  if (id == 5) { 
  document.getElementById('h1_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h1_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot4').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot5').src = imgPath + "pulse.gif";
  document.getElementById('h1_spot6').src = imgPath + "spacer.gif";
  }
  if (id == 6) { 
  document.getElementById('h1_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h1_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot4').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot5').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot6').src = imgPath + "pulse.gif";
  }
  http.abort();
  var statusDiv = document.getElementById('pano');
  http.open("GET", "http://"+ window.location.host +"/pano/pano.php?id=h1" + id, true);
  http.onreadystatechange=function() {
    if (http.readyState == 1){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 2){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 3){ statusDiv.innerHTML = statusContent; }
	if(http.readyState == 4) {
      document.getElementById('pano').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

function panoload2h(id) {
  var imgPath = "http://"+ window.location.host +"/pano/h2_hplan/images/";
  if (id == 1) { 
  document.getElementById('h2_spot1').src = imgPath + "pulse.gif";
  document.getElementById('h2_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h2_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h1_spot4').src = imgPath + "spacer.gif";
  }
  if (id == 2) { 
  document.getElementById('h2_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h2_spot2').src = imgPath + "pulse.gif"; 
  document.getElementById('h2_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h2_spot4').src = imgPath + "spacer.gif";
  }
  if (id == 3) { 
  document.getElementById('h2_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h2_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h2_spot3').src = imgPath + "pulse.gif";
  document.getElementById('h2_spot4').src = imgPath + "spacer.gif";
  }
  if (id == 4) { 
  document.getElementById('h2_spot1').src = imgPath + "spacer.gif";
  document.getElementById('h2_spot2').src = imgPath + "spacer.gif"; 
  document.getElementById('h2_spot3').src = imgPath + "spacer.gif";
  document.getElementById('h2_spot4').src = imgPath + "pulse.gif";
  }
  http.abort();
  var statusDiv = document.getElementById('pano');
  http.open("GET", "http://"+ window.location.host +"/pano/pano.php?id=h2" + id, true);
  http.onreadystatechange=function() {
    if (http.readyState == 1){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 2){ statusDiv.innerHTML = statusContent; }
  	if (http.readyState == 3){ statusDiv.innerHTML = statusContent; }
	if(http.readyState == 4) {
      document.getElementById('pano').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
