function in_array(array, value) {
	for(i = 0; i < array.length; ++i)
		if(array[i] == value)
			return i;
	return false;
}

var NaviElements = new Array("home", "about", "forum", "blog", "art", "cuts", "uploader", "contact");
var NaviIsActive = false;
var NaviIsNextActive = false;
var NaviInitActive = false;

function NaviInit(id) {
	id = (sub = id.substring(0, id.indexOf('_'))) ? sub : id;
	NaviInitActive = id;
	NaviIsActive = NaviInitActive;
	
	document.getElementById(NaviInitActive + "_inactive").id = NaviInitActive + "_active";
	
	var index = in_array(NaviElements, NaviInitActive) - 1;
	if(index >= 0) {
		NaviIsNextActive = NaviElements[index];
		document.getElementById(NaviIsNextActive + "_inactive").id = NaviIsNextActive + "_next_active";
	} else
		NaviIsNextActive = false;
}
function NaviSetActive(id) {
	id = (sub = id.substring(0, id.indexOf('_'))) ? sub : id;
	
	if(NaviInitActive)
		document.getElementById(NaviInitActive + "_active").id = NaviInitActive + "_inactive";
	if(NaviIsNextActive)
		document.getElementById(NaviIsNextActive + "_next_active").id = NaviIsNextActive + "_inactive";
		
	NaviIsActive = id;
	document.getElementById(NaviIsActive + "_inactive").id = NaviIsActive + "_active";
	
	var index = in_array(NaviElements, NaviIsActive) - 1;
	if(index >= 0) {
		NaviIsNextActive = NaviElements[index];
		document.getElementById(NaviIsNextActive + "_inactive").id = NaviIsNextActive + "_next_active";
	} else
		NaviIsNextActive = false;
}
function NaviReset() {
	if(NaviIsActive)
		document.getElementById(NaviIsActive + "_active").id = NaviIsActive + "_inactive";
	if(NaviIsNextActive) {
		document.getElementById(NaviIsNextActive + "_next_active").id = NaviIsNextActive + "_inactive";
		NaviIsNextActive = false;
	}

	if(NaviInitActive)
		document.getElementById(NaviInitActive + "_inactive").id = NaviInitActive + "_active";
		
	var index = in_array(NaviElements, NaviInitActive) - 1;
	if(index >= 0) {
		NaviIsNextActive = NaviElements[index];
		document.getElementById(NaviIsNextActive + "_inactive").id = NaviIsNextActive + "_next_active";
	} else
		NaviIsNextActive = false;
}
