window.addEventListener?window.addEventListener('load',function(){
	ray.validateInp(); // Call the validateInp function inside ray object
	},false):
window.attachEvent('onload',function(){
	ray.validateInp(); // Call the validateInp function inside ray object
	}); // FF : IE
	
var ray=
{
validateInp:function()
	{
	var frm=document.getElementsByTagName('form')[0]; // Get a copy of our form
	this.checkURL();
	frm.onsubmit=function()
		{
		var inps=this.getElementsByTagName('input'); // Get a copy of all the input elements
		var txtArea=this.getElementsByTagName('textarea') ; // Get a copy of all the textarea
		if(this.password.value=='') {
			alert('Please retype the image in the "password" field.');
			ray.getID('password').focus();
			return false;
		}
		 for(var i=0;i<inps.length;i++) // Loop through all the textarea and input
			{
			if (inps[i].value.indexOf('http')>-1 ||
			inps[i].value.indexOf('ftp')>-1 ||
			inps[i].value.indexOf('www')>-1 ||
			inps[i].value.match(/(([\w\-]?)+\.)+([a-z]{2,4})/)
			) // If culprit detected
				{
				alert('Action not allowed.'); // Show me the message
				return false; // Don't submit the form
				}
			}
		for(var c=0;c<txtArea.length;c++)
			{
			if (txtArea[c].value.indexOf('http')>-1 ||
			txtArea[c].value.indexOf('ftp')>-1 ||
			txtArea[c].value.indexOf('www')>-1 ||
			txtArea[c].value.match(/(([\w\-]?)+\.)+([a-z]{2,4})/)
			) // If culprit detected
				{
				alert('Action not allowed.'); // Show me the message
				return false; // Don't submit the form
				}
			} // End of the for loop
		} // End of the function declaration
	}, // End of the function declaration
	
	checkURL:function(){
		if(location.href.indexOf('captcha=')>1){
			var captchaVal = location.href.split('captcha=')[1];
			if(captchaVal=='') {
				alert('Please retype the image.');
				window.scrollTo(0,5000);
				this.getID('password').focus();
			}
		}
	},
	
	getID:function(el) {
		return document.getElementById(el);
	}
} // End of the object
