$(document).ready(function(){

	// dear css, love jquery
	$(".pagination a:last").addClass('last');

	// sliding animation
	$("#add-image").click(function(){
		$(".top-link").show();
		$(this).hide();
		$(".slidewrap").hide();
		$("#imageform").show();
		return false;
	});
	$("#add-video").click(function(){
		$(".top-link").show();
		$(this).hide();
		$(".slidewrap").hide();
		$("#videoform").show();
		return false;
	});

	$("h1.slide").click(function(){
		$(this).next().slideToggle(200);
	});
	$("#notice").click(function(){
		$(this).fadeOut(200);
	});
	
	$(".caption").each(function(){
		$(this).html().replace(/@+([_A-Za-z0-9-]+)/ig, '<a href="http://twitter.com/$1">@$1</a>');
	});
	
	// sorry ie
	if (jQuery.browser.msie) {
		ver= jQuery.browser.version;
		if (ver=='6.0') {
			$('body').html('&nbsp;');
			$('body').html('<div id="bsod"></div>');
			$('body').css({'background':'blue'});
			$('#bsod').append('<h2>check out this mother f*cker trying to use internet explorer 6.</h2>');
			//some proactive solutions to the raised problem..
			$('#bsod').append('<p>upgrade your browser or use one of these free and much better browsers:<br/> * <a href="http://www.apple.com/safari/download/">safari</a><br/>* <a href="http://firefox.com">firefox</a><br/>* <a href="http://www.google.com/chrome">chrome</a>');
		}	
	}
	
	$("#list li object, #list li embed").attr('width','120').attr('height','100');
	
});

$(window).load(function() {
  $('#list img').each(function(i){
    var inlineHeight = $(this).height();
    $(this).attr('height',inlineHeight);
  });
  $('#list').masonry();
});