$(window).load( function() {

	//var popup = $("#sharethis-popup");
	var link = $('.link-sharethis a');
	
	//popup.css("z-index", "1");
	//$("object").css("z-index", "0");
	//$("embed").css("z-index", "0");
	// need to wrap these in a div, position them absolute within that and add wmode=transparent

	link.click( function() {

		var popup = $(this).parents(".entry").find(".sharethis-popup");
		var offset = $(this).offset();
		popup.find(".sharethis-email-result").html("").hide();
		popup.find(".sharethis-emailform form").show();
		popup.css("left", offset.left -20 + "px");
		popup.css("top", offset.top +24 + "px");
		popup.toggle();
	});
	
	$(".sharethis-close a").click( function() {
		$(this).parents(".sharethis-popup").hide();
	});
	
	
	$(".sharethis-send").click(function() {
		current = $(this).parents(".sharethis-popup");
		$.post("/ajax/sharethis_send.asp", {
			sharethis_to: current.find(".sharethis-to").val(),
			sharethis_name: current.find(".sharethis-name").val(),
			sharethis_email: current.find(".sharethis-email").val(),
			sharethis_url: 	current.find(".sharethis-url").val(),
			submitted: -1
		},function(result) {
			current.find(".sharethis-emailform form").hide();
			current.find(".sharethis-email-result").html(result).show();
		});
	});
});