function k_addLoadEvent(func) {
	var oldonload=window.onload;
	if(typeof window.onload!='function') {
		window.onload = func;
		}
	else {
		window.onload = function() {
			if (oldonload) oldonload();
			func();
			}
		}
	}
b3_adjLayout=function() {
	var ww=document.getElementById('header').offsetWidth;
	var mdx=document.getElementById('menudx');
	mdx.style.width=(ww-795)+'px';
	}
k_addLoadEvent(b3_adjLayout);
window.onresize=b3_adjLayout;

function b3_centerImg(t) {
	t.style.position='relative';
	t.style.top=-(t.height-t.parentNode.parentNode.offsetHeight)/2+'px';
	t.style.left=-(t.width-t.parentNode.parentNode.offsetWidth)/2+'px';
	}

/* pannello newsletter */
var nl_t=0;
var nl_s="close";
function b3_newsletterMouseOver() {
	if(nl_s=="close") {
		if(nl_t) clearInterval(nl_t);
		nl_t=setInterval("b3_newsletterResize(25)",50);
		}
	else b3_newsletterMouseOut();
	}
function b3_newsletterMouseOut() {
	if(nl_t) clearInterval(nl_t);
	nl_t=setInterval("b3_newsletterResize(-25)",50);
	}
function b3_newsletterResize(px) {
	var nl_div=document.getElementById('newsletter');
	nl_div.style.height=(nl_div.offsetHeight+px)+'px'
	if(nl_div.offsetHeight>200) {
		clearInterval(nl_t);
		nl_s="open";
		}
	if(nl_div.offsetHeight<50) {
		nl_div.style.height='33px';
		clearInterval(nl_t);
		nl_s="close";
		}
	}
function b3_checkNl(f) {
	if(!f.email.value.match(/.*@.*\..{2,4}/)) { alert('E-mail non valida'); f.email.focus(); return false; }
	else if(!f.privacy.checked) { alert('Devi acconsentire al trattamento dei dati personali'); f.privacy.focus(); return false; }
	return true;
	}
	
/* pop up */
function k_pop(url,w,h) {
	if(!w) w=300;
	if(!h) h=200;
	window.open(url,"popup","top=10,left=10,width="+w+",height="+h+",status=no,menubar=no,toolbar=no,scrollbar=no");
	}
