expires = new Date();
expires.setTime(expires.getTime() + 86400000);
expires2 = new Date();
expires2.setTime(expires2.getTime() - 1);
sum = 0;
winprops = "height=560, toolbar=no, width=500";

function check_email(email) {
	invalid = " /:,;";
	if (email == "") {
		return false
	}
	for (i=0; i < invalid.length; i++) {
		bad = invalid.charAt(i);
		if (email.indexOf(bad, 0) != -1) {
			return false;
		}
	} 
	at = email.indexOf("@", 0);
	if ((at == -1) || (at == 0)) {
		return false;
	}
	if (email.indexOf("@", at+1) != -1) {
		return false;
	}
	period = email.indexOf(".", at);
	if ((period == -1) || (period == at+1)) {
		return false;
	}
	if (period+3 > email.length == -1) {
		return false;
	}
	return true;
}

function save(form) {
	if (!(check_email(form.email.value))) {
		alert('Please type a valid e-mail address!');
		form.email.focus();
		form.email.select();
		return false;
	}
	else {
		return true;
	}
}

function Results(correct1, correct2, correct3, correct4, correct5, mess_20, mess_40_80, mess_100) {
	checks = 0;
	score = 0;
	score_message = "";
	your_knowledge_message = "";
	compare_answers_message = "";
	message = "";
	for (radio=0; radio<=19; radio++) {
		if (document.sample.elements[radio].checked) {
			checks += 1;
		}
	}
	if (checks==5) {
		for (question=0; question<=4; question++) {
			for (radio=question*4+1; radio<=question*4+4; radio++) {
				new_radio = radio-1;
				if (document.sample.elements[new_radio].checked) {
					if (document.sample.elements[new_radio].value.substring(0,1) == "T") {
						compare_answers_message += Math.floor(new_radio / 4 + 1) + ". Correct\n\n";
						score += 20;
					}
					else {
						compare_answers_message += Math.floor(new_radio / 4 + 1) + ". Incorrect\nThe correct answer: " + Results.arguments[question] + "\nYour answer: " + document.sample.elements[new_radio].value.substring(2,document.sample.elements[new_radio].value.length) + "\n\n";
					}
				}
			}
		}
		score_message = "Your result: " + score/20 + " of 5 (" + score + "%)\n\n";
		if (score <= 20) {
			your_knowledge_message = mess_20;
		}
		if (score >= 40 && score <= 80) {
			your_knowledge_message = mess_40_80;
		}
		if (score == 100) {
			your_knowledge_message = mess_100;
		}
		message = score_message + your_knowledge_message + compare_answers_message;
		alert(message);
	}
	else {
		alert('You have not selected all answers. Please try again.');
	}
}

function Count() {
	var j = 0;
	var k = 70;
	sum = 0;
	for (j = 0; j < document.cookie.length/70; j++)
		{
		sum = sum + "+" + document.cookie.substring(k-20,k-16);
		k += 70;
		}
	sum = Math.round(100*eval(sum))/100;
	if (document.cookie.length==70)
		{
		document.order.status.value = document.cookie.length/70 + " item, $" + sum;
		}
	else
		{
		document.order.status.value = document.cookie.length/70 + " items, $" + sum;
		}
}

function Pantheon() {
	window.location.href = document.pantheon.othercoll.options[document.pantheon.othercoll.selectedIndex].value;
}

function showCollAccessWin() {
	self.name = "main";
	accessWin = window.open("../accession.htm", "Accessions", winprops);
}

function Titbits() {
	window.location.href = document.titbits.othersite.options[document.titbits.othersite.selectedIndex].value;
}

function closeRemote() {
	timer = setTimeout('window.close();', 10);
}

