// Floating menu based up on original script by:  Randy Bennett
// The JavaScript Source!! http://javascript.internet.com
// additional scripting obtained from 'JavaScript for the WWW' book

function setVariables() {
 showFirst=null
 timerID=null
 waitTime=3000
 checkInterval=100
 objIn=10
 objUp=320
 floatObj="menu"
 objSwitch="pindex"
 nextObjNa="linkFwd"
 objBG=".backgroundColor"
BGclear="=''"
 if (navigator.appName == "Netscape") {
	v = ".top="
	h = ".left="
	dS = "document."
	sD = ""
	y = "window.pageYOffset"
	x = "window.pageXOffset"
	iH = "window.innerHeight"
	}
 else {
	v = ".pixelTop="
	h = ".pixelLeft="
	dS = ""
	sD = ".style"
	y = "document.body.scrollTop"
	x = "document.body.scrollLeft"
	iH = "document.body.clientHeight"
	}
 if (document.getElementById){
 // 'standards-compliant browser'
 	v = ".top='"
	h = ".left='"
	u = "px'"
	dS = "document.getElementById('"
	sD = "').style"
	y = "parseInt("+y+")"
	x = "parseInt("+x+")"
	iH = "parseInt("+iH+")"
	}
 objSwitch=dS+objSwitch
	if (document.layers){
 		objSwitch=dS+floatObj+"."+objSwitch
		objBG=".bgColor"
		BGclear="=null"
 		// following two lines are for window resize bug workaround
		oW = window.innerWidth
		oH = window.innerHeight
 	}
  objBG=dS + floatObj + sD + objBG

}


function checkLocation() {
 var yy = eval(y)
 var xx = eval(x)
 //for debugging
 //window.status= (dS + floatObj + sD + v + (yy + eval(iH) - objUp) + u)+' --- '+(dS + floatObj + sD + h + (xx + objIn) + u)
 eval(dS + floatObj + sD + v + (yy + eval(iH) - objUp) + u)
 eval(dS + floatObj + sD + h + (xx + objIn) + u)
 if (!showFirst) {
 	eval(dS + floatObj + sD + ".visibility='visible'")
	showFirst="true"
 }
 setTimeout("checkLocation()", checkInterval)
}

function switchOn() {
if (timerID) { clearTimeout(timerID) }
 eval(objSwitch + sD + ".visibility='visible'")
 eval(objBG + "='black'")
}

function switchOff() {
 eval(objSwitch + sD +".visibility='hidden'")
 eval(objBG + BGclear)
}

function currentPage(currentURL) {
 var current=String(currentURL)
 var currentTemp=""
 for (i=current.length; i>11; i--) {
 	(current.charAt(i) == "#") ? currentTemp="" : currentTemp=current.charAt(i)+currentTemp
 }
 current=currentTemp
 var lenP = (current.length - 10)
 if (current.charAt(lenP) == "p") {
	lenP++
 }
 return (current.charAt(lenP) + current.charAt(lenP+1))
}

function pageFwd() {
 var currentP = currentPage(window.location)
 var nextP = "p"
 if (currentP.charAt(0)=="A") {
	nextP =null
 }
 else {
	currentP = Number(currentP)
	if (currentP == 98) {
		nextP += "A0-A1.html"
	}
	else {
		if (currentP < 8) {
			nextP += "0"
		}
		nextP += (currentP + 2)+"-"+(currentP + 3)+".html"
	}
 }
if (nextP) {return ("<a href='"+nextP+"' title='One page forward'><span class='float_index'>next</span></a>") }
else {return ""}
}

function pageBack() {
 var currentP = currentPage(window.location)
 var nextP = "p"
 if (currentP.charAt(0)=="A") {
	nextP += "98-99.html"
 }
 else {
	currentP = Number(currentP)
	if (currentP == 2) {
		nextP = "index.html"
	}
	else {
		if (currentP < 12) {
			nextP += "0"
		}
		nextP += (currentP - 2)+"-"+(currentP - 1)+".html"
	}
 }
return ('<a href="'+nextP+'" title="One page back"><span class="float_index">back</span></a>')
}

function chPage(newPageURL) {
	document.location = newPageURL
}

function resizeFix() {
// netscape 4 resize bug workaround from JS for WWW book
if (document.layers) {
	if (window.innerWidth != oW || window.innerHeight != oH) {
		window.location.reload()
	}
}
}

// for debugging.. use function call..
// alert(show_props(document.menu.document.linkFwd, ".linkFwd"))

function show_props(obj, obj_name) {
          var result = ""
          for (var i in obj)
                    result += obj_name + "." + i + " = " + obj[i] + "\n"
          return result
}
