var img1 = new Image();
var img2 = new Image();
img1.src = 'images/target.gif';
img2.src = 'images/circle.gif';

var theWindow;

function linkoff(name1)
{
	document.images[name1].src = img2.src;
}
function linkon(name1)
{
	document.images[name1].src = img1.src;
}
function glossary()
{
 	var topLX = ((screen.width - 325) / 2);
 	var topLY = (((screen.height - 300) / 2) -20);
 	
	document.windowStatus.opened.value = "1";
 	
 	theWindow = window.open('glossary/a0640.htm','glossWindow','top='+topLY+',left='+topLX+',width=325,height=300,toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes');
}
function dateIt()
{
	months = new Array();
	months[0] = "January";
	months[1] = "February";
	months[2] = "March";
	months[3] = "April";
	months[4] = "May";
	months[5] = "June";
	months[6] = "July";
	months[7] = "August";
	months[8] = "September";
	months[9] = "October";
	months[10] = "November";
	months[11] = "December";
	today = new Date();
	var todayYear = today.getFullYear();
	var todayMonth = months[today.getMonth()];
	var todayDate = today.getDate();
	document.write(todayMonth+' '+todayDate+', '+todayYear);
}

var roots = new Array(
'andros- man, male\; man <br> Androcentric; sociological views developed by men.\nHaving a masculine emphasis or point of view.',
'patri- father <br>Patriarch a father figure',
'monocyte\; <br>monos--one <br>cyto--cell',
'neuralgia\; <br>neuron--nerve <br>algia--pain',
'polymorphonuclear\; <br>poly--many <br>morphe--form',
'neurosis\; <br>neuro--nerve <br>osis--condition',
'antagonist\; <br>anti--against <br>agonia--struggle',
'antipodes\; <br>anti--against <br>podos--foot',
'dialysis\; <br>dia--across <br>lysis--a loosening',
'hydrostatic\; <br>hydro--water <br>static--causing to stand',
'apoptosis, programmed cell death\; <br>apo--separate from <br>ptosis--fall from'
);

var factofday = new Array(
'Were you aware that there are 14.5 million high school students in the United States?',
'Were you aware that 779,000 high school students in the United States are in remedial reading and writing?',
'500,000 students in the United States have English as their second language.'
);

var factlink = new Array(
'National Center for Education Statistics',
'National Center for Education Statistics',
'National Center for Education Statistics'
);

var facthttp = new Array(
'http://nces.ed.gov',
'http://nces.ed.gov',
'http://nces.ed.gov'
);

var educationlink = new Array(
'The Discovery Channel',
'The History Channel',
'Animal Planet',
'The Learning Channel'
);

var educationhttp = new Array(
'http://www.discoverychannel.com',
'http://www.historychannel.com',
'http://animal.discovery.com',
'http://tlc.discovery.com'
);

var theteasers = new Array(
'tdribbles.swf',
'ttration.swf',
'tviewer.swf'
);

function rand(start, end)
{
 var range = end-start;
 var out = parseInt(parseFloat(Math.random()*range+start));
 if (out==end) out--;
 return (out);
}
function getRandomElement(someArray)
{
	var theRand = Math.random();
	var arrayLength = someArray.length;
	var lastArrayElementIndex = someArray.length - 1;	
	var randScaled = theRand * arrayLength;
	var useIndex = Math.round(randScaled);
	if(useIndex > lastArrayElementIndex) { useIndex = lastArrayElementIndex; }
	if(useIndex < 0) { useIndex = 0; }

	return(useIndex);
}

function choosetext()
{
	/***
	var rootnum = getRandomElement(roots);
	var factnum = getRandomElement(factofday);
	var educationnum = getRandomElement(educationlink);
	
	var ie = navigator.appName.indexOf("Microsoft") != -1;

	var factmovie = (ie ? window.fact : window.document.fact);
	var educationmovie = (ie ? window.education :window.document.education);
	var rootmovie = (ie ? window.root : window.document.root);


	factmovie.SetVariable ("fact", factofday[factnum]);
	factmovie.SetVariable ("factlink", factlink[factnum]);
	factmovie.SetVariable ("facthttp", facthttp[factnum]);	
	educationmovie.SetVariable ("educationlink", educationlink[educationnum]);
	educationmovie.SetVariable ("educationhttp", educationhttp[educationnum]);
	rootmovie.SetVariable ("root", roots[rootnum]);
	***/
}

