var collapsibles   = new Array();
var toggle_state   = new Array();
var collapsibles_n = new Array();
var toggle_state_n = new Array();

window.addEvent('domready', function()
{
	var list = $$('#dep-content div.element');
	var headings = $$('#dep-content div.toggler');
	
	headings.each( function(heading, i)
	{
		collapsibles[i] = new Fx.Slide(list[i], {
			duration: 500,
			transition: Fx.Transitions.linear
		});
        
        toggle_state[i] = 0;
        
		heading.onclick = function()
		{
            if (toggle_state[i] == 0)
            {
                this.style.color = "#ff6600";
                this.style.backgroundPosition = "0px -32px";
                toggle_state[i] = 1;
            }
            else
            {
                this.style.color = "#003366";
                this.style.backgroundPosition = "0px 0px";
                toggle_state[i] = 0;
            }
			collapsibles[i].toggle();
			return false;
		}
        
        heading.onmouseover = function()
		{
            if (toggle_state[i] == 0)
            {
                this.style.color = "#ff6600";
            }
        }
        
        heading.onmouseout = function()
		{
            if (toggle_state[i] == 0)
            {
                this.style.color = "#003366";
            }
        }
        
		collapsibles[i].hide();
	});

	var list_n = $$('#nar-content div.element');
	var headings_n = $$('#nar-content div.toggler');
	
	headings_n.each( function(heading, i)
	{
		collapsibles_n[i] = new Fx.Slide(list_n[i], {
			duration: 500,
			transition: Fx.Transitions.linear
		});
        
        toggle_state_n[i] = 0;
		
		heading.onclick = function()
		{
            if (toggle_state_n[i] == 0)
            {
                this.style.color = "#ff6600";
                this.style.backgroundPosition = "0px -32px";
                toggle_state_n[i] = 1;
            }
            else
            {
                this.style.color = "#003366";
                this.style.backgroundPosition = "0px 0px";
                toggle_state_n[i] = 0;
            }
			collapsibles_n[i].toggle();
			return false;
		}
        
        heading.onmouseover = function()
		{
            if (toggle_state_n[i] == 0)
            {
                this.style.color = "#ff6600";
            }
        }
        
        heading.onmouseout = function()
		{
            if (toggle_state_n[i] == 0)
            {
                this.style.color = "#003366";
            }
        }
        
		collapsibles_n[i].hide();
	});

});
