/*****************************************************************************************
*
* Authors: Steve Barg, Chris Brinker, Marc Cohen, Dave Whittinghill 
* Project: Bioscope Initiative JS code
*
*****************************************************************************************/
/*****************************************************************************************
 This is the code that pre-caches the spinning globes on external links
 
 General Directions: N/A
*****************************************************************************************/
 
 off = new Image(27,27);
 off.src ="images2/a0174.gif";
 on = new Image(27,27);
 on.src = "images2/a0176.gif";

/*****************************************************************************************

 Function: checkSize(width,height)
 Author: Marc Cohen
 Description: Checks to see if the width and height of an opened window will fit on the screen
 Input: width,height - the width and height of the desired window
 Output: returns an array of the final window size in the form array[newWidth,newHeight]
 
*****************************************************************************************/
var expyYear = 2001;

function checkDemo(URL)
{
	today = new Date();
	var thisYear = today.getYear();
	
	if(navigator.appName.indexOf("Netscape") != -1) thisYear += 1900;
	
	if(thisYear < expyYear)	document.location = URL;
	else anim("expired.htm");
}
function checkDemo2(funcName)
{
	today = new Date();
	var thisYear = today.getYear();
	
	if(navigator.appName.indexOf("Netscape") != -1) thisYear += 1900;
	
	if(thisYear < expyYear)
	{	
		if(funcName == "search") search();
		else if(funcName == "bioWorld") bioWorld();
	}
	else anim("expired.htm");
}
function checkSize(width,height)
{
	returnArray = new Array();
	
	if((width <= (screen.width - 50)) && (height <= (screen.height - 100)))
	{
		returnArray[0] = width;
		returnArray[1] = height;
		returnArray[2] = "no";
	}
	else if((width > (screen.width - 50)) && (height <= (screen.height - 100)))
	{
		returnArray[0] = (screen.width - 50);
		returnArray[1] = height;
		returnArray[2] = "yes";
	}
	else if((width <= (screen.width - 50)) && (height > (screen.height - 100)))
	{
		returnArray[0] = width;
		returnArray[1] = (screen.height - 100);
		returnArray[2] = "yes";
	}
	else
	{
		returnArray[0] = (screen.width - 50);
		returnArray[1] = (screen.height - 100);
		returnArray[2] = "yes";
	}	
	return(returnArray);
}
 /*****************************************************
 	this litle bit of code hides the error boxes...
 	but wait... there are no errors... so it does...
 	er.... nothing.... : )
 *****************************************************/
 
	window.onerror = myError;
	function myError(message, url, line)
	{
		  return true; // <------ set this to false to show the errors, true to hide them
	}

/*****************************************************************************************
 Function: isIE45()
 Author: Marc Cohen
 Description: Tests to see if the browser used is IE on a Mac
 Input: N/A
 Output: returns 1 if it is IE < 5.0 on Mac, 0 if anything else
*****************************************************************************************/
 
 function isIE45()
 {
	var bName = navigator.appName;
	var bVersion = navigator.appVersion;
	
 	if ((bVersion.indexOf("Mac") != -1) && (bName != "Netscape") && (navigator.appVersion.indexOf("MSIE 5") == -1)) return(1);
 	else return(0);
 }
 
 /*****************************************************************************************
 Function: isIEMac()
 Author: Marc Cohen
 Description: Tests to see if the browser used is IE on a Mac
 Input: N/A
 Output: returns 1 if it is IE on Mac, 0 if anything else
*****************************************************************************************/
 
 function isIEMac()
 {
	var bName = navigator.appName;
	var bVersion = navigator.appVersion;
	
 	if ((bVersion.indexOf("Mac") != -1) && (bName != "Netscape")) return(1);
 	else return(0);
 }
/*****************************************************************************************
 Function: setNext()
 Author: Marc Cohen
 Description: Stops the focusing of the 2nd deep window for 3rd elvel windows to avoid flashing
 Input: URL - the page to load
 Output: N/A
*****************************************************************************************/
 function setNext(URL)
 {
 	document.form.directive.value = 99;
 	if(top.scriptwin)
 	{
 		top.location = URL;
 	}
 	else if(top.main)
 	{
 		top.main.location = URL;
 	}
 	else top.location = URL;
 }