function drawFact()
{
	var factnum = getRandomElement(factofday);
	var theFact = factofday[factnum];
	var theLinkText = factlink[factnum];
	var theLink = facthttp[factnum];
	
	document.writeln('<font color=#006633>'+theFact+'</font><br><a class=two href="'+theLink+'">'+theLinkText+'</a>');	
}
function drawSOTD()
{
	var educationnum = getRandomElement(educationlink);
	var edLinkText = educationlink[educationnum];
	var edLink = educationhttp[educationnum];
	
	document.writeln('<img src="images/circle.gif" name=edBullet>&nbsp;<a class=one href="'+edLink+'" onMouseOver=\'linkon("edBullet")\' onMouseOut=\'linkoff("edBullet")\'>'+edLinkText+'</a>');
}
function drawWOTD()
{
	var rootnum = getRandomElement(roots);	
	var rootText = roots[rootnum];
	
	document.writeln('<font color=#006633>'+rootText+'</font>');
}
function dribbles(URL)
{
	var agent = navigator.userAgent.toLowerCase();
	
	isNav4 = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
	isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

	document.windowStatus.opened.value = "1";

	if (isIE4 && (agent.indexOf("mac")==-1))
	{	
		theWindow = window.open(URL,'Dribbles','width=700,height=470,scrollbars=no,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
	else
	{
		theWindow = window.open(URL,'Dribbles','width=715,height=487,toolbar=no,status=no,resizable=no,menubar=no,scrollbars=no,location=no');
	}
}

function getnextmovie()
{
	/*****
	var ie = navigator.appName.indexOf("Microsoft") != -1;

	var teasernum = rand(0, (theteasers.length));
	var ie = navigator.appName.indexOf("Microsoft") != -1;
	var teasermovie = (ie ? window.teaser : window.document.teaser);
	teasermovie.SetVariable ("nextmovie", theteasers[teasernum]);
	*****/
}

function concentration(URL)
{
	var agent = navigator.userAgent.toLowerCase();
	isNav4 = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
	isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

	document.windowStatus.opened.value = "1";

	if (isIE4 && (agent.indexOf("mac")==-1))
	{
		theWindow = window.open(URL,'Concentrate','width=400,height=360,scrollbars=no,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
	else
	{
		theWindow = window.open(URL,'Concentrate','width=415,height=377,scrollbars=no,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
}

function viewer(URL)
{
	var viewerPage = "taste/cd1/viewer/index.htm";
	
	var agent = navigator.userAgent.toLowerCase();
	isNav4 = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
	isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
	
	document.windowStatus.opened.value = "1";
	
	if (isIE4 && (agent.indexOf("mac")==-1))
	{	
		theWindow = window.open(viewerPage,'CellViewer','width=775,height=575,scrollbars=no,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
	else
	{
		theWindow = window.open(viewerPage,'CellViewer','width=790,height=590,scrollbars=no,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
}

function standard(URL)
{
	var agent = navigator.userAgent.toLowerCase();
	isNav4 = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
	isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

	document.windowStatus.opened.value = "1";

	if (isIE4 && (agent.indexOf("mac")==-1))
	{	
		theWindow = window.open(URL,'Standard','width=775,height=575,scrollbars=yes,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
	else
	{
		theWindow = window.open(URL,'Standard','width=790,height=590,scrollbars=yes,toolbar=no,status=no,menubar=no,resizable=no,location=no');
	}
}
function TCheck()
	{
		var x = 0;
		if(document.Teachers.Name.value=="")
		{
			window.alert("What is your Name? Click OK.");
			return false;
		}
		if(document.Teachers.Email.value=="")
		{
			window.alert("What is your Email Address? Click OK.");
			return false;
		}
		if(document.Teachers.School.value=="")
		{
			window.alert("What is your School that you teach at? Click OK.");
			return false;
		}
		if(document.Teachers.Speciality.value=="")
		{
			window.alert("What is your Speciality? Click OK.");
			return false;
		}
		if(document.Teachers.Country.value=="")
		{
			window.alert("What is your Country? Click OK.");
			return false;
		}
		if(document.Teachers.resources.value=="")
		{
			window.alert("Please list textbooks, multi-media, etc. Click OK");
			return false;
		}
		for(var i = 6; i <= 8; i++)
		{
			if(document.Teachers.elements[i].checked == true)
			{
				x++;	
			}
		}
		if(x == 0)
		{
			window.alert("You need to select at least one grade you taught in");
			return false;
		}
		return true;
	}
function OCheck()
	{
		if(document.Others.name.value=="")
		{
			window.alert("What is your Name? Click OK.");
			return false;
		}
		if(document.Others.email.value=="")
		{
			window.alert("What is your Email Address? Click OK.");
			return false;
		}
		if(document.Others.location.value=="")
		{
			window.alert("What is your Organization? Click OK.");
			return false;
		}
		if(document.Others.how.value=="")
		{
			window.alert("Where did you hear about us? Click OK.");
			return false;
		}	
		return true;
	}
	function MCheck()
		{
			if(document.Media.name.value=="")
			{
				window.alert("What is your Name? Click OK.");
				return false;
			}
			if(document.Media.email.value=="")
			{
				window.alert("What is your Email Address? Click OK.");
				return false;
			}
			if(document.Media.media.value=="")
			{
				window.alert("What is your Organization? Click OK.");
				return false;
			}
			if(document.Media.how.value=="")
			{
				window.alert("Where did you hear about us? Click OK.");
				return false;
			}	
			return true;
	}
function checkPopups()
{
	if(document.windowStatus.opened.value == "1")
	{
		if(!theWindow.closed)
		{
			theWindow.close();
		}
		document.windowStatus.opened.value = "0";
	}
}