document.write('<script type="text/javascript" src="http://images.talentum.com/pandora/2.0/prototype.js"></script>');
document.write('<script type="text/javascript" src="http://images.talentum.com/pandora/2.0/scriptaculous.js"></script>');

var Pandora = {

/**
 * open new browser window
 * @param fileName New window's content is fetched from  this file.
 * @param windowName Window's title.
 * @param winWidth Windows's width.
 * @param winHeight Window's height.
 * @return Cursor's x-offset from left, 0 if x-offset cannot be resolved.
*/
openWindow: function (fileName, windowName, winWidth, winHeight) {
  specs='\"toolbar=0,location=0,scrolling=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=' +
        winWidth + ',height=' + winHeight + '\"';
  winString = windowName + ' = window.open(\"' + fileName + '\",\"' + windowName + '\",' + specs + ')\;';
  eval(winString);
},

/**
 * Return cursor's x-offset from left or 0 if it cannot be resolved.
 * @param evt html dom event
 * @return Cursor's x-offset from left, 0 if x-offset cannot be resolved.
*/
getCursorX: function(evt) {
  if (!evt) evt = window.event;
  if (evt.pageX)
    return evt.pageX;
  else if (evt.clientX)
    return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);
  else
    return 0;
},

/**
 * Return cursor's y-offset from top or 0 if it cannot be resolved.
 * @param evt html dom event
 * @return Cursor's y-offset from top, 0 if y-offset cannot be resolved.
*/
getCursorY: function(evt) {
  if (!evt)
    evt = window.event;
  if (evt.pageY)
    return evt.pageY;
  else if (evt.clientY)
    return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
  else
    return 0;
},

/**
 * This function sets a html-element visible and makes it follow
 * the cursor on a javascript event.
 * @param evt html dom event
 * @param elementId html-element that we want to follow the cursor
*/
followCursor: function(evt, elementId) {

  var xOffSet = 15;
  var yOffSet = 15;
  var obj = document.getElementById(elementId);

  if (obj == null)
    return;

  obj.style.display='';
  obj.style.visibility = 'visible';
  obj.style.position ='absolute';
  obj.style.left = (parseInt(this.getCursorX(evt))+xOffSet) + 'px';
  obj.style.top = (parseInt(this.getCursorY(evt))+yOffSet) + 'px';
}

}