$(function(){

  // prevent jquery flickr
  $("body").css("display","block");

  // anything that links to video section will automatically display via thickbox
	var video = $("a[href*='contolini.com/video/']").attr("href");
	var video = video + "?KeepThis=true&TB_iframe=true&height=564&width=960";
	$("a[href*='contolini.com/video/']").addClass("thickbox video").attr("href",video);

  $("a[href$='.jpg'],a[href$='.png'],a[href$='.gif']").addClass("thickbox picture");
  
  $("a[href^='#TB_inline']").addClass("thickbox code");

	$(".entry-content").addClass("columnize").hide();
	
	$("object,param,embed,table,pre,.wp_syntax,code").addClass("dontsplit");
	
	$(".single .entry-content,.page .entry-content").show().columnize({
							width: 300,
							height: 300,
							buildOnce: true
						}).animate({opacity: "1.0"}, 1000).removeClass("columnize");
	
	$("div.column:empty").css("display","none");
	
	$(".home .entry-title a,.search .entry-title a,.archive .entry-title a").click(function(){
			$content = $(this).parent().siblings(".entry-content");
			if ($content.is(":hidden") && $content.hasClass("columnize")) {
				$content.slideDown().columnize({
							width: 300,
							height: 300,
							buildOnce: true
						}).removeClass("columnize");
				tb_init('a.thickbox');
				$("div.column:empty").css("display","none");
			} else if ($content.is(":hidden")) {
				$content.slideDown();
			} else {
				$content.hide("fast");
			}
			return false;
		});
		
});