down = new Array();
down['461'] = 44;
down['473'] = 64;
down['474'] = 2;
down['475'] = 35;
down['476'] = 36;
down['477'] = 30;
down['489'] = 111;
down['490'] = 140;
down['502'] = 11;
down['503'] = 36;
down['505'] = 'N/A';
down['506'] = 'N/A';
down['507'] = 'N/A';
down['508'] = 'N/A';
down['509'] = 'N/A';
down['510'] = 'N/A';
down['511'] = 'N/A';
down['512'] = 13;
down['520'] = 37;
down['521'] = 34;
down['522'] = 34;
down['531'] = 2;
down['532'] = 'N/A';
down['533'] = 'N/A';
down['537'] = 'N/A';
down['538'] = 'N/A';
down['540'] = 'N/A';
down['542'] = 'N/A';
down['543'] = 'N/A';
down['544'] = 'N/A';
down['545'] = 'N/A';
down['546'] = 'N/A';
down['547'] = 'N/A';
down['548'] = 'N/A';
down['549'] = 'N/A';
down['550'] = 'N/A';
down['551'] = 'N/A';
down['552'] = 'N/A';
down['553'] = 'N/A';
down['557'] = 'N/A';
down['562'] = 'N/A';
down['563'] = 'N/A';
down['565'] = 'N/A';
down['567'] = 'N/A';
down['568'] = 'N/A';
down['569'] = 'N/A';
down['570'] = 'N/A';
down['571'] = 'N/A';
down['572'] = 'N/A';
down['573'] = 'N/A';
down['649'] = 'N/A';
down['100toefl'] = 2947;
down['advtest'] = 1620;
down['aeintro'] = 1808;
down['afghantime'] = 520;
down['aging'] = 1076;
down['alephbet'] = 308;
down['amstated'] = 1387;
down['arabalpha'] = 1173;
down['asm8086d'] = 1512;
down['asteroid'] = 620;
down['astr'] = 249;
down['atoms'] = 405;
down['b2'] = 500;
down['calc'] = 277;
down['capital'] = 1980;
down['capstate'] = 3536;
down['cars'] = 147;
down['chord'] = 744;
down['confusion'] = 1029;
down['danish'] = 731;
down['digest'] = 20256;
down['disease'] = 2283;
down['divtable'] = 935;
down['dm'] = 577;
down['dogbreed'] = 185;
down['dzongalpha'] = 268;
down['ecomm'] = 1460;
down['economicsd'] = 821;
down['educ'] = 520;
down['engculin'] = 70;
down['engprovd'] = 1271;
down['engverbd'] = 1296;
down['familyfact'] = 557;
down['fraction'] = 263;
down['fuhao'] = 151;
down['gems'] = 530;
down['geralpha'] = 91;
down['gerpsychol'] = 1952;
down['gre'] = 1093;
down['greekalpha'] = 1788;
down['greekverb'] = 314;
down['gregen'] = 5117;
down['guide'] = 714;
down['heavybox'] = 2226;
down['hebconstr'] = 135;
down['hieralpha'] = 1318;
down['ie6'] = 915;
down['interhun'] = 2182;
down['ireland'] = 89;
down['javascriptir'] = 248;
down['koine'] = 636;
down['labview'] = 2501;
down['latalpha'] = 782;
down['latin'] = 909;
down['locationd'] = 355;
down['mathtest'] = 436;
down['mindmaze'] = 1078;
down['morse'] = 2033;
down['movies'] = 347;
down['mrwmath'] = 877;
down['mrwsample'] = 1594;
down['multitable'] = 577;
down['numeral'] = 610;
down['ole'] = 866;
down['osdistr'] = 719;
down['osmemory'] = 1109;
down['osprocess'] = 1131;
down['ossync'] = 1159;
down['outexp5'] = 340;
down['outexp6'] = 306;
down['particle'] = 856;
down['pharm'] = 2568;
down['phobia'] = 1636;
down['phototools'] = 169;
down['poland'] = 951;
down['portuguese'] = 336;
down['pregnancy'] = 1361;
down['presidentd'] = 675;
down['presidentv'] = 106;
down['psychol'] = 1592;
down['pvd'] = 891;
down['pvtest'] = 1091;
down['radiowav'] = 985;
down['record'] = 2652;
down['sep11'] = 1068;
down['si'] = 482;
down['sierra'] = 559;
down['signlang'] = 770;
down['sm2000'] = 1192;
down['sm2000gloss'] = 854;
down['sm2002'] = 259;
down['sm98'] = 535;
down['sm99'] = 627;
down['smilie'] = 2200;
down['smpt'] = 'N/A';
down['spaalpha'] = 225;
down['spamed'] = 165;
down['spellkids'] = 1262;
down['swahintro'] = 570;
down['swedish'] = 431;
down['tagalog'] = 855;
down['thai'] = 1196;
down['uetreaties'] = 223;
down['unit'] = 521;
down['visaya'] = 763;
down['webbrowser'] = 932;
down['winamp'] = 204;
down['wincmd'] = 'N/A';
down['wintersport'] = 141;
down['word'] = 172;
down['wordaday'] = 4;
