function fLoginSetEMail(f, b) {
	if (b && f.value == "E-Mail Address")
		f.value = "";
	else if (!b && f.value.length == 0)
		f.value = "E-Mail Address";
}

function fLoginSetPassword(f, b) {
	if (b) {
		f._pw_placeholder.style.display = "none";
		f._pw.style.display = "inline";
		f._pw.focus();
	} else if (!b && f._pw.value.length == 0) {
		f._pw.style.display = "none";
		f._pw_placeholder.style.display = "inline";
	}
}

var iOffsetX = -60;
var iOffsetY = 20;
var bIsNS = (document.getElementById && !document.all);
var bTipEnabled = false;
var oTip = null;

function fShowTip(sText, sColor, iWidth) {
	if (oTip == null) return;
	if (iWidth != undefined) oTip.style.width = iWidth + "px";
	if (sColor != undefined)
		if (sColor.length > 0)
			oTip.style.backgroundColor = sColor;
	oTip.innerHTML = sText;
	bTipEnabled = true;
	return false;
}

function fPositionTip(e) {
	if (bTipEnabled) {
		if (!bIsNS) var oDoc = ((document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body);
		var iX = ((bIsNS) ? e.pageX : (event.clientX + oDoc.scrollLeft));
		var iY = ((bIsNS) ? e.pageY : (event.clientY + oDoc.scrollTop));
		var iEdgeRight = ((!bIsNS && !window.opera) ? (oDoc.clientWidth - event.clientX - iOffsetX) : (window.innerWidth - e.clientX - iOffsetX - 20));
		var iEdgeBottom = ((!bIsNS && !window.opera) ? (oDoc.clientHeight - event.clientY - iOffsetY) : (window.innerHeight - e.clientY - iOffsetY - 20));
		var iEdgeLeft = ((iOffsetX < 0) ? (iOffsetX * -1) : -1000);
		if (iEdgeRight < oTip.offsetWidth) {
			oTip.style.left = ((!bIsNS) ? (oDoc.scrollLeft + event.clientX - oTip.offsetWidth) : (window.pageXOffset + e.clientX - oTip.offsetWidth)) + "px";
		} else if (iX < iEdgeLeft) {
			oTip.style.left = "5px";
		} else {
			oTip.style.left = (iX + iOffsetX) + "px";
		}
		if (iEdgeBottom < oTip.offsetHeight) {
			oTip.style.top = ((!bIsNS) ? (oDoc.scrollTop + event.clientY - oTip.offsetHeight - iOffsetY) : (window.pageYOffset + e.clientY - oTip.offsetHeight - iOffsetY)) + "px";
		} else {
			oTip.style.top = (iY + iOffsetY) + "px";
		}
		oTip.style.visibility = "visible";
	}
}

function fHideTip() {
	if (bTipEnabled) {
		bTipEnabled = false;
		oTip.style.visibility = "hidden";
		oTip.style.left = "-1000px";
		oTip.style.backgroundColor = "";
		oTip.style.width = "";
	}
}

var aTags = new Array('div','td','font');
var aSizes = new Array('8px', '10px', '12px', '14px', '18px', '24px', '36px');
var iStartSize = 2;

function fFontSize(iInterval) {
	if (!document.getElementById) return false;
	var d = document;
	var oElement = null;
	var iSize = iStartSize;
	iSize += iInterval;
	if (iSize < 0) iSize = 0;
	if (iSize > 6) iSize = 6;
	iStartSize = iSize;
	if (!(oElement = d.getElementById('body'))) oElement = d.getElementsByTagName('body')[0];
	oElement.style.fontSize = aSizes[iSize];
	for (var iIndex = 0; iIndex < aTags.length; iIndex++) {
		oTags = oElement.getElementsByTagName(aTags[iIndex]);
		for (var iIndex2 = 0; iIndex2 < oTags.length; iIndex2++) {
			if (aTags[iIndex] == "font") {
				if (oTags[iIndex2].size != "") oTags[iIndex2].size = (parseInt(oTags[iIndex2].size) + iInterval);
			} else {
				oTags[iIndex2].style.fontSize = aSizes[iSize];
			}
		}
	}
	fCreateCookie("FontSize", iSize, 90);
	return false;
}

function fLoadFontSize() {
	var sFontSize = fReadCookie("FontSize");
	if (sFontSize != null) {
		var iFontSize = parseInt(sFontSize);
		if (!isNaN(iFontSize)) {
			fCreateCookie("iFontSize", sFontSize, 90);
			fFontSize(iFontSize - iStartSize);
		}
	}
}

function fCreateCookie(sName, sValue, iDays) {
	if (iDays) {
		var dDate = new Date();
		dDate.setTime(dDate.getTime() + (iDays * 24 * 60 * 60 * 1000));
		var sExpires = "; expires=" + dDate.toGMTString();
	} else {
		var sExpires = "";
	}
	document.cookie = sName + "=" + sValue + sExpires + "; path=/";
}

function fReadCookie(sName) {
	var sNameEQ = sName + "=";
	var aC = document.cookie.split(';');
	for (var iIndex = 0; iIndex < aC.length; iIndex++) {
		var sCookie = aC[iIndex];
		while (sCookie.charAt(0) == " ") sCookie = sCookie.substring(1, sCookie.length);
		if (sCookie.indexOf(sNameEQ) == 0) return sCookie.substring(sNameEQ.length, sCookie.length);
	}
	return null;
}

function fGetAJAX() {
	var oAJAX = null;
	try {
		oAJAX = new XMLHttpRequest();
	} catch (e) {
		try {
			oAJAX = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				oAJAX = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// failed
			}
		}
	}
	return oAJAX;
}

var aLoadFunctions = new Array();

function fAddLoadFunction(sFunction) {
	aLoadFunctions.push(sFunction);
}

function fDoLoad() {
	for (var iIndex in aLoadFunctions)
		eval(aLoadFunctions[iIndex]);
}

/*fAddLoadFunction('fLoadFontSize();');*/

/* Begin Window Size Functions */
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
/* End Window Size Functions */

function fColorTR(o,c){o.parentNode.parentNode.className=((c)?'cTRHighlight':'');}

function htmlspecialchars(sString) {
	sString = sString.replace(/&/g, "&amp;");
	sString = sString.replace(/"/g, "&quot;");
	sString = sString.replace(/</g, "&lt;");
	sString = sString.replace(/>/g, "&gt;");
	return sString;
};

function fSocialBookmark(sURL) {
	window.open(sURL.replace(/#TITLE#/gi, encodeURIComponent(document.title)).replace(/#URL#/gi, encodeURIComponent(document.URL)));
};