$(document).ready(function() {

	$('a.mapzoom').fancybox({
		'type' : 'iframe',
		'width' : '50%',
		'height' : '75%',
		'showNavArrows' : 'false'
	});

	//$('a.lajitteluohje').fancybox();


	var fontcookie = getCookie('font');
	
	if(fontcookie){
		$("body").removeClass();
		$("body").addClass(fontcookie);
	}
	
	$("#FontResize").click(function() {
		var clslist = ["small", "normal", "big"],
			body = $("body"), i;
		for(i = 0; i < clslist.length; i++) {
			if(body.hasClass(clslist[i])) {
				body.removeClass(clslist[i]);
				i = (i + 1 >= clslist.length ? 0 : i + 1);
				body.addClass(clslist[i]);
				setCookie('font',clslist[i]);
				break;
			}
		}
		return false;
	});
	
	function setCookie(key, value, expiry, path) {
		var date = new Date();
		if(expiry === undefined || expiry === null)
			expiry = 31536000;
		date.setTime(date.getTime() + Math.floor(expiry * 1000));
		if(path === undefined || path === null)
			path = "/";
		
		var str = encodeURIComponent(key) + "=" + encodeURIComponent(value) + ";"
			+ " expires=" + date.toGMTString() + "; path=" + escape(path);
		document.cookie = str;
	}
	
	function getCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') 
				c = c.substring(1,c.length);
				
			if (c.indexOf(nameEQ) == 0) 
				return c.substring(nameEQ.length,c.length);
		}
		return null;
	}


});
