// JavaScript Document
function heightDifference(group) {
	tallestHeight = 0;
	shortestHeight = 0;
	group.children('.column').each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallestHeight){
			shortestHeight = tallestHeight;
			tallestHeight = thisHeight;
		} else {
			shortestHeight = thisHeight;
		}
	});
	difference = tallestHeight - shortestHeight;
	group.children('.column').each(function() {
		if($(this).height() == shortestHeight) {
			newHeight = $(this).children('.item.last').height()+difference;
			$(this).children('.item.last').height(newHeight);
		}
	});
}
function modularHeight(group, bias, padding) {
	group.each(function() {
		thisHeight = padding + (15 * parseInt(($(this).height()+bias) / 15));
		$(this).height(thisHeight);
	});
}
$(document).ready(function () { 
$('.reveal').css('cursor', 'pointer');
		$('.reveal .hiddentext').css('display', 'none');
		$('.reveal').toggle(
function(){$('.reveal .hiddentext').css('display', 'block');}, 
function(){$('.reveal .hiddentext').css('display', 'none');}
);
      $('#banner').css('background-image', 'url(assets/images/page/feBannerGrad.png)');
	  
	  $('#banner').css('background-color', 'transparent');

	   $('#footer').css('opacity', '0.95');
      $('.summary').css('opacity', '0');
      
		//heightDifference($("#twoCol"));
		modularHeight($(".item"), 2, 12);
		modularHeight($(".twitter"), 2, 42);
		modularHeight($("#sidebar a"), 3, 6);
		modularHeight($("#sidebar .item"), 4, 12);
	  $('.finalist').hover(
						   function(){
		$(this).css('cursor', 'pointer');	
						   }
	  );
	  $('.finalist').click(
		function(){
			url = $(this).find('h4 a').attr('href');
			window.location = "http://www.futureeverything.org/"+url;
		}
	  );
	  $('.login').click( function(){
	  	$('#tabs').animate({height: 200},200);
	  }
	  );
	  $('.homebox').mousedown(
		function(){
			url = $(this).children('h4').find('a').attr('href');
			window.location.href= url;
		});
	  $('.homebox').hover(
	  	function(){
            topVal = $(this).children('h4').height()-12;
				$(this).children('.summary').css({'cursor' : 'pointer', 'display' : 'block', 'width' : '140px', 'padding' : '6px 6px 4px 6px', 'top' : topVal+'px', 'height' : 180-topVal+'px'});
				$(this).children('.summary').animate({
				opacity: 0.95
			},200);
			
		},
	  	function(){
			$(this).children('.summary').animate({
				opacity: 0
			},800)
		}
		);
});