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("Activation email sent to " + trim(submit_form.contact_email.value) + ". Please click the activation link in order to verify your email address (your link request will be discarded if you do not verify your email address.)\n\nThank you for submitting your link!");
			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*$/,'');
}