/*****************************************************************************************
 Function: navcorrect()
 Author: Marc Cohen
 Description: corrects back button function for pages loaded into hidden frames
 Input: N/A
 Output: N/A
*****************************************************************************************/
 function navcorrect()
 {
 //unloads loaded page from browser history to correct back button function
 //netscape and microsoft handle this differently, hence browser check call
 //created by Marc Cohen
 
     var bversion = parseInt(navigator.appVersion); //get browser version
     var bname = navigator.appName;                 //get browser name
 
     if(bname == "Netscape" && bversion == "4")
     {
         parent.scriptwin.location.replace("blank.htm");
     }
     else
     {
         parent.scriptwin.history.back();
     }

}
/*****************************************************************************************
 Function: status()
 Author: Steve Barg
 Description: 
 Input: N/A
 Output: N/A
*****************************************************************************************/
 
 function status()
 {
 	if (window.opener && document.form.directive.value == "0")
 	{
 		if(window.opener.frames[1])
 		{
 			window.opener.frames[0].document.form.directive.value = "1";
 		}
 		else window.opener.document.form.directive.value= "1";
 		if(navigator.appVersion.indexOf("Mac") == -1)
 		{
			self.focus();
 		}
 	}
 }
  function statusConf()
 {
 	if (window.opener && document.form.directive.value == "0")
 	{
 		if(window.opener.top.gloss)
 		{
 			window.opener.top.gloss.document.form.directive.value="1";
 		}
 		else if(window.opener.top.scriptwin)
 		{
 			window.opener.top.main.document.form.directive.value="1";
 		}
 		else
 		{
 			window.opener.document.form.directive.value= "1";
 		}
 		if(navigator.appVersion.indexOf("Mac") == -1)
 		{
			self.focus();
 		}
 	}
 }
  function status2() // same as status but for frames
 {
 	if (top.window.opener && top.main.document.form.directive.value == "0")
 	{
 		if(top.window.opener.frames[1])
 		{
 			top.window.opener.frames[0].document.form.directive.value = "1";
 		}
 		else top.window.opener.document.form.directive.value= "1";
 		if(navigator.appVersion.indexOf("Mac") == -1)
 		{
			top.main.self.focus();
 		}
 	}
 }

/*****************************************************************************************
 Function: bodyt()
 Author: Steve Barg
 Description: Tests to see if the browser is IE4 on the PC; if so, it disables window-on-top
 Input: N/A
 Output: N/A
*****************************************************************************************/

