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
var ClassCurrentItem = "current-item";

function resizeFont(Mode) {
	var DEFAULT_FONTSIZE = 72;
	var FONTSIZE_MAX = 120
	var 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;
	// limiting for font-sizes
	if (NewFontSize < FONTSIZE_MIN)
		NewFontSize = FONTSIZE_MIN;
	if (NewFontSize > FONTSIZE_MAX)
		NewFontSize = FONTSIZE_MAX;
	
	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 pity, but Opera doesn't handle it correctly
		var ListItem = document.getElementById("list-item-" + NumberListItem);
		if (! (ListItem.className == ClassCurrentItem))
			ListItem.style.listStyleType = "disc";
	}
}

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


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");
}

function switchAtlasButton(Mode) {
	// alert('button');
	var Img = new Image();
	
	Img = document.getElementById('atlas-button');
	if (Mode == 0)
		Img.src = 'pics/pageframe/button_atlas.gif';
	else
		Img.src = 'pics/pageframe/button_atlas_hover.gif';
}


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);
	}
}

