bu_current=0;
bu_fade_interval=0;
current_bu = '';

function load_business_unit(bu,force)
{
	if((ready || force) && bu != current_bu)
	{
		//bu_fade_interval = setInterval('bu_fade(\''+bu+'\')',30);
		eval(bu+'_content_section.load_section()');
		
		update_location('development_elements-'+bu);
		
		if(current_bu != '')
		{
			eval(current_bu+'_content_section.unload_section()');
		}
			
		current_bu = bu;
	}
}

function bu_fade(bu)
{

	for(i=0; i<groups['business_units'].length; i++)
	{
		if(groups['business_units'][i] != 'business_unit_header')
		{
			if(bu!=groups['business_units'][i])
			{
				outgoing = groups['business_units'][i];
			
				ID(outgoing).style.opacity = 100-bu_current;
				ID(outgoing).style.MozOpacity = (100-bu_current)/100;
				ID(outgoing).style.KhtmlOpacity = (100-bu_current)/100;
				ID(outgoing).style.filter = "alpha(opacity=" + 100-bu_current + ")";
			}
			else
			{
				ID(bu).style.opacity = bu_current;
				ID(bu).style.MozOpacity = bu_current/100;
				ID(bu).style.KhtmlOpacity = bu_current/100;
				ID(bu).style.filter = "alpha(opacity=" +bu_current + ")"
			}
		}
	}
	
	if(bu_current<25)
	{
		/*ID(incoming).style.opacity = bu_current;
		ID(incoming).style.MozOpacity = bu_current/100;
		ID(incoming).style.KhtmlOpacity = bu_current/100;
		ID(incoming).style.filter = "alpha(opacity=" +bu_current + ")";*/
		bu_current+=5;
	}
	else
	{
		/*ID(outgoing).style.opacity = 10;
		ID(outgoing).style.MozOpacity = 10;
		ID(outgoing).style.KhtmlOpacity = 10;
		ID(outgoing).style.filter = "alpha(opacity=" + ID(outgoing).style.opacity + ")";
		ID(outgoing).style.display='none';*/
		
		ID(bu).style.opacity = 100;
		ID(bu).style.MozOpacity = 1;
		ID(bu).style.KhtmlOpacity = 1;
		ID(bu).style.filter = "alpha(opacity=" + ID(bu).style.opacity + ")";
		bu_current=0;
		clearInterval(bu_fade_interval);
	}
}

function bu_reset()
{
	for(i=0; i<groups['business_units'].length; i++)
	{
		if(groups['business_units'][i] != 'business_unit_header')
		{
			outgoing = groups['business_units'][i];
			
			ID(outgoing).style.opacity = 100;
			ID(outgoing).style.MozOpacity = 1;
			ID(outgoing).style.KhtmlOpacity = 1;
			ID(outgoing).style.filter = "alpha(opacity=" + ID(outgoing).style.opacity + ")";
		}
	}
	
	current_bu = '';
}

function quick_load_business_unit(bu)
{
	load_business_unit(bu,true)
}

function load_development_elements()
{
	load_all_sections('development_elements');		
		
	if(window.location.href.toString().indexOf('#') != -1 && window.location.href.toString().indexOf('-') != -1 && window.location.href.toString().split('#')[1].split('-')[0] == 'development_elements')
	{
		default_business_unit = window.location.href.toString().split('#')[1].split('-')[1];
	}
	else
	{
		default_business_unit = undefined;
	}
	
	if(default_business_unit != undefined)
	{
		quick_load_business_unit(default_business_unit);
	}
	else
	{	
		unload_all_sections('business_unit_content');
		update_location('development_elements');
	}
}

function unload_development_elements()
{
	unload_all_sections('development_elements');
	unload_all_sections('business_unit_content');
}


