// JavaScript Document
function apri_finestra(pagina, titolo, hex, wix, lex, tox)
{
	msg=window.open(pagina, titolo, "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+ wix +",height="+ hex +", left="+ lex +", top="+ tox +"")
}

function toggle(nascondiquesto) {
	if( document.getElementById(nascondiquesto).style.display=='none' ){
		document.getElementById(nascondiquesto).style.display = '';
	}else{
		document.getElementById(nascondiquesto).style.display = 'none';
	}
}

// funzione per prendere un elemento con id univoco
var XHR = null;
function prendiElementoDaId(id_elemento) {
	var elemento;
	if(document.getElementById)
		elemento = document.getElementById(id_elemento);
	else
		elemento = document.all[id_elemento];
	return elemento;
}

function caricaContenuti(param,dove) {
	par = inviaSync(param);
	if (dove != undefined ) {
		var elemento = prendiElementoDaId(dove);	
	}else{
		var elemento = prendiElementoDaId('calendario');
	}
	elemento.innerHTML = par;
}
	
// funzione per assegnare un oggetto XMLHttpRequest
function assegnaXMLHttpRequest() {
	var
		XHR = null,
		browserUtente = navigator.userAgent.toUpperCase();
	if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
		XHR = new XMLHttpRequest();
	else if(window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) {
		if(browserUtente.indexOf("MSIE 5") < 0)
			XHR = new ActiveXObject("Msxml2.XMLHTTP");
		else
			XHR = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return XHR;
};

function inviaSync(file, parametri) {	
	var req = assegnaXMLHttpRequest();
	req.open("POST", file, false);
	req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
	req.send(parametri);

	return req.responseText;		
}