/* jQuery functions for Esquire Theme by Matthew Buchanan v1.21 modified by Boris Masis*/

$(function() {

	//resize videos to be larger
	//$('.video object, .video embed').attr('width', 853).attr('height',505);
	
	//remove photo click-thoughs..
	$("div.photo a[href^='http://go.borism.net/photo/1280/']").click(function() { return false; }).attr('href', '').addClass('nolink');

	// Handle sidebar nav tooltips
	$(".buttons a").hover(function() {
		$("#buttontext").html($(this).attr("title"));
	}, function() {
		$("#buttontext").html("&nbsp;");
	});

	// Toggle search field
	$("#showsearch").click(function(ev){
		ev.preventDefault();
		$("#search").slideToggle();
	});

	// Move header to correct position in page markup, to sit beside the datebox
	var datebox = $("#posts .post:first .datebox");
	$("#header").remove().insertAfter(datebox).show();

	// Handle permalink date toggling
	$(".permalink a").hover(function() {
		ob = $(this).find("span");
		timeago = ob.text();
		ob.text(ob.attr("rel"));
	}, function() {
		ob.text(timeago);
	});

	// Handle hover states for reblog notes
	$(".via").hover(function() {
		$(this).addClass("via-hover");
	}, function() {
		$(this).removeClass("via-hover");
	});

	// Hide last slash in tag list
	$(".tags span:last-child").hide();

	// Fix for weird browser behaviour on dropcap
	if (!$.browser.safari()) {
		$(".text .content > p:first-child").addClass("fixcap");
	}

	// Fix font issue under windows by removing Adobe Caslon Pro
	if ($.browser.mac()) $("body").addClass("mac");

});