// Show/Hide mod for IPB 1.3
// (c) Basic-Pro.com
// (c) Creator. Unlimited Forum
<!--
var ipb_var_cookieid = "";
var ipb_var_cookie_domain = "";
var ipb_var_cookie_path   = "/";

function togglecategory( fid, pids, add )
{
        saved = new Array();
        clean = new Array();
        posts = new Array();
        var maxid = 0;
        posts = pids.split(",");
        if ( tmp = my_getcookie('collapsesigs') )
        {
                saved = tmp.split(",");
        }
        for( i = 0 ; i < saved.length; i++ )
        {
                if ( saved[i] != fid && saved[i] != "" )
                {
                        clean[clean.length] = saved[i];
                }
        }
        if ( add )
        {
                clean[ clean.length ] = fid;
                for( c = 0 ; c < posts.length; c++ )
                {
                        maxid = parseInt(posts[c]);
                        my_show_div( my_getbyid( 'sc_'+fid +'_'+maxid  ) );
                        my_hide_div( my_getbyid( 'so_'+fid +'_'+maxid  ) );
                }
        }
        else
        {
                for( c = 0 ; c < posts.length; c++ )
                {
                        maxid = parseInt(posts[c]);
                        my_show_div( my_getbyid( 'so_'+fid +'_'+maxid  ) );
                        my_hide_div( my_getbyid( 'sc_'+fid +'_'+maxid  ) );
                }
        }
        my_setcookie( 'collapsesigs', clean.join(','), 1 );
}

function my_getbyid(id)
{
        itm = null;

        if (document.getElementById)
        {
                itm = document.getElementById(id);
        }
        else if (document.all)
        {
                itm = document.all[id];
        }
        else if (document.layers)
        {
                itm = document.layers[id];
        }

        return itm;
}

function my_getcookie( name )
{
        cname = ipb_var_cookieid + name + '=';
        cpos  = document.cookie.indexOf( cname );

        if ( cpos != -1 )
        {
                cstart = cpos + cname.length;
                cend   = document.cookie.indexOf(";", cstart);

                if (cend == -1)
                {
                        cend = document.cookie.length;
                }

                return unescape( document.cookie.substring(cstart, cend) );
        }

        return null;
}

function my_setcookie( name, value, sticky )
{
        expire = "";
        domain = "";
        path   = "/";

        if ( sticky )
        {
                expire = "; expires=Wed, 1 Jan 2020 00:00:00 GMT";
        }

        if ( ipb_var_cookie_domain != "" )
        {
                domain = '; domain=' + ipb_var_cookie_domain;
        }

        if ( ipb_var_cookie_path != "" )
        {
                path = ipb_var_cookie_path;
        }

        document.cookie = ipb_var_cookieid + name + "=" + value + "; path=" + path + expire + domain + ';';
}

function my_hide_div(itm)
{
        if ( ! itm ) return;

        itm.style.display = "none";
}
function my_show_div(itm)
{
        if ( ! itm ) return;

        itm.style.display = "";
}
//-->
