

// the following two functions are so that
// the three columns appear to be the same height

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() {
	equalHeight($(".column"));
	
	//Configuration Options
	var max_width = 282; 	//Sets the max width, in pixels, for every image
	var selector = '.blogpostmain img'; 	//Sets the syntax for finding the images.  Defaults to all images.
				//For images inside of a particular element (id="abc") or class (class="abc"),
				//use '.abc img' or '#abc img' respectively.  Don't leave off the img tag!!!
	//End configuration options.  You don't need to change anything below here.
	
 	var $j = jQuery.noConflict();
	$j(selector).each(function(){
		var width = $j(this).width();
		var height = $j(this).height();
		if (width > max_width) {
			//Set variables	for manipulation
			var ratio = (height / width );
			var new_width = max_width;
			var new_height = (new_width * ratio);
 
			//Shrink the image and add link to full-sized image
			$j(this).height(new_height).width(new_width);
			$j(this).hover(function(){
				$(this).attr("title", "This image has been scaled down.  Click to view the original image.")
				$(this).css("cursor","pointer");
				});
			$j(this).click(function(){
				window.location = $j(this).attr("src");
			});
		} //ends if statement
	} //ends each function
	); //ends each argument
	
	
	$j("#scrolltop").click(function(){
			$j("html, body").animate({ scrollTop: 0 }, {
            duration: 'slow',
            easing: 'easeInOutQuad'
        });
        return false;
	}); 
	
	
    $j(".tweet").tweet({
  		count: 3,
  		query: "from:camdeniff",
  		loading_text: "Loading tweets..."
    });  
    
    positionFooter();
    
	$j(window)
		.scroll(positionFooter)
		.resize(positionFooter);
		
	function positionFooter() {
		var docHeight = $j(document.body).height() - $j("#footer").height();
		if(docHeight < $j(window).height()){
			var diff = $j(window).height() - docHeight;
			if (!$j("#sticky-footer-push").length > 0) {
				$j("#footer").before('<div id="sticky-footer-push"></div>');
			}
			$j("#sticky-footer-push").height(diff);
		}	
	}
});

