function changeBG(thisStyle, thisColor)	{
	thisStyle.background = thisColor
}

function checkForm(thisForm)	{
	if((thisForm.elements['feename'].value).length == 0)	{
		alert('You must enter your full name')
		return false
	}
	if(!isEmail(thisForm.elements['email'].value))	{
		alert('You must enter a valid email address')
		return false
	}
	if((thisForm.elements['password'].value).length < 5)	{
		alert('Your password must be at least 5 characters long')
		return false;
	}
	if((thisForm.elements['firmname'].value).length == 0)	{
		alert('You must enter your firm name')
		return false;
	}
	if(!isTel(thisForm.elements['telephone'].value, 'telephone') || !isTel(thisForm.elements['fax'].value, 'fax'))	{
		return false;
	}	
	return true;
}

function isTel(num, field)	{
	if(num.length > 0)	{
		if(num.length >= 10)	{
			for(var i=1;i<num.length;i++)	{
				if(isNaN(num.charAt(i)) && num.charAt(i) != ' ')	{
					alert('Your '+field+' number must only contain numbers')
					return false;
				}
			}
		}	else	{
			alert('Your '+field+' number is too short')
			return false;
		}
	}
	return true;
}	
function isEmail(val)	{
	if(val.length > 3)	{
		if((val.indexOf('@') >= 1) && (val.indexOf('@') + 1 < val.lastIndexOf('.')) && (val.lastIndexOf('.') != val.length-1))	{
			return true;
		}
	}
	return false;
}