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'>Relax, and then simply look at the images and concentrate, trying to envision which card will come up next. Then click the button for the card of your choice.  Repeat 10 to 20 times and then click the Test Results button to find out how psychic you are. The first time you try this test, your score may be lower than it actually is, simply because you're new at this.  The second time you try, you should get a more reliable score as to your psychic ability. Taking this test while you're under a lot of stress, have something pressing on your mind, or surrounded by a lot of noise and activity may also negatively affect the accuracy of your test results. Take this test when you're calm, able to relax and concentrate.</font>");
	winda.document.close();
}