function bodyTag(){
	
	if (navigator.appName.indexOf("Internet Explorer") != -1){
		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
			document.writeln("</HEAD>\n<BODY class=stan>\n");
		}
		else {
			document.writeln("</HEAD>\n<BODY class=stan onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
		}
	}
	else {
		document.writeln("</HEAD>\n<BODY class=stan onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
	}
}
function bodyTag2(){
	
	if (navigator.appName.indexOf("Internet Explorer") != -1){
		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
			document.writeln("</HEAD>\n<BODY class=nomarg>\n");
		}
		else {
			document.writeln("</HEAD>\n<BODY class=nomarg onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
		}
	}
	else {
		document.writeln("</HEAD>\n<BODY class=nomarg onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
	}
}
function bodyTagConfirm(){
	
	if (navigator.appName.indexOf("Internet Explorer") != -1){
		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
			document.writeln("</HEAD>\n<BODY class=stan>\n");
		}
		else {
			document.writeln("</HEAD>\n<BODY class=stan onblur=\"statusConf()\" onload=\"self.focus()\" onunload=\"endConf()\">\n");
		}
	}
	else {
		document.writeln("</HEAD>\n<BODY class=stan onblur=\"statusConf()\" onload=\"self.focus()\" onunload=\"endConf()\">\n");
	}
}

function bodyTagBlack(){
	
	if (navigator.appName.indexOf("Internet Explorer") != -1){
		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
			document.writeln("</HEAD>\n<BODY bgcolor=black>\n");
		}
		else {
			document.writeln("</HEAD>\n<BODY bgcolor=black onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
		}
	}
	else {
		document.writeln("</HEAD>\n<BODY bgcolor=black onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
	}
}
 function bodyTagBW(){
 	
 	if (navigator.appName.indexOf("Internet Explorer") != -1){
 		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
 			document.writeln("</HEAD>\n<BODY bgcolor=black text=white>\n");
 		}
 		else {
 			document.writeln("</HEAD>\n<BODY bgcolor=black  text=white onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
 		}
 	}
 	else {
 		document.writeln("</HEAD>\n<BODY bgcolor=black  text=white onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
 	}
}
function bodyTagI(input){
 	
 	if (navigator.appName.indexOf("Internet Explorer") != -1){
 		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
 			document.writeln("</HEAD>\n<BODY "+input+">\n");
 		}
 		else {
 			document.writeln("</HEAD>\n<BODY "+input+" onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
 		}
 	}
 	else {
 		document.writeln("</HEAD>\n<BODY "+input+" onblur=\"status()\" onload=\"self.focus()\" onunload=\"end()\">\n");
 	}
}

/*****************************************************************************************
 Function: statusf()
 Author: Steve Barg
 Description: 
 Input: N/A
 Output: N/A
*****************************************************************************************/
 
 function statusf(frame)
 {
 	var directive = eval("parent."+frame+".document.form.directive.value");
 	
  	if (window.opener && directive == "0")
  	{
  		self.focus();
  	}
 }
 
/*****************************************************************************************
 Function: end()
 Author: Steve Barg
 Description: Gives focus to previous window when current is closed, resets form value
 			  Also reloads the flash window in Mac IE if it is present
 Input: N/A
 Output: N/A
*****************************************************************************************/

 function end()
 { 
 	if (navigator.appName.indexOf("Internet Explorer") != -1)
 	{
		if (navigator.appVersion.indexOf("MSIE 4.0") == -1 || navigator.appVersion.indexOf("Win") == -1)
		{
			if (window.opener && !window.opener.closed)
			{
				if(window.opener.frames[1])
				{
					window.opener.frames[0].document.form.directive.value = "0";
				}
				else window.opener.document.form.directive.value="0";
				if(window.opener.window.opener && (document.form.directive.value != 99))
				{
					window.opener.focus();
				}
			}
 	 		makeReload();
		}
		
	}
	else 
	{
		if (window.opener && !window.opener.closed)
		{
			window.opener.document.form.directive.value="0";
				if(window.opener.window.opener && (document.form.directive.value != 99))
				{
					window.opener.focus();
				}
		}
 	 	makeReload();
	}
 }
 function endConf()
 { 
 	if (navigator.appName.indexOf("Internet Explorer") != -1)
 	{
		if (navigator.appVersion.indexOf("MSIE 4.0") == -1 || navigator.appVersion.indexOf("Win") == -1)
		{
			if (window.opener && !window.opener.closed)
			{
				if(window.opener.top.gloss)
				{
					window.opener.top.gloss.document.form.directive.value="0";
				}
 				else if(window.opener.top.scriptwin)
 				{
 					window.opener.top.main.document.form.directive.value="0";
 				}
				else
				{
					window.opener.document.form.directive.value="0";
				}
				if(window.opener.window.opener && (document.form.directive.value != 99))
				{
					window.opener.focus();
				}
			}
 	 		makeReload();
		}
		
	}
	else {
		if (window.opener && !window.opener.closed){
				if(window.opener.top.gloss)
				{
					window.opener.top.gloss.document.form.directive.value="0";
				}
				else
				{
					window.opener.document.form.directive.value="0";
				}
				if(window.opener.window.opener && (document.form.directive.value != 99))
				{
					window.opener.focus();
				}
		}
 	 	makeReload();
	}
 }
 function end3() // same as end but for frames
 { 	
 	if (navigator.appName.indexOf("Internet Explorer") != -1)
 	{
		if (navigator.appVersion.indexOf("MSIE 4.0") == -1 || navigator.appVersion.indexOf("Win") == -1)
		{
			if (top.window.opener && !top.window.opener.closed)
			{
				if(top.window.opener.frames[1])
				{
					top.window.opener.frames[0].document.form.directive.value = "0";
				}
				else top.window.opener.document.form.directive.value="0";
				if(top.window.opener.window.opener && (document.form.directive.value != 99))
				{
					top.window.opener.focus();
				}
			}
 	 		makeReload();
		}
		
	}
	else {
		if (top.window.opener && !top.window.opener.closed){
			top.window.opener.document.form.directive.value="0";
				if(top.window.opener.window.opener && (document.form.directive.value != 99))
				{
					top.window.opener.focus();
				}
		}
 	 	makeReload();
	}
 }
 
/*****************************************************************************************
 Function: end2()
 Author: Steve Barg
 Description: Gives focus to previous window when current is closed, resets form value
 			  Duplicate of end() without Mac IE flash fix
 Input: N/A
 Output: N/A
*****************************************************************************************/
 
 function end2()
 {
  	if (top.window.opener){
  		top.window.opener.document.form.directive.value="0";
  		top.window.opener.focus();
  	}
 }
 
/*****************************************************************************************
 Function: makeReload()
 Author: Marc Cohen
 Description: Reloads a window with a Flash movie in it for Mac IE
 Input: N/A
 Output: N/A
*****************************************************************************************/

 function makeReload() 
 {
 	if (isIE45())
 	{
 		if(window.opener) 
 		{
 			if(window.opener.top.frames[0])
 			{
 				if(window.opener.top.scriptwin)
 				{
 					window.opener.top.main.location="blank2.htm";
 				}
 				else if(window.opener.top.main.scriptwin)
 				{
 					window.opener.top.main.main.location = "blank2.htm";
 				}
 			}
 		}
 	}
 }

/*****************************************************************************************
 Function: lastHope()
 Author: Marc Cohen
 Description: Reloads a window with a Flash movie in it for Mac IE
 			  Same as makeReload(), may be used, don't want to delete for safety
 Input: N/A
 Output: N/A
*****************************************************************************************/

 function lastHope() 
 {
 	makeReload();
 }

/*****************************************************************************************
 Function: ie40PC()
 Author: Steve barg
 Description: Tests for IE 4.0 PC for stuff
 Input: N/A
 Output: 1 if it is IE 4.0, 0 if not
*****************************************************************************************/

function ie40PC(){
	if (navigator.appName.indexOf("Internet Explorer") != -1){
		if (navigator.appVersion.indexOf("MSIE 4.0") != -1 && navigator.appVersion.indexOf("Win") != -1){
			return(1);
		}
		else {
			return(0);
		}
	}
	else {
		return(0);
	}

}

/*****************************************************************************************
 This is the code that makes the majority of pop-up windows in the handles 
 
 General Directions: Send this function a URL and it displays it within the window
 
 Sample: <a href="javascript:anim('Some_Url.htm')">Link</A>
*****************************************************************************************/

 function anim(URL)
 {
 	sizeArray = new Array();
 	sizeArray = checkSize(700,550);
 	
 	var widthChecked = sizeArray[0];
 	var heightChecked = sizeArray[1];

 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { widthChecked += 15; }
 	
 	var topLX = ((screen.width - widthChecked) / 2);
 	var topLY = (((screen.height - heightChecked) / 2) - 20);
 	
 	if (!ie40PC())
 	{
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
 			animwin = window.open(URL,'Animation','toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes,top='+topLY+',left='+topLX+',width='+widthChecked+',height='+heightChecked+' ');
 		}
 	}
 	else 
 	{
 		animwin = window.open(URL,'Animation','toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes,top='+topLY+',left='+topLX+',width='+widthChecked+',height='+heightChecked+' ');
 	}
 }
 
/*****************************************************************************************
 Function: exitSection()
 Author: Dave Whittinghill
 Description: Prompts for a section change, if ok is clicked, the page changes
 Input: N/A
 Output: N/A
*****************************************************************************************/
 
function exitSection(URL)
{
	sizeArray = new Array();
 	sizeArray = checkSize(300,200);
 	
 	var width = sizeArray[0];
 	var height = sizeArray[1];
 	 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	document.cookie = "exitpage="+URL+"; path=\;";

 	if (!ie40PC()){
 		if (document.form.directive.value == "0"){
 			
 		document.form.directive.value="1";	
		var confirmWin = window.open('exitsect.htm','confirmation','width='+width+',height='+height+',top='+topLY+',left='+topLX+'toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no');
		}
	}
	else {
		var confirmWin = window.open('exitsect.htm','confirmation','width='+width+',height='+height+',top='+topLY+',left='+topLX+'toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no');
	}
}
 function exitSection2(URL) // same but for image DB
{
	sizeArray = new Array();
 	sizeArray = checkSize(300,200);
 	
 	var width = sizeArray[0];
 	var height = sizeArray[1];
 	 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	document.cookie = "exitpage="+URL+"; path=\;";
	
	var confirmWin = window.open('exitsect.htm','confirmation','width='+width+',height='+height+',top='+topLY+',left='+topLX+'toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no');
}
/*****************************************************************************************
 Steve B made this function to make a pop up window appear with the HTML you send with it
 
 General Directions:Send this function a string and that string is displayed in a pop-up
 
 Sample: <a href="javascript:giveAnswer('<I>Steve B is cool..!</I>')">Link</A>
*****************************************************************************************/
  
 function giveAnswer(URL)
 {
 	var topLX = ((screen.width - 350) / 2);
 	var topLY = (((screen.height - 200) /2) -20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
 	 		giveanswer=window.open(URL,"Answer","toolbars=no,menubar=no,scrollbars=yes,top="+topLY+",left="+topLX+",width=350,height=200");
 		}
 	}
 	else {
 		giveanswer=window.open(URL,"Answer","toolbars=no,menubar=no,scrollbars=yes,top='+topLY+',left='+topLX+',width=350,height=200");
 	}
 }
 
/*****************************************************************************************
 Function: giveAnswer2()
 Author: 
 Description: Makes a popup window appear with the URL sent in it
 			  Same as giveAnswer(), may be used, so i didn't delete it
 Input: URL - location being sent
 Output: N/A
*****************************************************************************************/

 function giveAnswer2(URL)
 {
 	giveAnswer(URL);
 }
 
/*****************************************************************************************
 This function makes the popup windows appear with the definitions within them
 
 General Directions:You must send the word in CAPS with '_' in place of spaces
 
 Sample: <a href="javascript:glossary('SMOOTH_ER')">Link</A>
*****************************************************************************************/
  
 function glossary(directive)
 {
 	var topLX = ((screen.width - 325) / 2);
 	var topLY = (((screen.height - 300) / 2) -20);
 	
 	document.form.directive.value = directive;
 	glossWin = open('glossary/a0640.htm', 'subWindow','top='+topLY+',left='+topLX+',width=325,height=300,'+
 						'toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes');
 }
 
 function reference(directive)
 {
 	var topLX = ((screen.width - 350) / 2);
 	var topLY = (((screen.height - 200) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value = directive;
 			reffWin =  window.open('a1244.htm', 'subWindow','top='+topLY+',left='+topLX+',width=350,height=200,'+
 						'toolbar=no,location=no,status=no,menubar=no,resizable=no');
 		}
 	}
 	else {
 		reffWin =  window.open('a1244.htm', 'subWindow','top='+topLY+',left='+topLX+',width=350,height=200,'+
					'toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes');
 	}
 }
 
/*****************************************************************************************
  This function makes a window that has an unlabeled picture in it, with a click it changes
  to a labeled version
 
 General Directions:Send this function the unlabeled version of the picture followed By the 
 	labeled, and then width and height of the image
 	
 	Default for the image H and W is 360 X 450 if you send the function: ('image','image',0,0)
 
 Sample: <a href="javascript:label('UnlabelePic.jpg','LabeledPic.jpg',400,400)">Link</A>
*****************************************************************************************/

 function label(URL,width,height)
 {
   	if (isIEMac())
 	{
 		var h=10;
 	}
 	else var h = 0;
 	
  	if (width == 0) { width=474; }
  	else { width += 24; }
  	
  	if (height == 0){ height= 430 + h; }
  	else { height += 65; }
  	
 	sizeArray = new Array();
 	sizeArray = checkSize(width,height);
 	
 	width = sizeArray[0];
 	height = sizeArray[1];
 	
 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
  		
  			labelwin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
  											'location=no,status=no,menubar=no,resizable=no');
 		}
 	}
 	else {
 		labelwin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
					'location=no,status=no,menubar=no,resizable=no');
 	}
 }

 function toggle(URL)
 {
  	if (isIEMac())
 	{
 		var h=10;
 	}
 	else var h = 0;
 	
 	sizeArray = new Array();
 	sizeArray = checkSize(424,(260 + h));
 	
 	var width = sizeArray[0];
 	var height = sizeArray[1];
 	
 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1"; 
 			togglewin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
 					'location=no,status=no,menubar=no,resizable=no');
 		}
 	}
 	else {
 		togglewin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
				'location=no,status=no,menubar=no,resizable=no');
 	}
 }
 
