﻿// JavaScript per recupero voci menu
var myRequest1 = null;
function CreateXmlHttpReq1(handler) {
	var xmlhttp1 = null;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer") {
		try	{
			xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp1.onreadystatechange = handler;
		} catch(e)	{
			alert("You need to enable active scripting and activeX controls");
		}
	} else {
		xmlhttp1 = new XMLHttpRequest();
		xmlhttp1.overrideMimeType('text/html');
		xmlhttp1.onload = handler;
		xmlhttp1.onerror = handler;
	}

	return xmlhttp1;
}
function myHandler1() {
	if (myRequest1.readyState == 4 && myRequest1.status == 200) {
		//e = document.getElementById("menu");
		blocco.innerHTML = myRequest1.responseText;
	}
}
function menu(p,b,m) {
	//alert(p+','+b)
	if(b!=4){
	blocco = document.getElementById("menu"+b);
	if(b==2) document.getElementById("menu3").innerHTML='';
	myRequest1 = CreateXmlHttpReq1(myHandler1);
	myRequest1.open("GET","blocchi/menu.cfc?method=f_init&padre="+p+"&blocco="+b+"&idmenu="+(m==undefined?0:m),false);
	myRequest1.send(null);
	}
}
