/* ----------------------------------------------------------------------------------
 *  Copyright (c) Raccoon Valley Swim Club
 * ----------------------------------------------------------------------------------
 */


function jsMailTo (prefix) {
	location.href = "mailto:" + prefix + "&#64;" + "rvsc" + "&#46;" + "org";
}

function mailPrint (prefix) {
	return prefix
	       + "<img src=\"/_resources/images/spacer.gif\" height=\"1\" width=\"1\" alt=\"\" border=\"0\">"
	       + "&#64;"
	       + "<img src=\"/_resources/images/spacer.gif\" height=\"1\" width=\"1\" alt=\"\" border=\"0\">"
	       + "rvsc" + "&#46;" + "org"
}


/* To cut down on spam, all email addresses on RVSC.org are generated programmatically. */

function emailInfo() {
	document.write("<a href=\"javascript:jsMailTo('info')\">" + mailPrint("info") + "</a>");
}

function emailMembership() {
	document.write("<a href=\"javascript:jsMailTo('memberships')\">" + mailPrint("memberships") + "</a>");
}

function emailSwimTeam() {
	document.write("<a href=\"javascript:jsMailTo('swimteam')\">" + mailPrint("swimteam") + "</a>");
}

function emailDiveTeam() {
	document.write("<a href=\"javascript:jsMailTo('diveteam')\">" + mailPrint("diveteam") + "</a>");
}

function emailSwimLessons() {
	document.write("<a href=\"javascript:jsMailTo('swimlessons')\">" + mailPrint("swimlessons") + "</a>");
}

function emailWebmaster() {
	document.write("<a href=\"javascript:jsMailTo('webmaster')\">" + mailPrint("webmaster") + "</a>");
}

function emailDirect(sAddr) {
	document.write("<a href=\"javascript:jsMailTo('" + sAddr + "')\">" + mailPrint(sAddr) + "</a>");
}



/* show/hide JS code, usually used for tooltip elements */

function showElt(sId) {
	oElt = document.getElementById(sId);

	if (oElt) {
		oElt.style.display = "block";
	}
}

function hideElt(sId) {
	oElt = document.getElementById(sId);

	if (oElt) {
		oElt.style.display = "none";
	}
}


/* swapImage */

function swapImage(imgId, pat, url1, url2) {
	var oImg = document.getElementById(imgId);

	if (oImg) {
		if (oImg.src.search(pat) >= 0) {
		oImg.src = url1;
		} else {
			oImg.src = url2;
		}
	}
}