$(document).ready(function(){

	$('#LanguageSwitcher a').bind('click', function()
	{
		var Pos = ($(this).offset());	
		$('#LanguageDropdown').css({left: Pos.left, top: Pos.top + 20, position: 'absolute'});
		ToggleLanguageDropdown();
		return false;
	})	

	$('#Fontsize a').bind('mouseover', function()
	{
		$('#Fontsize span').html($(this).attr('title'));
	});

	$('#Fontsize a').bind('mouseleave', function()
	{
		$('#Fontsize span').html('Lettergrootte: ');
	});
	
	Fontsize.Init();
	
	$('input#SubscribeNewsletter').focus(function()
	{
		if($(this).val() == 'Uw e-mail adres...') $(this).val('');
	}).val('Uw e-mail adres...').blur(function()
	{
		if($(this).val() == '') $(this).val('Uw e-mail adres...');
	});	 
});


function ChangeLanguage(Lancode)
{
	// doe niks totdat er meer talen zijn...
	ToggleLanguageDropdown();
}


function ToggleLanguageDropdown()
{
	$('#LanguageDropdown').slideToggle();
}


var Fontsize = {

	Size: 12,
	DefaultSize: 12,
	DefaultH1Size: 29,
	DefaultH2Size: 20,
	CookieSettings: {path: '/'},
	
	
	Init: function()
	{
		var Cookie = $.cookie('fontsize');
		if(Cookie !== null && !isNaN(Cookie))
		{
			Fontsize.Size = parseInt(Cookie);
			Fontsize.Apply();
		}
	},


	Bigger: function()
	{
		if(Fontsize.Size + 1 < 20)
		{
			Fontsize.Size += 1;
			Fontsize.Apply();
		}	
	},


	Smaller: function()
	{
		if(Fontsize.Size - 1 > 8)
		{
			Fontsize.Size -= 1;
			Fontsize.Apply();
		}	
	},


	Apply: function()
	{
		$('p, label, input, textarea, td, li').css({fontSize: Fontsize.Size});
		$('h1').css({fontSize: Fontsize.Size + 18});
		$('h2').css({fontSize: Fontsize.Size + 10});
			
		$.cookie('fontsize', Fontsize.Size, Fontsize.CookieSettings);
	},


	Reset: function()
	{
		Fontsize.Size = Fontsize.DefaultSize;
		$('p, label, input, textarea, td, li').css({fontSize: Fontsize.DefaultSize});
		$('h1').css({fontSize: Fontsize.DefaultH1Size});
		$('h2').css({fontSize: Fontsize.DefaultH2Size});
		
		$.cookie('fontsize', Fontsize.DefaultSize, Fontsize.CookieSettings);
	}
}

