$().ready(function() {

if ($("#shareit").length > 0) {
	//place the sharing bar under the article
	$("#shareit").css({"position":"relative","left":"0"});
	//get the vertical position of #shareit for scrolling purposes
	scrollToShareIt = $("#shareit").offset().top;
	clickedYet = false;
}
//open/close sharing item
$("#shareit .trigger").click(function() {
	$("#shareit .trigger").not(this).removeClass("selected");
	$("#shareit .content").not($(this).parent().find(".content")).removeClass("activecontent");
	if ($(this).parent().is(".print")) {
		window.print();
	} else {
		$(this).toggleClass("selected");
		$(this).parent().find(".content").toggleClass("activecontent");
		//make space for the abolute positioned .content
		$("#shareit").css("margin-bottom",($(this).parent().find(".content").outerHeight()) + "px");
		if (clickedYet == false) {
			$('html, body').animate({scrollTop:scrollToShareIt}, 'slow');
		}
		clickedYet = true;
	}
});

$("#shareit .addthis").click(function() {
	$("#shareit .content").removeClass("activecontent");
	$("#shareit .trigger").removeClass("selected");
	$("#shareit").css("margin-bottom", "0px");
});

//one large click area for the polaroids
$(".polaroid").hover(function() {
	var thisLink = $(this).find("a").attr("href");
	$(this).addClass("polaroidHover");
	$(this).click(function() {
		location.href = thisLink;
	});
}, function() {
	$(this).removeClass("polaroidHover");
});

});
