//
//	 jsMail, jsMailFull, jsMailShort, jsMailCombo
//
//	 These scripts can be used to help hide email addresses from spammers. 
//	 Basically, you can use these scripts so any email address doesn't really show
//	 in the code, but it will show up when an average user visits the page.
//
//	 Basic premise is that spambots are not going to be parsing javascript because
//	 of the load introduced.
//
//	 Specific usage notes for each individual script are included below. For all scripts,
//  if you just pass a bare username (e.g. "joeblow"), the script will assume it's to
//  be considered an EE address and will append "@ee.washington.edu".
//
//	 -----------------------------------------------------------------
//
//	 jsMail(fake_address)
//
//	 To use this script, call it as follows. Let's say the intended
//	 recipient is joeblow@ee.washington.edu. You'd put the following
//	 bit of code into your page:
//
//			 <script type="text/javascript">
//			 <!--
//			 jsMail("joeblow_at_ee");
//			 // -->
//			 </script>
//
//	 Note that this can be used for any "washington.edu" or "uw.edu" address. If the person's
//	 e-mail was "janeblow@u.washington.edu", you'd use the string "janeblow_at_u" in the obvious
//	 places in the code. For a uw.edu address (e.g. "joeblow@uw.edu"), change the passed string
//  to "joeblow_at_uw".
//

function jsMail(raw_address)
	{
	var this_address = raw_address.split("_at_");
	var user_account = this_address[0];
	if (this_address[1] == "uw") {
		document.write("<a href=\"mailto:" + user_account + "@uw.edu\">" +
			user_account + "@uw.edu" + "</a>");
		}
	else if (!this_address[1]) {
		document.write("<a href=\"mailto:" + user_account + "@ee.washington.edu\">" +
			user_account + "@ee.washington.edu</a>");
		}
	else {
		document.write("<a href=\"mailto:" + user_account + "@" + this_address[1] + ".washington.edu\">" +
			user_account + "@" + this_address[1] + ".washington.edu</a>");
		}
	return;
	}

//
//	 jsMailFull(fake_address)
//
//	 To use this script, call it as follows. Let's say the intended
//	 recipient is joeblow@comcast.net. You'd put the following
//	 bit of code into your page:
//
//			 <script type="text/javascript">
//			 <!--
//			 jsMail("joeblow_at_comcast_dot_net");
//			 // -->
//			 </script>
//			 <noscript>
//			 Sorry, e-mail address display requires JavaScript<br>
//			 </noscript>
//
//	 Note that this can be used for any normal e-mail address. If the person's email
//	 is "janeblow@u.washington.edu", you'd use the string "janeblow_at_u_dot_washington_dot_edu"
//	 in the obvious places in the code.
//

function jsMailFull(raw_address)
	{
	var this_address = raw_address.split("_at_");
	var user_account = this_address[0];
	if (!this_address[1]) {
		document.write("<a href=\"mailto:" + user_account + "@ee.washington.edu\">" +
			user_account + "@ee.washington.edu</a>");
		}
	else {
		var domain_address = this_address[1].replace(/_dot_/g,".");
		document.write("<a href=\"mailto:" + user_account + "@" + domain_address +
			"\">" + user_account + "@" + domain_address + "</a>");
		}
	return;
	}

//
//	 jsMailShort(fake_address)
//
//	 Only difference between this and jsMail is this one displays a "short"
//	 version of the email address
//
//	 To use this script, call it as follows. Let's say the intended
//	 recipient is joeblow@ee.washington.edu. You'd put the following
//	 bit of code into your page:
//
//			 <script type="text/javascript">
//			 <!--
//			 jsMail("joeblow_at_ee");
//			 // -->
//			 </script>
//
//	 Note that this can be used for any "washington.edu" or "uw.edu" address. If the person's
//	 e-mail was "janeblow@u.washington.edu", you'd use the string "janeblow_at_u" in the obvious
//	 places in the code. For a uw.edu address (e.g. "joeblow@uw.edu"), change the passed string
//  to "joeblow_at_uw".
//

function jsMailShort(raw_address)
	{
	var this_address = raw_address.split("_at_");
	var user_account = this_address[0];
	if (this_address[1] == "uw") {
		document.write("<a href=\"mailto:" + user_account + "@uw.edu\">" +
			user_account + "@uw" + "</a>");
		}
	else if (!this_address[1]) {
		document.write("<a href=\"mailto:" + user_account + "@ee.washington.edu\">" +
			user_account + "@ee</a>");
		}
	else {
		document.write("<a href=\"mailto:" + user_account + "@" + this_address[1] + ".washington.edu\">" +
			user_account + "@" + this_address[1] + "</a>");
		}
	return;
	}

//
//	 jsMailCombo(display_name,fake_address)
//
//	 Like jsMail, but displays a person's name instead of the email address
//
//	 To use this script, call it as follows. Let's say the intended
//	 recipient is Joe Blow and his email address is joeblow@ee.washington.edu. 
//	 You'd put the following bit of code into your page:
//
//			 <script type="text/javascript">
//			 <!--
//			 jsMail("Joe Blow","joeblow_at_ee");
//			 // -->
//			 </script>
//
//	 Note that this can be used for any "washington.edu" address. If the person's
//	 e-mail was "janeblow@u.washington.edu", you'd use the string "jane_at_u" in the
//	 obvious places in the code.
//
//	 It can also be used for the new "uw.edu" addresses.
//

function jsMailCombo(name,raw_address)
	{
	var this_address = raw_address.split("_at_");
	var user_account = this_address[0];
	if (this_address[1] == "uw") {
		document.write("<a href=\"mailto:" + user_account + "@uw.edu\">" + name + "</a>");
		}
	else if (!this_address[1]) {
		document.write("<a href=\"mailto:" + user_account + "@ee.washington.edu\">" + name + "</a>");
		}
	else {
		var domain_address = this_address[1].replace(/_dot_/g,".");
		document.write("<a href=\"mailto:" + user_account + "@" + domain_address +
			".washington.edu\">" + name + "</a>");
		}
	return;
	}

