function strReplace(str1, str2, str3) { 
	while(str1.indexOf(str2) != -1) {
		str1 = str1.replace(str2, str3);
	} 
	return str1;     
} 

function isValidEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return true;
	}
	return false;
}

function validateForm() {
	var isValid = true;
	var email = document.getElementById('txtEmail').value;
	
	if (document.getElementById('txtFirstName').value==""){ isValid = false; }
	if (document.getElementById('txtLastName').value==""){ isValid = false; }
	//if (document.getElementById('txtPhone').value==""){ isValid = false; }
	if (document.getElementById('txtEmail').value==""){ isValid = false; }
	//if (document.getElementById('txtComments').value==""){ isValid = false; }
	
	if (!(isValid)) {
		alert('Please fill out all required fields.');
		return false;
	}
	
	if (!isValidEmail(email)) {
		alert('Please enter a valid email.');
		return false;
	}
	
	return true;
}

function targetLinks() {
	var x=document.getElementsByName("extLink");
	for (var i=0;i<x.length;i++) {
		x[i].target="_blank";
	}
}