/*****************************************************************************************
  This code makes the external link windows that are used with online resources
 
 General Directions:Send this function the URL you would like in the window and it will place
 	the correct frames around it to make it BioScope official.
 
 Sample: <a href="javascript:link('http://www.yahoo.com')">Link</A>
*****************************************************************************************/

 function link2(URL)
 {
 	sizeArray = new Array();
 	sizeArray = checkSize(700,550);
 	
 	var width = sizeArray[0];
 	var height = sizeArray[1];
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);

 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0"){
 			document.form.directive.value="1";
 			link2win =  window.open(URL,'subWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,'+
 				'status=yes,menubar=no,resizable=no,scrollbars=yes');
 		}
 	}
 	else {
 		link2win =  window.open(URL,'subWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,'+
				'status=yes,menubar=no,resizable=no,scrollbars=yes');
 	}
 }
 								  
 function link(URL)
 {
 	sizeArray = new Array();
 	sizeArray = checkSize(700,550);
 	
 	var width = sizeArray[0];
 	var height = sizeArray[1];

 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
  	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 40);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			
 			if (getCookie('biointernet') == 'true')
 			{
 				document.form.directive.value="1";
 				extURL = "http://www.bioscope.org/cgi-bin/url/url.cgi?URL="+URL+"&PASS=student";
 				linkwin =  window.open(URL,'subWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,'+
 								  'status=yes,menubar=no,resizable=no');
 			}		
 			else{
 				if (confirm("Are you sure you would like to connect to this site on the internet?"))
 				{
 					document.form.directive.value="1";
 					document.cookie = "biointernet=true; path=\;";
 					extURL = "http://www.bioscope.org/cgi-bin/url/url.cgi?URL="+URL+"&PASS=student";
					linkwin =  window.open(URL,'subWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,'+
			          	          'status=yes,menubar=no,resizable=no');
				}		
			}
 		}
 	}
 	else {
 		if (getCookie('biointernet') == 'true')
		{
			extURL = "http://www.bioscope.org/cgi-bin/url/url.cgi?URL="+URL+"&PASS=student";
			linkwin =  window.open(URL,'subWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,'+
								  'status=yes,menubar=no,resizable=no');
		}		
		else{
			if (confirm("Are you sure you would like to connect to this site on the internet?"))
			{
				document.cookie = "biointernet=true; path=\;";
				extURL = "http://www.bioscope.org/cgi-bin/url/url.cgi?URL="+URL+"&PASS=student";
				linkwin =  window.open(URL,'subWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,'+
		          	          'status=yes,menubar=no,resizable=no');
			}		
		}
 	}
 }
 	
