function openPopup(strURL) {
	var wndH = window.open(strURL, 'popup', 'width=600, height=400, addressbar=no, statusbar=no, toolbar=no, hotkey=no, scrollbars=yes');
}


function isEmpty(val) { return (val.length==0); }
function isEmail(val) { 
	var reEmail = /\w+([-+.\']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	return reEmail.test(val);
}
function isPhone(val) { 
	var rePhone = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/;
	return rePhone.test(val);
}
function isSelected(rdoSet) {
	var valOut = false;
	for (var i=0; i<rdoSet.length; i++) {
		if (rdoSet[i].checked) { 
			valOut = true;
			break;
		}
	}
	return valOut;
}
function isChecked(cbx) {
	return (cbx.checked);
}

function isValidated() {
	var frm = document.frmVote;
	if (isEmpty(frm.fldFirstName.value)) {
		alert("Please specify your First Name.");
		frm.fldFirstName.focus();
		return false;
	}
	if (isEmpty(frm.fldSurname.value)) {
		alert("Please specify your Surname.");
		frm.fldSurname.focus();
		return false;
	}
	if (isEmpty(frm.fldEmail.value)) {
		alert("Please specify your Email address.");
		frm.fldEmail.focus();
		return false;
	}
	else if (!isEmail(frm.fldEmail.value)) {
		alert("Please specify a valid Email address.");
		frm.fldEmail.select();
		return false;
	}
	if (isEmpty(frm.fldState.value)) {
		alert("Please specify your State.");
		frm.fldState.focus();
		return false;
	}
	if (isEmpty(frm.fldContact.value)) {
		alert("Please specify your Phone Number.");
		frm.fldContact.focus();
		return false;
	}
	else if (!isPhone(frm.fldContact.value)) {
		alert("Please specify a valid Phone Number.");
		frm.fldContact.focus();
		return false;
	}
	
	if (!isSelected(frm.fldVote))
	{
			alert("Please nominate the film that you wish to vote for.");
			return false;
	}

	if (!isChecked(frm.fldAcceptTnC)) {
		alert("You must accept the Terms and Conditions.");
		return false;
	}
	
	return true;
}
