/* Lesson Init Script */

function nextLesson() {
	var lastLesson = false; /* Last Lesson Toggle - true = Last Lesson */
	isLastLesson(lastLesson);
}

function init(somemenu){
	if (((navigator.appName == 'Netscape') && (fileType == "s") && (parseFloat(navigator.appVersion) >= 4.07)) || ((navigator.appName == 'Microsoft Internet Explorer') && (fileType == "s") && (parseFloat(navigator.appVersion) >= 4))) {
		menuInit(somemenu);
	}
	if (fileType == "h") {
		printPage();
	}
}

/* End Lesson Init Script */
/* Previous-Next Lesson Script Start */

var VERSION = parseInt(navigator.appVersion);
var NS = (navigator.appName == "Netscape");
var URL = unescape(location.href)	// get current URL in plain ASCII
var xstart = URL.lastIndexOf("/") + 1
var xend = URL.length
var digitOnePlace = URL.lastIndexOf('.') - 2
var digitTwoPlace = URL.lastIndexOf('.') - 1
var digitOne = URL.charAt(digitOnePlace)
var digitTwo = URL.charAt(digitTwoPlace)
var filePrefix = URL.substring(xstart,digitOnePlace)
var suffixStart = URL.lastIndexOf('.')
var fileTypeChar = URL.lastIndexOf('.') + 1
var fileType = URL.charAt(fileTypeChar)
var fileSuffix = URL.substring(suffixStart,xend)
var dig1 = null
var dig2 = null
dig1=parseInt(digitOne)
dig2=parseInt(digitTwo)

if (dig1 == 0) {
	currentLesson = dig2;
} else {
	currentLesson = ('' + dig1 + dig2 + '');
}

function prevLesson() {
	var dig1prev = dig1
	var dig2prev = dig2
	if (dig1prev == 0 && dig2prev == 1) 
		document.write('<FONT FACE="Verdana, Arial, Geneva" SIZE="2"><B>&nbsp;</B></FONT>');
	else {
		if (dig2prev == 0) {
			dig2prev = 9
			dig1prev--
		}
		else {
			dig2prev--
		}
		
		document.write('<FONT FACE="Verdana, Arial, Geneva" SIZE="2"><a href="lesson' + dig1prev + dig2prev + '.shtml">');
		document.write('<img src="/content/shared_images/arrow_left2.gif" border="0" WIDTH="15" HEIGHT="12"></a>');
		document.write('<B><a href="lesson' + dig1prev + dig2prev + '.shtml"><FONT COLOR="#FFFFFF">Previous Lesson</FONT></a></B></FONT>');
	}
}

function isLastLesson(lastLesson) {
	var dig1next = dig1
	var dig2next = dig2
	if (lastLesson) { 
		document.write('<FONT FACE="Verdana, Arial, Geneva" SIZE="2">');
		document.write('<B><A HREF="http://www3.riosalado.edu/research/assessments/assessment.asp?EvalTypeID=1"><FONT COLOR="#FFFFFF">Course Evaluation</FONT></A></B></FONT>');
		document.write('<a href="http://www3.riosalado.edu/research/assessments/assessment.asp?EvalTypeID=1"><img src="/content/shared_images/arrow_right2.gif" border="0" WIDTH="15" HEIGHT="12"></a>');
	} else {
		if (dig2next == 9) {
			dig2next = 0
			dig1next++
		}
		else {
			dig2next++
		}

		document.write('<FONT FACE="Verdana, Arial, Geneva" SIZE="2">');
		document.write('<B><a href="lesson' + dig1next + dig2next + '.shtml"><FONT COLOR="#FFFFFF">Next Lesson</FONT></a></B></FONT>');
		document.write('<a href="lesson' + dig1next + dig2next + '.shtml"><img src="/content/shared_images/arrow_right2.gif" border="0" WIDTH="15" HEIGHT="12"></a>');
	}
}

function keywords() {
		document.write('<A HREF="../keywords/keywords' + dig1 + dig2 + '.shtml"><B>Lesson ' + currentLesson + ' Keywords</B></A>');
}

function backToLesson() {
		document.write('<A HREF="../lessons/lesson' + dig1 + dig2 + '.shtml"><B>Back to Lesson ' + currentLesson + '</B></A>');
}

function printVersion() {
	if (fileType == "s") 
		document.write('<P><font size=-1 color=black><i>(Our coursework is design for viewing and printing from Internet explorer.  If you do not have the latest version of Internet Explorer, you may download it from <a href="http://www.microsoft.com/windows/ie/downloads/ie6/default.asp" target=_new>here</a>)</i></font></P><B><a href="lesson' + dig1 + dig2 + '.html">Print This Lesson</a></B>');
	else
		document.write('<B><a href="lesson' + dig1 + dig2 + '.shtml">Return to Lesson</A></B>');
}

function printVersionform() {
	if (fileType == "s") 
		document.write('<P><font size=-1 color=black><i>(Our coursework is design for viewing and printing from Internet explorer.  If you do not have the latest version of Internet Explorer, you may download it from <a href="http://www.microsoft.com/windows/ie/downloads/ie6/default.asp" target=_new>here</a>)</i></font></P><B><a href="form' + dig1 + dig2 + '.html">Print This Form</a></B>');
	else
		document.write('<B><a href="form' + dig1 + dig2 + '.shtml">Return to Form</A></B>');
}

