// Validation of contact us form
function fValidateForm(){
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var phone = document.getElementById('phone').value;
	var question = document.getElementById('question').value;
	var seccode=document.getElementById('seccode').value;

	if (name==''){
		alert('Please enter your first and last name');
		document.getElementById('name').focus();
		document.getElementById('nameLabel').className='invalidAlert';
		return false;
	}
	if (email==''){
		alert('Please enter your Email address');
		document.getElementById('email').focus();
		document.getElementById('emailLabel').className='invalidAlert';
		return false;
	}
	if (phone==''){
		alert('Please enter a valid phone number');
		document.getElementById('phone').focus();
		document.getElementById('phoneLabel').className='invalidAlert';
		return false;
	}	
	if (question==''){
		alert('Question cannot be left empty');
		document.getElementById('question').focus();
		document.getElementById('questionLabel').className='invalidAlert';
		return false;
	}
	if (seccode=='' || seccode!='JHXL3'){
		alert('Invalid Security Code.');
		document.getElementById('seccode').focus();
		return false;
	}

	fClearInvalidAlert();
}

// Clear Invalid Alert CSS when field has a value

function fClearInvalidAlert(){
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var phone = document.getElementById('phone').value;
	var question = document.getElementById('question').value;

	if (name!=''){ document.getElementById('nameLabel').className=''; }
	if (email!=''){ document.getElementById('emailLabel').className=''; }
	if (phone!=''){ document.getElementById('phoneLabel').className=''; }
	if (question!=''){ document.getElementById('questionLabel').className=''; }
}
