function sendMail(domainSuffix, user, CSSclass, domainPrefix, linkText) {
	F = user; 
	R = domainSuffix;
	L = domainPrefix;
	cls = CSSclass;
	if (cls == "") {
		if (linkText == "") {
			document.write("<a href=\"" + "m" + "a" + "i" + "l" + "t" + "o" + ":" + F + "@" + L + "." + R + "\">" + F + "@" + L + "." + R + "</a>");
		} else {
			document.write("<a href=\"" + "m" + "a" + "i" + "l" + "t" + "o" + ":" + F + "@" + L + "." + R + "\">" + linkText + "</a>");
		}
	} else {
		if (linkText == "") {
			document.write("<a href=\"" + "m" + "a" + "i" + "l" + "t" + "o" + ":" + F + "@" + L + "." + R + "\" class=\"" + cls + "\">" + F + "@" + L + "." + R + "</a>");
		} else {
			document.write("<a href=\"" + "m" + "a" + "i" + "l" + "t" + "o" + ":" + F + "@" + L + "." + R + "\" class=\"" + cls + "\">" + linkText + "</a>");
		}
	}
}

function TextMail(suffix1, user, suffix2, prefix, suffix3) {
	A = suffix2;
	F = user;
	R = suffix1;
	I = suffix3;
	L = prefix;
	return F + "@" + L + "." + R + A + I;
}

function EmailFormField(type, name, suffix, user, prefix) {
	F = user;
	R = suffix;
	L = prefix;
	document.write("<input type=\"" + type + "\" name=\"" + name + "\" value=\"" + F + "@" + L + "." + R + "\">");
}

function EmailSelectOption(display, suffix, user, prefix) {
	F = user;
	R = suffix;
	L = prefix;
	output = "<option value=\"" + F + "@" + L + "." + R + "\">" + display;
	if (document.URL.indexOf('SendFeedback.htm') != -1) {
		output = output + " (" + F + "@" + L + "." + R + ")";
	}
	output = output + "</option>";
	document.write(output);
}

function EnableFeedback() {
	document.getElementById("CCSDFeedback").Submit.disabled = false;
}

function SubmitFeedback() {
	GoToURL = "";
	if (document.getElementById("CCSDFeedback").Feedback.value == "") {
		alert("You did not enter any feedback.");
		return false;
	}
	else {
		if (document.URL.indexOf('SendFeedback.htm') == -1) {
			GoToURL = document.URL;
			document.getElementById("CCSDFeedback").return_link_title.value = "Click here to return to: \"" + document.title + "\"";
			document.getElementById("CCSDFeedback").Submitted_From.value = "\"" + document.title + "\"";
			document.getElementById("CCSDFeedback").Submitted_From_URL.value = GoToURL;
		} else {
			if (document.referrer == "") {
				GoToURL = document.getElementById("CCSDFeedback").return_link_url.value;
				document.getElementById("CCSDFeedback").Submitted_From_URL.value = "";
			} else {
				GoToURL = document.referrer;
				document.getElementById("CCSDFeedback").Submitted_From_URL.value = GoToURL;
			}
			document.getElementById("CCSDFeedback").return_link_title.value = "Click here to return.";
			document.getElementById("CCSDFeedback").Submitted_From.value = "";
		}
		document.getElementById("CCSDFeedback").return_link_url.value = GoToURL;
		document.getElementById("CCSDFeedback").redirect.value = GoToURL;
		alert("Thank you for sending us your feedback.");
		//document.getElementById("CCSDFeedback").Submit.value = "";
		return true;
	}
}

function ParseGetVars(VariableString) {
	var getVars = new Array();
	var qString = VariableString;
	var pairs = qString.split(/\&/);
	for (var i in pairs) {
		var nameVal = pairs[i].split(/\=/);
		getVars[decode(nameVal[0])] = decode(nameVal[1]);
	}	
	return getVars;
}

function decode(EncodedString) {
	return unescape(String(EncodedString).replace(/\+/g, " "));
}

function MM_openBrWindow2(theURL,winName,features) { //v2.0
  var displayWindow = window.open(theURL,winName,features);
  displayWindow.focus;
  return false;
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}

function FormDisplay(user) {
	document.getElementById("EM").innerHTML = document.getElementById("EM").innerHTML + " (" + TextMail("c", user, "o", "calvarysd", "m") + ")";
	document.getElementById("WS").innerHTML = document.getElementById("WS").innerHTML + " (" + TextMail("c", "webservant", "o", "calvarysd", "m") + ")";
}

window.onload = externalLinks;