function fixColumnHeights() {

	var winHeight = $(window).height();
	var contentHeight = $("#content").height() + 200; 
	var h = winHeight > contentHeight ? winHeight : contentHeight; 
	
	$("#wrapper").css("min-height", h);
	//$("#twitfollow").css("top", (h - $("#twitfollow").height()) + 'px'); 
}

function codeBlocks() {

	$("#content blockquote code").each(function() {
		$(this).css("display", "inline"); 
		var $bq = $(this).parents('blockquote');
		var width = $(this).width();
		$bq.addClass("code"); 	
		$bq.width(width+10); 
		$(this).css("display", "block"); 

		$p = $(this).parent("p"); 

		if($p.size()) {
			var html = $p.html();
			$p.remove();
			$bq.html(html); 
		}
	}); 	

	$("#content pre code").each(function() {
		var width = $(this).width();
		var $pre = $(this).parent("pre"); 
		if(width > $pre.width()) $pre.width(width+10); 
		$pre.css("position", "relative").css("z-index", "999"); 
	}); 
}

function featureBlocks() {
	$("#content div.feature").append("<div class='feature_bottom'></div>"); 
}

function imageBlocks() {
	$("#content .related_image img[alt]").each(function() {
		$(this).after("<p class='caption'>" + $(this).attr('alt') + "</p>"); 
		$(this).parent().wrapInner("<div class='image_caption_wrap'></div>"); 
	}); 
}

function browsers() {
	if($.browser.mozilla && parseFloat($.browser.version) >= 1.9) 
		$("body").addClass("firefox3"); 	
	if($.browser.safari) $("body").addClass("safari"); 
}

function linkRoll() {
	$("#delicious-posts-ryancramerdesign a").attr("target", "_blank"); 
}

function twitFollow() {
	
}

$(document).ready(function() {

	fixColumnHeights();
	browsers();
	codeBlocks();
	featureBlocks();
	imageBlocks();
	$(window).resize(fixColumnHeights); 
	linkRoll();

	$("select[multiple].asmselect").asmSelect({
		animate: false,
		sortable: true,
		debugMode: false,
		highlight: false
	}); 

}); 

