var NavigatorOpera = (navigator.appName == 'Opera');			// used for ListItem-HoverEffect
var CurFontSize = null;			// global variable, so that CurFontSize doesn't have to be read in anew when resizing stepwise

function resizeFont(Mode) {
	var DEFAULT_FONTSIZE = 75;
	var FONTSIZE_MAX = 140, FONTSIZE_MIN = 50;
	var RESIZE_STEP = 4;
	var SizeDelta = RESIZE_STEP;
	var NewFontSize;

	if (! CurFontSize) {
		if (document.cookie) CurFontSize = getCookieValue("FontSize");
	}
	if (! CurFontSize) CurFontSize = DEFAULT_FONTSIZE;

	if (Mode == "-") SizeDelta = SizeDelta * -1;

	NewFontSize = parseInt(CurFontSize) + SizeDelta;
	if (NewFontSize < FONTSIZE_MAX && NewFontSize > FONTSIZE_MIN) { 		// setting limits for font-sizes
		document.getElementsByTagName("body")[0].style.fontSize = String(NewFontSize) + "%";
		document.cookie = "FontSize=" + NewFontSize;		// user-FontSize is saved for this session
		CurFontSize = NewFontSize;
	}
	return false;
}

function getCookieValue(CookieName){
	if (document.cookie) {
		var StringToFind = CookieName + "=";
		var CookieStart = document.cookie.indexOf(StringToFind);
		if (CookieStart > -1) {
			var CookieValueStart = CookieStart + StringToFind.length;
			var CookieValueEnd = document.cookie.indexOf(";", CookieValueStart);
			CookieValueEnd = (CookieValueEnd > -1)? CookieValueEnd : document.cookie.length;
			var CookieValue = document.cookie.substring(CookieValueStart, CookieValueEnd);
			CookieValue = (CookieValue.length == 0)? null : unescape(CookieValue); 
			return CookieValue;
		}
	}
	return null;
}

function showBullet(NumberListItem) {
	if (! NavigatorOpera) {				// it'a petty, but Opera doesn't handle it correctly
		var ListItem = document.getElementById("ListItem" + NumberListItem);
		if (! (ListItem.className == "CurrentListItem")) ListItem.style.listStyleType = "disc";
	}
}

function hideBullet(NumberListItem) {
	if (! NavigatorOpera) {				// it'a petty, but Opera doesn't handle it correctly
		var ListItem = document.getElementById("ListItem" + NumberListItem);
		if (! (ListItem.className == 'CurrentListItem')) ListItem.style.listStyleType = "none";
	}
}

function openPopupWindow(Href, Width, Height) {
	var WindowParams = "width=" + Width + ",height=" + Height + ",resizable=yes,scrollbars=yes,dependent=yes";
	var PopupWindow = window.open(Href, "Popup", WindowParams);
	PopupWindow.focus();
}

function showButtonStyle(ButtonID, Style) {		// Style can be 'hover' or 'normal'
	if (document.all) {				// we don't need this for mozilla cause it handles CSS correctly
		var ClassAttribute = document.createAttribute('class');
		Style == 'hover' ? ClassAttribute.nodeValue = 'CustomHover' : ClassAttribute.nodeValue = 'Custom';
		document.getElementById(ButtonID).setAttributeNode(ClassAttribute);
	}
}

function hideElement(ElementID) {
	document.getElementById(ElementID).style.display = "none";
}

function showElement(ElementID, DisplayStyle) {
	if (! DisplayStyle) DisplayStyle = "block";
	document.getElementById(ElementID).style.display = DisplayStyle;
}

function expandText() {
	hideElement("more-linker");
	showElement("more-text");
	showElement("less-linker");
}

function reduceText() {
	showElement("more-linker");
	hideElement("more-text");
	hideElement("less-linker");
}
