var myImage = '';
var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1);

function setTimout() { setTimeout("hide_thumbnailfull();",1000); }

function display(event, layerName, width, height, url) {
  var myElement = document.getElementById(layerName);
  // var mySearch = document.getElementById("search");
  var x, y;
  myWidth = width + 10;
  var myHeight = height + 10;

  if(window.event) {
    x = window.event.clientX + document.documentElement.scrollLeft
                             + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop +
                             + document.body.scrollTop;
  } else {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }
  x += 1;
  y += 1;

  // move the pop-up image to the left -dougl
  x -= 500;

  var myHTML='<table class="thumbnailtable" style="width: ' + width + 'px " cellpadding="3" cellspacing="1" border="0" onclick="javascript:hide_thumbnailfull();">'
            +'<tr><td class="thumbnailfull"><img src="' + url + '" width="' + width + '" height="' + height + '"/></td></tr>'
            +'</table>';
  myElement.style.left = x + "px";
  myElement.style.top = y + "px";
  myElement.style.width = myWidth;
  myElement.style.height = myHeight;
  myElement.style.background = "#FFFFFF";
  myElement.style.visibility = "visible";
  myElement.innerHTML = myHTML;
  // mySearch.style.visibility = "hidden";

  myImage = '';
  document.getElementById(layerName).onclick = hide_thumbnailfull;
}

function hide_thumbnailfull() {
  var myElement = document.getElementById("image");
  myElement.style.visibility = "hidden";
  //var mySearch = document.getElementById("search");
  //mySearch.style.visibility = "visible";

}

function mouseOver(src,colorOver,id,highlightcolor){
  if(navigator.appVersion.indexOf("MSIE")!=-1){
    src.style.cursor = 'hand';
  } else {
    src.style.cursor = 'pointer';
  }
  src.style.background = 'url(' + colorOver + ')';
  var myCell = document.getElementById(id);
   myCell.style.background = 'url(' + colorOver + ')';
}

function mouseOut(src,colorIn,id,highlightcolor){
  src.style.cursor = 'default';
  src.style.background = colorIn;
  var myCell = document.getElementById(id);
  myCell.style.background = highlightcolor;
}

function Checklist(sec, dbid, element, e){
  if (!e) e = window.event;
  if (document.images){
    if (element.type == "checkbox"){
      var type;
      if (element.checked){
        type = 'add';
      } else {
        type = 'del';
      }
      window.open(surlnodb + 'db=' + sec +';print_checklist_' + type + '_popup=on;id=' + dbid,'checklist','WIDTH=300,HEIGHT=300,scrollbars=yes,resize=yes,left=150,top=100,screenX=150,screenY=100');
    }
  }

  if(e.stopPropagation)
    e.stopPropagation();
  e.cancelBubble = true;

  return true;
}
