function createObject() {
var tipo_richiesta;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
tipo_richiesta = new ActiveXObject("Microsoft.XMLHTTP");
}else{
tipo_richiesta = new XMLHttpRequest();
}
return tipo_richiesta;
}

var http = createObject();

function richiedi(valore,form,campo) {
http.open('get', root+'common/function/calendar.php?tipo='+valore+'&form='+form+'&campo='+campo+'&root='+root);
http.onreadystatechange = handleResponse;
http.send(null);
}

function richiedi2(form,campo) {
var valore = document.getElementById('ci').value;
if ((valore != null)&&(valore != "")){
	var data = valore.split("/");
	valore = data[1] + data[2];
} else {
	var now = new Date();
	var year= now.getYear();if (year < 1000) year += 1900;
	nameMth = new Array('01','02','03','04','05', '06', '07', '08', '09', '10', '11','12');
	valore = nameMth[now.getMonth()] + year;
}

http.open('get', root+'common/function/calendar.php?tipo='+valore+'&form='+form+'&campo='+campo+'&root='+root);
http.onreadystatechange = handleResponse2;
http.send(null);
}

function handleResponse() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('calendar').innerHTML = response;
}
} 

function handleResponse2() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('calendar2').innerHTML = response;
}
} 

function setta(form,campo,value){
	document.getElementById(campo).value = value;
	document.getElementById('calendar').innerHTML = null;
	document.getElementById('calendar2').innerHTML = null;
		 
}
