version = navigator.appVersion.toLowerCase();
agent = navigator.userAgent.toLowerCase();
ie = (version.indexOf('msie')>-1);
win = (version.indexOf('windows')>-1);
opera = (agent.indexOf('opera')>-1);
ie50 = (version.indexOf('msie 5.0')>-1);

function prn() {
    document.write(' \074span\076\&bull\;\074/span\076 \074a href=\"javascript:goprn();\"\076Print page\074/a\076');
}
function goprn() {
    window.print();
}
function fav() {
    if ((opera) && (win)) return false;
    else if ((ie) && (win)) document.write(' \074span\076\&bull\;\074/span\076 \074a href=\"javascript:gofav();\"\076Add to favorites\074/a\076');
}
function gofav() {
    window.external.addFavorite('http://www.reptarium.cz/','Reptarium.cz - teraristika a herpetologie');
}

$(document).ready(function() {
    
    $('.collapsed').each( function (i) {
        var cook = '';
        if ($(this).hasClass("tax_collapsible")) {
            cook = MyCookie.Read( this.id );
        }
        if ( cook != 'show') {
            $(this).children('.body').slideUp('fast');
        } else {
            $(this).removeClass("collapsed");
        };
    });

    $('.collapsible .title a').click(function(event){
        if ($(this).parents(".collapsible:first").hasClass("collapsed")) {
            $(this).parents(".collapsible:first").removeClass("collapsed");
            $(this).parents(".title").next(".body").slideDown('fast');
        } else {
            $(this).parents(".collapsible:first").addClass("collapsed");
            $(this).parents(".title").next(".body").slideUp('fast');
        }
     
        return false;
    });

    $('.tax_collapsible .title a').click(function(event){
        var taxid = $(this).parents(".tax_collapsible:first").attr("id");
        if ($(this).parents(".tax_collapsible:first").hasClass("collapsed")) {
            $(this).parents(".tax_collapsible:first").removeClass("collapsed");
            $(this).parents(".title").next(".body").slideDown('fast');
            MyCookie.Write(taxid, 'show', 30);
        } else {
            $(this).parents(".tax_collapsible:first").addClass("collapsed");
            $(this).parents(".title").next(".body").slideUp('fast');
            MyCookie.Write(taxid, '', -1);
        }
     
        return false;
    });

});

