var box1_selectedIndex;
var box2_selectedIndex;
var box3_selectedIndex;
var box1, box2, box3;

function changeBox1(index) {
	box1_selectedIndex = index;
	writeBox1();
	initBox2();
}

function changeBox2(index) {
	box2_selectedIndex = index;
	writeBox2();
	initBox3();
}

function writeBox1() {
	boxArray = box1Array;
	strHTML = "";
	for (x=0;x<boxArray.length;x++) {
		if (x==box1_selectedIndex) {
			strHTML += "&nbsp;&nbsp;- <span class='right_ext_lks_sel'>"
			+ boxArray[x].substring(boxArray[x].indexOf("::")+2)
			+ "</span><br>";
		}
		else {
			strHTML += "&nbsp;&nbsp;- <a href='JavaScript:void(null)' onClick='changeBox1(" + x + ");return(false)'>"
			+ boxArray[x].substring(boxArray[x].indexOf("::")+2)
			+ "</a><br>";
		}
	}
	box1.innerHTML = strHTML;
}

function writeBox2() {
	boxArray = box2Array[box1_selectedIndex];
	strHTML = "";
	for (x=0;x<boxArray.length;x++) {
		if (x==box2_selectedIndex) {
			strHTML += "&nbsp;&nbsp;- <span class='right_ext_lks_sel'>"
			+ boxArray[x].substring(boxArray[x].indexOf("::")+2)
			+ "</span><br>";
		}
		else {
			strHTML += "&nbsp;&nbsp;- <a href='JavaScript:void(null)' onClick='changeBox2(" + x + ");return(false)'>"
				+ boxArray[x].substring(boxArray[x].indexOf("::")+2)
				+ "</a><br>";
		}
	}
	box2.innerHTML = strHTML;
}

function writeBox3() {
	boxArray = box3Array[box1_selectedIndex][box2_selectedIndex];
	strHTML = "";
	for (x=0;x<boxArray.length;x++) {
		if (x==box3_selectedIndex) {
			strHTML += "&nbsp;<span class='right_ext_lks_sel' style='font-size:10px'>"
			+ boxArray[x].substring(boxArray[x].indexOf("::")+2)
			+ "</span>&nbsp;<span class='tit_11_b_az_esc'>| </span>";
		}
		else {
			strHTML += "&nbsp;<a style='font-style:italic;font-size:10px' href='JavaScript:void(null)' onClick='showContent(" + x + ");return(false)'>"
				+ boxArray[x].substring(boxArray[x].indexOf("::")+2)
				+ "</a>&nbsp;<span class='tit_11_b_az_esc'>| </span>";
		}
	}
	box3.innerHTML = strHTML;
}

function initBoxes() {
	box1 = document.getElementById("divBox1");
	box2 = document.getElementById("divBox2");
	box3 = document.getElementById("divBox3");
	box1_selectedIndex = 0;
	writeBox1();
	initBox2();
}

function initBox2() {
	box2_selectedIndex = 0;
	writeBox2();
	initBox3();
}

function initBox3() {
	box3_selectedIndex = 0;
	showContent(0);
}

function showContent(index) {
	box3_selectedIndex = index;
	writeBox3();
	document.getElementById("dinContent").innerHTML = "<img alt='imagem gráfica' src='" + contentPath
		+ box3Array[box1_selectedIndex][box2_selectedIndex][box3_selectedIndex].substring(0,box3Array[box1_selectedIndex][box2_selectedIndex][box3_selectedIndex].indexOf("::"))
		+ "'>";
	document.getElementById("dinHeader").innerHTML = box1Array[box1_selectedIndex].substring(box1Array[box1_selectedIndex].indexOf("::")+2,100) + " &ndash; " + box2Array[box1_selectedIndex][box2_selectedIndex].substring(box2Array[box1_selectedIndex][box2_selectedIndex].indexOf("::")+2,100) + " &ndash; " + box3Array[box1_selectedIndex][box2_selectedIndex][box3_selectedIndex].substring(box3Array[box1_selectedIndex][box2_selectedIndex][box3_selectedIndex].indexOf("::")+2,100);
}

