///////////////////////////////////////////////////////////////////
//    
//	   File Name: VALIDATION TEST 
//      
//     Purpose: Created to prevent forms from being submitted by
//			      bot programs ,to prevent spamming 
////////////////////////////////////////////////////////////////////       



//The string of characters represented by bitmaps
var keystring = "";
//////////////////////////////////////////////////////
//   FUNCTION : showvalidationtext
//	  		  
//   Purpose: To generate and display six bitmaps of modified alphabet characters         
//
//
function showvalidationtext()
{
	
	//create the new variable array
	var character = new Array();
	//the number of characters in our validation text
	var numChars = 6;
	
	//loop through array generating random characters
	for(i = 0;  i < numChars; i++)
	{
		character[i] = 97 + Math.round(Math.random() * 25);
		//generate the string version
		keystring = keystring + String.fromCharCode(character[i]);
	}
	
	//bitmap names randomized for security purposes
	
	
	var imageDir = "validationImages/";  
	for(j = 0;  j < numChars; j++)
	{
		var temp = character[j];
		switch(temp)
		{
			case 97: document.write("<img src=\"../" + imageDir + "821" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 98: document.write("<img src=\"../" + imageDir + "133" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 99: document.write("<img src=\"../" + imageDir + "596" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 100: document.write("<img src=\"../" + imageDir + "642" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 101: document.write("<img src=\"../" + imageDir + "493" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 102: document.write("<img src=\"../" + imageDir + "288" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 103: document.write("<img src=\"../" + imageDir + "937" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 104: document.write("<img src=\"../" + imageDir + "940" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 105: document.write("<img src=\"../" + imageDir + "4" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
 			   break;
			case 106: document.write("<img src=\"../" + imageDir + "633" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 107: document.write("<img src=\"../" + imageDir + "186" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 108: document.write("<img src=\"../" + imageDir + "584" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 109: document.write("<img src=\"../" + imageDir + "82" + ".png\" width=\"30\" height=\"30\" alt=\"\">"); 
 			   break;
			case 110: document.write("<img src=\"../" + imageDir + "653" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 111: document.write("<img src=\"../" + imageDir + "17" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
 			   break;
			case 112: document.write("<img src=\"../" + imageDir + "526" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 113: document.write("<img src=\"../" + imageDir + "843" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 114: document.write("<img src=\"../" + imageDir + "923" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 115: document.write("<img src=\"../" + imageDir + "899" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 116: document.write("<img src=\"../" + imageDir + "191" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 117: document.write("<img src=\"../" + imageDir + "865" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 118: document.write("<img src=\"../" + imageDir + "21" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;	
			case 119: document.write("<img src=\"../" + imageDir + "102" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 120: document.write("<img src=\"../" + imageDir + "495" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 121: document.write("<img src=\"../" + imageDir + "116" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
			   break;
			case 122: document.write("<img src=\"../" + imageDir + "845" + ".png\" width=\"30\" height=\"30\" alt=\"\">");
				
			  break;	
			default:  
		}
		
	}

return true;
}



//////////////////////////////////////////////////////////////////////////////////
//   FUNCTION : validateText
//	  		  
//   Purpose: To validate that the user has entered the validation code correctly        
//
function validateText(t1)
{
	
	
	if (t1==keystring) 
	{
		alert("Thank you for entering the correct validation code");
		return true;
	}
	else
	{
		alert("ERROR: Enter the characters as they are shown.");
		document.getElementById("validationkey").focus();
		return false;
	}
}

//  End --> 
