// =========================================================
//
// . . . . . WA2009 MENU HANDLER
// . . . . . by töff, mid-2008 ff., adapted to WA 2009-05-17
//
// =========================================================
var LinkCt = 0
var Link = new Array()
var showItmTxt = " "
var mousie = " onmouseover=' this.style.cursor=\"pointer\" ; this.style.color=\"#ffaa00\" ; ' "
mousie +=" onmouseout =' this.style.cursor=\"default\" ; this.style.color=\"#5f4500\" ; ' "
function LinkName (name) {
	LinkCt+=1
	Link[LinkCt] = new Object()
	Link[LinkCt].Name = name
}
function LinkSection (section) { Link[LinkCt].Section = section }
function LinkURL (url) { Link[LinkCt].URL = url }
function LinkTarget (target) { Link[LinkCt].Target = target }
function LinkType (type) { Link[LinkCt].Type = type }
// =======================================
function ShowSection(whichSection,whichState) {
	showItmTxt=" "
	showItmTxt+="<p class=navboxsection><nobr>"
	showItmTxt+="\n <span "
	showItmTxt+= mousie
	showItmTxt+=" onClick=' "
	showItmTxt+=" toggle(\""+whichSection+"\"); "
	showItmTxt+=" toggle(\""+whichSection+"GREEN\"); "
	showItmTxt+=" toggle(\""+whichSection+"RED\"); "
	showItmTxt+="'>"
	// show & hide arrows
		showItmTxt+="<span id='"+whichSection+"GREEN' style='display:"
		if (whichState==0) { showItmTxt+="none" } else { showItmTxt+="inline" }
		showItmTxt+="'><img src=http://www.worldearcane.com/zz.collapseGREEN.png border=0 align=absmiddle></span>"
		showItmTxt+="<span id='"+whichSection+"RED' style='display:"
		if (whichState==1) { showItmTxt+="none" } else { showItmTxt+="inline" }
		showItmTxt+=" '><img src=http://www.worldearcane.com/zz.collapseRED.png border=0 align=absmiddle></span>"
	showItmTxt+="&nbsp;"+whichSection //.toLowerCase()
	showItmTxt+="</span></nobr>"
	// show & hide Items in this section
		showItmTxt+="<div id='"+whichSection+"' style='display:"
		if (whichState==0) { showItmTxt+="none" } else { showItmTxt+="inline" }
		showItmTxt+="'>"
	for ( s=1;s<=LinkCt;s++) {
		if (Link[s].Section==whichSection) {
				showItmTxt+=LinkTxt(s)
		}
	}
	showItmTxt+=" </div>"
	document.write(showItmTxt)
}
// =======================================
function LinkTxt(whichNum) {
	LinkHTML = " "
	LinkHTML+="\n<!-- Item "+whichNum+" -->"
	LinkHTML+="\n<p class=navboxlink>"
	LinkHTML+="\n<a "
	LinkHTML+=" type="+Link[whichNum].Type+ " "
	LinkHTML+=" number="+whichNum+ " "
	switch (Link[whichNum].Type) {
		case 1 : LinkHTML+=" href="+Link[whichNum].URL+" target="+Link[whichNum].Target ; break ;
		case 2 : LinkHTML+=" href=http://"+Link[whichNum].URL+" target="+Link[whichNum].Target ; break ;
		case 3 : LinkHTML+=" href=mailto:"+Link[whichNum].URL ; break ;
		case 4 : LinkHTML+=" href="+Link[whichNum].URL+" target="+Link[whichNum].Target ; break ;
	}
	LinkHTML+=" >"
	LinkHTML+=Link[whichNum].Name
	LinkHTML+="</a>"
	return LinkHTML
}
// =======================================
function GetLinkNum(whichName) {
	for (var x=1;x<=LinkCt;x++) { if (Link[x].Name==whichName) { return x } }
}
// =======================================
function ShowLink(whichName) {
	showLinkTxt=LinkTxt(whichName)
	document.write(showLinkTxt)
}
// =======================================
function ShowAll() {
	// ShowLink(GetLinkNum('M&M Home'))
	// ShowLink(GetLinkNum('Library'))
	ShowSection('The Stories',1)
	ShowSection('The Worlde',0)
	ShowSection('The RPG',0)
	ShowSection('Tools',0)
	ShowSection('Library',0)
	ShowSection('Games',0)
	ShowSection('Help',0)
	ShowSection('Private',0)
}
// =======================================
function toggle(which) {
	if (document.getElementById(which).style.display=='none') { document.getElementById(which).style.display = 'inline'; }
	else { document.getElementById(which).style.display = 'none'; }
}
// =======================================
//
// Linktype: 1 = Discus page, 2 = External WWW, 3 = Mailto
// Stories
	LinkName("Last 2 Hours")	; LinkSection("The Stories")	; LinkURL("/cgi-bin/discus/search.cgi?method=last&number=1&units=120&tree=ON&where=all")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Last 5 Hours")	; LinkSection("The Stories")	; LinkURL("/cgi-bin/discus/search.cgi?method=last&number=1&units=300&tree=ON&where=all")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Last 24 Hours")	; LinkSection("The Stories")	; LinkURL("/cgi-bin/discus/search.cgi?method=last&number=1&units=1440&tree=ON&where=all")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Last 72 Hours")	; LinkSection("The Stories")	; LinkURL("/cgi-bin/discus/search.cgi?method=last&number=1&units=4320&tree=ON&where=all")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Keyword Search")	; LinkSection("The Stories")	; LinkURL("/cgi-bin/discus/search.cgi")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Players &amp; Stories Wanted!")	; LinkSection("The Stories")	; LinkURL("/discus/messages/8643/8643.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("in <b><i>Wayfarer</i></b>")	; LinkSection("The Stories")	; LinkURL("/Wayfarer")	; LinkTarget("_top")	; LinkType(1)
	LinkName("The <b><i>Herald</i></b>")	; LinkSection("The Stories")	; LinkURL("worldearcaneherald.wordpress.com/")	; LinkTarget("_top")	; LinkType(2)
