/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {
	
	jQuery.fn.equalCols = function(){
		//Array Sorter
		var sortNumber = function(a,b){return b - a;};
		var heights = [];
		//Push each height into an array
		$(this).each(function(){
			heights.push($(this).height());
		});
		heights.sort(sortNumber);
		var maxHeight = heights[0];
		return this.each(function(){
			//Set each column to the max height
			$(this).css({'height': maxHeight});
		});
	};
	$(function(){
	    $('a[href*=#]').click(function() {
	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	        && location.hostname == this.hostname) {
	            var $target = $(this.hash);
	            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
	            if ($target.length) {
	                var targetOffset = $target.offset().top;
	                $('html,body').animate({scrollTop: targetOffset}, 1000);
	                return false;
	            }
	        }
	    });
	});
	jQuery(function($){
		//Select the columns that need to be equal e.g
		$('#content,#side-bottom').equalCols();
	});
	
	window.onload = function(){
	    $("tr:nth-child(odd)").addClass("odd");
	};
	
})(jQuery);