/*****************************************************************************************
movie() - opens a movie in a new window on a mac with quicktime, uses media player on pc
*****************************************************************************************/

 function movie(movie,width,height,titlestr)
 { 		
 	if (navigator.appVersion.indexOf("Mac") != -1)
 	{
 		var movieW = width;
 		var movieH = height + 15;
 		
 		if (isIEMac())
 		{
 			var h=15;
 		}
 		else var h = 0;
 		
 		if (height == 0) { height = 360 + h; }
 		else { height += (50 + h); }
 		
 		if (width == 0) { width = 450; }
 		else { width += 50; }
 		
 		var topLX = ((screen.width - width) / 2);
 		var topLY = (((screen.height - (height)) / 2) - 20);
 		
 		//document.form.directive.value="1";

  		if (titlestr==null) { titlestr="Bioscope Movie"; }
  		
 		picWin =  window.open('','newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
				'location=no,status=no,menubar=no,resizable=no,scrollbars=no');
 		picWin.document.write('<HTML><HEAD><TITLE>'+titlestr+'</TITLE></HEAD><BODY bgcolor=black>');
 		picWin.document.write('<form name="form"><input type=hidden name="directive" value="0"></form><center>');
 		picWin.document.write('<embed src="'+movie+'" name="movie" width="'+movieW+'" height="'+movieH+'" border=0 align=center></embed>');
 		picWin.document.write('<BR><a href="javascript:self.close()"><img src="images2/a1024.jpg" border=0></a>'+'</center>');
 		picWin.document.write('</BODY></HTML>');
 	}
 	else
 	{
 		document.form.directive.value="1";
 		top.location=movie;
 	} 	
 }
 