// Worlde
	LinkName("Characters")	; LinkSection("The Worlde")	; LinkURL("/Characters.shtml")	; LinkTarget("_top")	; LinkType(1)
	LinkName("LPC's")	; LinkSection("The Worlde")	; LinkURL("/LPC.shtml")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Communities")	; LinkSection("The Worlde")	; LinkURL("/discus/messages/4988/4988.html")	; LinkTarget("_top")	; LinkType(1)
// LinkName("<i>The&nbsp;Herald</i>")	; LinkSection("The Worlde")	; LinkURL("/Herald/z.herald.frames.shtml")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Lands")	; LinkSection("The Worlde")	; LinkURL("/cgi-bin/discus/discus.cgi?pg=topics")	; LinkTarget("_top")	; LinkType(1)
// RPG
	LinkName("Rules")	; LinkSection("The RPG")	; LinkURL("/discus/messages/15977/17126.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Join Us!")	; LinkSection("The RPG")	; LinkURL("/discus/messages/15977/17127.html")	; LinkTarget("_top")	; LinkType(1)
// Library
	LinkName("Bestiary" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17118.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Calendar" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17119.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Timeline" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17120.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Coinage &amp; Barter")	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17121.html")	; LinkTarget(" ")	; LinkType(4)
	LinkName("Deities" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17122.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Histories" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17123.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Magick" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17124.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Maps" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/15979.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Races" )	; LinkSection("Library")	; LinkURL("/discus/messages/15977/17125.html")	; LinkTarget("_top")	; LinkType(1)
// LinkName("Soundtrack" )	; LinkSection("Library")	; LinkURL("/Soundtrack/indexcontrol.shtml")	; LinkTarget("soundtrackcontrol")	; LinkType(1)
// LinkName("Worlde Arcane Font (TTF)")	; LinkSection("Library")	; LinkURL("/WORLA___.TTF")	; LinkTarget("_top")	; LinkType(1)
// Tools
	LinkName("Keyword Search")	; LinkSection("Tools")	; LinkURL("/cgi-bin/discus/search.cgi")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Your Profile")	; LinkSection("Tools")	; LinkURL("/cgi-bin/discus/board-profile.cgi")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Forgot Password")	; LinkSection("Tools")	; LinkURL("/cgi-bin/discus/board-profile.cgi?action=forgot")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Moderators")	; LinkSection("Help")	; LinkURL("/cgi-bin/discus/board-contact.cgi")	; LinkTarget("_top")	; LinkType(1)
