// 
//  basic.js
//  
//  Created by Jeremy Tredway.
//  Copyright 2010 Hinrichs Fine Woods. All rights reserved.
// 


// obfuscate address function
function obfsMail(s,e,h,d,c) {
	//if (e == "" || h == "") { return; }
	if (d == "") { d = "com"; }
	var x = e + "&#x40;" + h + "&#x2E;" + d;
	if (c == "") { c = x; }
	var y = "href=\"ma" + "ilto:" + x + "\"";
	var z = (s == "") ? ("<a " + y + ">" + c + "</a>") : ("<a class=\"" + s + "\" " + y + ">" + c + "</a>");
	return z;
}


// onload routines
$(document).ready(function() {

	// initialize left-hand navigation active state
	$('#nav_sec').find('a').each(function() {
		if (location.href == this.href) {
			$(this).parent().addClass('active');
		}
	});

	// initialize obfuscated addresses
	$(".obfmail").each(function() {
		var $this = $(this);
		var params = $this.attr("rel").split(":");
		if (params[0] == "mail") {
			var addr = obfsMail("",params[1],"yahoo","","");
		}
		$this.html(addr);
	});

});
