function ShowSticky(obj,field)

{

  if (document.all)

    helpObj = document.all[field+"_help"];

  else if (document.getElementById)

    helpObj = document.getElementById(field+"_help");

  if (helpObj && helpObj.style.display == "none")

  ShowHelp(obj,field);

}



function ShowHelp(obj,field,use_parent)

{

  if (!obj.id)

    obj = document.getElementById(field+"_source");

  // Get parent container object...

  var parentObj= null;

  if (use_parent)

    parentObj= obj.parentNode;

  

  //Get help object

  var helpObj = document.getElementById(field+"_help");


  if (helpObj) {

    if (helpObj.style.display == "none") {

      helpObj.style.display = "";

      var dobj = helpObj.getElementsByTagName("DIV")[0];

      dobj.style.padding='10px'; 

    }

    

    // Screen height and width...

    var screenHeight = (window.innerHeight) ? window.innerHeight - 25 : document.body.clientHeight;

    var screenWidth = (window.innerWidth) ? window.innerWidth - 25 : document.body.clientWidth;

    

    // Help object offset top, offset left, height and width...

    var offsetTop;

    if (use_parent)

      offsetTop = (parentObj.offsetTop + obj.offsetTop + obj.offsetHeight + 25);

    else

      offsetTop = (helpGetOffsetTop(obj) + obj.offsetHeight);

    var offsetLeft;

    if (use_parent)

      offsetLeft = (parentObj.offsetLeft - obj.offsetLeft);

    else

      offsetLeft = (helpGetOffsetLeft(obj) - obj.offsetLeft);

    var divHeight = parseInt(obj.style.height);

    var divWidth = parseInt(obj.style.width);

    

    //Get location of mouseover object, move help object to the left if will display off-screen

    if ((offsetLeft + divWidth) > screenWidth) {

      offsetLeft = screenWidth - divWidth;

    }

    if (offsetLeft < 0) offsetLeft= 0;

    newX = offsetLeft;

    

    //Get location of mouseover object, move help object on top if will display off-screen

    if ((offsetTop + divHeight) > screenHeight + helpGetScrollY()) {

      offsetTop = helpGetOffsetTop(obj) - divHeight;

    }

    if (offsetTop < 0) offsetTop= 0;

    newY = offsetTop;

    

    helpObj.style.top = newY + 'px';

    helpObj.style.left = newX  + 'px';

  }

}



function HideHelp(obj,field)

{

  if (!obj.id)

    obj = document.getElementById(field+"_source");

  //Get help object

  var helpObj = document.getElementById(field+"_help");

  

  if (helpObj) {

    if (helpObj.style.display != "none") {

      helpObj.style.display = "none";

      var dobj = helpObj.getElementsByTagName("DIV")[0];

      dobj.style.padding='0px';

    }

  }

}



function helpGetOffsetTop(elm)

{

  var mOffsetTop = elm.offsetTop;

  var mOffsetParent = elm.offsetParent;

  while(mOffsetParent) {

    mOffsetTop += mOffsetParent.offsetTop;

    mOffsetParent = mOffsetParent.offsetParent;

  }

  return mOffsetTop;

}



function helpGetOffsetLeft(elm)

{

  var mOffsetLeft = elm.offsetLeft;

  var mOffsetParent = elm.offsetParent;

  while(mOffsetParent) {

    mOffsetLeft += mOffsetParent.offsetLeft;

    mOffsetParent = mOffsetParent.offsetParent;

  }

  return mOffsetLeft;

}



function helpGetScrollY()

{

  var scrOfY = 0;

  if (typeof(window.pageYOffset) == 'number' )

  { // Netscape

    scrOfY = window.pageYOffset;

  }

  else if (document.body && (document.body.scrollLeft || document.body.scrollTop))

  { // DOM

    scrOfY = document.body.scrollTop;

  }

  else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))

  { // IE6

    scrOfY = document.documentElement.scrollTop;

  }

  return scrOfY;

}



function qh_hideElement(elmID, overDiv)

{

  if (document.all)

  {

    for(i = 0; i < document.all.tags(elmID).length; i++)

    {

      obj = document.all.tags( elmID )[i];

      if (!obj || !obj.offsetParent) continue;

      

      // Find the element's offsetTop and offsetLeft relative to the BODY tag.

      objLeft   = obj.offsetLeft;

      objTop    = obj.offsetTop;

      objParent = obj.offsetParent;

      

      while(objParent.tagName.toUpperCase() != 'BODY')

      {

        objLeft  += objParent.offsetLeft;

        objTop   += objParent.offsetTop;

        objParent = objParent.offsetParent;

      }

      

      objHeight = obj.offsetHeight;

      objWidth  = obj.offsetWidth;

      

      if ((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);

      else if((overDiv.offsetTop + overDiv.offsetHeight) <= objTop);

      else if(overDiv.offsetTop >= (objTop + objHeight));

      else if(overDiv.offsetLeft >= (objLeft + objWidth));

      else {

        obj.style.visibility = 'hidden';

      }

    }

  }

}



function qh_showElement(elmID)

{

  if (document.all)

  {

    for(i = 0; i < document.all.tags( elmID ).length; i++)

    {

      obj = document.all.tags(elmID)[i];

      if (!obj || !obj.offsetParent) continue;

      obj.style.visibility = '';

    }

  }

}

