$(document).ready(function(){

	function setElementHeight() {
	
		var windowHeight = $(window).height();
		var footerHeight = $('.footer').height();
		var contentY	 = $('.content_container').offset().top;
		
		$('.content_container').css('min-height', windowHeight-footerHeight-contentY);
		
		var mainPaddingTop 		= parseInt($('.main_content').css('padding-top').replace('px', ''));
		var mainPaddingBottom 	= parseInt($('.main_content').css('padding-bottom').replace('px', ''));
		var mainMenuHeight		= $('ul.menu').outerHeight();
		
		
		var mainMinHeight		= windowHeight-footerHeight-contentY-(mainPaddingTop+mainPaddingBottom)-mainMenuHeight;
		
		$('.main_content').css('min-height', mainMinHeight);
		
		//var headerImageHeight		= $('.header_image').height();
		//var CategoryMenu			= $('.category_menu').outerHeight();
		var TextBorderTop			= parseInt($('.text_content').css('border-top-width').replace('px', ''));
		var leftColHeight			= $('.left_col').height();
		var rightColHeight			= $('.right_col').height();
		var textContentMinHeight	= mainMinHeight-TextBorderTop//mainMinHeight-headerImageHeight-CategoryMenu-TextBorderTop;
		
		if(leftColHeight > rightColHeight && leftColHeight > textContentMinHeight)
		{
			textContentMinHeight = leftColHeight;
		}
		
		if(rightColHeight > leftColHeight && rightColHeight > textContentMinHeight)
		{
			textContentMinHeight = rightColHeight;
		}		
		
		$('.text_content').css('min-height', textContentMinHeight);
	}
	
	$(window).resize(setElementHeight);
	
	setElementHeight();
	
	// blue hover
	/*$('#blue').hover(function(){
		$(this).addClass('hover');
		$('li.category_0').addClass('hover');
	}, function(){
		$(this).removeClass('hover');
		$('li.category_0').removeClass('hover');
	});
	
	$('li.category_0').hover(function(){
		$('#blue').addClass('hover');
	}, function(){
		$('#blue').removeClass('hover');
	});
	
	//orange
	$('#orange').hover(function(){
		$(this).addClass('hover');
		$('li.category_1').addClass('hover');
	}, function(){
		$(this).removeClass('hover');
		$('li.category_1').removeClass('hover');
	});
	
	$('li.category_1').hover(function(){
		$('#orange').addClass('hover');
	}, function(){
		$('#orange').removeClass('hover');
	});
	
	//green
	$('#green').hover(function(){
		$(this).addClass('hover');
		$('li.category_2').addClass('hover');
	}, function(){
		$(this).removeClass('hover');
		$('li.category_2').removeClass('hover');
	});
	
	$('li.category_2').hover(function(){
		$('#green').addClass('hover');
	}, function(){
		$('#green').removeClass('hover');
	});*/
	
	$("a.lightbox").each(function()
	{
		var dWidth 		= parseInt($(this).attr('href').match(/width=[0-9]+/i)[0].replace('width=',''));
		var dHeight 	=  parseInt($(this).attr('href').match(/height=[0-9]+/i)[0].replace('height=',''));
	
		$(this).fancybox({ 
			'width'			:	dWidth,  
			'height'		:	dHeight,
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true,
			'type'			:	'iframe',
			'scrolling'		:	'no'
		});
	});
});
