/*********************************************************
 * A simple JavaScript to protect images from being
 * downloaded by "surfers" without permission.
 *
 * NOTE: Not foolproof, but helpful!
 *
 * Created by Johan Liedholm for EPN - www.euro-photo.net
 *********************************************************/

// Warning message
var warn = "Images on this website are protected by copyright and we discourage you from downloading and using them in any way without copyright holder approval. \n\nThank you for your consideration, WorldECHO.com!";

// Determine browser
var IE4 = (document.all) ? true : false;
var NS4 = (document.layers) ? true : false;

// Function for trapping mouse clicks on images
function trap(e) {

  // Works best in IE
  if (IE4 && event.button == 2) {
    alert(warn);
  }
  else if (NS4) {
    alert(warn);
  }

  return false;
}

// Function to assign trap for every image on page
// NOTE: Might disable hyperlinks on images in Netscape!
function protect() {
  if(document.images) {
    for(i = 0; i < document.images.length; i++) {
      document.images[i].onmousedown = trap;
    }
  }
}

