/*

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

*/


	
// Set Variables	
	//var site	=	'http://www.shaungill.co.uk/scripts/jscaptcha/';  // 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 fith	=	(Math.floor(Math.random()*10))+'';
	
	var captcha	=	(first + second + third + fourth + fith);


	
function jscaptcha()
{
// Display the Captcha Images
	document.write("<img src=\"assets/templates/aircare/images/captcha/" + first	+ ".gif\" alt=\"\" height=\"25\" align=\"absbottom\">");
	document.write("<img src=\"assets/templates/aircare/images/captcha/" + second + ".gif\" alt=\"\"  height=\"25\" align=\"absbottom\">");
	document.write("<img src=\"assets/templates/aircare/images/captcha/" + third + ".gif\" alt=\"\" height=\"25\" align=\"absbottom\">");
	document.write("<img src=\"assets/templates/aircare/images/captcha/" + fourth + ".gif\" alt=\"\" height=\"25\" align=\"absbottom\">");
	document.write("<img src=\"assets/templates/aircare/images/captcha/" + fith + ".gif\" alt=\"\" height=\"25\" align=\"absbottom\">");
// Display the Input Box
}

function jscaptchaSubmit(frm)
{
	if(frm.code.value != captcha)
	{
		$("#code").before("<div class='error'>**Enter the code shown on the image.</div>");	
		valid = false;		
	}
	else
	{
		$('#verify').attr('value',$('#code').val());
		valid = true;
	}
	return valid;
}
