    
    var jsAreaShowTime = 1000;
    var JsAreas = new Object();

    function GetArea(id)
    {
	    return JsAreas[id] ? JsAreas[id] : (JsAreas[id] = new JsArea(id));
    }

    // A single popup window
    function JsArea(id)
    {
	    this.AreaId = id;
    }

    // Function to return the DIV Layer
    
    JsArea.prototype.ContentArea= function()
    {

	    var divArea = document.getElementById(this.AreaId);
	    if (divArea != null)
	    {
		    return divArea;
	    }
	    
	    return null;
        
    }

    var activeAreaId = null;


    // Function to show the DIV Layer
    
    JsArea.prototype.popareaup = function(x, y)
    {
    if (activeAreaId != null)	
	    jsAreaClose(activeAreaId);

	    var divLayer = this.ContentArea();
	    divLayer.style.position = 'absolute';
	    divLayer.style.display = 'block';
	    divLayer.style.left = (x + 10) + "px";
	    divLayer.style.top = (y - 40) + "px";
	    divLayer.onmouseover= JsAreaMouseOver;
	    divLayer.onmouseout = jsAreaMouseOut;
	    activeAreaId = this.AreaId;

	    var iframe = document.getElementById("HelpShim");
	    iframe.style.position = 'absolute';
	    iframe.style.display = 'block';
	    iframe.style.left = (x + 30) + "px";
	    iframe.style.top = (y - 40) + "px";
	    iframe.style.width = "309px";
	    iframe.onmouseover= JsAreaMouseOver;
	    iframe.onmouseout = jsAreaMouseOut;

    	
	    return false;
    }


    JsArea.prototype.hide = function()
    {
	    var divLayer = this.ContentArea();
	    if (divLayer != null)
		    divLayer.style.display = 'none';
    		
	    return false;
    }

    // Function to be called
    // by Web forms to show the Popup Window
    
    function PopupArea(e, areaId)
    {
        
	    var iframe = document.getElementById("HelpShim");

        if (iframe.style.display =="none")
        {
//	        if (document.layers)
//	        {
//		        posx = e.pageX;
//		        posy = e.pageY;
//		        xMousePosMax = window.innerWidth+window.pageXOffset;
//		        yMousePosMax = window.innerHeight+window.pageYOffset;
//	        }
//	        else 
//	        if (document.all)
//	        {
//		        posx = window.event.x + document.documentElement.scrollLeft;
//		        posy = window.event.y + document.documentElement.scrollTop;
//		        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
//		        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
//        		
//	        }
//	        else
//	        {
//		        posx = e.pageX;
//		        posy = e.pageY;
//		        xMousePosMax = window.innerWidth+window.pageXOffset;
//		        yMousePosMax = window.innerHeight+window.pageYOffset;
//	        }
	        
	        
	        
	        if (e.pageX || e.pageY)
	        {
		        posx = e.pageX;
		        posy = e.pageY;
		        xMousePosMax = window.innerWidth+window.pageXOffset;
		        yMousePosMax = window.innerHeight+window.pageYOffset;
	        }
	        else if (e.clientX || e.clientY)
	        {
		        posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		        posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
		        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
	        }
	        else
	        {
		        posx = e.pageX;
		        posy = e.pageY;
		        xMousePosMax = window.innerWidth+window.pageXOffset;
		        yMousePosMax = window.innerHeight+window.pageYOffset;
	        }

	                
	        
	        
        	
	        if ((posx *1)+309 > xMousePosMax *1)
	        {
	            posx = (xMousePosMax *1) -329;
	        }
        	
	        var area = GetArea(areaId);

	        area.popareaup(posx, posy);
        	
	        try{	
	            var oBody	=	document.getElementById(areaId);
            		
	            iframe.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
	            iframe.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth) - 20;
	        }
	        //An error is raised if the IFrame domain != its container's domain
	        catch(e)
	        {
    	        alert('Error: ' + e.number + '; ' + e.description);
	        }
        }
        else
        {
            this.document.focus();
        }
    	
    }



    // Function to be called
    // by Web forms to show the Popup Window
    // when the focus is on the control to be filled and not on the image to show the popup
    
    function IndirectPopupArea(e, areaId, offsetX, offsetY)
    {
	    
        try{
            
            var theId;
		    
		    if (e.srcElement != null)
		        theId = e.srcElement.id;
		    else
		        theId = e.currentTarget.id;

		    var theElement = document.getElementById(theId);
		    
            
            var theX = findPosX(theElement);
            
            if (theX != '' && theX != null)
                theX = theX + theElement.offsetWidth + 5;   //  Get control width plus an extra offset
            
            var theY = findPosY(theElement);
            
            
	        var iframe = document.getElementById("HelpShim");

            if (iframe.style.display =="none")
            {
	            if (document.layers)
	            {
		            posx = theX;    //  e.pageX;
		            posy = theY;    //  e.pageY;
		            xMousePosMax = window.innerWidth+window.pageXOffset;
		            yMousePosMax = window.innerHeight+window.pageYOffset;
	            }
	            else 
	            if (document.all)
	            {
		            posx = theX + document.documentElement.scrollLeft;      //   window.event.x + document.documentElement.scrollLeft;
		            posy = theY //+ document.documentElement.scrollTop;       //   window.event.y + document.documentElement.scrollTop;
		            xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
		            yMousePosMax = document.body.clientHeight+document.body.scrollTop;
	            }
	            else
	            {
		            posx = theX; //   e.pageX;
		            posy = theY; //   e.pageY;
		            xMousePosMax = window.innerWidth+window.pageXOffset;
		            yMousePosMax = window.innerHeight+window.pageYOffset;
	            }
	            
	            
	            posx = posx + offsetX;
	            posy = posy + offsetY;
	            
            	
	            if ((posx *1)+309 > xMousePosMax *1)
	            {
	                posx = (xMousePosMax *1) -329;
	            }
            	
	            var area = GetArea(areaId);

	            area.popareaup(posx, posy);
        	    	
                var oBody	=	document.getElementById(areaId);
            		
                iframe.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
                iframe.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth) - 20;
            }
            else
            {
                this.document.focus();
            }
        }
        //An error is raised if the IFrame domain != its container's domain
        catch(e)
        {
	        
        }
    	
    }

    //  Get position x of a element
    
    function findPosX(obj){
    
        var curleft = 0;
        
        if(obj.offsetParent)
            while(1) {
              
              curleft += obj.offsetLeft;
              if(!obj.offsetParent)
                break;
              obj = obj.offsetParent;
            }
        else if(obj.x)
            curleft += obj.x;
        return curleft;
      }
  
  
  //  Get position y of a element
  
  function findPosY(obj){
  
    var curtop = 0;
    if(obj.offsetParent)
        while(1){
        
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

    // Function to hide the DIV Layer

    function jsAreaClose(areaId)
    {
    
	    GetArea(areaId).hide();
    	
	    var iframe = document.getElementById("HelpShim");
	    iframe.style.position = 'absolute';
	    iframe.style.display = 'none';
    	
	    activeAreaId = divHangTimer = null;	
    }

    var divHangTimer = null;

    // Function to keep the Div Layer
    // showing for a "period" of time
    // after that period, if the mouse
    // has been outside the DIV Layer, 
    // it will be hidden automatically
    function KeepArea(areaId)
    {
	    if (areaId == activeAreaId && divHangTimer != null)
	    {
		    clearTimeout(divHangTimer);
		    divHangTimer = null;
	    }
    }

    // Function to release the DIV Layer
    function RelArea(areaId)
    {
    //	if (areaId == activeAreaId && divHangTimer == null)
    //		divHangTimer = setTimeout('jsAreaClose(\'' + areaId + '\')', jsAreaShowTime);
    }


    // Function fired when mouse is over the 
    // DIV Layer, used to keep the layer showing
    
    function JsAreaMouseOver(e)
    {
	    if (!e) 
		    var e = window.event;
	    var targ = e.target ? e.target : e.srcElement;
	    KeepArea(activeAreaId);
    }


    // Function that fires when mouse is out of
    // the scope of the DIV Layer
    
    function jsAreaMouseOut(e)
    {
	    if (!e) 
		    var e = window.event;
	    var targ = e.relatedTarget ? e.relatedTarget : e.toElement;
	    var activeAreaView = document.getElementById(activeAreaId);
	    if (activeAreaView != null && !jsAreaContains(activeAreaView, targ))
		    RelArea(activeAreaId);
    }
    
    
    function jsAreaContains(parent, child)
    {
	    while(child)
		    if (parent == child) return true;
		    else 
			    child = child.parentNode;
    		
		    return false;
    }
