function checkForm(obj)

{

	var i;

	var empty;

	var checks= new Array();

	checks[0] = 'naam';

	checks[1] = 'email';

	

	empty = false;

	for(i = 0; i < checks.length; i++)

	{

		if(!checkEmpty(checks[i]))

		{

			changeStyle(checks[i],true);

			empty = true;

		}

		else

		{

			changeStyle(checks[i],false);

		}

	}

	if(empty == true)

	{

		return false;	

	}

	else

	{

		return true;	

	}

}

function changeStyle(idName,bool)

{

	if(bool == true)

	{

		document.getElementById(idName).style.background = 'red';

		document.getElementById(idName).style.color = 'white';

	}

	else

	{

		document.getElementById(idName).style.background = 'white';

		document.getElementById(idName).style.color = 'black';

	}

	return;

	

}

function checkEmpty(idName)

{

	if(trim(document.getElementById(idName).value) == '')

	{

		return false;

	}

	else

	{

		return true;

	}

}

function trim(value) {

  value = value.replace(/^\s+/,'');

  value = value.replace(/\s+$/,'');

  return value;

}

document.write('<form id="tip" method="post" onsubmit="return checkForm(this);" action=""><input type="hidden" name="mailAFriend" value="true" /> <label for="naam">Naam vriend</label><input name="naam" type="text" id="naam" size="30" class="boxes"/><br/><label for="email">E-mailadres vriend(in):</label><input name="email" type="text" id="email" size="30" class="boxes"/><br/><label for="tipTxt">Persoonlijke tekst*:</label><textarea name="tipTxt" cols="30" rows="5" id="tipTxt" class="boxes"></textarea><br/><input type="submit" id="btn" value="Verzend tip" class="submit"></form>');
