//* Direkter Zugang zu Publikationen www.soziothek.ch/?xxxx xxxx=Bestellnummer
var dirAccess = (location.search) ? location.search : "";
access = "programm.htm"; // default-Seite
if (dirAccess != "") {
	dirAccess = dirAccess.substr(1,dirAccess.length)
	//* Aufruf einer bestimmten Seite
	if (dirAccess.indexOf("Seite:")==0 || dirAccess.indexOf("seite:")==0) {
		dirAccess = dirAccess.substr(6,dirAccess.length);
		var i1 = 0;
		var i2 = 0;
		if (dirAccess.indexOf(",")>-1) {
			i1 = dirAccess.substr(0,dirAccess.indexOf(","))-1;
			i2 = dirAccess.substr(dirAccess.indexOf(",")+1)-1;
		} else if (dirAccess.indexOf(".")>-1) {
			i1 = dirAccess.substr(0,dirAccess.indexOf("."))-1;
			i2 = dirAccess.substr(dirAccess.indexOf(".")+1)-1;
		} else if (!isNaN(dirAccess)) {
			i1 = dirAccess-1;
		}
		var access = menu_items[i1][2][i2][1];
		var link = "";
		var anker = "";
		if (access.indexOf("#")>-1) {
			anker = access.substr(access.indexOf("#")+1);
			link = access.substr(0,access.indexOf("#"));
		} else {
			link = access;
		}
		access = "frames.html?" + link + ",m" + i1 + "," + anker;
		window.location.href=access;
	} else if (dirAccess.indexOf("Reihe:")==0) {
		dirAccess = dirAccess.substr(6,dirAccess.length);
		window.location.href="frames.html?reiheaufruf.htm?"+dirAccess+",m1,";
	} else {
		var a=0, test=true;
		for (a=0; a<AnzahlPub; a++) {
			if (publDB[a][6]==dirAccess) {
				test=false;
				access=publDB[a][5];
				break;
			}
		}
		if (test) {
			alert("Die Publikation konnte nicht gefunden werden!" +
			" Es wird die vollständige Liste aller Publikationen aufgerufen.")
		}
		var link = access.substring(0,access.indexOf("#"));
		var anker = access.substring(access.indexOf("#")+1);
 		access = "frames.html?" + link + ",'m1'," + anker;
 		window.location.href=access;
	}
}

//* Menu schreiben
function writeMenu() {
	var tpos1 = 4;
	var tpos2 = 0;
	for (var i=0; i<menu_items.length; ++i) {
		if (menu_items[i]==null) continue;
		if (menu_items[i][1]=="index.html") continue;
		//--- Rotes Quadrat
		window.document.write("<div id='l"+i+"' class='m1'");
		window.document.write("style='position:relative; left:5px; ");
		window.document.write("top:"+tpos1+"px; height:10px; width:15px; ");
		window.document.write("font-size:12pt; ");
		window.document.write("background-color:red; cursor:pointer' ");
		window.document.write("onMouseover=" + unescape("%22") + "mover('l" + i + "')" + unescape("%22") + " ");
		window.document.write("onMouseout=" + unescape("%22") + "mout('l" + i + "')" + unescape("%22") + ">");
		window.document.writeln("&nbsp;</div>");
		
		//--- Text
		window.document.write("<div id='m"+i+"' class='m1' ");
		window.document.write("style='position:relative; margin-left:30px; top:"+(tpos1-13)+"px; cursor:pointer' ");
		window.document.write("onMouseover=" + unescape("%22") + "mover('l" + i + "')" + unescape("%22") + " ");
		window.document.write("onMouseout=" + unescape("%22") + "mout('l" + i + "')" + unescape("%22") + " ");
		window.document.write("onClick=" + unescape("%22") + "goTo('m"+i+"','"+menu_items[i][1]+"')" + unescape("%22") + ">");
		window.document.writeln(menu_items[i][0]+"</div>");
		tpos1 = tpos1 + 4;
	}
}
function mover(id) {
	window.document.getElementById(id).style.background="#FF9999";
	var mid = "m" + id.substring(1);
	window.document.getElementById(mid).style.textDecoration="underline";
	window.document.getElementById(mid).style.fontWeight="bolder";
	window.document.getElementById(mid).style.backgroundColor="#FFCCCC";
}
function mout(id) {
	window.document.getElementById(id).style.background="#FF0000";
	var mid = "m" + id.substring(1);
	window.document.getElementById(mid).style.textDecoration="none";
	window.document.getElementById(mid).style.fontWeight="normal";
	window.document.getElementById(mid).style.backgroundColor="#FFFFFF";
}
function goTo(m,f) {
	//window.location.href="frames.html?" + f + "," + m + "," + anker;
	window.location.href="frames.html?" + f + "," + m + ",";
}

function writeNeu() {
	var AnzahlNeu=0;
	for (a=0; a<AnzahlPub; a++) {
		if (publDB[a][4]=="Neu") {
			AnzahlNeu++;
		}
	}
	window.document.write("<p style='margin-top:0px; margin-left:0px; font-size:10pt; color:#ff0000;'>");
	window.document.write("<b>Aktuell verfügbar:</b><br>");
	window.document.write("<a href='programm.htm' style='color:#ff0000'>"+AnzahlPub+"&nbsp;Publikationen</a>,&nbsp;");
	window.document.write("<a href='reihe.htm' style='color:#ff0000'>"+reiheArray.length+"&nbsp;Publikationsreihen</a>,&nbsp;");
	window.document.write("<a href='neu.htm' style='color:#ff0000'>"+AnzahlNeu+"&nbsp;Neuerscheinungen</a></p>");
	window.document.write("<p style='margin-top:0px; margin-bottom:0px; margin-left:0px; font-size:10pt; color:#ff0000;'>");
	window.document.write("<b>Neuerscheinungen:</b></p>");
	for (a=0; a<AnzahlPub; a++) {
		if (publDB[a][4]=="Neu") {
			window.document.write("<p style='margin-left:0px; margin-right:40px; margin-top:6px; margin-bottom:6px'>");
			window.document.write(publDB[a][0]+" ("+publDB[a][7]+")<br>");
			window.document.write("<b>"+publDB[a][1]+"</b> -&nbsp;");
			window.document.write("<a style='color:#ff0000' href='javascript:goto(\""+publDB[a][5]+"\")'>Info</a><br>");
			window.document.write("</p>");
		}
	}
}

function goto(access) {
	var link = access.substring(0,access.indexOf("#"));
	var anker = access.substring(access.indexOf("#")+1);
	access = "frames.html?" + link + ",'m1'," + anker;
	window.location.href=access;
}

function setLogoSize(id, s) {
	var title = "ltit"+id;
	var logo = "logo"+id;
	var link = "llink"+id;
	if (s=="big") {
			document.getElementById(title).style.fontSize="12pt";		
			document.getElementById(logo).height=document.getElementById(logo).height*2;
			document.getElementById(logo).width=document.getElementById(logo).width*2;
			document.getElementById(link).style.fontSize="12pt";
		
	} else {
			document.getElementById(title).style.fontSize="8pt";
			document.getElementById(logo).height=document.getElementById(logo).height/2;
			document.getElementById(logo).width=document.getElementById(logo).width/2;
			document.getElementById(link).style.fontSize="8pt";
	}
}
