﻿$(function () {

    $(".table-container table tr:even").css({ backgroundColor: "#F2F2F2" });

    $("a[href$='.pdf']").addClass("pdf");
    $("a[href$='.xls']").addClass("xls");
    $("a[href$='.doc']").addClass("doc");
    $("a[href$='.mp3']").addClass("mp3");
    $("a[href$='.zip']").addClass("zip");
    $("a[href$='.swf']").addClass("swf");
    $(".empty").removeClass("pdf").removeClass("xls").removeClass("doc");

    //alert(parseUri(location.href).relative);
    if (jQuery.url.segment(0) != null) {
        
        if (jQuery.url.segment(0).toLowerCase() == 'gradanstvo'
        || jQuery.url.segment(0).toLowerCase() == 'racuni'
        || jQuery.url.segment(0).toLowerCase() == 'kartice'
        || jQuery.url.segment(0).toLowerCase() == 'krediti'
        || jQuery.url.segment(0).toLowerCase() == 'pitanja-i-odgovori'
        || jQuery.url.segment(0).toLowerCase() == 'osobni-bankar'
        || jQuery.url.segment(0).toLowerCase() == 'prigovori-i-pohvale'
        || jQuery.url.segment(0).toLowerCase() == 'osiguranja'
        || jQuery.url.segment(0).toLowerCase() == 'osiguranje') {
            $('.gradanstvo').addClass('active');
        } 
        if (jQuery.url.segment(0).toLowerCase() == 'poslovno-bankarstvo') {
            $('.poslovno').addClass('active');
        }
        if (jQuery.url.segment(0).toLowerCase() == 'riznica'
        || jQuery.url.segment(0).toLowerCase() == 'riznica-investicijsko-bankarstvo') {
            $('.investicijsko').addClass('active');
        }
        if (jQuery.url.segment(0).toLowerCase() == 'osiguranje') {
            $('.osiguranje').addClass('active');
        }
    }

    //Switch the "Open" and "Close" state per click
    $(".pane h5.menu_head").toggle(function () {
        $(this).css({ background: "url('/images/collapse.png') no-repeat right top" });
    }, function () {
        $(this).css({ background: "url('/images/expand.png') no-repeat right top" });
    });

    $(".pane h5.menu_head").click(function () {
        $(this).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
    });

    $("#pane h5.menu_head").toggle(function () {
        $(this).css({ background: "url('/images/collapse.png') no-repeat right top" });
    }, function () {
        $(this).css({ background: "url('/images/expand.png') no-repeat right top" });
    });

    $("#pane h5.menu_head").click(function () {
        $(this).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
    });


    //Switch the "Open" and "Close" state per click
    $("#paneFooter h5.menu_head_footer").toggle(function () {
        $(this).css({ background: "url('/images/footer-backg-collapse.jpg') no-repeat right top" });
    }, function () {
        $(this).css({ background: "url('/images/footer-backg-expand.jpg') no-repeat right top" });
    });


    $("#paneFooter h5.menu_head_footer").click(function () {
        $(this).next("div.menu_body_footer").slideToggle(300).siblings("div.menu_body_footer").slideUp("slow");
    });

});
