<!--
// All code was written by Ed Estes for use by Marc Levenson
// (c) 2008, Web Media Tools, LLC

img1 = new Image();
myObj = null;

function ClosePhoto() {
  onresize='';      // call rePos() whenever page is resized

  thePhoto = document.getElementById("bigPhoto");
  theDIV = document.getElementById("bigPhotoDIV");

  HideItem(theDIV);
  img1.src = thePhoto.src = thePhoto.name;
}

function LoadPhoto(theImage) {
  if (window.getSelection) { // FF, Safari, Chrome, Opera
    var sel = window.getSelection();
    sel.removeAllRanges();
  } else if (document.selection) { // IE
    document.selection.empty();
  }

  if(NN4) myObj=document.bigPhoto;
  else myObj=document.getElementById("bigPhoto").style;
  onresize=rePos      // call rePos() whenever page is resized
  theDIV = document.getElementById("bigPhotoDIV");
  thePhoto = document.getElementById("bigPhoto");
  ShowItem(theDIV);
  rePos();
  imageName = theImage.name;
  img1.onload = LoadPhotoDIV;
  img1.src = imageName;
}

function LoadPhotoDIV()
{
  popUpOpacity = 60
  popUp = document.getElementById("popUpDIV");
  popUp.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + popUpOpacity +")";
  popUp.style.MozOpacity = popUpOpacity / 100;
  popUp.style.opacity = popUpOpacity / 100;
  popUp.style.display = "";

  thePhoto = document.getElementById("bigPhoto");
  thePhoto.src = img1.src;

  thePhoto.className = "bigPhotoLoaded";
  if(NN4) myObj=document.bigPhoto
  else myObj=document.getElementById("bigPhoto").style
  rePos();

}

function ShowHideItem(theItem) {
  if (theItem != null) {
    if (document.getElementById) {
      if (theItem.style.visibility == 'hidden')
        theItem.style.visibility= 'visible';
      else
        theItem.style.visibility ='hidden';
    }
    else {// IE 4 & Netscape 4
      if (theItem.visibility == 'hidden')
        theItem.visibility='visible';
      else
        theItem.visibility='hidden';
    }
  }
}

function ShowItem(theItem) {
  if (theItem != null) {
    if (document.getElementById) {
      theItem.style.visibility= 'visible';
    }
    else {// IE 4 & Netscape 4
      theItem.visibility='visible';
    }
  }
}

function HideItem(theItem) {
  if (theItem != null) {
    if (document.getElementById) {
      theItem.style.visibility= 'hidden';
    }
    else {// IE 4 & Netscape 4
      theItem.visibility='hidden';
    }
  }
}


IE5=NN4=NN6=OPA=false
if(navigator.userAgent.toLowerCase().indexOf("opera")+1) OPA=true
else if(document.all)IE5=true
else if(document.layers)NN4=true
else if(document.getElementById)NN6=true

// Opera doesn't have an onresize event so you have to call rePos all the time.
if(OPA) setInterval("rePos()",500)

function rePos() {
  w=img1.width   // width of the image
  h=img1.height  // height of the image
  // compute center coordinate
  if(NN4||NN6) {
    xc=Math.round((window.innerWidth/2)-(w/2))
    yc=Math.round((window.innerHeight/2)-(h/2))
  } else {
    xc=Math.round((document.body.clientWidth/2)-(w/2))
    yc=Math.round((document.body.clientHeight/2)-(h/2))
  }
  // reposition image
  if(this.NN4) {
    myObj.moveTo(xc,yc)
  } else {
    myObj.left = xc + "px"
    myObj.top = yc + "px"
  }
}
