<!--
  //=================
  // ResidentPages.js
  //=================

  var timer = null;
  var leftPos = 0;
  var maxMove = 10;
  var curDiv = "";
  var curImg = "";
  var curMove = 0;
  var j;

  usingIE = navigator.userAgent.indexOf("MSIE") > -1;
  usingGecko = navigator.userAgent.indexOf("Gecko") > -1;

  function startMove(curImgSelect){
    var i;

    if (timer==null){
      curMove = 0;
      curDiv = "pgDiv" + curImgSelect;
      curImg = "pgImg" + curImgSelect;

      timer=window.setInterval("movePhoto()",10);
      for (var i=0; i<document.images.length; i++) {
        j = document.images[i].src.indexOf("-t.jpg");
        if (j > 1) { 
          if (document.images[i].src.substr(j-2,2) != curImgSelect) { 
            document.images[i].src = document.images[i].src.substr(0,j) + "-f.jpg";
          }
        }
      }
    }
    return false;
  }

  function endMove(){
    if (timer!=null){
      window.clearInterval(timer);
      timer=null;
    }
    return false;
  }

  function movePhoto() {
    if (usingIE) {
      document.all[curDiv].style.left = leftPos++;
      document.all[curDiv].style.top = leftPos++;
    } else {
      document.getElementById(curDiv).style.left = leftPos++;
      document.getElementById(curDiv).style.top = leftPos++;
    }
    if (leftPos >= maxMove) {
      endMove();
    }
  }

  function restorePhotoPosition() {
    endMove();
    leftPos = 0;
    if (usingIE) {
      document.all[curDiv].style.left = 0;
      document.all[curDiv].style.top = 0;
    } else {
      document.getElementById(curDiv).style.left = 0;
      document.getElementById(curDiv).style.top = 0;
    }
    for (var i=0; i<document.images.length; i++) {
      j = document.images[i].src.indexOf("-f.jpg");
      if (j > 1) { 
        document.images[i].src = document.images[i].src.substr(0,j) + "-t.jpg";
      }
    }
  }

  function selectPhoto(selPhoto){
    document.images["pgImg00"].src = "pg" + selPhoto + "-s.jpg";
    if (usingIE) {
      document.all["pgCaption"].innerHTML = document.images[curImg].title;
    } else {
      document.getElementById("pgCaption").innerHTML = document.images[curImg].title;
    }
  }

// -->  

