

if(!window.SU){
	SU = {
	
		setEmailShareHref: function(a_name){
			var subject = encodeURIComponent(document.title);
			var body = encodeURIComponent("I wanted to share this page with you:\r\n\r\n" + document.title + " (" + window.location.href + ")");
			var href = "mailto:?subject=" + subject + "&body=" + body;
		
			var elts = document.getElementsByName(a_name);
			for(var i in elts){
				elts[i].href = href;
			}
		},

		setTwitterShareHref: function(a_name){
			var status = encodeURIComponent("Currently reading: " + document.title + " (" + window.location.href + ")");
			var href = "http://twitter.com/home?status=" + status;
		
			var elts = document.getElementsByName(a_name);
			for(var i in elts){
				elts[i].href = href;
			}
		},
		
		showUntil: function(enddate, yes, no){
			var end_bits = enddate.split("/", 3);
			document.write((new Date(end_bits[2], end_bits[1]-1, end_bits[0]) >= new Date()) ? yes : no);
		},
		
		writeCaptionedImage: function(caption, imgurl, link, samewindow){
			document.write("<table class='se-captioned-image'><tr><td class='se-captioned-image-pad'></td>");

			for(var i = 0; arguments.length > i; i += 4){
				caption = arguments[i];
				imgurl = arguments[i+1];
				link = arguments[i+2];
				samewindow = arguments[i+3];
				
				document.write("<td>");
				if(samewindow){
					document.write("<a href='" + link + "'><img src='" + imgurl + "' /></a>");
					document.write("<p class='se-caption'><a href='" + link + "'>" + caption + "</a></p>");
				}else{
					document.write("<a class='se-external-link' target='_new' href='" + link + "'><img src='" + imgurl + "' /></a>");
					document.write("<p class='se-caption'><a class='se-external-link' target='_new' href='" + link + "'>" + caption + "</a></p>");
				}
				document.write("</td>");
			}
			
			document.write("<td class='se-captioned-image-pad'></td></table>");
		}
	};
}

