function openImage(Link, Image,Size) {
   photoDims = get_size(Size);
// Get the browser size
 
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    winW = window.innerWidth;
    winH = window.innerHeight;
    scrH = window.pageXOffset;
    scrV = window.pageYOffset;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    winW = document.documentElement.clientWidth;
    winH = document.documentElement.clientHeight;
    scrH = document.documentElement.scrollLeft;
    scrV = document.documentElement.scrollTop;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    winW = document.body.clientWidth;
    winH = document.body.clientHeight;
    scrH = document.body.scrollLeft;
    scrV = document.body.scrollTop;
  }

   if(winW/(photoDims[0]+100) > winH/(photoDims[1]+100)) {
      newPhotoH = Math.min(winH-100, photoDims[1]);
      newPhotoW = Math.min(photoDims[0], photoDims[0] *  (newPhotoH/(photoDims[1])) );
//      alert("Case Height Limit: Screen: "+ winW + "*" + winH + " Photo: " + Size + " New size: " + newPhotoW + "*" + newPhotoH);
   } else {
      newPhotoW = Math.min(winW-100, photoDims[0]);
      newPhotoH = Math.min(photoDims[1], photoDims[1] * (newPhotoW/(photoDims[0])) );
//      alert("Case Width Limit: Screen: "+ winW + "*" + winH + " Photo: " + Size + " New size: " + newPhotoW + "*" + newPhotoH);
   }
   divH = newPhotoH+100;
   divW = newPhotoW+100;
   divTop  = winH/2 - divH/2 + scrV;
   divLeft = winW/2 - divW/2;
//   alert("Screen: "+ winW + "*" + winH + " Div: " + divW + "*" + divH +" divLeft: " + divLeft + " New size: " + newPhotoW + "*" + newPhotoH);

// Create the blackout if needed
   if((blackout = document.getElementById('blackout')) == null) {
      blackout = document.createElement('div');
      blackout.setAttribute('id','blackout');
      document.body.appendChild(blackout);
   }
// Set the attributes 
   blackout.style.display='block';
   blackout.style.width = '100%';
   blackout.style.height = '100%';
   blackout.style.zIndex = '5';
   blackout.style.backgroundColor = '#010101';
   blackout.style.opacity = '0.7';
   blackout.style.position = 'absolute';
   blackout.style.top = '' + scrV + 'px';
   blackout.style.left = '0px';

// Create the DIV for the photo if needed
   if((photoDiv = document.getElementById('map_photo')) == null) {
      photoDiv = document.createElement('div');
      photoDiv.setAttribute('id','map_photo');
      document.body.appendChild(photoDiv);
   }
// Set the attributes e.g. position
   var title = Link.getAttribute('title');
   photoDiv.innerHTML = "<p>" + title + "</p><p>Click on the image to close</p><img Height='" + newPhotoH + "' Width='" + newPhotoW + "' ID='map_photo' SRC='" + Image + "' onmousedown='hidephoto();'>";
   photoDiv.style.position = 'absolute';
   photoDiv.style.zIndex = '10';
   photoDiv.style.backgroundColor = 'white';
   photoDiv.style.top = '' + divTop + 'px';
   photoDiv.style.left = '' + divLeft + 'px';
   photoDiv.style.width = '' + divW + 'px';
   photoDiv.style.height = '' + divH + 'px';
   photoDiv.style.display = 'block';
// Set attributes of the title and instruction
   photoDiv.childNodes[0].style.textAlign = 'center';
   photoDiv.childNodes[0].style.fontWeight = 'bold';
   photoDiv.childNodes[0].style.padding = '15px 0px 0px 0px';
   photoDiv.childNodes[0].style.margin = '0px';
   photoDiv.childNodes[0].style.width = 'auto';
   photoDiv.childNodes[1].style.textAlign = 'center';
   photoDiv.childNodes[1].style.fontWeight = 'normal';
   photoDiv.childNodes[1].style.fontSize = 'smaller';
   photoDiv.childNodes[1].style.padding = '0px';
   photoDiv.childNodes[1].style.margin = '0px';
   photoDiv.childNodes[1].style.width = 'auto';
// Set the attributes of the embedded Picture
   photoDiv.childNodes[2].style.position = 'absolute';
   photoDiv.childNodes[2].style.top = '50px';
   photoDiv.childNodes[2].style.left = '50px';
//alert("Photo:" + Image + " Size:" + get_size(Size));
}
function get_size(Size) {
   var WH = Size.split("*");
   WH[0] = parseFloat(WH[0]);
   WH[1] = parseFloat(WH[1]);
   return WH;
}
function hidephoto() {
   document.getElementById('map_photo').style.display = 'none';
   document.getElementById('blackout').style.display='none';
}
