var menu_vis = new Array();
var menu_but = new Array();
var menu_txt;
var menu_no_red;
var menu_txtd;
var menu_txtw;
var menu_no_red2;
var count_menu_vis = 0;
var count_menu_all = 0;
var menu_timer;
var menu_delay = 1000;
var amenu_timer = 0;
var bmenu_timer = 0;

function close_all() {
	clearTimeout(menu_timer);
	for ( var i = 0; (i < count_menu_vis); i++) {
		menu_vis[i].className = "buy_menu_txt_no";
		menu_but[i].className = "";
	}
	menu_txtd.className = "buy_menu_txt";
	menu_no_red.style.display = "none";
	menu_txt.className = "main_menu_txt";
	bmenu_timer = 0;
}

function start_timer() {
	stop_timer();
	menu_timer = setTimeout(function() {
		close_all();
		amenu_timer = 0;
	}, menu_delay);
}
function stop_timer() {
	clearTimeout(menu_timer);
}
function set_menu_txt_panel(id_txt) {
	menu_txt = document.getElementById(id_txt);
	menu_txt.className = "main_menu_txt";
	menu_txt.onmouseout = function() {
		start_timer();
	};
	menu_txt.onmouseover = function() {
		stop_timer();
	};
}
function set_menu_img(id_no_red) {
	menu_no_red = document.getElementById(id_no_red);
}
function set_menu_txtd(id_txtd) {
	menu_txtd = document.getElementById(id_txtd);
}
function set_menu_txtw(id_txtw) {
	menu_txtw = document.getElementById(id_txtw);
}
function set_nomenu_img(id_no_red2) {
	menu_no_red2 = document.getElementById(id_no_red2);
}
function set_new_menu(id_but, id_vis) {
	var current = count_menu_vis;
	var current_pos = count_menu_all;
	var localtmr;
	count_menu_vis++;
	count_menu_all++;
	menu_vis.length = count_menu_vis;
	menu_but.length = count_menu_vis;
	menu_but[current] = document.getElementById(id_but);
	menu_vis[current] = document.getElementById(id_vis);
	menu_but[current].onmouseover = function() {
		localtmr = setTimeout(function() {
			amenu_timer = 250;
			stop_timer();
			close_all();
			menu_vis[current].className = "buy_menu_txt";
			menu_but[current].className = "hover";
			menu_txt.className = "main_menu_txt_hover";
			menu_no_red.style.margin = "30px 0 0 " + (184 * current_pos + 1)
					+ "px";
			menu_no_red.style.display = "";
			menu_txtd.className = "buy_menu_txt_no";
		}, amenu_timer);
	};
	menu_but[current].onmouseout = function() {
		menu_txtd.className = "buy_menu_txt_no";
		amenu_timer = 250;
		clearTimeout(localtmr);
		start_timer();
	};
}
function set_new_menu_mini(id_but) {
	var current_pos = count_menu_all;
	var localtmr;
	count_menu_all++;
	document.getElementById(id_but).onmouseover = function() {
		localtmr = setTimeout(function() {
			amenu_timer = 250;
			stop_timer();
			close_all();
			document.getElementById(id_but).className = "mini";
			menu_no_red2.style.margin = "28px 0 0 0";
			menu_no_red2.style.display = "";
			menu_txtd.className = "buy_menu_txt_no";
			menu_txtw.className = "buy_menu_txt";
			bmenu_timer = 1;
		}, amenu_timer);
	};
	document.getElementById(id_but).onmouseout = function() {
		clearTimeout(localtmr);
		amenu_timer = 0;
		document.getElementById(id_but).className = "";
		menu_no_red2.style.display = "none";
		if (bmenu_timer == 1) {
			menu_txtd.className = "buy_menu_txt";
		}
		bmenu_timer = 0;
		menu_txtw.className = "buy_menu_txt_no";
	};
}