function showpicpopup(src){
  if(typeof XMLHttpRequest == "undefined") return;
  if(typeof xhreq == "undefined"){
    xhreq = new XMLHttpRequest();
  };
  if(!xhreq) return false;

  if(src.tagName.toLowerCase() == 'a'){
    src1 = src.getElementsByTagName('img')[0];
    src.bigsrc = src.href;
    src.alt = src1.alt;
  }else src.bigsrc = src.src;

  //Prepare the help container
  hidepicpopup(); //Just in case we missed a close event somewhere
  var h = document.createElement('div');
  h.id = 'floatingpic';
  h.style.position = 'absolute';
  h.style.backgroundColor = '#ffffff';
  p = findPos(src);
  h.style.left = p[0] + 'px';
  h.style.width = 'auto';
  h.style.height = 'auto';
  h.style.border = '2px #831B1A solid';
  h.style.zIndex = 9;
  h.style.padding = '0px';
  h.style.top = p[1] + 'px';
  var l = document.createElement('a');
  l.setAttribute('href', 'javascript:void(0)');
  l.setAttribute('title', 'close');
  l.style.position = 'absolute';
  l.style.right = '0px';
  l.style.top = '0px';
  l.style.cursor = 'pointer';
  l.style.color = '#0000ff';
  l.style.backgroundColor = '#ffffff';
  l.style.padding = '5px';
  l.onclick = new Function('this.parentNode.parentNode.removeChild(this.parentNode); return false');
  var t = document.createTextNode('X');
  l.appendChild(t);
  h.appendChild(l);
  var i = document.createElement('img');
  i.src = src.bigsrc;
  i.style.display = 'block';
  i.style.margin = 'auto';
  i.setAttribute('title', src.alt + '; click to close');
  i.onclick = new Function('this.parentNode.parentNode.removeChild(this.parentNode)');
  h.appendChild(i);
  src.parentNode.insertBefore(h, src);
  setTimeout("document.getElementById('floatingpic').style.top = Math.max(p[1] - (document.getElementById('floatingpic').offsetHeight / 2), 0) + 'px'", 1);
  return true;
};
function hidepicpopup(){
  var h = document.getElementById('floatingpic');
  if(h){
    h.parentNode.removeChild(h);
  };
};

if(typeof findPos == "undefined"){
 function findPos(obj) {
  var curleft = curtop = 0;
  if(obj.offsetParent){
    do{
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }while (obj = obj.offsetParent);
  };
  return [curleft,curtop];
 };
};