 var _helpElement = null;
 var _backgroundElement = null;
 var _helpTime = null;
 var _helpLink = '';
 
 function InitHelp()
 { 
     this._backgroundElement = document.createElement('div');
     //this._backgroundElement.style.visibility = 'hidden';
     this._backgroundElement.style.display = 'none';
     this._backgroundElement.style.position = 'absolute';
     //this._backgroundElement.style.overflow = 'hidden';
     this._backgroundElement.style.left = '0px';
     this._backgroundElement.style.top = '0px';
     this._backgroundElement.style.width = '450px';
     this._backgroundElement.style.height = '302px';
     this._backgroundElement.style.zIndex = 10000;
     this._backgroundElement.className = 'ms_background';    
     
     var html = "<div id='helpFrameDiv' style='border:solid 1px gray'><iframe id='HelpFrame' scrolling='auto' frameborder='0' width='100%' height='100%' src='";
     html += _helpLink;
     html += "' onmouseout='HideHelpTipDiv(event);'></iframe></div>";
     
     document.write(html);
     this._helpElement = document.getElementById("helpFrameDiv");
     //this._helpElement.style.visibility = 'hidden';
     this._helpElement.style.display = 'none';
     this._helpElement.style.position = 'absolute';
     //this._helpElement.style.overflow = 'hidden';
     this._helpElement.style.left = '0px';
     this._helpElement.style.top = '0px';   
     this._helpElement.style.width = '450px';
     this._helpElement.style.height = '302px';
     this._helpElement.style.zIndex = 10001;
     this._helpElement.parentNode.appendChild(this._backgroundElement);
 }
 
 function PopHelpTipDiv()
 {   
    
    if( this._helpElement.style.display == 'none' )
    {
        var help = document.getElementById("helpDiv");
        var p = getAbsolutePos(help);
        
        //var top = getAbsolutePos(document.getElementById("Layout_MainContent"));
        
        var left = p.x - _helpElement.offsetWidth + help.offsetWidth;
        if( left < 0 )
           left = 0;
        
        var helpWidth = _helpElement.style.width.replace("px","");
        
        _helpElement.style.left = (left - helpWidth) + "px";
        _helpElement.style.top = (p.y + help.offsetHeight) + "px";
        
        _backgroundElement.style.left = (helpWidth+4) + "px";
        _backgroundElement.style.top = (p.y + help.offsetHeight+4) + "px";
        
        if(_helpLink == '')
        {
            this._backgroundElement.style.display = 'none';
            this._helpElement.style.display = 'none';
        }
        else
        {
            this._backgroundElement.style.display = '';
            this._helpElement.style.display = '';
        }
        
        
     } 
     _helpTime=null;
 }
 
 function HideHelpTipDiv(evt)
 {
    if(_helpTime)
    {
        clearTimeout(_helpTime);
        _helpTime = null;
    }
    
    if( this._helpElement.style.display == '' )
    {       
        var id = undefined;        
        if (window.event) 
        {   
            if(window.event.toElement != null)
                id = window.event.toElement.id;
        }
        else if(evt != undefined)
        {            
            id = evt.relatedTarget.id;                        
        }
        
        if( id == undefined || id.toLowerCase().indexOf('help') == -1)
        {
            this._helpElement.style.display = 'none';
            this._backgroundElement.style.display = 'none';
        }
     }
 }