function resizeElements()
{
	$('#content').width($(window).width()-210).height($(window).height());

	$('#content-small').css('height','auto');

	if($('#content-small').height()<($(window).height()-20))
		$('#content-small').height($(window).height()-20);

	$('#content-fullpage').width($(window).width());
	$('#content-fullpage').height($('#content-small').height()+20);

	/*$('#content-small').width($(window).width()-220);
	if($('#content-small').width()<760)
		$('#content-small').width(760);

	$('#content-small').css('height','auto');
	if($('#content-small').height()<($(window).height()-20))
		$('#content-small').height($(window).height()-20);*/
}

function isIOS()
{
	return navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i);
}
// error-safe logging function
function log() {
	try 	{
		if (console && console.log) {
			var output = "";
			for (var i = 0; i < arguments.length; i++)
				output += arguments[i] + " ";
			console.log(output);
		}
	}
	catch(e){}
}

$(document).ready(function()
{
	menuFadeDuration		=	200;
	menuHoverDuration		=	150;

	$('#sidebar').hover(function()
	{
		$('#menu ul li a.lk-on').each(function()
		{
			if(!$(this).parent().hasClass('selected'))
				$(this).animate({opacity:1},{queue:false,duration:menuFadeDuration});
		});
	},function()
	{
		$('#menu ul li a.lk-on').each(function()
		{
			if(!$(this).parent().hasClass('selected'))
				$(this).animate({opacity:0},{queue:false,duration:menuFadeDuration});
		});
	});

	$('#menu ul li a.lk-hover,#menu ul li a.lk-on').css('opacity',0).show();
	$('#menu ul li').hover(function()
	{
		if(!$(this).hasClass('selected'))
			$(this).find('a.lk-hover').animate({opacity:1},{queue:false,duration:menuHoverDuration});
	},function()
	{
		if(!$(this).hasClass('selected'))
			$(this).find('a.lk-hover').animate({opacity:0},{queue:false,duration:menuHoverDuration});
	});
	/*
	$('#link-patinoire a#lk-la-patinoire-hover').css('opacity',0).show();
	$('#link-patinoire').hover(function()
	{
		if(!$(this).hasClass('selected'))
			$('a#lk-la-patinoire-hover').animate({opacity:1},{queue:false,duration:menuHoverDuration});
	},function()
	{
		if(!$(this).hasClass('selected'))
			$('a#lk-la-patinoire-hover').animate({opacity:0},{queue:false,duration:menuHoverDuration});
	});
	*/
	
	/*
	if ($('body').attr('id') != 'body-welcome')
	{
		if (!($.browser.msie && parseFloat($.browser.version) < 7))
		{
			var spriteAnimation = new SpriteAnimation($('h1 a'), 23, 60);
			var spriteAnimationButton = new SpriteAnimationButton(spriteAnimation);
		}
	}
	*/
	
	if ($('body').attr('id') == 'body-gallery' || $('body').attr('id') == 'body-agenda')
	{
		//$('body').append('<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4ce5360e648830c4"></script>');
	}

	$('#menu ul li.off a,#link-patinoire a').click(function(e)
	{
		e.preventDefault();
		
		return false;
	});
});

$(window).load(function() 
{
	resizeElements();
});

$(window).resize(function()
{
	resizeElements();
});

$(window).scroll(function()
{
	if($.browser.msie && parseFloat($.browser.version) < 7)
	{
		$('#background').css('top',($(window).scrollTop()));
		$('#sidebar').css('top',($(window).scrollTop()));
	}
});
