/*
var curPos = new Object();
  curPos.setPos = function(e) {

        e = e || event;
        var cursor = {x:0, y:0};
        this.x = 0;
        this.y = 0;
        if (e.pageX || e.pageY) {
        this.x = e.pageX;
            this.y = e.pageY;
        }
        else {
                var de = document.documentElement;
                var b = document.body;
                this.x = e.clientX +
                        (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
                this.y = e.clientY +
                        (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
        }

}

*/

 var offset=8;
 function showPopup (name,description,image) {
  var win=new DataPopup(name,description, image, 320,420);
 }

 var nodeID;
 
 function DataPopup(name, description, image ,w,h) {
  var bod=document.createElement("div");
  bod.id="newDiv";
  document.body.appendChild(bod);


  this.contentDiv=document.createElement("div");
  this.contentDiv.style.left = curPos.x;
  this.contentDiv.style.top = curPos.y;
  this.contentDiv.style.position = 'absolute';
  this.contentDiv.className="winContents";
  this.contentDiv.id="contentDiv";

  var imageDiv = document.createElement("div");
  imageDiv.innerHTML=image;
  this.contentDiv.appendChild(imageDiv);

  var descDiv = document.createElement("div");
  descDiv.innerHTML=description;
  this.contentDiv.appendChild(descDiv);
  bod.appendChild(this.contentDiv);
  nodeID = document.getElementById("newDiv");
  var winCursorPosX = curPos.x + 100;
  var winCursorPosY = curPos.y;
  
  if ((curPos.y + h + 0) > document.body.clientHeight) {winCursorPosY = (curPos.y-h+0); }
 
  this.win=new windows.Window(bod,name,winCursorPosX,winCursorPosY,w,h);
 }

 
 function removePopup() {
        
      var bodyNode = document.getElementById("smithrock.com");
      var dragBarNode = document.getElementById("dragbar");
      if (dragBarNode) {
                bodyNode.removeChild(dragBarNode);
                dragBarNode = null;
          } 
      var closebuttonNode = document.getElementById("closebutton");
      if (closebuttonNode) {
                bodyNode.removeChild(closebuttonNode);
                closebuttonNode = null;
          } 

      var titleBarNode = document.getElementById("titlebar");
      if (titleBarNode) {
                bodyNode.removeChild(titleBarNode);
                titleBarNode = null;
          } 
      var bodNode = document.getElementById("hoverDiv");
      if (bodNode) {
                bodyNode.removeChild(bodNode);
                bodNode = null;
          } 

  } 