var intervd;
var intervu;
var posit;
var speed = 5;
var mm, ml, i, mlu, num, who;
function loadMenu() {
	intervd = new Array();
	intervu = new Array();
	posit = new Array();
	mm = document.getElementById("main_menu");
	ml = mm.getElementsByTagName("li");
	for(i = 0 ; i < ml.length ; i++) {
		mlu = ml[i].getElementsByTagName("ul");
		if(mlu.length > 0) {
			mlu[0].id = "sub" + i;
		}
		ml[i].id = "menu" + i;
		if(mlu.length > 0) {
			ml[i].onmouseover = function(i) {
				clearScroll();
				schuifSub(this);
			}
			ml[i].onmouseout = function() {
				hideSub(this);
			}
		} else {
			ml[i].onmouseover = function(i) {
				clearScroll();
			}
		}
		ml[i].onclick = function() {
			this.className = "active";
		}
	}
}
var thesub;
var tmpo, w, s2;
function hideSub(who) {
	mlu = who.getElementsByTagName("ul");
	mlu[0].way = false;
	
	tmpo = parseInt(mlu[0].style.opacity * 100);
	thesub[mlu[0].id] = setTimeout("schuifSubSub('" + mlu[0].id + "', " + tmpo + ")", 39);
}
function schuifSub(who) {
	if(!thesub) {
		thesub = new Array();
	}
	mlu = who.getElementsByTagName("ul");
	tmpo = parseInt(mlu[0].style.opacity * 100);
	if(!tmpo) {
		tmpo = 0;
	}
	mlu[0].way = true;
	
	thesub[mlu[0].id] = setTimeout("schuifSubSub('" + mlu[0].id + "', " + tmpo + ")", 39);
	mlu[0].style.display = "block";
	
	if(typeof(mlu[0].style.opacity) == "undefined" || mlu[0].style.opacity === "") {
		mlu[0].style.opacity = 0;
		mlu[0].style.filter = "alpha(opacity=0)";
	}
}
function schuifSubSub(who, s) {
	if(thesub[who]) {
		clearTimeout(thesub[who]);
	}
	w = document.getElementById(who);
	if(w.way) {
		if(s >= 80) {
			s = 80;
		} else {
			s2 = s + 10;
			thesub[who] = setTimeout("schuifSubSub('" + who + "', " + s2 + ")", 39);
		}
	} else {
		if(s <= 0) {
			s = 0;
			w.style.display = "none";
		} else {
			s2 = s - 10;
			thesub[who] = setTimeout("schuifSubSub('" + who + "', " + s2 + ")", 39);
		}
	}
	w.style.opacity = s/100;
	w.style.filter = "alpha(opacity=" + s + ")";
}
var activeNews;
function showHideNews(num, to) {
	who = document.getElementById("news_" + num);
	
	if(who.style.display == "none") {
		if(activeNews) {
			activeNews.style.display = "none";
		}
		who.onmouseover = function() {
			clearTimeout(newstimeout);
		}
		
		activeNews = who;
		who.style.display = "block";
	} else {
		who.style.position = "relative";
		who.style.display = "none";
	}
 	document.getElementById("item_" + num).style.visibility = "visible";
 	clearTimeout(newstimeout);
}
function hideActivenews() {
	if(activeNews) {
		activeNews.style.display = "none";
	}
}
var newstimeout;
function clearSc() {
	clearTimeout(newstimeout);
	newstimeout = setTimeout("hideActivenews()", 400);
}

bh = 576;
bw = 720;
function initFlow() {
	h = document.documentElement.clientHeight - 97 - 110;
	flow = document.getElementById("flow")
	flow.style.height = h + "px";
	flow.style.width = parseInt(h*bw/bh) + "px";
}
document.onresize = function() {
	alert("A");
}