/*****************************************************************************************
qtmovie() - used for quicktime movies... not implemented in the product yet
*****************************************************************************************/
 function qtmovie(movie,width,height)
 {
 	if (height==0){height=360;}
 	if (width==0){width=450;}
 	
 	width += 20;
 	height += 70;
 	
 	if (isIEMac())
 	{
 		var h=15;
 	}
 	else var h = 0;
 		
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - (height + h)) / 2) - 20);
 		
 	document.form.directive.value="1";
 	
 	var newSuffix = ".mov";
 	var htmSuffix = "m.htm";
 	var prefix = "movies/";
 	
 	var prefixAdded = prefix.concat(movie);
	var finalMovie = prefixAdded.concat(newSuffix);
	var page = movie.concat(htmSuffix);
	
	window.open(page,'movieWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',menubar=no,toolbar=no,status=no,location=no,resizable=no');
 }
/*****************************************************************************************
  This pops up a window with an image perfectly centered within it
 
 General Directions:Send it a picture file and the size in order to make the new window
 
 	Default for the image H and W is 360 X 450 if you send the function: ('image','image',0,0)
 	
 Sample: <a href="javascript:picture('pic.jpg',100,100)">Link</A>
*****************************************************************************************/

 function picture(URL,height,width)
 {
   	if (isIEMac())
 	{
 		var h=10;
 	}
 	else var h = 0;
 	
 	if (width == 0) { width = 474; }
 	else { width += 30; }
 	
	if (height == 0) { height = 420 + h; }
	else { height += (75 + h); }
	
 	sizeArray = new Array();
 	sizeArray = checkSize(width,height);
 	
 	width = sizeArray[0];
 	height = sizeArray[1];
 	
 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
 		
 			picturewin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,resizable=no');
 		}
 	}
 	else {	
		picturewin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,resizable=no');
 	}
 } 
 
