var eTT_text = new Array(); 
eTT_text[0] = new Array("Nothing can stop the man with the right mental attitude from achieving his goal; nothing on earth can help the man with the wrong mental attitude.","Thomas Jefferson"); 
eTT_text[1] = new Array("Nothing is so wretched or foolish as to anticipate misfortunes. What madness is it to be expecting evil before it comes.","Seneca"); 
eTT_text[2] = new Array("Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.","Albert Einstein"); 
eTT_text[3] = new Array("The quick brown fox jumped over the lazy little puppy dog, then fell fast asleep as he counted sheep.",""); 
eTT_text[4] = new Array("The minute you settle for less than you deserve, you get even less than you settled for.","Maureen Dowd"); 
eTT_text[5] = new Array("When I examine myself and my methods of thought, I come to the conclusion that the gift of fantasy has meant more to me than my talent for absorbing positive knowledge.","Albert Einstein"); 
eTT_text[6] = new Array("If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest.","Joseph E. O'Donnell"); 
eTT_text[7] = new Array("Genial manners are good, and power of accommodation to any circumstance, but the high prize of life, the crowning fortune of a man is to be born with a bias to some pursuit, which finds him in employment and happiness.","Ralph Waldo Emerson"); 
eTT_text[8] = new Array("Neither a borrower nor a lender be; For loan oft loses both itself and friend, and borrowing dulls the edge of husbandry.","William Shakespeare"); 
eTT_text[9] = new Array("If you have built castles in the air, your work need not be lost; that is where they should be. Now put the foundations under them.","Henry David Thoreau"); 
eTT_text[10] = new Array("If you can imagine it, you can achieve it. If you can dream it, you can become it.","William Arthur Ward"); 
eTT_text[11] = new Array("Shoot for the moon. Even if you miss, you'll land among the stars.","Les Brown"); //for(i=0;i<eTT_text.length;i++) {
//	var tmp = eTT_text[i];
//	alert(tmp[0]);
//}
//alert(eTT_text.length);
//alert('35');
var eTT_text_idx = 0;
var eTT_qc = "Thomas Jefferson";
var eTT_cnt = 0;
var eTT_st = false;
var eTTr = false;
var eTT_f;
var eTT_tid;
var eTT_b_msg = "Sorry - Your web browser does not support this operation. Please upgrade or use a different browser.";
function eTT_gr(x) {
	eTT_st = false;
	eTTr = false;
	eTT_cnt = 0;
	if(eTT_tid) { clearTimeout(eTT_tid); }
	eTT_f = document.forms['eTTform'];
	eTT_f.wpm.value = "";
	eTT_f.inp.value = "";
	if(x) {
		if(!document.getElementById) { alert(eTT_b_msg); return false; }
		var obj = document.getElementById("eTT_id_text");
		if(!obj.innerHTML) { alert(eTT_b_msg); return false; }
		eTT_text_idx = eTT_text_idx+1;
		if(eTT_text_idx==eTT_text.length) { eTT_text_idx = 0; }
		var a = eTT_text[eTT_text_idx];
		var txt = a[0];
		eTT_qc = a[1];
		obj.innerHTML = txt;
	}
}
function eTT_q_credit() {
	if(eTT_qc) { alert(eTT_qc); }
	else { alert("Unknown author"); }
}
function eTT_s() {
	if(eTTr) { return; }
	eTTr = true;
	eTT_tmr();
}
function eTT_tmr() {
	if( !eTT_st ) {
		eTTr = true;
		eTT_cnt ++;
		//eTT_f = document.forms['eTTform'];
		eTT_wpm();
		eTT_tid = setTimeout("eTT_tmr()",1000);
	}
}
function eTT_c() {
	if(document.forms['eTTform'].inp.value=="") { return false; }
	eTT_st = true;
	clearTimeout(eTT_tid);
	eTT_wpm();
}
function eTT_wpm()
{
	//var eTT_f = document.forms['eTTform'];
	var w = eTT_f['inp'].value.split(" ");
	var cnt = 0;
	for(var i=0; i<w.length; i++) {
		if(w[i]) {
			cnt++;
		}
	}
	var m = eTT_cnt/60;
	var wpm = cnt/m;
	eTT_f.wpm.value = Math.round(wpm);
}

if( document.layers && !document.getElementById ) {
	document.write( 'Sorry, to view this typing test you must use a newer browser.<p />');
} else {
document.write(
'<table width="100%" cellpadding="0" cellspacing="7" border="0">',
'<form name="eTTform">',
	'<tr>',
		'<td><div align="center"><span style="font-family:arial,helvetica,sans-serif;font-size:13px;color:#000000"><b>',
		'How Fast Can You Type?</b></div>',
		'<span style="font-family:arial,helvetica,sans-serif;font-size:11px;color:#000000">',
		'Type the entire sentence below. The test will begin when you type your first character. When you are done, hit your <i>tab</i> key or click the <i>stop</i> button.  <span style="font-size:10px">(Author of current quote: <a href="#" onclick="eTT_q_credit();return false;" style="color:#000000">click here</a>)</span>.',
		'</span></td>',
	'</tr>',
	'<tr>',
		'<td style="padding:10px;border: 1px solid #cdcdcd; background-color:#ffffff">',
		'<div id="eTT_id_text" style="font-family:arial,helvetica,sans-serif;font-size:12px;color:#000000">',
		"Nothing can stop the man with the right mental attitude from achieving his goal; nothing on earth can help the man with the wrong mental attitude.",
		'</div></td>',
	'</tr>',
	'<tr>',
		'<td align="center" s!tyle="font-family:arial,helvetica,sans-serif;font-size:12px;padding:10px;border: 1px solid #000000; background-color:#FFFF99">',
		'<span style="font-family:arial,helvetica,sans-serif;font-size:12px">',
		'<textarea onmousedown="eTT_gr()" onkeydown="eTT_s()" onchange="eTT_c()" style="width:300px;height:60px;font-family:arial,helvetica,sans-serif;font-size:12px" rows="4" cols="20" name="inp" wrap="virtual"></textarea></span>',
		'<br /><input type="button" onclick="eTT_c();return false;" name="stop" value="stop" style="background-color:#ffffff; border:2px solid #000000; border-top:1px solid #999999; border-left:1px solid #999999; color:#000000; font-size:11px; font-family:arial,verdana,helvetica,sans-serif;">',
		' <input type="button" onclick="eTT_gr();return false;" name="reset" value="reset" style="background-color:#ffffff; border:2px solid #000000; border-top:1px solid #999999; border-left:1px solid #999999; color:#000000; font-size:11px; font-family:arial,verdana,helvetica,sans-serif;">',
		' <input type="button" onclick="eTT_gr(1);return false;" name="newtext" value="next" style="background-color:#ffffff; border:2px solid #000000; border-top:1px solid #999999; border-left:1px solid #999999; color:#000000; font-size:11px; font-family:arial,verdana,helvetica,sans-serif;">',
		'</td>',
	'</tr>',
	'<tr>',
		'<td align="center" style="border: 1px solid #999999;">',
		'<span style="font-family:arial,helvetica,sans-serif;font-size:11px;color:#000000">Your speed is <input type="text" name="wpm" value="" size="2" style="font-family:arial,helvetica,sans-serif;font-size:11px;width:30px"> words per minute ',
		'<a href="#" onclick="alert(\'Please note that this test does not give a corrected score (does not detect typing errors).\');return false;">*</a></span></td>',
	'</tr>',
'</form>',
'</table>'
);
}
