// JavaScript Document

function index_over(el, num, lan){
	if(!lan) lan = "";
	else lan = "_" + lan;
	for(var i=0; i<7; i++){
		document.getElementById(String.fromCharCode(i+97)).firstChild.src = "assets/index_menu/thumbs/0" + (i+1) + "0.jpg";
		document.getElementById(String.fromCharCode(i+97)).firstChild.className = "index_menu_item";
	}
	el.firstChild.src = "assets/index_menu/thumbs/" + num + "1.jpg";
	el.firstChild.className = "index_menu_item_active";
	document.getElementById("menu_top").src = "assets/index_menu/large/" + num + "_top.jpg";
	document.getElementById("menu_middle").src = "assets/index_menu/large/" + num + "_middle.jpg";
	document.getElementById("menu_bottom").src = "assets/index_menu/large/" + num + "_bottom.jpg";
	document.getElementById("menu_footer").src = "assets/index_menu/footer/" + num + lan + ".gif";
}

var widths = new Array();
var main_active = new String();
var sub_active;

function main_open(id){
	if(id == main_active) return;
	widths[id] = document.getElementById(id).style.width;
	document.getElementById(id).style.width = "";
}

function main_close(id){
	if(id == main_active) return;
	document.getElementById(id).style.width = widths[id];
}

function main_over(el){
	if(el == sub_active) return;
	var src = el.firstChild.src;
	var p1 = src.substr(0,src.lastIndexOf(".")-1);
	var p2 = src.substr(src.lastIndexOf("."));
	el.firstChild.src = p1 + "1" + p2;
}

function main_out(el){
	if(el == sub_active) return;
	var src = el.firstChild.src;
	var p1 = src.substr(0,src.lastIndexOf(".")-1);
	var p2 = src.substr(src.lastIndexOf("."));
	el.firstChild.src = p1 + "0" + p2;
}

function main_init(){
	for(var i=0; i<4; i++){
		var cn = document.getElementById(String.fromCharCode(97+i)).childNodes;
		for(var j=0; j<cn.length; j++){
			if(cn[j].href == window.location.href){
				main_open(String.fromCharCode(97+i));
				main_active = String.fromCharCode(97+i);
				main_over(cn[j]);
				sub_active = cn[j];
				break;
			}
		}
		if(main_active != "") break;
	}
}