var strTest = "Test" ;

/**
* This array of characters is used by the strRandomLetter function
*/
var astrLetters = new Array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
														 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
														 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
														 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ) ;


/**
* This function returns a single, random upper- or lower-case letter.
*/

function strRandomLetter()
{
	return astrLetters[ Math.floor( 52 * Math.random() ) ] ;
}

/**
* This function returns a sequence of between three and five random upper- and lower-case letters.
*/

function strRandomLetters()
{
	// Choose how many random characters to produce; range 3 to 5.
	//
	var intNoOfLetters = 3 + Math.floor( 3 * Math.random() ) ;
	var intIndex ;
	var strLetters = "" ;

	for ( intIndex=0; intIndex < intNoOfLetters; intIndex++ )
		strLetters += strRandomLetter() ;

	return strLetters ;
}

/**
* This function takes an email address, subject text and pop-up title text and writes to
* the document a randomised email address that is harder for robotic scanners to exploit.
*
* Created by Dr Paul A Daniels, 4-Dec-2008
*/

function AntiRobot( pstrEmailAddress1, pstrEmailAddress2, pstrSubject, pstrTitle )
{
	var strHTML = '\n<a href="' ;
	var strEmail = 'mailto:' + pstrEmailAddress1 + '@' + pstrEmailAddress2 + '?subject=' + pstrSubject ;
	var strDisplay = pstrEmailAddress1 + '<span style="display: none">' + strRandomLetters() + '</span>' +
									 '@' + '<span style="display: none">' + strRandomLetters() + '</span>' + pstrEmailAddress2 ;

	document.writeln( strHTML + encodeURI( strEmail ) + '" title="' + pstrTitle + '">\n  ' + strDisplay + '\n</a>' ) ;
}
