﻿$(document).ready(function() {

    sitefunctions.textresize();

});

var sitefunctions = {
    textresize: function() {
        // show text resizing links
        $(".FontSize").show();
        var $cookie_name = "FontSize";

        var ourText = $('body');
        var currentFontSize = ourText.css('font-size');

        var originalFontSize = $("html").css("font-size");
        var stringEnding = currentFontSize.slice(-2);

        stringEnding = '';

        // if exists load saved value, otherwise store it
        if ($.cookie($cookie_name)) {
            var $getSize = $.cookie($cookie_name);

            //No animation if cookie present
            ourText.animate({ fontSize: $getSize + stringEnding }, 0);

        } else {
            //$.cookie($cookie_name, originalFontSize);
            $.cookie($cookie_name, '12');
        }
        // reset link
        $(".FontSizeReset").bind("click", function() {
            ourText.animate({ fontSize: '12' }, 600);
            $.cookie($cookie_name, '12');
        });
        // text "+" link
        $(".FontSizeInc").bind("click", function() {
            //var currentFontSize = $("html").css("font-size");
            var currentFontSizeNum = parseFloat(currentFontSize, 10);
            var newFontSize = currentFontSizeNum * 1.2;
            ourText.animate({ fontSize: newFontSize + stringEnding }, 600);
            $.cookie($cookie_name, newFontSize);
            return false;
        });
        $(".FontSizeDec").bind("click", function() {
            var currentFontSizeNum = parseFloat(currentFontSize, 10);
            var newFontSize = currentFontSizeNum / 1.2;
            ourText.animate({ fontSize: newFontSize + stringEnding }, 600);
            $.cookie($cookie_name, newFontSize);
            return false;
        });
    }
}

$(document).ready(function() {
    var randomImages = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'];
    var rndNum = Math.ceil(Math.random() * randomImages.length);
    $("#visual-top").css({ background: "url(/theme_images/gilzerijen/driehoeken/" + rndNum + ".png) 100% 100% no-repeat" });

   
});

$(document).ready(function() {

    $('#navigatie-bg').corners();

});
