var isNav4, isIE5
var range = ""
var styleObj = ""
var OpSys
if (navigator.appVersion.charAt(0) == "4") {
	if (navigator.appName >= "Netscape") {
		isNav4 = true
		document.captureEvents(Event.KEYDOWN)
	} else {
		isIE5 = true
		range = "all."
		styleObj = ".style"
	}
}

if(navigator.userAgent.indexOf('Mac') != -1) { 
	OpSys = "Mac"; 
} else {
	OpSys = "Win";
}

// Convert object name string or object reference into a valid object reference
function getObject(obj) {
	var theObj
	theObj = document.getElementById(obj)


	//if (typeof obj == "string") {
	//	theObj = eval("parent.frames[0].document." + range + obj + styleObj)
	//} else {
	//	theObj = obj
	//}
	//return theObj
}

function netscapeReload() {
	if (isNav4 == true) {
	window.frames[0].location = "menu.htm"
		///location.reload()
	}
}

var activeState = ""
var currentState = ""
var mapName = "sidebar"
var theActiveBtn = "activeBtnHilite"

var btnHilite = new Array(11)
 btnHilite[0] = "per4Hilite"
 btnHilite[1] = "per5Hilite"
 btnHilite[2] = "per6Hilite"
 btnHilite[3] = "calendarHilite"
 btnHilite[4] = "syllabusHilite"
 btnHilite[5] = "emailHilite"
 function MouseOverBtn(btnNum) {
//	var theInfo
//  	theInfo = btnName[btnNum-1]
	var theHilite = btnHilite[btnNum-1];
	//var theLabel = labelName[btnNum-1];
	//var theMsg = btnName[btnNum-1];
	activeState = theHilite;
	//setMsg(theMsg)
	if (isNav4 == true) {
		var thePath = eval("document." + mapName + ".document" +".layers[theHilite]")
		thePath.visibility = "show"
	} else {
	 var theObj = document.getElementById(theHilite); //getObject(theHilite);
		theObj.style.visibility = "visible";
		///alert(theObj)
	}
	//alert(theObj)
}

function clearHilite(btnNum) {
// var theLabel = labelName[btnNum-1];
 setMsg('')
 if (activeState) {
	if (isNav4 == true) {
		var thePath = eval("document." + mapName + ".document" +".layers[activeState]")
		thePath.visibility = "hide"
	}else{
	 	var theObj = document.getElementById(activeState); //getObject(activeState);
		theObj.style.visibility = "hidden";
	}
  }	
	return true
}

function setMsg(msg) {
	window.status = msg
	return true
}

function clickBtn(thePage) {
	//target="Dynamic" 	theVis = true
	switch (thePage) {
   		case 1:
  			displayGrades(1,493,469);
  			break
  		case 2: 
 	  		displayGrades(2,778,430);
  	  		break
 		case 3: 
 	  		displayGrades(3,778,430);
  	  		break
  		case 4: 
 			displayCalendar("biocal0901",766,590);
  	  		break
		case 5: 
 	  		theURL = "notes/biosyllabus.html";
			theLeft = 55
  			theTop = 248 
  			clearHilite(5)
  			window.open(theURL, "NewWindow", "toolbar,status,resizable,location,directories,menubar,scrollbars")
 	  		//location.href=theURL
  	  		break
  	  	case 6: 
 			href="mailto:bdoltar@pps.k12.or.us"
  	  		break

  	}
	if (thePage != 7) {
	  	//positionActive(theLeft,theTop,theVis)
		//parent.frames["Dynamic"].location.href=theURL		
	}
}


function goOtherSite(theURL) {
	window.open(theURL, "NewWindow", "toolbar,status,resizable,location,directories,menubar,scrollbars")
}

function goWithinSite(theURL) {
	parent.frames["Dynamic"].location.href=theURL;
	if (isNav4 == true) {
		//var thePath = eval("document." + mapName + ".document" + ".activeBtn");
		var thePath = eval("parent.frames[0].document.sidebar.document.activeBtn");
			thePath.visibility = "hide";
	} else {
	 	var theActive = document.getElementById(btnHilite[9]); //getObject(btnHilite[9]);
			theActive.style.visibility = "hidden";
	}
}
var gradesWD
function displayGrades(thePer,theName,theW,theH,theDate,showTooLate) {
	clearHilite(thePer)
 	var theGrades = "<IMG SRC='grades/Per"+theName+".gif' ALT='' height="+theH+","+"width="+theW+">"
	if (gradesWD && !gradesWD.closed) {
		gradesWD.close()
	}
	var theW2 = theW + 36
	var theH2 = theH + 48
		gradesWD = window.open("","","toolbar,status,location,directories,menubar,scrollbars=1,resizable=1,height="+theH2+","+"width="+theW2)
		if (!gradesWD.opener) {
			gradesWD.opener = window
		}
		// assemble content for new window
		var newContent = "<HTML><HEAD><TITLE>Period " + theName + " Grades</TITLE></HEAD>"
		//newContent += "<BODY leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' BGCOLOR='#ffffff'>"
		//newContent += "<BR>  Sorry, no grades yet!"
		newContent += theGrades 
		if (showTooLate == true) {
		//newContent += "<br>This is the 1st Quarter Grade! &nbsp;&nbsp;";
		  //  newContent += "<br>Assignments 1-18 can no longer be turned in.   Assignments 19-27 must be completed by 11/2/10."
           //newContent += "<br> Assignments 32-51 can no longer be turned in. All others must be completed by 6/9/11.  "
			//newContent += "<br>  All missing assignments must be turned by 4/28/11.  "
		  newContent += "<br> This is the 2nd Semester grade.  "
		 //newContent += "<br>Assignments 1-6 must be turned in by 3/15." 
               }else{
	          //newContent += "<BR>  Sorry, no grades yet!."
		}
		 //newContent += "<BR>Late assignments will no longer be accepted for this semester.  Have a safe and enjoyable summer."
		newContent += "<FONT COLOR = '#FF0000'><BR>Updated on " +theDate+".</FONT>"
		newContent += "</BODY></HTML>"
		// write HTML to new window document
		gradesWD.document.write(newContent)
		gradesWD.document.close() // close layout stream
}

