﻿
/**
* @author basil
* 
*/
function sitemap() { return this.constructor(); }
sitemap.prototype = {
    initialize: function() {
        $('.category-items li').each(function(i, el) {
            if ($(el).children().length > 1) {
                if ($(el).hasClass('item-0')) {
                    var exp = $.create('a', { 'class': 'expander-blue', 'style': 'width: 11px; height: 18px; display: block; position: absolute' }, []);
                    $(exp).toggle(function() {
                        $(this).next()
									.find('ul').show();
                        $(this).removeClass('expander-blue')
									.addClass('collapser-blue');
                        /**
                        * @author basil 
                        * @fix 05/01/2009
                        * 
                        */
                        $($(this).next().find('.group-2')).each(function(i, el) {
                            if ($(el).parent().prev().hasClass('expander-black'))
                                $(el).hide();
                        });

                    }, function() {
                        $(this).next()
									.find('ul').hide();
                        $(this).removeClass('collapser-blue')
									.addClass('expander-blue');
                    });

                    // Append
                    $(el).before(exp);

                }

                if ($(el).hasClass('item-1')) {
                    var exp = $.create('a', { 'class': 'expander-black', 'style': 'width: 11px; height: 18px; display: block; position: absolute' }, []);
                    $(exp).toggle(function() {
                        $(this).next()
									.find('ul').show();
                        $(this).removeClass('expander-black')
									.addClass('collapser-black');
                    }, function() {
                        $(this).next()
									.find('ul').hide();
                        $(this).removeClass('collapser-black')
									.addClass('expander-black');
                    });

                    // Append
                    $(el).before(exp);
                }
            }
        });
    },
    constructor: function() {
        // TODO Auto-generated method stub
    }
};

/**
* @
*
*/
var _sitemap = new sitemap();

$(document).ready(function() {
    _sitemap.initialize();
});