function sampleDetail(id) {
	var where = 'sample_detail.php?id='+id;
	window.open(where,'sample','scrollbars=yes,resizable=yes,width=600,height=400');
}
//
function isEmpty() {
	if (whatB == 'continue') {
		field1 = document.video_form.first.value;
		field2 = document.video_form.last.value;
		field3 = document.video_form.phone.value;
		emailfield = document.video_form.email.value;
		
		check1 = document.video_form.privatedd.checked;
		check2 = document.video_form.intdis.checked;
		check3 = document.video_form.vidfee.checked;
		check4 = document.video_form.vrhf.checked;
		
		radio1 = document.video_form.terms[0].checked;
		radio2 = document.video_form.terms[1].checked;
		radio3 = document.video_form.terms[2].checked;
		radio4 = document.video_form.terms[3].checked;
		
		if (field1 == "" || field1 == null || !isNaN(field1) || field1.charAt(0) == ' ') {
			alert("\"First Name\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field2 == "" || field2 == null || field2.charAt(0) == ' ') {
			alert("\"Last Name\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field3 == "" || field3 == null || field3.charAt(0) == ' ') {
			alert("\"Phone\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (emailfield == "" || emailfield == null || emailfield.charAt(0) == ' ') {
			alert("\"Email\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (!check1 && !check2) {
			alert("You must select \"Private Database Display\" and/or \"Internet Display\" checkboxes to continue.\r\nPlease try again.");
			return false;
		}
	
		if (!check3) {
			alert("Selecting the \"Video Fee\" checkbox is mandatory field.\r\nPlease try again.");
			return false;
		}
		
		if (check4 && (!radio1 && !radio2 && !radio3 && !radio4)) {
			alert("You have selected the \"Video Resume Hosting Fee\" checkbox. It is mandatory to select the \"Terms\" below.\r\nPlease try again.");
			return false;
		}
		
		if (!check4 && (radio1 || radio2 || radio3 || radio4)) {
			document.video_form.vrhf.checked = true;
		}
		
	} else {

		field4 = document.video_form.intro.value;
		field5 = document.video_form.employ.value;
		field6 = document.video_form.edu.value;
		field7 = document.video_form.achieve.value;
		field8 = document.video_form.value.value;
		field9 = document.video_form.strength.value;
		field10 = document.video_form.hobint.value;
		field11 = document.video_form.offer.value;
		
		if (field4 == "" || field4 == null || field4.charAt(0) == ' ') {
			alert("\"Introduction\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field5 == "" || field5 == null || field5.charAt(0) == ' ') {
			alert("\"Previous Employment History\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field6 == "" || field6 == null || field6.charAt(0) == ' ') {
			alert("\"Education\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field7 == "" || field7 == null || field7.charAt(0) == ' ') {
			alert("\"Major Achievement\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field8 == "" || field8 == null || field8.charAt(0) == ' ') {
			alert("\"My Values\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field9 == "" || field9 == null || field9.charAt(0) == ' ') {
			alert("\"Strengths\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field10 == "" || field10 == null || field10.charAt(0) == ' ') {
			alert("\"Hobbies/Interests\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	
		if (field11 == "" || field11 == null || field11.charAt(0) == ' ') {
			alert("\"What can I offer your organization?\" is a mandatory field.\r\nPlease try again.");
			return false;
		}
	}
	
    return true;
}
//
function isValidEmail() {
	validRegExp = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	theemail = document.video_form.email.value;

   	if (theemail.search(validRegExp) == -1) {
		alert('A valid email address is required.\r\nPlease try again.');
		return false;
    }
	
    return true; 
}
//
function checkForm() {
	if (whatB == 'preview' || whatB == 'continue') {
		if (isEmpty()) {
			if (isValidEmail()) {
				return true;
			}
		}
		
		return false;
	}
}
//
function setButton(param) {
	whatB = param;
}
//
function samplePage(id,pg) {
	if (id=="new") {
		var where = 'video_samples/index.php';
	} else {
		var where = 'video_samples/index.php?id='+id+'&pg='+pg+'&type=video';
	}
	window.open(where,'samples','resizable=yes,width=800,height=600');
}

