/***********************************
 *   INDEX-PUOLEN JAVASCRIPTIT
 ***********************************/

$(document).ready(function(){
    $("img[id*='success']").each( function (i) {
        $(this).hide();
    } );
    $("img[id*='error']").each( function (i) {
        //$(this).hide();
    } );
    $("img[id*='loading']").each( function (i) {
        $(this).hide();
    } );
    
    /* Piilotetaan blogiarkistolinkit */
    $(".archive-hidden").each( function (i) {
        $(this).hide();
    } );

    /* Piilotetaan blogiarkistolinkit */
    $(".blog-photos-hidden-table").hide();

});


function toggleBlogPhotos() {
    if ($.trim($('#expand-icon-blog-photos').text()) === "+") {
        $('#expand-icon-blog-photos').text("-");
    }
    else if ($.trim($('#expand-icon-blog-photos').text()) === "-") {
        $('#expand-icon-blog-photos').text("+");
    }
    $('.blog-photos-hidden-table').slideToggle("fast");
}


function checkSpamFilter() {
    if (($('#cb1').is(':checked')) == true && $('#cb2').is(':checked') == false) {
        $('#error').hide();
        $('#success').show(); 
    }
    else {
        $('#success').hide();
        $('#error').show();
    }
}

function toggleArchive(year) {
    if ($('#expand-icon-'+year).text() == "+") {
        $('#expand-icon-'+year).text("-");
    }
    else if ($('#expand-icon-'+year).text() == "-") {
        $('#expand-icon-'+year).text("+");
    }

    $('#archive-'+year).slideToggle("slow");
}
