//-----------------------------------------------------------------------------
function show_hotspots() {

  if (!hotspot_list || hotspot_list.length == 0) {
    return;
  }

  var ivp = document.getElementById('ivp');

  if (hotspot_tour && hotspot_tour.length == 3) {
    var tour = document.createElement('img');
    var style = 'position:absolute;z-index:10;opacity:' + hotspot_tour[2] +
      ';filter:alpha(opacity=' + (hotspot_tour[2] * 100) + ')' +
      ';left:' + hotspot_tour[0] + 'px;top:' + hotspot_tour[1] + 'px';

    tour.setAttribute('style', style);
    tour.setAttribute('src', glob_pano_dir + '/tour.png');
    tour.setAttribute('border', '0');
    tour.setAttribute('alt', '');
    tour.setAttribute('title', '');

    if (!tour.style.position) {
      // IE is pure shit
      tour.style.setAttribute('cssText', style);
    }

    ivp.appendChild(tour);
  }

  for (var i = 0; i < hotspot_list.length; i++) {
    var xyf = hotspot_list[i];

    if (xyf.length < 3) {
      continue;
    }

    var link = document.createElement('a');
    link.setAttribute('href', "javascript:show_pano('" + xyf[2] + "')");

    if (xyf.length == 4) {
      link.setAttribute('title', xyf[3]);
    }

    var img = document.createElement('img');
    var style = 'position:absolute;z-index:20;left:' + xyf[0] + 'px;top:' + xyf[1] + 'px';
    img.setAttribute('style', style);
    img.setAttribute('src', glob_pano_dir + '/inactive' + glob_pano_icon_suffix);
    img.setAttribute('border', '0');
    img.setAttribute('title', '');
    img.setAttribute('alt', '');
    img.setAttribute('id', 'h_' + xyf[0] + '_' + xyf[1]);

    if (!img.style.position) {
      // IE is pure shit
      img.style.setAttribute('cssText', style);
    }

    link.appendChild(img);
    ivp.appendChild(link);
  }
}


//-----------------------------------------------------------------------------
function show_active(x, y) {

  var hotspot = document.getElementById('h_' + x + '_' + y);
  hotspot.src = glob_pano_dir + '/active' + glob_pano_icon_suffix;

  var box = document.getElementById('box_' + x + '_' + y);
  if (box) {
    box.style.display = 'block';
  }
}


//-----------------------------------------------------------------------------
function show_pano(file) {
  document.PurePlayer.loadpano(glob_pano_dir + '/' + file, false);
 
  for (var i = 0; i < hotspot_list.length; i++) {
    var xyf = hotspot_list[i];

    document.getElementById('h_' + xyf[0] + '_' + xyf[1]).src = glob_pano_dir + '/inactive' + 
      glob_pano_icon_suffix;

    var box = document.getElementById('box_' + xyf[0] + '_' + xyf[1]);
    if (box) {
      box.style.display = 'none';
    }

    if (xyf[2] == file) {
      show_active(xyf[0], xyf[1]);
    }
  }
}

