guess=0;
correct = 0;
incorrect = 0;
function FormatNumber(num, decimalNum, bolLeadingZero, bolParens)
/* IN - num:            the number to be formatted
decimalNum:     the number of decimals after the digit
bolLeadingZero: true / false to use leading zero
bolParens:      true / false to use parenthesis for - num
RETVAL - formatted number
*/
{
	var tmpNum = num;
	// Return the right number of decimal places
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.floor(tmpNum);
	tmpNum /= Math.pow(10,decimalNum);
	var tmpStr = new String(tmpNum);
	// See if we need to hack off a leading zero or not
	if (!bolLeadingZero && num < 1 && num > -1 && num !=0)
		if (num > 0) {
		tmpStr = tmpStr.substring(1,tmpStr.length);}
		else {
		// Take out the minus sign out (start at 2)
		tmpStr = "-" + tmpStr.substring(2,tmpStr.length);
	}
	// See if we need to put parenthesis around the number
	if (bolParens && num < 0) {
		tmpStr = "(" + tmpStr.substring(1,tmpStr.length) + ")";
	}
	return tmpStr;
}
function generateRandomNumber(name) {
	answer=Math.floor(Math.random()*5) +1
		if(answer == name) {
			correct++;
		guess++;
		shape = new Array('Circle','Cross','Square','Star','Wave')
			now = "You are correct. The answer is " + shape[answer - 1];
		document.fname.report.value =guess;
		document.fname.report2.value = now;
		document.fname.report4.value = correct;
		document.fname.report6.value =Math.floor(correct/guess * 100) +"%";
		} else {
		incorrect++;
		guess++;
		shape = new Array('Circle','Cross','Square','Star','Wave')
			now = "Try again. The answer is "+ shape[answer - 1];
		document.fname.report.value =guess;
		document.fname.report2.value = now;
		document.fname.report4.value = correct;
		document.fname.report6.value =Math.floor(correct/guess * 100) +"%";
		//document.fname.report.value =
	}
}
function psychic() {
	a = .16 * guess;
	b = Math.sqrt(a);
	c = guess * .2 ;
	d = correct - c ;
	e =(d/b) ;
	f = Math.abs(e);
	g = FormatNumber(f,2,true,false)
		if( f <= 1.96) {
			document.fname.tell.value = "Your score of " +g+ " does not indicate psychic ability.";
		} if( f > 1.96 && f <= 2.58) {
		document.fname.tell.value = "Your score of " +g+ " indicates slight psychic ability." ;
	}
	if( f > 2.58 && f <= 3.00) {
		document.fname.tell.value = "Your score of " +g+ " indicates significant psychic ability" ;
		if( f > 3.00) {
			document.fname.tell.value = "Your score of " +g+ " indicates very significant psychic ability" ;
		}
	}
}
function openit(){
	winda =
		window.open("","newone","scrollbars,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=400,height=250");
	winda.focus();
	winda.document.open();
	winda.document.write("<font style='font-family:arial; font-size:10pt; color:#000080'>This test is based on the Zenner card test.  Since the shape is not selected until after you have made your choice, this is a test of your ability to predict future events.  The accuracy of the result increases with the number of guesses that you make.  The significance level is determined by a formula that was used with the Zenner tests.  Less then 1.96 indicates no psychic ability.  1.96 to 2.58 indicates some psychic ability.  2.58 to 3.00 indicates significant psychic ability. Greater then 3.00 indicates very signficant psychic ability.</font>");
	winda.document.close();
}