/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if(Prototype.Browser.IE){
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        Prototype.BrowserFeatures['Version'] = new Number(RegExp.$1);
    }
}
document.observe("dom:loaded", function() {
    $$('#nav-left li.parent > a:not(.category-link)').invoke('observe','click',function(event){
        event.stop();
        toggleCategory(this);
    });
});

function toggleCategory(element){
    list=$(element).next('ul');
	if (!list) {
		buildSubmenu(element);
		list=$(element).next('ul');
	}
    thisParent = $(element).up(0);
    if(Prototype.Browser.IE && Prototype.BrowserFeatures['Version'] < 8 ){
        $(list).toggle();
        thisParent.toggleClassName('active');
    }else{
        if(!$(list).hasClassName('locked')){
            $(list).addClassName('locked');
            thisParent.toggleClassName('active');
            new Effect.toggle($(element).next('ul'),'blind',{
                duration: 0.5,
                queue: {position: 'end', scope: 'menuscope'},
                afterFinish: function (){
                    $(list).removeClassName('locked');
            }});
        }
    }
}
