function submitForm() {
	return validateForm();
}

function testFunc(){
    var tmp = new Array();
    var tmp2 = new Array();
    var param = new Array();

    var get = location.search;
    if(get != '') {
        tmp = (get.substr(1)).split('&');
        for(var i=0; i < tmp.length; i++) {
            tmp2 = tmp[i].split('=');
            param[tmp2[0]] = tmp2[1];
        }
        if (param['send']) {
            alert("Activation email sent to " + param['send'] + ". 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!");
        }
    }
}

window.onload = testFunc;

function validateForm() {
	if (trim(document.submit_form.site_url.value).length < 1) {
		alert("Please enter the URL of the site.");
		document.submit_form.site_url.focus();
		return false;
	}
	if (trim(document.submit_form.anchor_text.value).length < 1) {
		alert("Please enter the name of the site.");
		document.submit_form.anchor_text.focus();
		return false;
	}
	if (trim(document.submit_form.description.value).length < 1) {
		alert("Please enter the description of the site.");
		document.submit_form.description.focus();
		return false;
	}
	if (trim(document.submit_form.reciprocal_url.value).length < 1) {
		alert("Please enter the reciprocal URL.");
		document.submit_form.reciprocal_url.focus();
		return false;
	}
	if (trim(document.submit_form.contact_name.value).length < 1) {
		alert("Please enter your contact name.");
		document.submit_form.contact_name.focus();
		return false;
	}
	if (trim(document.submit_form.contact_email.value).length < 1) {
		alert("Please enter your email address.");
		document.submit_form.contact_email.focus();
		return false;
	}
	
	return true;
}

function trim(str) {
	return str.replace(/^\s*/,'').replace(/\s*$/,'');
}
