divs = new Array();
/*

0 = root
1 = antti
2 = news
3 = work

*/

divs[0] = new Array("antti", "news", "work");

divs[1] = new Array();
divs[2] = new Array();
divs[3] = new Array("cf1", "cf2", "cf3", "cf4", "cf5", "mom1", "mom2", "mom3", "h1", "h2", "h3", "h4", "d1", "r1");

function change(Realm, Changer) {
	for (Div in divs[Realm]) {
		if (divs[Realm][Div] != Changer) {
			if (Realm == 0) {
				for (i=1; i<=divs[Realm].length; i++) {
					for (Element in divs[i]) {
						document.getElementById(divs[i][Element]).style.display = "none";
					}
				}
			}
			document.getElementById(divs[Realm][Div]).style.display = "none";
		} else {
			if (document.getElementById(divs[Realm][Div]).style.display == "none") {
				document.getElementById(divs[Realm][Div]).style.display = "block";
			} else {
				document.getElementById(divs[Realm][Div]).style.display = "none";
			}
		}
	}
}



function toggle(layerId) {
	if (document.getElementById) {
		if (document.getElementById(layerId).style.display == "none") {
			document.getElementById(layerId).style.display = "block";
			return;
		} else {
			document.getElementById(layerId).style.display = "none";
			return;
		}
	}
}

function on(layerId) {
	if (document.getElementById) {
			document.getElementById(layerId).style.display = "block";
	}
}

function off(layerId) {
	if (layerId == "all") {
		for (Div in divs[0]) {
			document.getElementById(divs[0][Div]).style.display = "none";
		}
		return;
	}
	if (document.getElementById) {
			document.getElementById(layerId).style.display = "none";
	}
}


<!-- Char: actual character, Glyph: dotted pattern of character -->
<!-- Pixel: Screen-pixel, Dot: Square of A x A screen pixels with A = DotSize
<!-- DivYPos, GlyphSet, TypeId, LinkHref werden weitergereicht an Write, Type wird in Einzelzeichen aufgespalten -->

function WriteLine(DivYPos, GlyphSet, TypeId, Type, LinkHref) {

	<!-- GlyphPos wird über die Line-Eingabe kontinuierlich um die Breite des vorigen Buchtabens aufaddiert -->
	GlyphPos = 0;	
	for (CharPos=0; CharPos<Type.length; CharPos++) {
		if (CharPos > 0) {
			GlyphPos = GlyphPos + glyphs[GlyphSet][Type.charAt(CharPos-1)]["string"][1].length;
		}

		<!-- Aufruf der Write-Funktion, wobei 
		<!-- 	DivYPos:		Y-Offset der Linien-div in Dots
		<!-- 	TypeId:			ID-key für die Linien-div
		<!-- 	Type.charAt: 	Einzelzeichen (Schlüssel zum glyphs[GlyphSet]-Hash extrahiert aus dem Type-String)
		<!-- 	GlyphPos:		Offset des Zeichens in Relation zum Beginn der Zeile in Dots (akkumuliert aus Zeichenbreiten)
		<!--	DotSize:		Umrechnungsziffer
		<!-- 	CharPos:		Lfd.Nr. des Zeichens in der Zeichenfolge
		<!--	LinkHref:		Verweisziel für die Linien-div
		Write(DivYPos, GlyphSet, TypeId, Type.charAt(CharPos), GlyphPos, DotSize, CharPos, LinkHref);
	}
}



function Write(DivYPos, GlyphSet, TypeId, Char, GlyphPos, DotSize, CharPos, LinkHref) {
	document.write ("<div style='z-index:100; width:" + glyphs[GlyphSet][Char]["string"][1].length * DotSize + "px; top:" + (DivYPos + Padding) * DotSize + "px; left:" + (GlyphPos + Padding) * DotSize + "px'>");

	for (Line in glyphs[GlyphSet][Char]["string"]) {

		for (i=0; i<glyphs[GlyphSet][Char]["string"][Line].length; i++) {

			<!-- GifId: TypeId($) + Position des Chars in der Kette(#) + Character($) + Lfd.Nr. des GIFs in der Glyph-Grafik(#)
			GifId = TypeId.concat(String(CharPos)).concat(Char).concat(String(Line * glyphs[GlyphSet][Char]["string"][Line].length + i));

			if (glyphs[GlyphSet][Char]["string"][Line].charAt(i) == 0) {
				document.write ("<a href='" + LinkHref + "'><img name='gif" + GifId + "' src='0.gif' width='" + DotSize + "' height='" + DotSize + "' onMouseOver=\"Rollover('gif" + GifId + "','gif_1');\"></a>");
			} else {
				document.write ("<a href='" + LinkHref + "'><img name='gif" + GifId + "' src='no.gif' width='" + DotSize + "' height='" + DotSize + "' onMouseOver=\"Rollover('gif" + GifId + "','gif_0');\"></a>");
			}
		}
	}
	document.write ("</div>");
}





function Rollover(Bildnr,Bildobjekt) {
	if (!(Bildobjekt == "gif_1" && (navigator.appName.match("Explorer") || navigator.appName.match("Opera")))) {
		document.images[Bildnr].src = eval(Bildobjekt +".src");
	}
}





function Background(DotSize) {
	if (!(navigator.appName.match("Explorer") || navigator.appName.match("Opera"))) {
		document.write ("<div onClick='off(\"all\")' style='z-index:0; width:" + (window.innerWidth - 3 * DotSize) + "px; position:absolute'>");
		count = ((window.innerWidth - 3 * DotSize) / DotSize) * ((window.innerHeight - DotSize) / DotSize);
		for (i=0; i<count ; i++) {
			document.write ("<img onMouseOver='Rollover(\"gif" + i + "\", \"gif_1\")' name='gif" + i + "' src='0.gif' width='" + DotSize + "' height='" + DotSize + "'>");
		}
		document.write ("</div>");
		return;
	}
}






