// Copyright Damian Montero

var divName = 'HelpPopUp'; // div that is to follow the mouse
var offX = 50;         // X offset from mouse position
var offY = 0;         // Y offset from mouse position
var isVisible = 0;

// no changes required below this line
function mouseX(evt) 
{
	if (!evt) evt = window.event; 
	if (evt.pageX) return evt.pageX; 
	else 
		if (evt.clientX)
			return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); 
		else 
			return 0;
} 

function mouseY(evt) 
{
	if (!evt) evt = window.event; 
	if (evt.pageY) 
		return evt.pageY; 
	else 
	if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); 
	else 
		return 0;
} 

function follow(evt) 
{
	if ( (isVisible==1) &&  (document.getElementById) )
	{
		var obj = document.getElementById(divName).style; 
		//obj.visibility = 'visible'; 
		obj.left = (parseInt(mouseX(evt))+offX) + 'px';  
		obj.top = (parseInt(mouseY(evt))+offY) + 'px';
	}
} 

function changeDivText(divName,strInnerHtml)
{
    var borderstyle = 'solid';
    if (strInnerHtml == '')
        { borderstyle='none'; }
        
    

	if (document.layers)
	{
		document.layers[divName].innerHTML = strInnerHtml;
		//document.layers[divName].border-style=borderstyle; 

	}
	else if (document.all)
	{
		document.all[divName].innerHTML = strInnerHtml;
		//document.all[divName].style.border-style=borderstyle; 
	}
	else if (document.getElementById)
	{
		document.getElementById(divName).innerHTML = strInnerHtml;
		//document.getElementById(divName).style.border-style=borderstyle; 
	}

}

//Show (html to show, 1 = show, 0 = hide
function ShowHide(strTitle,strDescription,strShowHide,strTitleColor)
{ //003366 

    isVisible = strShowHide;

	var HideShowOld,HideShowNew,strInnerHtml;
	if (strShowHide==1)
	    {
	    HideShowOld = 'show';
	    HideShowNew = 'visible';
	    //document.body.style.cursor='help';
	    }
	else
	    {
	    HideShowOld = 'hide';
	    HideShowNew = 'hidden';
	    //document.body.style.cursor='auto';

	    }	

    strInnerHtml = "<div style=\"background-color: #"+strTitleColor+";color:white;\"><b>"+strTitle+"</b></div><div style='margin:2px;'></b>"+strDescription+"</div>";

	if (document.layers)
	{
		document.layers[divName].visibility =HideShowOld;
		document.layers[divName].innerHTML = strInnerHtml;

	}
	else if (document.all)
	{
		document.all[divName].style.visibility = HideShowNew;
		document.all[divName].innerHTML = strInnerHtml;
	}
	else if (document.getElementById)
	{
		document.getElementById(divName).style.visibility = HideShowNew;
		document.getElementById(divName).innerHTML = strInnerHtml;
	}
	
   /*
    var obj = document.getElementById(divName).style; 
    x = event.clientX + document.body.scrollLeft; // get the mouse left position
    y = event.clientY + document.body.scrollTop + 35; // get the mouse top position 
    Popup.style.display="block"; // display the pop-up
    Popup.style.left = x; // set the pop-up's left
    Popup.style.top = y; // set the pop-up's top
   */
		
}

document.onmousemove = follow;	// this function shows the pop-up when user moves the mouse over the link


