var i;
var z;
var fragSelection = new Array();
var homeSelection = new Array();
var lightSelection = new Array();
var outSelection = new Array();
var seasSelection = new Array();
var wallSelection = new Array();

function arrayPush(array, cat, max)
{
	array.push('../../img/' + cat + '/_' + cat + '-feat.jpg');
	for (var a = 1; a <= max; a++)
	{
		if(array != 'lightSelection' && a != 2)
		{
			array.push('../../img/' + cat + '/' + cat + '-' + a + '.jpg');
		}
	}
}

arrayPush(fragSelection, 'frag', 16);
arrayPush(homeSelection, 'home', 13);
arrayPush(lightSelection, 'light', 10);
arrayPush(outSelection, 'out', 6);
arrayPush(seasSelection, 'seas', 8);
arrayPush(wallSelection, 'wall', 11);


function set_z()
{
	var z_span = document.getElementById('the_z');
	if(z < 10)
	{
		z_span.innerHTML = '0' + z;
	}
	else
	{
		z_span.innerHTML = z;
	}
}

function next_image(array)
{	
	i++;
	z++;
	if(i == array.length)
	{
		i = 0;
		z = 1;
	}
	document.getElementById('body_container').style.backgroundImage = 'url(' + array[i] + ')';
	set_z(array);
}

function prev_image(array)
{
	i--;
	z--;
	if(i == - 1)
	{
		i = array.length - 1;
		z = i + 1;
	}
	document.getElementById('body_container').style.backgroundImage = 'url(' + array[i] + ')';
	set_z(array);
}

function blank_page()
{
	var body_footer_container = document.getElementById('body-footer_container').style;
	var body_container = document.getElementById('body_container').style;
	var stage_title = document.getElementById('stage_title');
	
	body_container.background = 'url(img/blank_bg.png) left top repeat-x';
	body_footer_container.background = 'none';
	
	stage_title.style.color = '#8ecdbc';
	stage_title.style.textAlign = 'left';
	
	document.getElementById('player').style.visibility = 'hidden';
}

function set_opacity()
{
	document.getElementById('body_container').style.backgroundColor = 'transparent';
	var stage_title = document.getElementById('stage_title');
	stage_title.style.opacity = 0.5;
	stage_title.filters.alpha.opacity = 50;
}

function toggle_article(article, link, scroll_point)
{
	var my_article = document.getElementById(article);
	var article_specs = document.getElementById(article + '_specs');
	
	self.scrollTo(0, scroll_point);
	
	if(my_article.style.display == 'none')
	{
		my_article.style.display = 'block';
		article_specs.style.display = 'none';
		
		link.innerHTML = '- COLLAPSE ARTICLE -';
	}
	else
	{
		my_article.style.display = 'none';
		article_specs.style.display = 'block';
		link.innerHTML = '+ EXPAND ARTICLE +';
	}
}

function bottom_links_format()
{
	document.getElementById('body_container').style.backgroundColor = 'transparent';
	document.getElementById('player').style.visibility = 'hidden';
	document.getElementById('stage_title').style.color = 'white';
}
