var sIFRFile = '/_files/frutiger_lt_ce.swf'
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

var d = new Date().getFullYear();
var m = new Date().getMonth()+1;

function embedRotatingFlash(src, position, DOMElementID) {
    var soRotatingFlash = new SWFObject(src[position][0], "rotator", "470", "138", "8");
    if( src[position][1] != null) {
        for (i = 0; i <= src[position][1].length - 2; i++) {            
            soRotatingFlash.addVariable(src[position][1][i][0],src[position][1][i][1]);
        }
    }
    soRotatingFlash.write(DOMElementID);
};



function targetBlank(array, selector) {
    $(array).each(function() {
        $(selector + " a").attr("target","_blank");
    });
};

function showFullRanking() {
  $("#zwiniety").toggle();
  $("#rozwiniety").toggle();
  $("#showFullRanking li#show").toggle();
  $("#showFullRanking li#hide").toggle();
}

$(document).ready(function(){
    //sifr
    if(typeof sIFR == "function"){
        sIFR.replaceElement(".headBlack",  named({sFlashSrc: sIFRFile, sColor: "#000000", sWmode: "transparent"}));
        sIFR.replaceElement("#main h6",  named({sFlashSrc: sIFRFile, sColor: "#000000", sWmode: "transparent"}));
        sIFR.replaceElement(".headBlackBig",  named({sFlashSrc: sIFRFile, sColor: "#000000", sWmode: "transparent"}));
        sIFR.replaceElement("#main h5",  named({sFlashSrc: sIFRFile, sColor: "#000000", sWmode: "transparent"}));
        sIFR.replaceElement(".headNavy",  named({sFlashSrc: sIFRFile, sColor: "#505e68", sWmode: "transparent"}));
        sIFR.replaceElement(".headLeftBox",  named({sFlashSrc: sIFRFile, sColor: "#333333", sWmode: "transparent"}));    
        sIFR.replaceElement(".headBlue",  named({sFlashSrc: sIFRFile, sColor: "#0087CD", sWmode: "transparent"}));    
        sIFR.replaceElement(".headGray",  named({sFlashSrc: sIFRFile, sColor: "#666666", sWmode: "transparent"}));    
        sIFR.replaceElement("#siteMap .siteMapGroup h4 span",  named({sFlashSrc: sIFRFile, sColor: "#666666", sWmode: "transparent"}));

    }


    //rozwijanie rankingu
    if($("#imageOverlay").size() > 0 ) {
      $("#rozwiniety").hide();
    }


    // lista agentow
    if(window.location.hash != "") {
        var myHash = "#toggle" + window.location.hash.slice(1);
        if($(myHash).length > 0) {
            $(myHash + " div.insideToggle").show();
            $(myHash + " a.slide").removeClass("slideDown");
            $(myHash + " a.slide").addClass("slideUp");
            $(myHash + " a.slide").addClass("link2head");
       }
    }    
    $(".slide").toggle( function() {
        $(this).blur().
        removeClass("slideDown").
        addClass("slideUp").
        addClass("link2head").
        next().show();
    },function() {
        $(this).blur().
        removeClass("slideUp").
        addClass("slideDown").
        removeClass("link2head").
        next().hide();
    });

    // table odd/eaven colors
    if($(".editorText table").length > 0) {            
        $(".editorText table tbody tr:odd").addClass("trWhite");
    }

    // select with year
//width of #pager
        var pager_width = 0;
        $("#pager li").each(function() {
            pager_width+=$(this).width()+6;
            $("#pager").width(pager_width);
        });
   
        //color table
        $('div.news table tbody tr:even').addClass('tableOdd');
        $('div.news table tbody tr:odd').addClass('tableEven');
        $('div.news table').addClass('tableNews');   

    $("#back").click(function(){
        window.history.back();
        $(this).blur();
        return false;
    });

    // print link
    $(".print a").click(function() {print();});
    $('a:contains(>>)').text("»");

});

function rozwinOpis(id) {
    $("#" + id).toggle();
}

function initMenu(a,b) {
    // zaslepka funkcji dla symfonii
}