function trim(str) {
  while (str.charAt(str.length - 1)==" ")
    str = str.substring(0, str.length - 1);
  while (str.charAt(0)==" ")
    str = str.substring(1, str.length);
  return str;
}

function verifyCompleteExchange() {

	LinkDetailsForm.name.value = trim(LinkDetailsForm.name.value);
	LinkDetailsForm.email.value = trim(LinkDetailsForm.email.value);
	LinkDetailsForm.linkin.value = trim(LinkDetailsForm.linkin.value);
	LinkDetailsForm.url.value = trim(LinkDetailsForm.url.value);
	LinkDetailsForm.websitetitle.value = trim(LinkDetailsForm.websitetitle.value);
	
	if ((LinkDetailsForm.name.value == "") || (LinkDetailsForm.name.value == "Your Name")) {
		alert ("Please enter your name.");
		LinkDetailsForm.name.focus();
		return false;
	}
	if (LinkDetailsForm.email.value == "") {
		alert ("Please enter a valid address.");
		LinkDetailsForm.email.focus();
		return false;
	}
	if (LinkDetailsForm.email.value !="")
	{ 
		var goodEmail = LinkDetailsForm.email.value.match
							(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmail)
		{
			//alert('good email 1');
		} 
		else 
		{
			alert('Please enter a valid e-mail address.');
			LinkDetailsForm.email.focus();
			LinkDetailsForm.email.select();
			return false;
		}
	}
	if (!goodEmail) return false;

	if ((LinkDetailsForm.linkin.value == "") || (LinkDetailsForm.linkin.value == "Location of my link on your website")) {
		alert ("Please enter the web page where you placed my link details.");
		LinkDetailsForm.linkin.focus();
		return false;
	}

	if ((LinkDetailsForm.url.value == "") || (LinkDetailsForm.url.value == "URL of your website")) {
		alert ("Please enter the URL of your website.");
		LinkDetailsForm.url.focus();
		return false;
	}

	if ((LinkDetailsForm.websitetitle.value == "") || (LinkDetailsForm.websitetitle.value == "Title of your website")) {
		alert ("Please enter the title of your website.");
		LinkDetailsForm.websitetitle.focus();
		return false;
	}

	if ((LinkDetailsForm.description.value == "") || (LinkDetailsForm.description.value == "Description of your website")) {
		alert ("Please enter the description of your website.");
		LinkDetailsForm.description.focus();
		return false;
	}

	return true;
}


