$(function on_dom_ready (){

	matchHeight();
	hitAreas();

});

// CORE FUNCTION (called on dom_ready) ///

function matchHeight() {
	if($('.matchHeight').size() > 0) {
		var maxHeight = '0';
		$('.matchHeight').each(function(){
			maxHeight = ($(this).height() > maxHeight) ? $(this).height() : maxHeight;
		});

		$('.matchHeight .fixedToBottom').each(function(){
			bottomPos = ($(this).parents('.matchHeight').height() < maxHeight) ? (maxHeight - $(this).parents('.matchHeight').height()) * -1 : 0;
			$(this).css('bottom',bottomPos);
		});
		$('.matchHeight').height(maxHeight);
	}
}


function hitAreas() {
	$('.hitArea').hover(function(){
		$(this).css('cursor','pointer');
	},function(){});
	$('.hitArea').click(function(){
		var hitlink = '';
		hitlink = $(this).find('a.hitLink:first').attr('href');
		if(hitlink){
			window.location = hitlink;
		}
		else{
			window.location = $(this).find('a:first').attr('href');
		}
	});
}


// jQuery extend

$.fn.idle = function(time) { 
	var o = $(this); 
	o.queue(function() { 
		setTimeout(function() { 
			o.dequeue(); 
		}, 
		time);
	});
};

