/*

  JavaScript Captcha Script
   -  2009 Shaun Gill  -
http://www.landingnet.co.uk
http://www.shaungill.co.uk   

*/


	
// Set Variables	
	var site	=	'http://www.adoglikeyou.com/';  // this needs to be the 'root' of the site
	
	var first	=	(Math.floor(Math.random()*10))+'';
	var second	=	(Math.floor(Math.random()*10))+'';
	var third	=	(Math.floor(Math.random()*10))+'';
	var fourth	=	(Math.floor(Math.random()*10))+'';
	var fifth	=	(Math.floor(Math.random()*10))+'';
	
	var captcha	=	(first + second + third + fourth + fifth);


	
function jscaptcha()
{
// Display the Captcha Images
	
	document.write("<label>&nbsp;</label>");
	document.write("<div id=\"jscaptcha\" style=\"border: 1px solid #f90; width: 150px;margin:5px 0\">");
	document.write("<img src=\"" + site + "images/" + first	+ ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "images/" + second + ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "images/" + third + ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "images/" + fourth + ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "images/" + fifth + ".gif\" alt=\"\">");
	document.write("</div>");
	
	
// Display the Input Box
        document.write("<div id=\"jscaptcha2\">");
	document.write("<label><strong>Enter the numbers shown above</strong></label>");
        
	document.write("<input type=\"text\" name=\"jscaptchaInput\">");
	document.write("</div>");
}

function jscaptchaSubmit(frm)
{
	if(frm.jscaptchaInput.value != captcha)
	{
		alert("Please double check the numbers you entered; they don\'t quite match");
		valid = false;		
	}
	else
	{
		valid = true;
	}
	return valid;
}

