jQuery(document).ready(function() {


    // pcchess: pezzi catturati on/off

    /* firefox bug? */
    jQuery('.catch-board-case').hide();
    jQuery('.catch-board-case').show();


    jQuery('#catch-board-switcher').toggle(
        function(){
     jQuery('.catch-board-case').hide();
 },
 function(){
     jQuery('.catch-board-case').show();
 }
    );


    // correzione (vecchi) articoli PDF
    var new_width = '600';
    jQuery('embed[@src$=".pdf"]').each(
 function () {
     jQuery(this).attr('width', new_width);
     jQuery(this).parent('div').attr('align', 'left');
     var src_pdf = jQuery(this).attr('src');
     var pdf_link = '<div class="fondino-gray">Scarica il <a href="' + src_pdf + '">file in formato PDF</a></div>';
     jQuery(this).after(pdf_link);
 });
    jQuery('object[@type="application/pdf"]').each(
 function () {
     jQuery(this).attr('width', new_width);
     jQuery(this).parent('div').attr('align', 'left');
     var src_pdf = jQuery(this).attr('src');
     //var pdf_link = '<div class="fondino-gray"><a href="' + src_pdf + '">Scarica</a> il file in formato PDF</div>';
     var pdf_link = '<div class="fondino-gray">Scarica il <a href="' + src_pdf + '">file in formato PDF</a></div>';
     jQuery(this).after(pdf_link);
 });

    // Form registrazione: newsletter selezionate per default
    jQuery(".componentheading:contains('Registrazione')").parents('tr').each(
            function () {
         jQuery('.newslettersList input[@type="checkbox"]').attr('checked', 'checked');
     }
    );

    // com_pcchess
    $('#pcchess-score').tablesorter({widgets:['zebra'], sortList: [[6,1]]});
    $('#pcchess-score-active').tablesorter({widgets:['zebra'], sortList: [[4,1]]});
    var pcchessTable = $('table.tablesorter');
    $("#pcchess-table-filter").keyup(function() {
        $.uiTableFilter( pcchessTable, this.value );
    });

    $('#pcchess-filter-form').submit(function(){
        pcchessTable.find("tbody > tr:visible > td:eq(1)").mousedown();
        return false;
    }).focus();


    // separatore elenco articoli HP
    jQuery('table.blog').find('table.contentpaneopen:odd').after('<span class="article_seperator"/>');

    // cb_login
    jQuery('#mod_login_logoutform_login').addClass('mod_login_logoutform_login');

    jQuery('#mcquizForm').addClass('contentpane');

    jQuery('#gameForm td').css('padding', '0px');
    jQuery('#gameForm img').css('margin', '0px 0px 0px 0px');

    jQuery('#cbtab12 .content_rating').css('padding', '0px');

    // gioco "Resto"
    jQuery('.resto-img').show();
    jQuery('.resto-img').hide();
    jQuery('#howto').toggle(
        function(){
     jQuery('.resto-img').show();
 },
 function(){
     jQuery('.resto-img').hide();
 }
    );

    //jQuery('#pm-box').parents('table:first').addClass('moduletable_user2').after('<div class="end_dx"></div>');

    // box gioca con la matematica
    //jQuery('#box-gioca-matematica').parents('table:first').addClass('moduletable_user2');

    //jQuery('.moduletable_ultimeforum').after('<div class="end_dx"></div>');

});

