var ANSWER = {
	fields: ['first_name', 'last_name',  'email', 'phone'],

	init_form: function()
	{
		for (var i = 0, L = ANSWER.fields.length; i < L; i++)
		{
			document.getElementById(ANSWER.fields[i]).onfocus = ANSWER.clearField;
		}
	},	

	clearField: function()
	{
		if (this.value && this.type == 'text' || this.type == 'password')
		{
			this.select();
		}
		else
		{
			this.style.backgroundColor = 'White';
		}
	},

	testForm: function()
	{
		var o, r = false;
		for (var i = 0, L = ANSWER.fields.length; i < L; i++)
		{
			o = document.getElementById(ANSWER.fields[i]);
            if (o.value == '' || o.value == -1)
			{
				o.style.backgroundColor = 'Red';
				r = true;
			}
			else
			{
				o.style.backgroundColor = 'White';
			}
		}
	
		if (r)
		{
		    alert('Not Empty!');
		}
		return r;
	}
}

ANSWER.init_form();
