$(document).ready(function(){
	function changeElem(size) {
		var old_size = ($.cookies.get('mlp_fontsize') !== null ) ? $.cookies.get('mlp_fontsize') : 'm';
		
		if (size != old_size) {
			var size = size !== undefined ? size : old_size;
			
			changeFS('#main', size);
			changeFS('.head', size);
		}
	} 

	function changeFS(elem, size) {
		var ourText = $(elem);
		
		if (ourText.length !== 0) {		
			if(size == 'l') {
				fs = '90%';
				$.cookies.set('mlp_fontsize', 'l', { expires: 30 });
			} else if (size == 'm') {
				fs = '75%';
				$.cookies.set('mlp_fontsize', 'm', { expires: 30 });
			} else if (size == 's') {
				fs = '62.5%'
				$.cookies.set('mlp_fontsize', 's', { expires: 30 });
			}
			
			ourText.css('fontSize', fs);
		}
	}

	$('.resize').click(function() {
		changeElem(this.id)
	});

    $("a[title='voorlezen']").attr('href','http://app.readspeaker.com/proreader/proreader.php?cid=4303&amp;lang=nl_nl&amp;url=');
    $("a[title='voorlezen']").attr('target','prwin');
    $("a[title='voorlezen']").attr('onclick','window.open(this.href+escape(document.location.href)+"&selhtml="+escape(selectedString), this.target, "width=190, height=120, resizable=1, scrollbars=1, screenX=0,screenY=0, left=0, top=0"); return false;');
	
	changeElem();
});
