//Image Functions

 function findPosX(obj){
  
  var curleft = 0;
  if (obj.offsetParent){
    
    while (obj.offsetParent){
      
      curleft += obj.offsetLeft
      obj = obj.offsetParent;
    }
  } else if (obj.x)
  curleft += obj.x;
  return curleft;
}

function findPosY(obj) {
  var curtop = 0;
  if (obj.offsetParent) {

    while (obj.offsetParent){
      
      curtop += obj.offsetTop
      obj = obj.offsetParent;
    }
  } else if (obj.y)
  curtop += obj.y;
  return curtop;
}

function show_popup(iid,largepic)
{

  var dd=document.getElementById(iid);
  
  var ddleft=findPosX(dd);
  var ddtop=findPosY(dd);
 
  if (dd.width < dd.height) {
    document.getElementById("mypopup").style.width="225px";
    document.getElementById("mypopup").style.height="300px"
  
  }else {
    document.getElementById("mypopup").style.width="300px";
    document.getElementById("mypopup").style.height="225px"
  }
  
  document.getElementById("mypopup").style.top = ddtop + "px";
  document.getElementById("mypopup").style.left = ddleft + "px";
  document.getElementById("mypopup").style.display = "block";
  document.getElementById("imgsrc").src =largepic;
}

function hide_popup(iid)
{

  document.getElementById(iid).style.display = 'none';
}

//End Image Functions
                            
