// JavaScript Document
var flag;

/* Captcha Function. */



function DrawCaptcha()

{	
	
	var a = Math.ceil(Math.random() * 5)+ '';

	var b = Math.ceil(Math.random() * 5)+ '';       

	var c = Math.ceil(Math.random() * 5)+ '';  

	var d = Math.ceil(Math.random() * 5)+ '';  

	var e = Math.ceil(Math.random() * 5)+ '';  

	var f = Math.ceil(Math.random() * 5)+ '';  

	var g = Math.ceil(Math.random() * 5)+ '';  

	var code = a + ' ' + b + ' ' + ' ' + c + ' ' + d + ' ' + e + ' '+ f + ' ' + g;

	

	document.getElementById("txtCaptcha").value = code;

	//document.getElementById("txtInput").value = code;

}



    // Validate the Entered input aganist the generated security code function   

function ValidCaptcha()

{

	

	var str1 = removeSpaces(document.getElementById('txtCaptcha').value);

	var str2 = removeSpaces(document.getElementById('TR_txtInput').value);

	

	if (str1 == str2) 

	{

		//document.getElementById('captcha_err').innerHTML="";

		return true;  

	}

	else

	{

		//document.getElementById('captcha_err').innerHTML="Invalide Captcha Value";
		alert("Invalide Captcha Value");

		return false;

	}//return false;

	

}



// Remove the spaces from the entered and generated code

function removeSpaces(string)

{

	return string.split(' ').join('');

}
	
