var mtopLis=0;
var iMtoplis = new Array();

var iFirstLi=0;
var iLastLi=5;


function initMtop(){
	var uls = document.getElementsByTagName("ul");
	if(document.getElementById("mtop")!=null){
		var mtop=document.getElementById("mtop");
		var mtopChilds=document.getElementById("mtop").childNodes;
		for(k=0;k<mtopChilds.length;k++){
				if(mtop.childNodes[k].tagName=='LI'){
					iMtoplis.push(k);
				}
		}
		mtopLis=iMtoplis.length;
		mtopNav(0);
	}
}
function throwAnchor(idAnchor){
	var panchor=document.getElementById(idAnchor);
	scrollbar.tweenTo(panchor.offsetTop);
}			

function mmenu(id,tag) {
	var iCurpage=document.location.href.indexOf(tag.href);
	var menu = document.getElementById(id);
	var display = menu.style.display;
	if(iCurpage ==-1){document.location.href=tag.href}
	else {menu.style.display = (display == "block") ? "none" : "block";}
}
function mtopNav(d){
	k=(d==1)?1:-1;
	iFirstLi=iFirstLi+d+d+d;
	iLastLi=iLastLi+d+d+d;
		for(h=0;h<mtopLis;h++){
			if(iFirstLi<=h && h<=iLastLi)document.getElementById("mtop").childNodes[iMtoplis[h]].style.display='block';
			else document.getElementById("mtop").childNodes[iMtoplis[h]].style.display='none';
		}
		if(document.getElementById("mtop-nav")!=null){
			document.getElementById('mtop-nav-sx').style.display=(iFirstLi>0)?'block':'none';
			document.getElementById('mtop-nav-dx').style.display=(iLastLi<mtopLis)?'block':'none';
		}

}

function openPrintPag(theURL) { 
	var features='width=600,height=600,resizable= yes,scrollbars = yes,status=0';
	window.open(theURL,'printpage',features);
}
function mailPage(){
	var tit=document.title;

	var domaininvia='www.campusmultimedia.net';

	var urlinvia=document.location.href;

	var subjPrefix="";

	var bodyPrefix="Puoi trovare la pagina in oggetto all'indirizzo:\n\n";

	var bodyFooter="\n\n----------\nhttp://"+domaininvia+"/";

	var subj=escape(subjPrefix+tit);

	var body=escape(bodyPrefix+urlinvia+bodyFooter);

	var popup=window.open("mailto:?subject="+subj+"&body="+body,"mail");
}