var calendarWD
function displayCalendar(theName,theW,theH,theDate) {
	clearHilite(4)
	var theHeight = (theH + 40)
 	var theCal = "<IMG SRC='calendars/"+theName+".gif' ALT='' height="+theH+","+"width="+theW+">"
	if (calendarWD && !calendarWD.closed) {
		calendarWD.close()
	}
	//if (!newWindow || newWindow.closed) {
	var theW2 = theW + 12
	var theH2 = theH + 36
		calendarWD = window.open("","","toolbar,status,location,directories,menubar,scrollbars=1,resizable=1,height="+theH2+","+"width="+theW2) //window.open("","","scrollbars=0,height="+theHeight+","+"width="+theW)
		///newWindow.focus()
		if (!calendarWD.opener) {
			calendarWD.opener = window
		}
		// assemble content for new window
		var newContent = "<HTML><HEAD><TITLE>Calendar</TITLE></HEAD>"
		newContent += "<BODY leftmargin='5' topmargin='5' marginwidth='5' marginheight='5' BGCOLOR='#ffffff'>"
		newContent += theCal 
		newContent += "<BR><FONT COLOR = '#FF0000'> This calendar is tentative.  Actual activities and assignments may be different.  Updated on " +theDate+".</FONT>"
		//newContent += "<BR><A HREF='pdf/BioCal0901.pdf'><IMG SRC='graphics/pdfIcon.gif' ALT='' WIDTH='16' HEIGHT='16' BORDER='0'>Download September Calendar</A>"
		newContent += "</BODY></HTML>"
		// write HTML to new window document
		calendarWD.document.write(newContent)
		calendarWD.document.close() // close layout stream
	//} else {
		// window's already open; bring to front
		//newWindow.focus()
	//}
}

function displayAttendanceOFF(thePer,theName,theW,theH,theDate) {
	clearHilite(thePer)
 	var theGrades = "<IMG SRC='grades/Per"+theName+"a.gif' ALT='' height="+theH+","+"width="+theW+">"
	if (gradesWD && !gradesWD.closed) {
		gradesWD.close()
	}
	var theW2 = theW + 20
	var theH2 = theH + 30
		gradesWD = window.open("","","toolbar,status,location,directories,menubar,scrollbars=1,resizable=1,height="+theH2+","+"width="+theW2)
		if (!gradesWD.opener) {
			gradesWD.opener = window
		}
		// assemble content for new window
		var newContent = "<HTML><HEAD><TITLE>Period " + theName + " Attendance</TITLE></HEAD>"
		newContent += "<BODY leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' BGCOLOR='#ffffff'>"
		newContent += theGrades 
		newContent += "<BR><FONT COLOR = '#000000'>Ex = Excused  U = Unexcused  S = Suspension  T = Tardy.</FONT>"
		newContent += "<BR><FONT COLOR = '#FF0000'>Updated on " +theDate+".</FONT>"
		newContent += "</BODY></HTML>"
		// write HTML to new window document
		gradesWD.document.write(newContent)
		gradesWD.document.close() // close layout stream
}


function makeArray() {
var args = makeArray.arguments;
    for (var i = 0; i < args.length; i++) {
    	this[i] = args[i];
    }
this.length = args.length;
}

// This function determines which page is selected and goes to it.
function goPage(form,theURL) {
//alert(theURL)
i = form.menu.selectedIndex;            
    if (i != 0) {
    	window.location.href = theURL[i];  
    }
}

// Past Notes Menu
// This array holds the descriptions and names of the pages.
var Npages = new makeArray("Past Notes"
  // "Chapter 1 Notes"
    );

// This array hold the URLs of the pages.
var Nurls = new makeArray(""
   // "oldNotes/Ch1Notes.html"
     );


// This function determines which page is selected and goes to it.
function goNotesOFF(form) {
	i = form.Nmenu.selectedIndex;            
    	if (i != 0) {
    		window.location.href = Nurls[i];  
    	}
	}

	{ 	but1_on = new Image(122,32); but1_on.src ="graphics/Per1btnH.gif"; but1_off = new Image(122,32); but1_off.src = "graphics/Per1btn.gif";
	but2_on = new Image(122,32); but2_on.src ="graphics/Per2btnH.gif"; but2_off = new Image(122,32); but2_off.src = "graphics/Per2btn.gif";
	but3_on = new Image(122,32); but3_on.src ="graphics/Per3btnH.gif"; but3_off = new Image(122,32); but3_off.src = "graphics/Per3btn.gif";
	but4_on = new Image(122,32); but4_on.src ="graphics/Per6btnH.gif"; but4_off = new Image(122,32); but4_off.src = "graphics/Per6btn.gif";
	but5_on = new Image(264,110); but5_on.src ="graphics/BioBuck2.jpg"; but5_off = new Image(264,110); but5_off.src = "graphics/BioBuck.jpg";
}

function SwitchGif(imgDocID,ImgObjName) { 	
	if (navigator.appName== "Netscape" && parseInt(navigator.appVersion) >= 3)
  		document.images[imgDocID].src = eval(ImgObjName + ".src")
  	else if (navigator.appName != "Netscape" && parseInt(navigator.appVersion) >= 4) 
  		document.images[imgDocID].src = eval(ImgObjName + ".src")
} 

