function ValidateForm(prForm)
	{
	var cntChecks;
	
			if (prForm.first_name.value == "")
			{
			  alert("Please fill in your name");
					prForm.first_name.focus();
					return(false);	  
			}
			
			if (prForm.last_name.value == "")
			{
			  alert("Please fill in your surname");
					prForm.last_name.focus();
					return(false);	  
			}

			if (prForm.email.value.length < 2 || prForm.email.value.indexOf("@") == -1)
			{
			  alert("Please fill in your E-mail address");
					prForm.email.focus();
					return(false);	  
			}
return true;
}	

function SubmitForm(prForm){
	if (!ValidateForm(prForm)){ return false; }
	return true;
}

function drawSubscriptionForm () {
	var html = '';
	html += '<form onsubmit="return SubmitForm(document.forms[0]);" action="http://www.masterplan.co.za/phpmyformmail.php" method="post">';
	html += '<input type="hidden" value="jerome@masterplan.co.za" name="recipient">';
	html += '<input type="hidden" value="http://www.masterplan.co.za/resources/newsletter_thankyou.php" name="redirect">';
	html += '<input type="hidden" value="Newsletter subscription" name="subject">';
	
	html += '<table border="0" cellspacing="0" cellpadding="1">';
	html += '		  <tr>';
	html += '			<td><span style="font-weight: bold">Name*:</span></td>';
	html += '			<td><input type="text" name="first_name" id="first_name" class="formWidth"></td>';
	html += '		  </tr>';
	html += '		  <tr>';
	html += '			<td><span style="font-weight: bold">Surname*:</span></td>';
	html += '			<td><input type="text" name="last_name" id="last_name" class="formWidth"></td>';
	html += '		  </tr>';
	html += '		  <tr>';
	html += '			<td><span style="font-weight: bold">Email address*:</span></td>';
	html += '			<td><input type="text" name="email" id="email" class="formWidth"></td>';
	html += '		  </tr>';
	html += '		  <tr>';
	html += '			<td nowrap><span style="font-weight: bold">Contact number:</span></td>';
	html += '			<td><input type="text" name="contact" id="landline" class="formWidth"></td>';
	html += '		  </tr>';
	html += '		  <tr>';
	html += '			<td>&nbsp;</td>';
	html += '			<td><input type="submit" name="submit" id="submit" value="Subscribe"></td>';
	html += '	  	</tr>';
	html += '</table>';
	
	
	html += '</form>';
	document.write(html);
}
