$(function() {
var startSize = $.cookie('fontSize');
var startSize = parseFloat(startSize, 12);

if (startSize > 16){
	$('#destaque').css("height", "auto");
	$('#destaqueGovernador').css("height", "auto");
	
}

$('.text').css('font-size', startSize);
var captionVisible = false;

$(".add").click(function(){
    var currentFontSize = $('.text').css('font-size');
	var currentHeight = $('.text').css('height');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum+1;
	if (newFontSize < 23) {
	$('#destaque').css("height", "auto");
	$('#destaqueGovernador').css("height", "auto");
    $('.text').css('font-size', newFontSize);

	}
    return false;
});

$(".minus").click(function(){
    var currentFontSize = $('.text').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum-1;
	if (newFontSize > 8) {	
	$('#destaque').css("height", "auto");
	$('#destaqueGovernador').css("height", "auto");
    $('.text').css('font-size', newFontSize);
	}
	return false;
  });
});

window.onbeforeunload = leaveCookie;

function leaveCookie()
{
	var FontSize = $('.text').css('font-size');
   	var IntFontSize = parseFloat(FontSize, 10);
	$.cookie('fontSize', IntFontSize);
}
