
//----------------------------------------

function fnMakeTopWindow()
{
	// Make this the top frame
	if (window != top) top.location.href = window.location.href;
}

//----------------------------------------

function fnSetClass(oDOM, sClassName)
{
	oDOM.className = sClassName;
}

//----------------------------------------

function fnSubmitFormTo(sFormName, sAction)
{
	oForm = document.all(sFormName);
	oForm.action = sAction;
	oForm.submit();
}

//----------------------------------------

function fnPopupHelptext(sUrl, nSizeX, nSizeY)
{
	window.open(sUrl, null, 'height=' + nSizeX + ',width=' + nSizeY + ',status=no,toolbar=no,menubar=no,location=no');
}

//----------------------------------------

function fnGetCookieVal(nStart)
{
	nEnd = document.cookie.indexOf(";", nStart);
	if (nEnd == -1) nEnd = document.cookie.length;
	return unescape(document.cookie.substring(nStart, nEnd));
}
function fnGetCookie(sName)
{
	sFind = sName + "=";
	nFindLen = sFind.length;
	nCookieLen = document.cookie.length;
	nStart = 0;
	while (nStart < nCookieLen)
	{
		nEnd = nStart + nFindLen;
		if (document.cookie.substring(nStart, nEnd) == sFind)
			return fnGetCookieVal(nEnd);
		nStart = document.cookie.indexOf(" ", nStart) + 1;
		if (nStart == 0) break; 
	}
	return null;
}
function fnSetCookie(sName, sValue, sExpires, sPath, sDomain, sSecure)
{
	document.cookie =	sName + "=" + escape(sValue) +
						((sExpires) ? "; expires=" + sExpires.toGMTString() : "") +
						((sPath) ? "; path=" + sPath : "") +
						((sDomain) ? "; domain=" + sDomain : "") +
						((sSecure) ? "; secure" : "");
}
function fnDeleteCookie(sName, sPath, sDomain)
{
	if (fnGetCookie(sName))
	{
		document.cookie =	sName + "=" +
							((sPath) ? "; path=" + sPath : "") +
							((sDomain) ? "; domain=" + sDomain : "") +
							"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
function fnSetOneYearCookie(sName, sValue)
{
	tExpiry = new Date();
	tExpiry.setTime(tExpiry.getTime() + (365 * 24 * 60*60*1000));
	fnSetCookie(sName, sValue, tExpiry);
}

//----------------------------------------

function fnShowToon(num)
{
	sUrl = 'http://eq.magelo.com/profile/' + num;
	window.open(sUrl, null, 'width=800,height=600,status=no,toolbar=no,menubar=no,location=no');
}

//----------------------------------------

function fnShowElem(sElemID)
{
	oElem = document.all(sElemID);
	if (oElem.length == null)				oElem.style.display = "block";
	else for (i = 0; i < oElem.length; i++)	oElem[i].style.display = "block";
}
function fnHideElem(sElemID)
{
	oElem = document.all(sElemID);
	if (oElem.length == null)				oElem.style.display = "none";
	else for (i = 0; i < oElem.length; i++)	oElem[i].style.display = "none";
}
function fnShowHideElem(sElemID)
{
	oElem = document.all(sElemID);
	if (oElem.style.display == "none")	oElem.style.display = "block";
	else								oElem.style.display = "none";
}
function fnToggleCheck(sElemName)
{
	oElem = document.all(sElemName);
	oElem.checked = !oElem.checked;
}

//----------------------------------------

sActiveTabID = '01';
function fnActivateTab(sTabID, bActive)
{
	document.all('Tab' + sTabID).className = (bActive ? "TabTableTabSelected" : "TabTableTabUnselected");
	document.all('Cnt' + sTabID).style.display = (bActive ? "block" : "none");
}
function fnTabClick(sTabID)
{
	if (sActiveTabID == sTabID) return;
	fnActivateTab(sActiveTabID, false);
	fnActivateTab(sTabID, true);
	sActiveTabID = sTabID;
}

//----------------------------------------
