﻿var strForm = "frmFMSContact";

function getFMSContactInfo() {
	var strURL = "/public/fms_contact.aspx";
	contactWindow = window.open(strURL, "contactWindow", 'width=580,height=475,status=yes') 
}

function onEmailSuccess() {
	alert('Thank You. Your inquiry has been successfully sent to Favorite Healthcare Staffing.');
	window.close();
}

function verifyFMSContact() {
	var strMsg = "";
	if (verifyContactField("FirstName", 0, true) == false) strMsg += "A first name is required.\n";
	if (verifyContactField("LastName", 0, true) == false) strMsg += "A last name is required.\n";
	if (verifyContactField("Email", 10, true) == false) strMsg += "Email is not in a valid format.\n";
	if (verifyContactField("AreaCode", 0, true) == false || verifyContactField("Prefix", 0, true) == false || verifyContactField("Number", 0, true) == false) {
		strMsg += "A phone number is required.\n";
	}
	if (strMsg == "")
		return true;
	else {
		alert(strMsg);
		return false;
	}
}

function verifyContactField(strField, intType, blnRequired) {
	if (verifyField(getField(strField), strField, intType) == false) {
		var strFieldType = document[strForm][strField].type;
		if (blnRequired) {
			switch (strFieldType) {
				case "text": case "textarea": case "checkbox":
					document[strForm][strField].className = "required";
					break;
				case "select-one": case "select-multiple":
					document[strForm][strField].className = "requiredSelect";
					break;
				case "radio":
					document[strForm][strField].className = "required";
					break;
				case "hidden":
					break;
			}
			return false;
		} else {
			return false;
		}
	}else{
		document[strForm][strField].className = "";
		return true;
	}
}

function gotoContinue() {
    if (opener != null) {
		self.close();
	}else{
		window.location = '/';
	}
}