// Games
	LinkName("Doubles Drink")	; LinkSection("Games")	; LinkURL("/discus/messages/138/5715.html#POST5083")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Harb Zar")	; LinkSection("Games")	; LinkURL("/HarbZar.shtml")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Dead Man's Tale")	; LinkSection("Games")	; LinkURL("/discus/messages/138/13179.html#POST68981")	; LinkTarget("_top")	; LinkType(1)
// Help
	LinkName("FAQ")	; LinkSection("Help")	; LinkURL("/FAQ")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Email Mentor")	; LinkSection("Help")	; LinkURL("mentor@worldearcane.com")	; LinkTarget(" ")	; LinkType(3)
	LinkName("Formatting")	; LinkSection("Help")	; LinkURL("/cgi-bin/discus/discus.cgi?pg=formatting")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Credits")	; LinkSection("Help")	; LinkURL("/Credits.shtml")	; LinkTarget("_top")	; LinkType(1)
// Private
	LinkName("Admin")	; LinkSection("Private")	; LinkURL("/cgi-bin/discus/discus.cgi?pg=admin")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Uploader")	; LinkSection("Private")	; LinkURL("/AboutImages/upload.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Pantheon")	; LinkSection("Private")	; LinkURL("/cgi-bin/discus/board-auth.cgi?file=/299/299.html")	; LinkTarget("_top")	; LinkType(1)
	LinkName("Conclave")	; LinkSection("Private")	; LinkURL("/cgi-bin/discus/board-auth.cgi?file=/929/929.html")	; LinkTarget("_top")	; LinkType(1)
// ================================================
// Seals prep
var original=1 ; var broken=2 ; var repaired=3 ; var underlord=4
var Seal = new Array() ; var SealCt=0
function AddSeal(sealtype,sealtopic,sealpage) {
	SealCt+=1
	Seal[SealCt] = new Object
	Seal[SealCt].Type = sealtype
	Seal[SealCt].URL = "http://www.worldearcane.com/cgi-bin/discus/show.cgi?"+sealtopic+"/"+sealpage
}
// Load Seals DB
document.write('<script src="http://www.worldearcane.com/UnderLord/sealsdb/seals.js" type="text/JavaScript"><\/script>');
AddSeal(underlord,8643,17168)
// Show Seals
function pick(max) { return Math.floor(Math.random()*max)+1 }
function ShowSeals() {
	var BrokenCt = 12 // depends how many graphics we have
	var SealNum = pick(SealCt)
	var BrokenNum = pick(BrokenCt)
	ShowSealTxt = " " ; 
	for (ss=1;ss<=SealCt;ss++) {
		SealNum+=1 ; if (SealNum>SealCt) { SealNum-=SealCt }
		BrokenNum+=1 ; if (BrokenNum>BrokenCt ) { BrokenNum-=BrokenCt }
		ShowSealTxt+="<a href="+Seal[SealNum].URL+" target=\"_top\""
		ShowSealTxt+=" SealNum="+SealNum+" BrokenNum="+BrokenNum
		ShowSealTxt+="><img border=0 src="
		ShowSealTxt+="http://www.worldearcane.com/UnderLord/z-Seal-"
		switch (Seal[SealNum].Type) {
			case 1 : ShowSealTxt+="1-Original"+".png  title=\"Original Seal\">" ; break ;
			case 2 : ShowSealTxt+="2-Broken-"+BrokenNum+".png   title=\"Broken Seal\">" ; break ;
			case 3 : ShowSealTxt+="3-Repaired"+".png   title=\"Repaired Seal\">" ; break ;
			case 4 : ShowSealTxt+="4-UnderLord"+".png   title=\"The Return Of The Dark UnderLord\">" ; break ;
		}
		ShowSealTxt+="</a> "
		if (ss==SealCt-2) { ShowSealTxt+="<nobr>" } 
	}
	ShowSealTxt+="</nobr>"
	document.write(ShowSealTxt)
}
// ================================================
