fps = 30;
load_time = 1;

current_background=1;
background_interval = 0;
current = 0;

navigation = ['home','development_elements','new_compounds','about_script_lab','contact_us']

function init()
{
	load_all_sections('layout');
	
	current_template = window.location.href.toString().split('/')[window.location.href.toString().split('/').length-1].split('#')[0].split('.')[0];
	
	default_page = window.location.href.toString().split('#')[1];
	
	if(default_page != undefined && default_page.indexOf('-') != -1)
	{
		default_page = default_page.split('-')[0]
	}
	
	if(default_page != undefined)
	{
		setTimeout('current_area(\''+default_page+'\')',load_time*2500);
	}
	else if(current_template != '' && current_template != 'INDEX')
	{
		setTimeout('current_area(\''+default_page+'\')',load_time*2500);
	}
	else
	{
		setTimeout('current_area(\'home\')',load_time*2500);
	}
}

function current_area(area)
{
	for(n=0; n<navigation.length; n++)
	{
		if(navigation[n] != area)
		{
			ID(navigation[n]+'_arrow').src = '/images/shim.gif';
			eval('unload_'+navigation[n]+'()')
		}
		else
		{
			ID(navigation[n].split('-')[0]+'_arrow').src = '/images/navigation/arrow.png';
			eval('load_'+navigation[n]+'()')
		}
	}	
}

function update_location(location)
{
	document.title = 'Script_Lab: '+initcaps(location.split('-')[0].split('_').join(' '))+(location.indexOf('-') != -1 ? ' - '+location.split('-')[1].split('_').join(' ').toUpperCase() : '');
	window.location.replace('#'+location);
}

function HOME(init)
{
	if(ready || init != undefined)
	{
		unload_development_elements();
		current_area('home');
		update_location('home');
	}
}

function DEVELOPMENT_ELEMENTS(init)
{
	if(ready || init != undefined)
	{
		load_development_elements();
	}
}

function NEW_COMPOUNDS(init)
{
	if(ready || init != undefined)
	{
		unload_development_elements();
		load_new_compounds();
	}
}

function ABOUT_SCRIPT_LAB(init)
{
	if(ready || init != undefined)
	{
		unload_development_elements();
		current_area('about_script_lab');
	}
}

function CONTACT_US(init)
{
	if(ready || init != undefined)
	{
		unload_development_elements();
		current_area('contact_us');
	}
}

/*function move_arrow(destination)
{
	navigation_arrow_section.direction='right';
	move_to = Number(ID('navigation_arrow').style.left.toString().split('px')[0]);
		
	if(move_to > destination)
	{
		navigation_arrow_section.startx=destination;
		navigation_arrow_section.unload_section();
	}
	if(move_to < destination)
	{
		navigation_arrow_section.startx=move_to;
		navigation_arrow_section.x=destination;
		navigation_arrow_section.load_section();
	}
}*/