<!-- 
MODULE NAME: week3.cfm
PURPOSE: Cincinnati State - Javascript Class - Week 3 Scripts
REFERRING MODULE(S): 
DESTINATION MODULE(S):
QUERYSTRING METHODS SUPPORTED:
AUTHOR: Grant Szabo (grant@quagmire.com) Sterling Creek Software
CREATED: 12/2/02
LAST MODIFIED: 12/2/02
-->

<script language="javascript">
<!--

//this function will write information about the user's browser to an alert box
function fcnBrowserDetection() {
alert("JavaScript has detected the following information about your browser: \n\n" + "navigator.appName: " + navigator.appName + "\n" + "navigator.appVersion: " + navigator.appVersion + "\n" + "navigator.userAgent: " + navigator.userAgent);
	if (navigator.appName == "Microsoft Internet Explorer") {
	document.write ("Since you are running Internet Exlplorer, perhaps you would like to try Netscape or Mozilla? \n\n <a href='http://www.mozilla.org' target='_blank'>Get Mozilla</a> \n\n <a href='http://channels.netscape.com/ns/browsers/download.jsp' target='_blank'>Get Netscape</a>");
	}
	else {
	document.write ("Since you are not running Internet Explorer, perhaps you would like to try it?  \n\n <a href='http://www.microsoft.com/ie' target='_blank'>Get Internet Explorer</a>");
	}
}

//this function will loop over plugins and output them to the screen
function fcnPluginDetection() {	
	if (navigator.plugins && navigator.plugins.length > 0) {
	var strHTMLArr = new Array();
	var intArrCount = 0;
	var strHTML = "";
	
	strHTMLArr[intArrCount++] = '<table border="1">';
	strHTMLArr[intArrCount++] = '<tr bgcolor="silver"><th>Name</th><th>Filename</th><th>Description</th></tr>';
	for (i=0; i < navigator.plugins.length; i++) {
		thisPlugin = navigator.plugins[i];
		strHTMLArr[intArrCount++] = '<tr><td>';
		strHTMLArr[intArrCount++] = thisPlugin.name;
		strHTMLArr[intArrCount++] = '</td><td>';
		strHTMLArr[intArrCount++] = thisPlugin.filename;
		strHTMLArr[intArrCount++] = '</td><td>';
		strHTMLArr[intArrCount++] = thisPlugin.description;
		strHTMLArr[intArrCount++] = '</td></tr>';
		}
	strHTMLArr[intArrCount++] = '</table>';
	strHTML = strHTMLArr.join("");	
	//alert(strHTML);   
	document.getElementById("divStaticContent").innerHTML = strHTML;	
	}
	else {
	document.write("There were no plugins detected for your browser.  Try running this script with Netscape or Mozilla.");
	}
}

//this function takes two parameters, presents the strMessage in an alert box and does a redirect.
function fcnAuthors(strMessage, intBook) {
	alert(strMessage);
	switch (intBook) {
	case 1:
	top.location="http://www.amazon.com/exec/obidos/ASIN/0345339711/qid=1038892737/sr=2-2/ref=sr_2_2/104-8812391-7714329";
	break
	case 2:
	top.location="http://www.amazon.com/exec/obidos/tg/detail/-/034531011X/qid=1038892692/sr=1-1/ref=sr_1_1/104-8812391-7714329?v=glance&s=books";
	break
	case 3:
	top.location="http://www.amazon.com/exec/obidos/tg/detail/-/0380018004/qid=1038892657/sr=1-2/ref=sr_1_2/104-8812391-7714329?v=glance&s=books";
	break
	case 4:
	window.location ="http://www.amazon.com/exec/obidos/tg/detail/-/0812550307/qid=1038891960/sr=1-7/ref=sr_1_7/104-8812391-7714329?v=glance&s=books";	
	break
	}
}
	
//this function takes user input out of a text field and scrolls it in the status bar
function fcnScrollBar() {
var strMsg = document.frmScroll.scrollBarText.value;
var i = 0;
window.status = strMsg.substring(i,strMsg.length) + strMsg.substring(0,i-1);
if (i < strMsg.length) {
	i++
	}
else {
	i = 0
	}
setTimeout("fcnScrollBar()",50);
}

function fcnChangeStatusBar(strMsg) {
window.defaultStatus = strMsg;
}

//-->
</script>

<noscript>
This page requires Javascript.
</noscript>