/*****************************************************************************************
  Same as above
 
 General Directions: same as picture above, but doesn't resize the image
 
 Sample: <a href="javascript:pictureNoResize('pic.jpg, 100, 100')">Link</A>
*****************************************************************************************/

 function pictureNoResize(URL, height, width)
 {
   	if (isIEMac())
 	{
 		var h=10;
 	}
 	else var h = 0;
 	
 	if (width == 0){width=450}
 	else { width += 24; }
 	
	if (height == 0){ height=360 + h; }
	else { height += (100 + h); }
	
 	sizeArray = new Array();
 	sizeArray = checkSize(width,height);
 	
 	width = sizeArray[0];
 	height = sizeArray[1];
 	
 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";

 			picnosizewin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+
 					  ',toolbar=no,location=no,status=no,menubar=no,resizable=no');
 		}
 	}
 	else {			
		picnosizewin =  window.open(URL, 'newWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+
			  ',toolbar=no,location=no,status=no,menubar=no,resizable=no');
 	}
 }
 
/*****************************************************************************************
 This function pops up a window that allows someone to search the KnowledgeDataBase for definitions
 
 General Directions:Just place the following code where ever you want to set definitions
 
 Sample: <a href="javascript:search()">Link</A>
*****************************************************************************************/

 function search()
 {
 	var topLX = ((screen.width - 320) / 2);
 	var topLY = (((screen.height - 300) / 2) - 20);
 	
 	temp13 = window.open('a0889.htm', 'searchWindow','top='+topLY+',left='+topLX+',width=320,height=300,toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=no');
 }
 
/*****************************************************************************************
  This is for external links. it makes the animated gif switch to the static one
 
 General Directions: You must specifiy the name of the image in order for this function to work
 
 	Refer to Bottom of this file for specifics
 
*****************************************************************************************/

 function swapOff(name)
 {
 	eval("document."+name+".src = 'images2/a0176.gif'");
 }
 
/*****************************************************************************************
  This does the opposite of the previous function
 
 General Directions: You must specifiy the name of the image in order for this function to work
 
 	Refer to Bottom of this file for specifics
 
*****************************************************************************************/

 function swapOn(name)
 {
 	eval("document."+name+".src = 'images2/a0174.gif'");
 }
 
/*****************************************************************************************
  This pops up a window that contains a Flash movie in it.
 
 General Directions: Default H and W are set at flashs' default of 400 and 550 send it the swf file
 	and the rest is taken care of for you IE4 has dificulties with autostart and this but a click 
 	takes care of that should 
 
 Sample: <a href="javascript:('Bobo_animation.swf',0,0)">Link</A>
*****************************************************************************************/

 function swf(flaswf,height,width)
 {
   	if (isIEMac())
 	{
 		var h=10;
 	}
 	else var h = 0;
 	
 	if (width == 0) { width= 570; }
 	else { width += 24; }
 	
	if (height == 0){ height = 480+ h; }
	else { height += (65 + h); }
	
 	sizeArray = new Array();
 	sizeArray = checkSize(width,height);
 	
 	width = sizeArray[0];
 	height = sizeArray[1];
 	
 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
 
 			flashwin =  window.open(flaswf, 'flash','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes');
 	
 		}
 	}
 	else {
		flashwin =  window.open(flaswf, 'flash','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes');
		 	
 	}
 }
 
/*****************************************************************************************
  This is very similar to 'anim' but it uses a different window so this can pop-up from
  within another pop-up.  This is for the animations that open pop-ups from pop-up windows
  
 General Directions:N/a
 
 Sample: <a href="javascript:thrDeep('Some_Url.htm')">Link</A>
*****************************************************************************************/

 function thrDeep(URL)
 {
  	sizeArray = new Array();
 	sizeArray = checkSize(700,550);
 	
 	width = sizeArray[0];
 	height = sizeArray[1];

 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
 			window.open(URL, 'thirdPU','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes');
 		}
 	}
 	else {
 		window.open(URL, 'thirdPU','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes');
 	}
 }
 
/*****************************************************************************************
  Same as above
 
 General Directions:N/A
 
 Sample: <a href="javascript:twoDeep('Some_Url.htm')">Link</A>
*****************************************************************************************/
  
 function twoDeep(URL)
 {
  	sizeArray = new Array();
 	sizeArray = checkSize(700,550);
 	
 	width = sizeArray[0];
 	height = sizeArray[1];

 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	if (!ie40PC()){
 		if (document.form.directive.value == "0")
 		{
 			document.form.directive.value="1";
 			window.open(URL, 'secondPU','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,resizable=yes');
 		}
 	}
 	else {
 		window.open(URL, 'secondPU','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,resizable=yes');
 	}
 }
 
