function formValidator(){
	// Make quick references to our fields
	var company = document.getElementById('company');
	var job = document.getElementById('job');
	var contact = document.getElementById('contact');
	var email = document.getElementById('email');
	var phone = document.getElementById('phone');
	
	// Check each input in the order that it appears in the form!
	if(isAlphanumeric(company, "Numbers and Letters Only for Company/Band Name")){
		
		if(isAlphanumeric(job, "Numbers and Letters Only for Job Name")){
			
			if(isAlphabet(contact, "Please enter a valid contact name")){
					
				if(emailValidator(email, "Please enter a valid email address")){
						
					if(isPhone(phone, "Please enter a valid phone number")){
						
						if(checkFile()) {
							return true;
						}
						
					}
				}
			}
		}
	}
	
	
	return false;
	
}

function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function checkFile(){
	var largeFile = document.getElementById('largeFile');
	var smallFile = document.getElementById('smallFile');
	var dropFile = document.getElementById('drop_file');
	var file_upload = document.getElementById('file_upload');
	
	if(smallFile.checked == true) {
		if(file_upload.value =="" || file_upload.value.length<4) {
			alert("Please select a file to upload");
			file_upload.focus(); // set the focus to this input
			return false;
		} else {
			return true;
		}
		
	} else if(largeFile.checked == true) {
		if(dropFile.value =="" || dropFile.value.length<4) {
			alert("Please use drop.io to upload a file");
			dropFile.focus(); // set the focus to this input
			return false;
		} else {
			return true;
		}
		
	} else {
		alert("Please select a file");
		return false;
	}
	
	
}

function isPhone(elem, helperMsg){
	/* var numericExpression = /^[0-9 -]+$/; */
	var numericExpression = /^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/; 
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z ]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z ]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		elem.focus();
		return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Please Choose"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}