/* (c) Kalamun.org - GPL 3 */

var divMenu=null;
var ulMenu=null;
var menuTimer=null;

function k_attivaMenu() {
	divMenu=document.getElementById('menu');
	ulMenu=divMenu.getElementsByTagName('UL')[0];
	var s=ulMenu.getElementsByTagName('A');
	for(i=0;s[i];i++) {
		if(s[i].parentNode.parentNode==ulMenu) s[i].onmouseover=function() { k_menuSub(this); };
		else {
			s[i].onmouseover=function() { k_menuSub(this.parentNode.parentNode); };
			}
		s[i].onmouseout=k_menuNascondi;
		}
	k_menuNascondiTutto();
	}
function k_menuSub(sm) {
	if(menuTimer) clearTimeout(menuTimer);
	k_menuNascondiTutto();
	sm.parentNode.getElementsByTagName('UL')[0]?sm.parentNode.getElementsByTagName('UL')[0].style.display='block':sm;
	}
function k_menuNascondiTutto() {
	var s=ulMenu.childNodes;
	for(i=0;s[i];i++) {
		if(s[i].nodeName=='LI') {
			s[i].getElementsByTagName('UL')[0]?s[i].getElementsByTagName('UL')[0].style.display='none':s[i];
			}
		}
	}
function k_menuNascondi() {
	menuTimer=setTimeout("k_menuNascondiTutto()",100);
	}
	
function b3_openDiv(id,h) {
	timer=setInterval("b3_apriDiv('"+id+"',"+h+")",20);
	}
function b3_apriDiv(id,h) {
	div=document.getElementById(id);
	if(parseInt(div.style.height)<h) div.style.height=(parseInt(div.style.height)+20)+"px";
	else clearInterval(timer);
	}
function b3_closeDiv(id,h) {
	timer=setInterval("b3_chiudiDiv('"+id+"',"+h+")",20);
	}
function b3_chiudiDiv(id,h) {
	div=document.getElementById(id);
	if(parseInt(div.style.height)>h) div.style.height=(parseInt(div.style.height)-20)+"px";
	else clearInterval(timer);
	}

var bodyNews=null;
var scrollTimer=null;
function scrollNews() {
	bodyNews=document.getElementById('bodyNews');
	bodyNews.style.top="150px";
	for(var i=0;bodyNews.childNodes[i];i++) {
		bodyNews.childNodes[i].onmouseover=stopScroll;
		bodyNews.childNodes[i].onmouseout=startScroll;
		}
	startScroll();
	}
function startScroll() {
	scrollTimer=setInterval(scrollaNews,100);
	}
function stopScroll() {
	clearInterval(scrollTimer);
	}
function scrollaNews() {
	bodyNews.style.top=parseInt(bodyNews.style.top)-2+'px';
	if(parseInt(bodyNews.style.top)+bodyNews.offsetHeight<0) bodyNews.style.top='150px';
	}