var rayRefer=
{
validate:function()
	{
	var fname=this.getID('fname_refer'); // Get firstname field
	var email=this.getID('email_refer'); // Get email field
	var message=''; // Initialize message var
	var gname=document.getElementsByName('friend_name[]'); // Get all the friends name textbox
	var gemail=document.getElementsByName('friend_email[]'); // Get all the friends email textbox
	var shout=true; // Initialize shout var
	if(fname.value=='') // If first name not given
		{
		message='- Firstname field is mandatory\n'; // Let them know we need it
		fname.focus(); // Set the focus on the firstname textbox
		}
	if(email.value=='') // If email field not given
		{
		message+='- Email field is mandatory\n'; // Let them know we need it
		email.focus(); // Set the focus on email textbox
		}
	else if(!email.value.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)) // If they're trying to hack us
		{
		message+='- Email address is invalid\n'; // Let them know we hate that
		email.focus(); // Set the focus on email textbox	
		}
		
	for(var i=0;i<gname.length;i++) // Loop through all the friend's name textbox
	{
		if(gname[i].value!='') // If at least one of the field has an entry
			{
			shout=false; // Don't shout
			break; // End the loop prematurely
			} // End of the if statement
	} // End of the for loop
	
	if(shout) // See if shout was true
		message+='- Please provide at least one referral\n'; // Let them know we want someone's name
	
	for(var c=0;c<gemail.length;c++)
	{
		if(gemail[c].value!=''&&!gemail[c].value.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)) // Email should be valid
			{
			message+='- Your referral\'s email address is invalid\n'; // Let them know we hate that
			break; // End the loop prematurely
			} // End of the if statement
	} // Loop through all the friend's referral textbox
				
	if(message!='') // If the message var has something to say
		{			
		alert(message); // Let the user know their mistakes
		return false; // Don't submit the form
		} // End of the if statement
	}, // End of validate method/property of ray object
getID:function(el){return document.getElementById(el);} // return's the element's ID
} // End of ray object