/*
Copyright 2007 Andrew Rader

This file is part of Fancy Categories

 Fancy Categories is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

 Fancy Categories is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Fancy Categories; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

function fancat_click( e ) {
    if( e.target ) {
        src = e.target;
    }
    else {
        src = window.event.srcElement;
    }

    id = src.id.replace( 'fancycat_link_', '' );
    subcats = document.getElementById( 'fancycat_sub_' + id );
    posts = document.getElementById( 'fancycat_posts_' + id );

    if( src.getAttribute( "rel" ) == "hide" ) {
        if( subcats != null ) {
            subcats.style.display = "none";
        }
        if( posts != null ) {
            posts.style.display = "none";
        }
        src.setAttribute("rel","show");
    }
    else {
        if( subcats != null ) {
            subcats.style.display = "";
        }
        if( posts != null ) {
            posts.style.display = "";
        }
        src.setAttribute("rel","hide");
    }

    if( e.preventDefault ) {
        e.preventDefault();
    }

    e.returnValue = false;

    return false;
}


