$(document).ready(function()
{
	gtc_panels_equalize();
	fit_general_text_content();
	
	init_pager_manim();
	
	position_opening_hours_box();
});

function fit_general_text_content()
{
	if ($('#general_text_content').length == 0) return;
	
	if ($.browser.msie && $.browser.version.substr(0,1) < 8)
	{
		var height = $('#gtc_left_group').height();
	
		$('#general_text_content').height(height);
	}
}

function fit_gtc_right_panel()
{
	if ($('#gtc_right_panel').length == 0) return;
	if ($('#gtc_right_panel').height() == $('#general_text_content').height()) return;
	
	$('#gtc_right_panel').height($('#general_text_content').height());
	//$('#gtc_right_panel .container').height($('#gtc_right_panel').height());
}

function gtc_panels_equalize()
{
	var maxHeight = $('#gtc_left_panel').height();
	maxHeight = maxHeight > $('#gtc_content').height() ? maxHeight : $('#gtc_content').height();
	maxHeight = maxHeight > $('#gtc_right_panel').height() ? maxHeight : $('#gtc_right_panel').height();
	
	$('#gtc_left_panel').height(maxHeight);
	$('#gtc_content').height(maxHeight);
	$('#gtc_right_panel').height(maxHeight + 30);
}

function init_pager_manim()
{
	if ($('#gtc_pager').length == 0) return;
	
	var pic1 = new Image;
	pic1.src = 'assets/image/pager_dec_over.png';
	
	var pic2 = new Image;
	pic2.src = 'assets/image/pager_inc_over.png';
	
	$('a.gtc_pager')
	.mouseover(function()
	{
		if ($(this).hasClass('dec'))
		{
			$(this).children('img').attr('src', 'assets/image/pager_dec_over.png');
		}
		else
		{
			$(this).children('img').attr('src', 'assets/image/pager_inc_over.png');
		}
	})
	.mouseout(function()
	{
		if ($(this).hasClass('dec'))
		{
			$(this).children('img').attr('src', 'assets/image/pager_dec_active.png');
		}
		else
		{
			$(this).children('img').attr('src', 'assets/image/pager_inc_active.png');
		}
	});
}

function position_opening_hours_box()
{
	if ($('#opening_hours').length == 0) return;
	
	var top = $('#foot').position().top - $('#opening_hours').height() - 10;
	
	$('#opening_hours').css('top', top);
}

function switch_oh_panel_disp()
{
	if ($('#opening_hours').css('display') == 'none')
	{
		$('#opening_hours').css('display', 'block');
	}
	else
	{
		$('#opening_hours').css('display', 'none');
	}
}

