var bV  = parseInt(navigator.appVersion);var bNS = navigator.appName=="Netscape";var bIE = navigator.appName=="Microsoft Internet Explorer";

function GetObj(strID)
{
    if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
    	return(document.getElementById(strID));
    }
    else if(document.layers)   //NN4+
    {
    	return(document.layers[strID]);
    }
    else if(document.all)	// IE 4
    {
        return(document.all[strID]);
    }
	return(null);
}

function ShowHideID(strID, nState) // 1 = show, 0 = hide
{
	return(ShowHideObj(GetObj(strID), nState));
}

function ShowHideObj(strObj, nState) // 1 = show, 0 = hide
{
    if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        strObj.style.visibility = nState ? "visible" : "hidden";
    }
    else if(document.layers)   //NN4+
    {
		strObj.visibility = nState? "show" : "hide";
    }
    else if(document.all)	// IE 4
    {
        strObj.visibility = nState ? "visible" : "hidden";
    }
}

function GetEventTarget(objEvent) 
{
	var objTarget;
	
	if (!objEvent)
	{
		var objEvent = window.event;
	}
	if (objEvent.target)
	{
		objTarget = objEvent.target;
	}
	else if (objEvent.srcElement)
	{
		objTarget = objEvent.srcElement;
	}
	if (objTarget.nodeType==3) // defeat Safari bug
	{
		objTarget = objTarget.parentNode;
	}
	return(objTarget);
}

function ShowTextBox(objEvent, strBoxID, strCoverID, strTitle, strText, nLeft, nTop )
{
	if (GetObj("FAQ_Categories") && bIE)
	{
		ShowHideObj(GetObj("FAQ_Categories"), 0);
	}
	if (GetObj("Doc_Categories") && bIE)
	{
		ShowHideObj(GetObj("Doc_Categories"), 0);
	}
	if (strCoverID)
	{
		objCover = GetObj(strCoverID);
		if (objCover)
		{
			objCover.style.width = document.body.clientWidth + 18 + "px";
			objCover.style.height = document.body.clientHeight + 36 + "px";
			ShowHideObj(objCover, 1);
		}
		if(bNS)
			ShowHideObj(GetObj('flash_header'), 0);
	}

	var nScrollTop = 0;
	var nScrollLeft = 0;
	if (document.documentElement)
	{
		nScrollTop = document.documentElement.scrollTop;
		nScrollLeft = document.documentElement.scrollLeft;
	}
	else
	{
		nScrollTop = document.body.scrollTop;
		nScrollLeft = document.body.scrollLeft;
	}
	var objBox = GetObj(strBoxID + '_Base');
	var objBody = GetObj(strBoxID + '_Body');
	var nHeight = 0;

	if (window.innerHeight)
	{
		nHeight = window.innerHeight;
	}
	else if(document.documentElement.clientHeight)
	{
		nHeight = document.documentElement.clientHeight;
	}				
	else
	{
		nHeight = document.body.clientHeight;
	}
	GetObj(strBoxID + "_Title").innerHTML = strTitle; //.substr(0, (strTitle.indexOf(' ', 36) == -1 ? strTitle.length : strTitle.indexOf(' ', 36)));
	objBody.style.height = "auto";
	objBody.innerHTML = strText;

	if (objBody.offsetHeight > nHeight - 96)
	{
		objBody.style.height = nHeight - 96 + 'px';
	}

	// Use the mouse location to determin the position of the popup box
	if (objBox)
	{
		if (nLeft)
		{
			if (nLeft == "mouse")
			{
				objBox.style.left = objEvent.clientX + nScrollLeft + "px";
			}
			else if (nLeft == 'center')
			{
				objBox.style.left = (document.body.clientWidth/2) - (objBox.offsetWidth/2) + nScrollLeft + "px";
			}
			else
			{
				objBox.style.left = nLeft + "px";
			}
		}

		if (nTop)
		{
			if (nTop  == "mouse")
			{
				objBox.style.top = objEvent.clientY + nScrollTop + "px";
			}
			else if (nTop  == 'center')
			{
				objBox.style.top = (nHeight /2) - (objBox.offsetHeight/2) + nScrollTop + "px";

			}
			else
			{
				objBox.style.top = nTop  + "px";
			}
		}
			
		objBox.style.backgroundImage = "url('images/template/p_topbar_650.gif')"; 
		
		ShowHideObj(objBox, 1);
	}
}

function closeMouseUp(objEvent, strID, strCoverID)
{
	if (strID)
		ShowHideObj(GetObj(strID + '_Base'), 0);
	if (strCoverID)
		ShowHideObj(GetObj(strCoverID), 0);
	if(bNS)
		ShowHideObj(GetObj('flash_header'), 1);
	if (GetObj("FAQ_Categories") && bIE)
		ShowHideObj(GetObj("FAQ_Categories"), 1);
	if (GetObj("Doc_Categories") && bIE)
		ShowHideObj(GetObj("Doc_Categories"), 1);
}

function closeMouseDown(objEvent, strID)
{
	GetObj(strID + '_Base').style.backgroundImage= "url('images/template/p_topbar_down_650.gif')"; 
}

function closeMouseOut(objEvent, strID)
{
	GetObj(strID + '_Base').style.backgroundImage= "url('images/template/p_topbar_650.gif')"; 
}
