$(document).ready(function () {
    var current_url = window.location.pathname;

    $('#footer-jcarousel').jcarousel();
    $('.jcarousel-item-horizontal').css('padding', '0px');

    var fLink = "a[href='" + current_url + "']";
    var match_str = "", left_menu_file = "";

    $("#menu a").each(function (ind) {
        if ($(this).attr("href") == current_url) {
            $(this).addClass("current");
        }
    });

    $("#footer-second-row span:first-child").addClass('first-child');
    $("#footer ul:last-child").addClass('last-child');

    // içeriklerdeki h1 tagları için
    if ($("#divContentArea").length > 0) {
        $("#divContentArea h1").each(function (ind) {
            var html = $(this).html();
            html = "<span>" + html + "</span>";

            $(this).html(html);
        })
    }

    // içerik icon kısımları
    $("div.icons-area").each(function (ind) {
        $(this).find("a[name=print]").click(function () {
            window.print();
        });

        $(this).find("a[name=share]").hide(); // share şimdilik gizli olacak.

        $(this).find("a[name=font-increase]").click(function () {
            if (curFontSize < 26) {
                curFontSize += 2;
                curLineHeight += 2;
                $("#divContentArea").css("font-size", curFontSize + "px").css("line-height", curLineHeight + "px");
            }
        });

        $(this).find("a[name=font-decrease]").click(function () {
            if (curFontSize > 14) {
                curFontSize -= 2;
                curLineHeight -= 2;
                $("#divContentArea").css("font-size", curFontSize + "px").css("line-height", curLineHeight + "px");
            }
        });

        $(this).find("a[name=go2top]").click(function () {
            $('html, body').animate({scrollTop:0}, 'slow');
	        return false;
        });
    });
});

// Custom Functions

// getFileContent : async: false olarak ajax isteği oluşturur ve url ile belirtilen dosyanın içeriğini döndürür.
function getFileContent(url) {
    var fileContent = "";
    $.ajax({ type: 'GET', async: false, url: url, success: function (ajaxResponse) { fileContent = ajaxResponse; } });
    return fileContent;
}

// aktif içerik boyutlarımız
var curFontSize = 14;
var curLineHeight = 24;