/*****************************************************************************************
  Opens a new window that to the BioWorld external sites
 
 General Directions:N/A
 
 Sample: <a href="javascript:bioWorld()">Link</A>
*****************************************************************************************/

 function bioWorld()
 {
  	if (isIEMac())
 	{
 		var h=10;
 	}
 	else var h = 0;

	var height = 495 + h;
	
  	sizeArray = new Array();
 	sizeArray = checkSize(780,height);
 	
 	var width = sizeArray[0];
 	height = sizeArray[1];
 	
 	var scrollable2 = sizeArray[2];
 	if (scrollable2 == "yes") { width += 15; }
 	 	
 	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 50);
 	
 	if (getCookie('biointernet') == 'true')
 	{
		newWin =  window.open('bioworld/index.htm', 'BioWorldWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
			  'status=no,menubar=no,resizable=no');
	}
	else 
	{
		if (confirm("Are you sure you would like to connect to this site on the internet?"))
		{
			document.cookie = "biointernet=true; path=\;";
			newWin =  window.open('bioworld/index.htm', 'BioWorldWindow','top='+topLY+',left='+topLX+',width='+width+',height='+height+',toolbar=no,'+
			  'status=no,menubar=no,resizable=yes');
		}
 	}
 }
 
/*****************************************************************************************
 Function: playSound()
 Author: 
 Description: Plays sounds on browsers over version 3
 Input: name - name tag in sound file to play
 Output: N/A
*****************************************************************************************/

 function playSound(name) 
 {
     if (navigator.appName== "Netscape" && parseInt(navigator.appVersion) > 3)
     {
     	eval("document."+name+".setvol(90);");
     	eval("document."+name+".play(false);");
     }
     else
     {
 		if ((navigator.userAgent.indexOf("IE") > -1) && (navigator.platform == "Win32"))
 		{
 			//MediaPlayer.autoStart = true;
 		}
 
     }
 }
/*****************************************************************************************
 Function: picCap()
 Author: Marc Cohen
 Description: Opens a picture with a caption
 Input: fileName, caption, height, width
 Output: N/A
*****************************************************************************************/

function picCap(fileName,width,height)
{
	width += 50;
	height += 100;
	
	if(width >= (screen.width - 100)) { width = screen.width - 100; }
	if(height >= (screen.height - 150)) { height = screen.height - 150; }
	
	var topLX = ((screen.width - width) / 2);
 	var topLY = (((screen.height - height) / 2) - 20);
 	
 	var pictureWindow = window.open(fileName,'picWin','top='+topLY+',left='+topLX+',width='+width+
 						',height='+height+',toolbar=no,status=no,menubar=no,resizable=yes');
 }

/*****************************************************************************************
 Function: bgSound()
 Author: 
 Description: Embeds background music in files
 Input: sound - the sound to play, loop - want it to loop?
 Output: N/A
*****************************************************************************************/
 
 function bgSound(sound,loop)
 {	
 	if (navigator.appName== "Netscape" && parseInt(navigator.appVersion) > 3)
 	{
 		document.write('');
 	}
 	else
 	{
 		if (loop == "" || loop == null)
 		{
 			loop=6;
 		}
 		document.writeln('<BGSOUND src="'+sound+'" loop="'+loop+'" name="soundtrack">');
 	}
 }

/*****************************************************************************************
 Function: getCookie()
 Author: 
 Description: Gets values from cookie file
 Input: Name - variable to look in cookie file for
 Output: returns the values in the cookie file
*****************************************************************************************/

 function getCookie(Name) 
 {
    var search = Name + "="
    if (document.cookie.length > 0) 
    { 
       offset = document.cookie.indexOf(search)
       if (offset != -1) 
       { 
          offset += search.length 
          end3 = document.cookie.indexOf(";", offset)
          if (end3 == -1) 
          {
          	end3 = document.cookie.length
          }
          return (document.cookie.substring(offset, end3))
       } 
    }
 }
 /******************************************
	This section does the printing stuff
******************************************/

var dAll = (document.all) ? 1 : 0;
var printable = (window.print) ? 1 : 0;
var isMac = (navigator.userAgent.indexOf("Mac") != -1); 
var confirmString = "This will use your browser's default print settings.  Do you still want to print?";

function printPage2() {
  if (printable)            // NS4, IE5
    window.print();
  else if (dAll && !isMac)  // IE4 (Windows)
  {
  	 if(confirm(confirmString))
  	 {
     	vbPrintPageContents();
     	alert("Your document has been printed.  Check printer for output.");
     }
  }
  else                      // other browsers
    alert("Sorry, your browser doesn't support this feature.  Please click on the image to select the frame, then choose \"Print\" from the \"File\" menu.");
  return false;
}

if (dAll && !printable && !isMac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPageContents');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}

// END OF PRINTING STUFF
