function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function showElement(elementID) {
  document.getElementById(elementID).style.display = 'block';
}

function hideElement(elementID) {
	document.getElementById(elementID).style.display = 'none';
}

function checkClear(element,value){
	if(document.getElementById(element).value == value){
		document.getElementById(element).value = "";	
	}
}

function checkFill(element,value){
	if(document.getElementById(element).value == ""){
		document.getElementById(element).value = value;	
	}
}

function validateSignUp(){
	if(document.getElementById('firstName').value == ""){
		alert('Please include your first name');
		return false;
	}
	if(document.getElementById('lastName').value == ""){
		alert('Please include your last name');
		return false;
	}
	if (validateEmail(document.getElementById('emailAddress').value)==false) {
		return false;
	}
	if(document.getElementById('password1').value == '' | document.getElementById('password2').value == ''){
		alert('Please enter and confirm the password you would like to use');
		return false;
	}
	if(document.getElementById('password1').value != document.getElementById('password2').value){
		alert('Your passwords do not match');
		document.getElementById('password1').value = '';
		document.getElementById('password2').value = '';
		return false;
	}
	
	document.formSignup.submit();
}

function validateEmail(str) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = str;
   if(reg.test(address) == false) {
      alert('The email you have entered appears to be invalid. A valid email MUST be provided for your account to be approved.');
      return false;
   }
}
