/*

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

Modified by Darren Moss, July 2009.

*/
// Set Variables	
	var site	=	'http://www.webhostNZ.co.nz/';  // 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("<label>&nbsp;</label>");
	// document.write("<div id=\"jscaptcha\" 
	document.write("<style=\"border: 1px solid #f90; width: 150px;\">");
	document.write("<img src=\"" + site + "capcha/" + first	+ ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "capcha/" + second + ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "capcha/" + third + ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "capcha/" + fourth + ".gif\" alt=\"\">");
	document.write("<img src=\"" + site + "capcha/" + fith + ".gif\" alt=\"\">");
	document.write("</div>");
	
	
// Display the Input Box
	document.write("<br>");
	document.write("<input type=\"text\" name=\"jscaptchaInput\">");
	
}

function jscaptchaSubmit(frm)
{
	if(frm.jscaptchaInput.value != captcha)
	{
		alert("Sorry, the numbers entered don\'t match, Please try again.");
		valid = false;		
	}
	else
	{
		valid = true;
	}
	return valid;
}