function printVersionsubmit() {
	if (fileType == "s") 
		document.write('<P><font size=-1 color=black><i>(Our coursework is design for viewing and printing from Internet explorer.  If you do not have the latest version of Internet Explorer, you may download it from <a href="http://www.microsoft.com/windows/ie/downloads/ie6/default.asp" target=_new>here</a>)</i></font></P><B><a href="submit' + dig1 + dig2 + '.html">Print This Submit</a></B>');
	else
		document.write('<B><a href="submit' + dig1 + dig2 + '.shtml">Return to Submit</A></B>');
}

function printPage() {
if ((NS) || (VERSION >= 5)) {
    window.print();
	history.go(-1);
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 1);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";  
	history.go(-1);
}
}

/* End Previous-Next Lesson Script Start */
/* Scrolling Menu Script Start */

/* BrowserCheck */
ie=document.all?1:0
n=document.layers?1:0

var move=10;
menuSpeed=40
var minwidth=640
var minheight=480
var layerRef=""; var styleSwitch="";

if  (navigator.appName == 'Netscape'){
	lshow=15
}
else{	
	lshow=200
}

if (screen.width <= minwidth||screen.height <= minheight)
	var moveOnScroll=false
else
	var moveOnScroll=true

var tim;

function makeMenu(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style')					
	this.state=1
	this.go=0
	this.height=n?this.css.document.height:eval(obj+'.offsetHeight')
	this.top=b_gettop
    this.obj = obj + "Object"; 	eval(this.obj + "=this")	
}

function b_gettop(){
	var gleft=(n) ? eval(this.css.top):eval(this.css.pixelTop);
	return gleft;
}

function moveMenu(){
	if(!oMenu.state){
		clearTimeout(tim)
		mIn()	
	}else{
		clearTimeout(tim)
		mOut()
	}
}

function mIn(){
	if(oMenu.top()>eval(scrolled)-oMenu.height+lshow){
		oMenu.go=1
		oMenu.css.top=oMenu.top()-move
		tim=setTimeout("mIn()",menuSpeed)
	}else{
		oMenu.go=0
		oMenu.state=1
	}	
}

function mOut(){
	if(oMenu.top()<eval(scrolled)){
		oMenu.go=1
		oMenu.css.top=oMenu.top()+move
		tim=setTimeout("mOut()",menuSpeed)
	}else{
		oMenu.go=0
		oMenu.state=0
	}	
}

function checkScrolled(){
	if(!oMenu.go)oMenu.css.top=(!oMenu.state)?eval(scrolled):eval(scrolled)-oMenu.height+lshow
	if(n) setTimeout('checkScrolled()',30)
}

function menuInit(somemenu){
	/*oMenu=new makeMenu('divMenu')
	scrolled=n?"window.pageYOffset":"document.body.scrollTop"
	oMenu.css.top=eval(scrolled)-oMenu.height+lshow
	oMenu.css.visibility='visible'
	if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();*/
	if (navigator.appName == 'Netscape'){
		layerRef = 'document.layers';
		styleSwitch = '';
	}
	else{
		layerRef = 'document.all';
		styleSwitch = '.style';
	}
	//showLayer(somemenu);
}

function showMenu1(){
hideLayer('menu2');
showLayer(eval('"menu1"'));
}

function showMenu2(){
hideLayer('menu1');
showLayer(eval('"menu2"'));
}

function hideLayer(layerID){
if(document.layers)
	document.layers.divMenu.document.layers[layerID].visibility="hidden"
else
	eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="hidden"');
}

function showLayer(layerID){
if(document.layers)
	document.layers.divMenu.document.layers[layerID].visibility="visible"
else
	eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="visible"');
}

function writeContent(descriptionText,w,h) {
if (((h == "") || (h == null)) && ((w == "") || (w == null))) {
w = "300"
h = "250"
} else {
}
windowOptions = 'width='+w+',height='+h
	textWindow=window.open("/content/shared_files/blank.html","textWindow",windowOptions);
	textWindow.document.write("<HTML><HEAD></HEAD><BODY BGCOLOR=#FFFFFF><BLOCKQUOTE><FONT FACE=ARIAL SIZE=2>"+descriptionText+"</FONT></BLOCKQUOTE></BODY></HTML>")
	textWindow.document.close()
	textWindow.focus()
}

/*
You would use this script to pop open a new window (of a specific size) to display a HTML page or graphic.

Paste this line of code around what you want to serve as your popup link.  Be sure to customize the url, name, and window properties.

<A HREF="javascript:new_window('url','name','window_properties')"></A>

Explanation of new_window attributes:
*URL (required) - The location of what you want to display (i.e. "../misc/somefile.html")
*Name (required) - This is the name you give the window (useful when you want to refer to the window later).
*Window Properties (required) - A string containing a comma-separated list determining whether or not to create various standard window features.
	Below are some explanations of the more important window properties
		-Height (required) - Specifies the height of the window in pixels.
		-Width (required) - Specifies the width of the window in pixels.
		-Toolbar - If yes, creates the standard browser toolbar, with buttons such as Back and Forward.	
		-Scrollbars - If yes, creates horizontal and vertical scrollbars when the Document grows larger than the window dimensions.
		-Resizable - If yes, allows a user to resize the window.
	Note: If a window property is not included, it's assumed to be "no" or "0"

Example:
<A HREF="javascript:new_window('../images/slide_modems.jpg','slide','height=457,width=588,left=0,top=0,scrollbars=no,resizable=yes')">Modems</A>
*/

function new_window(url,name,window_properties) {
	link = window.open(url,name,window_properties);
	link.focus();
}

/* End Scrolling Menu Script Start */

