function submitForm() {
	if (validateForm()) {
		if (submit_form.skip_confirmation && submit_form.skip_confirmation.value == "true") {
			alert("Thank you for submitting your link!\n\nYour link will be approved as soon as we check your details and see a link to our webiste on your web page " + trim(submit_form.reciprocal_url.value));
			return true;
		} else {
			alert("Thank you for submitting your link!\n\nYour link will be approved as soon as we check your details and see a link to our webiste on your web page " + trim(submit_form.reciprocal_url.value));
			return true;
		}
	}
	return false;
}

function validateForm() {
	if (trim(submit_form.site_url.value).length < 1) {
		alert("Please enter the URL of the site.");
		submit_form.site_url.focus();
		return false;
	}
	if (trim(submit_form.anchor_text.value).length < 1) {
		alert("Please enter the name of the site.");
		submit_form.anchor_text.focus();
		return false;
	}
	if (trim(submit_form.description.value).length < 1) {
		alert("Please enter the description of the site.");
		submit_form.description.focus();
		return false;
	}
	if (trim(submit_form.reciprocal_url.value).length < 1) {
		alert("Please enter the reciprocal URL.");
		submit_form.reciprocal_url.focus();
		return false;
	}
	if (trim(submit_form.contact_name.value).length < 1) {
		alert("Please enter your contact name.");
		submit_form.contact_name.focus();
		return false;
	}
	if (trim(submit_form.contact_email.value).length < 1) {
		alert("Please enter your email address.");
		submit_form.contact_email.focus();
		return false;
	}
	
	return true;
}

function trim(str) {
	return str.replace(/^\s*/,'').replace(/\s*$/,'');
}