$(function() {
	var title=encodeURIComponent(document.title);
	var url  = encodeURIComponent(document.location.href);
	var ibase = "/standards/icons/socials/";
	var bits=["facebook"];
	//bits.push
	var links="<div id='jsocial'><span><strong>SHARE:</strong></span>\n";
	links += "<span><a target='_blank' href='http://www.facebook.com/share.php?u="+url+"&amp;t="+title+"' title='send to facebook'><img src='"+ibase+"facebook.png'>facebook</a></span>";
	links += "<span><a target='_blank' href='http://delicious.com/post?url="+url+"&amp;title="+title+"' title='send to delicious'><img src='"+ibase+"delicious.png'>delicious</a></span>";
	links += "<span><a target='_blank' href='http://digg.com/submit?phase=2&amp;url="+url+"&amp;title="+title+"' title='digg this'><img src='"+ibase+"digg.png'>digg</a></span>";
	links += "<span><a target='_blank' href='http://reddit.com/submit?url="+url+"&amp;title="+title+"' title='send to reddit'><img src='"+ibase+"reddit.png'>reddit</a></span>";

	links +="</div>\n";
	$("h1").slice(0,1).after(links)
	
emailRegEx=/(([\w\d_\-])|([\w\d_\-])+(\.([\w\d_\-])))*@([\w\d_\-])+(\.([\w\d_\-])+)*\.([\w\d_\-])+/;	

	$("#email").attr("title","This will work only if you use a separate program to handle your email, or if you've configured your browser to send mailto links to your webmail program of choice.");
	$("#mailto").click(function(){
		if(!$.trim($("#email").val()).match(emailRegEx)) {
			alert("You must enter a complete, properly formatted email address.");
			return false;
		}
		s="mailto:"+$.trim($("#email").val());
		s+="?Subject=Centenary video";	
		s+="&Body=I think you might like to see this Centenary video: http://www.centenary.edu/annual";
		window.location=encodeURI(s);
	});	

	
	
});

