	blognavvisible	=	null;
	blogbottom		=	null;
	windowy			=	null;
	nextprevwidth	=	null;

$(document).ready(function() {
	
	// external links
	$('a.external').click(function() {
		window.open($(this).attr('href'), 'blank');

		return false;
	});

	// back links
	$('a.back').click(function() {
		history.go(-1);
		return false;
	});

	// clean junk on form submit
	$('form').submit(function() {
		$(this).find('input[title], textarea[title]').each(function() {
			if ($(this).attr('title') == $(this).attr('value')) $(this).attr('value', '');
		});
	});
	
	//get in before the cufon, bleurgh
	$('.blog-avatar').hover(function(){
		$('.popover',this).show();
	},function(){
		$('.popover',this).fadeOut();
	});
	
	// Cufon
	//Cufon.set('fontFamily', 'Romeral').replace("h1")("h2")("h3")('.superfont');
	//Cufon.set('fontFamily', 'Romeral').replace("#social-categories li a",{hover:true});

	// link click confirm
	if ($('a.confirm').length > 0) {
		$('a.confirm').click(function() {
			var url = $(this).attr('href');

			$('<div>You are about to open a link to ' + url + ', continue?</div>').dialog({
				title: 'External link',
				modal: true,
				buttons: {
					Yes: function(){
						$(this).dialog('close');
						window.open(url, 'blank');
					},
					No: function(){
						$(this).dialog('close');
					}
				}
			});

			return false;
		});
	}


	$('input:text.changedefault').each(function(){
	    $(this).val($(this).attr('default'));
	    $(this).click(function(){
		if($(this).val()==$(this).attr('default'));
		    $(this).val('');
	    });
	    $(this).blur(function(){
		if($(this).val()=='')
		    $(this).val($(this).attr('default'));
	    });
	});
	
	/*
	 * Funky little previous/next feature similar to the one on Mashable
	 */
	blognavvisible	=	false;
	blogbottom		=	parseInt($('.blog-body').offset().top +	$('.blog-body').height());
	windowy			=	parseInt($(window).scrollTop() + $(window).height());	
	
	$('#icom-next-previous-wrapper').appendTo('body').addClass('icom-next-previous-wrapper-hover');		
	nextprevwidth	=	-1 * $('.icom-next-previous-wrapper-hover').outerWidth();
	$('#icom-next-previous-wrapper').css('right',nextprevwidth);	
	
	$(window).scroll(function(){
		 windowy = parseInt($(window).scrollTop() + $(window).height());
		 if(windowy > blogbottom && !blognavvisible) {
			 blognavvisible	=	true;
			 $('.icom-next-previous-wrapper-hover').stop().animate({right:"0px"},500);
			 
		 }
		 else if(windowy < blogbottom && blognavvisible) {
			 blognavvisible	=	false;
			 $('.icom-next-previous-wrapper-hover').stop().animate({right:nextprevwidth},500);	 
		 }
	});
	
	$('.icom-next-previous-wrapper-hover .close').click(function(){
		$('#icom-next-previous-wrapper').remove();
		return false;
	});
	
	

});
