    var offsetx = 0;
    var offsety = 0;   
    var mousex = 0;
    var mousey = 0;
    var grabx = 0;
    var graby = 0;
    var orix = 0;
    var oriy = 0;
    var elex = 0;
    var eley = 0;

    var dragobj = null;


/* Begin Script to get the Context Sensitive Help asynchronously */
    
    function ShowHelp( objSource, helpkey ) 
    {        
      // set appropriate position of help frame
      getMouseXY();
      document.getElementById('objHelpControl_csh_Container').style.left = mousex + "px";
      document.getElementById('objHelpControl_csh_Container').style.top = mousey + "px";
      

      // if helpkey == '' : find helpkey according to objSource : find first element with name starting with 'Application'
      var children;
      var firstfoundhelpkey = '';
      var n = $(objSource).getParent();
      
      if (helpkey == '')
      {
        n = n.getNext();
        if (n == null) 
        {
          n = $(objSource).getParent().getParent();
          n = n.getNext();
        }
        if (n != null) 
        {
  		    do { 
  		      children = n.getElements('[name^=Application]');
  		      if (children.length > 0)
  		        if (firstfoundhelpkey == '') firstfoundhelpkey = children[0].name;
	  		    n = n.getNext();
		      } while (n); 
		    }
		     helpkey = firstfoundhelpkey;
      }
     
     helpkey = 'Help' + helpkey;
      // get help text according to helpkey
      CallBackHelp(helpkey,"");
    }    
    function JavaScriptCallBackHelp(help, context)
    {     
        var helpArray = new Array();
        helpArray = help.split('#');        
        ShowContextSensitiveHelp('objHelpControl',helpArray[0],helpArray[1]);
    }     
        
/* End Script to get the Context Sensitive Help asynchronously */    


/*  Begin Script ShowContextSensitiveHelp() * Display the context sensitive help */

function getPageSizeWithScroll()
{     
if (window.innerHeight && window.scrollMaxY) 
{
// Firefox        
 yWithScroll = window.innerHeight + window.scrollMaxY;         
 xWithScroll = window.innerWidth + window.scrollMaxX;     
 } 
 else
  if (document.body.scrollHeight > document.body.offsetHeight)
  { 
  // all but Explorer Mac        
   yWithScroll = document.body.scrollHeight;    
        xWithScroll = document.body.scrollWidth;    
} else {
           // works in Explorer 6 Strict, Mozilla (not FF) and Safari     
               yWithScroll = document.body.offsetHeight;      
                  xWithScroll = document.body.offsetWidth;      
                   }    
                    arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);    
                    alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );   
                     
                       return arrayPageSizeWithScroll; 
} 

function ShowContextSensitiveHelp( strPrefix, strTitle, strMessage ) 
{
   
    var objContainer = document.getElementById(strPrefix + '_csh_Container');
    var objTitle = document.getElementById(strPrefix + '_csh_Title');
    var objHelp = document.getElementById(strPrefix + '_csh_Description');
    objContainer.style.display = 'block';
    objTitle.innerHTML = strTitle;    
    objHelp.innerHTML = strMessage;
    objContainer.focus();
 //   objContainer.focus();
//    var nhei = document.documentElement.clientHeight;
//    if (nhei > hei)
//    {
//      window.scroll(objContainer.offsetLeft, objContainer.offsetTop);
//    }

//getPageSizeWithScroll();
}
/*  End Script ShowContextSensitiveHelp() * Display the context sensitive help */

        
/* Begin Script to make the Context Sensitive Help draggable */

    function falsefunc() { return false; } // used to block cascading events

    function init(context)
    {
      document.onmousemove = getMouseXY; // update(event) implied on NS, update(null) implied on IE
      getMouseXY();
    }
    
    //getMouseXY(e); // NS is passing (event), while IE is passing (null)
    function getMouseXY(e) // works on IE6,FF,Moz,Opera7
    { 
      if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

      if (e)
      { 
        if (e.pageX || e.pageY)
        { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
          mousex = e.pageX;
          mousey = e.pageY;
        }
        else if (e.clientX || e.clientY)
        { // works on IE6,FF,Moz,Opera7
          mousex = e.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft :  document.body.scrollLeft);
          mousey = e.clientY + (document.documentElement.scrollTop ?  document.documentElement.scrollTop :  document.body.scrollTop);
        }  
      } 
    }

    // dragobj : document.getElementById("objHelpControl_csh_Container")
    function grab(context)
    {
      document.onmousedown = falsefunc; // in NS this prevents cascading of events, thus disabling text selection
      dragobj = context;
      dragobj.style.zIndex = 10; // move it to the top
      document.onmousemove = drag;
      document.onmouseup = drop;
      //if (grabx == 0 && graby == 0) getMouseXY();
      grabx = mousex;
      graby = mousey;
      elex = orix = dragobj.offsetLeft;
      eley = oriy = dragobj.offsetTop;
      getMouseXY();
    }

    function drag(e) // parameter passing is important for NS family 
    {
      if (dragobj)
      {
        elex = orix + (mousex-grabx);
        eley = oriy + (mousey-graby);
        dragobj.style.position = "absolute";
        dragobj.style.left = (elex).toString(10) + 'px';
        dragobj.style.top  = (eley).toString(10) + 'px';
      }
      getMouseXY(e);
      return false; // in IE this prevents cascading of events, thus text selection is disabled
    }

    function drop()
    {
      if (dragobj)
      {
        dragobj.style.zIndex = 0;
        dragobj = null;
      }
      //getMouseXY();
      document.onmousemove = getMouseXY;
      document.onmouseup = null;
      document.onmousedown = null;   // re-enables text selection on NS
    }

    function Close()
    {
      document.getElementById("objHelpControl_csh_Container").style.display = "none";
    }


/* End Script to make the Context Sensitive Help draggable */
