// Image copyright notice
// To add the notice to an image, set the onmouseover
// function of the image to iover(), and the onmouseout
// to iout();

var d_notice = document.createElement('div');
d_notice.style.backgroundColor = "#eef";
d_notice.style.color   = "#000";
d_notice.style.border  = "2px solid #000";
d_notice.style.padding = "4px";
d_notice.style.display = "none";
d_notice.style.position = "absolute";
d_notice.id = "d_notice";
d_notice.innerHTML = "<center>Please <b style=\"color: #800;\">do not copy</b> this image!<br>It is protected by copyright law and<br>is the property of the artist.</center>";

function getPos(e) {
  var posx = 0;
  var posy = 0;
  if (!e) var e = window.event;
  if (e.pageX || e.pageY) {
    posx = e.pageX;
    posy = e.pageY;
  } else if (e.clientX || e.clientY) {
    posx = e.clientX + document.body.scrollLeft
           + document.documentElement.scrollLeft;
    posy = e.clientY + document.body.scrollTop
           + document.documentElement.scrollTop;
  }
  return [posx, posy];
}

function iover() {
  if (!document.getElementById('d_notice')) {
    document.body.appendChild(d_notice);
  }

  document.oncontextmenu = function(e) {
    if (!e) var e = window.event;
    var pos = getPos(e);
    d_notice.style.top  = (pos[1]+35)+"px";
    d_notice.style.left = pos[0]+"px";
    d_notice.style.display = "";
    return false;
  }
  document.onmousedown = function(e) { return false; }
}

function iout() {
 document.oncontextmenu = null;
 document.onmousedown = null;
 d_notice.style.display = "none";
}

function iover_2() {
  document.oncontextmenu = function(e) { return false; }
  document.onmousedown = function(e) { return false; }
}
