window.onload = function() {
	if (!document.getElementsByTagName) {
		return false; 
	} 
	var popuplinks = document.getElementsByTagName("a");
	for (var i=0; i < popuplinks.length; i++) {	
		if (popuplinks[i].getAttribute("class") == "popup") {	
			popuplinks[i].onclick = function() {	
			openPopUp(this.getAttribute("href"));	
			return false; 	
			} 	
		}
	} 
} 

function openPopUp(linkURL) {
window.open(linkURL,'popup','resizable=1,scrollbars=1,width=480,height=560')
}

function isContactFormValid() {

	var firstname = document.getElementById('firstname');
	var lastname = document.getElementById('lastname');
	var email = document.getElementById('email');
	//var country = document.getElementById('country');
	var primaryphone = document.getElementById('primaryphone');
	var alternatephone = document.getElementById('alternatephone');

	firstname = firstname.value;
	lastname = lastname.value;
	email = email.value;
	//country = country.value;
	primaryphone = primaryphone.value;
	alternatephone = alternatephone.value;

	if (firstname.length<2) {
		alert('Name not valid');
		return false;
	}

	if (lastname.length<2) {
		alert('Last name not valid');
		return false;
	}

	//if (country.length<3) {
	//	alert('Country not valid');
	//	return false;
	//}

	if (alternatephone.length==0 && primaryphone.length<7) {
		alert('AreaCode-Phone number not valid');
		return false;
	}

	if (primaryphone.length==0 && alternatephone.length<10) {
		alert('Alternate / Cell phone not valid');
		return false;
	}

	if (email.length<7) {
		alert('Email address not valid');
		return false;
	}

	return true;
}
