var def_helpText = "V1.0";

var helpText = new Array();

function showHelp( helpType, ev )
{
  if( typeof( helpText[helpType] ) == "undefined" )
  {
    helpText[helpType] = '<p>Help text missing, please report this error.</p>';
  }

  var helpDiv = getElt( "helpDiv" );

  if( helpDiv == null )
  {
    helpDiv = document.createElement( "div" );

    helpDiv.setAttribute( "id",    "helpDiv" );
    helpDiv.setAttribute( "class", "popup" );

    helpDiv.onclick = hideHelp;

    document.body.appendChild( helpDiv );
  }

  helpDiv.innerHTML = helpText[helpType] + '<p><a href="#">Click to close</a></p>';

  var x = ( ( ev.clientX ) ? ev.clientX : ev.pageX ) + getpagescrollx();
  var y = ( ( ev.clientY ) ? ev.clientY : ev.pageY ) + getpagescrolly();

  helpDiv.style.left = x + "px";
  helpDiv.style.top  = y + "px";

  if( document.all )
  {
    helpDiv.className = "popup";

    backLayer( helpDiv );
  }

  helpDiv.style.visibility = "visible";

  return false;
}

function hideHelp()
{
  var thePopup = getElt( "helpDiv" );

  thePopup.style.visibility = "hidden";

  if( document.all )
  {
    var theIframe = getElt( "helpDivIframe" );
    theIframe.style.display = "none";
  }
}
