$(document).ready(function(){
	$("#site_errors").hide();
	
	$("a[rel='external']").click(function(event){
		event.preventDefault();
		window.open(this);
	});
	
	$('span.addr').each(function() {
		var spt = "#" + $(this).attr("id");
		var to = ' to ';
		var period = ' period ';
		var addr = $(spt).text().replace(to,"@").replace(period,".").replace(period,".");
		$(spt).after('<a href="mailto:'+addr+'" onfocus="this.blur();">'+ addr +'</a>');
		$(spt).remove();
	});
	
	$("#help_icon").hover(
		function() {
			$("#help_icon").attr("src","_images/other/help_dark.gif");
			$("#help_icon").css("cursor","pointer");
		},
		function() {
			$("#help_icon").attr("src","_images/other/help_light.gif");
			$("#help_icon").css("cursor","default");
		}
	);
	$("#help_icon").click(
		function() {
			if($("#help_box").css('display') == 'none') {
				$("#help_box").fadeIn();
			} else {
				$("#help_box").fadeOut();
			}
		}
	);
	$("#help_close").hover(
		function() {
			$("#help_close").attr("src","_images/other/close_dark.gif");
			$("#help_close").css("cursor","pointer");
		},
		function() {
			$("#help_close").attr("src","_images/other/close_light.gif");
			$("#help_close").css("cursor","default");
		}
	).click(
		function() {
			$("#help_box").fadeOut();
		}
	);
});

function addr(id) {
	var spt = "#" + id;
	var to = ' to ';
	var period = ' period ';
	var addr = $(spt).text().replace(to,"@").replace(period,".").replace(period,".");
	$(spt).after('<a href="mailto:'+addr+'" onfocus="this.blur();">'+ addr +'</a>');
	$(spt).remove();
}

function web(id) {
	$("#"+id).click(function(event){
		event.preventDefault();
		window.open(this);
	});
}

function thick() {
	$("a.thickbox").click(function() {
		this.href += "&ref=1";
	});
}