/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var Prodotti =
{
    contentPanes : new Array(),

    init: function()
    {        
        var ul = Core.getElementsByClass("prodotti");
        for (var i = 0; i < ul.length; i++) {
            var folds = ul[i].getElementsByTagName("li");
            for (var j = 0; j < folds.length; j++) {
                var a = folds[j].getElementsByTagName("a");
                // Il primo elemento a apre la tendina
                a[0].onclick=Prodotti.expandFold;
                // L'ultimo elemento a la chiude
                a[a.length-1].onclick=Prodotti.collapseFold;
            }
        }
    },

    expandFold : function()
    {
        if (Core.hasClass(this.parentNode.parentNode, "collapsed"))
            Core.removeClass(this.parentNode.parentNode, "collapsed");
        if (!Core.hasClass(this.parentNode.parentNode, "expanded"))
            Core.addClass(this.parentNode.parentNode, "expanded");
        return false;
    },

    collapseFold : function()
    {
        if (Core.hasClass(this.parentNode.parentNode, "expanded"))
            Core.removeClass(this.parentNode.parentNode, "expanded");
        if (!Core.hasClass(this.parentNode.parentNode, "collapsed"))
            Core.addClass(this.parentNode.parentNode, "collapsed");
        return false;
    }

};

Core.start(Prodotti);



