 $(function() {
 	$('.acherno-like img').removeAttr('width').removeAttr('height');
 	$('.acherno-like').wrap('<div class="acherno-like-wrapper"><div class="acherno-like-hover"></div></div>');
 	$('.acherno-like-wrapper').each(function() {
 		var context = $(this);
 		var projectImage = context.find('img').get(0);
 		var resizeImage = function() {
 			if (projectImage.width > projectImage.height && projectImage.width > 480) projectImage.width = 480;
 			else if (projectImage.height > 480) projectImage.height = 480;
 			context.height(projectImage.offsetHeight + 6);
 		};
 		context.find('img').load(resizeImage);
		var src = $(projectImage).attr('src');
		$(projectImage).attr('src', src);
 	});
	$('.acherno-like-hover').hoverIntent(
		function() {
			var context = $(this);
			var project = context.find('a').get(0);
			$('<iframe id="acherno-like-frame" scrolling="no" frameborder="0" src="http://acherno.com/blog/likes/like.php?href='+
				project.href+'&title='+project.title+'"/>').appendTo(context);
				$('#acherno-like-frame').width(project.offsetWidth - 12);			
		}, 
		function() {
			$('#acherno-like-frame').remove();
		});
});

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars() {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
