var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var IE = navigator.appName.indexOf ("Internet Explorer") > -1;
var timer = 0;
var mx, my;

var menu = new Array();
var Voce_Attiva = new Array();
var sottomenu_attivo = false;

// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 45;
// -----------------------------------------------------------------------------

document.write ('<script src="/js/AC_RunActiveContent.js" language="javascript"></script>');

function mostraPagina() {
	document.getElementById("pg").style.visibility = "visible";
	document.getElementById("loading").style.visibility = "hidden";
}

function addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function vg1_DoFSCommand(command, args) {
	//var vg1Obj = isIE ? document.all.vg1 : document.vg1;
	/*if (command == "apri") {
		window.open("/inc/photoParser.php?photo=" + args, "_blank", "toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no, resizable=no'");
	}*/
	
	var mwBG = document.getElementById("mwBG");
	if (!mwBG) {
		mwBG = document.createElement("div");
		mwBG.id = "mwBG";
		mwBG.style.position = "fixed";
		mwBG.style.top = "0px";
		mwBG.style.left = "0px";
		mwBG.style.background = "#111";
		mwBG.style.opacity = '.5';
        mwBG.style.filter = 'alpha(opacity=50)';
		document.body.appendChild(mwBG);
	}
	mwBG.style.zIndex = 200;
	mwBG.style.height = Math.max(document.body.scrollHeight,document.body.clientHeight)+'px';
	mwBG.style.width  = Math.max(document.body.scrollWidth,document.body.clientWidth)+'px';
	mwBG.style.display = 'block';
		
	
	var pu = document.getElementById("popupVG");
	if (!pu) {
		pu = document.createElement("div");
		pu.id = "popupVG";
		pu.style.position = "fixed";
		pu.style.display = 'none';
		pu.style.width = "660px";
		pu.style.height = "600px";
		document.body.appendChild(pu);
	}
	pu.style.zIndex = 201;
	if (command == "apri") {
		param = args.split(",");
		argomenti = "?idGlr=" + param[0] + "&mastro=" + param[1] + "&idLng=" + param[2] + "&clicbl=1&idImg=" + param[3];
		pu.innerHTML = "<table id='imgPU' border=0 cellspacing=1 cellpadding=5 bgcolor='#cccccc' width=100% height=100%>" +
				   "<tr><td bgcolor='#ffffff' width=660 height=550><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0'" +
				   "id='vgGrande' width='660' height='550' align='middle'><param name='allowScriptAccess' value='sameDomain' />" +
				   "<param name='movie' value='/inc/vg.swf" + argomenti + "' /><param name='quality' value='high' /><param name='wmode' value='transparent' />"+
				   "<param name='bgcolor' value='#ffffff' />" +
				   "<embed src='/inc/vg.swf" + argomenti + "' quality='high' wmode='transparent' bgcolor='#ffffff' width='660' height='550' swLiveConnect=true id='vgGrande'" +
				   "name='vgGrande' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
					"</object><tr><td bgcolor='#ffffff' align=center><a style='cursor: pointer; cursor: hand' onclick='chiudiPopup()'><small>chiudi</small></a></td></tr></table>";
	} else if (command == "mostraVideo") {
		param = args.split("xfsnetx");
		param[1] = unescape(param[1]);
		ext = param[0].split('.');
		ext = "." + ext[ext.length-1].toLowerCase();
		immagini = ".jpg,.png,.gif,.tif,.jpeg,.tiff";
		flash = ".flv";
		video = ".wmv,.mpg,.mpeg,.avi,.mov";
		if (immagini.search(ext) >= 0) {
			pu.innerHTML = "<table id='imgPU' border=0 cellspacing=1 cellpadding=5 bgcolor='#cccccc' width=500 height=450>" +
						"<tr><td bgcolor='#ffffff' width=500 height=450 align=center valign=middle>" +
						"<img src='" + param[0] + "'>" +
						"</object><br><br>" + param[1] + "<tr><td bgcolor='#ffffff' align=center><a style='cursor: pointer; cursor: hand' onclick='chiudiPopup()'><small>chiudi</small></a></td></tr></table>";
		} else if (video.search(ext) >= 0) {
			pu.innerHTML = "<table id='imgPU' border=0 cellspacing=1 cellpadding=5 bgcolor='#cccccc' width=500 height=450>" +
						"<tr><td bgcolor='#ffffff' width=500 height=450 align=center valign=middle>" +
						'<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" ' +
						'width="320" height="290" id="VG" title="' + (param[1]) + '">' +
						'	<param name="AutoStart" value="true">' +
						'	<param name="ShowControls" value="true">' +
						'	<param name="ShowStatusBar" value="true">' +
						'	<param name="ShowDisplay" value="false">' +
						'	<param name="AutoRewind" value="false">' +
						'	<param name="windowlessVideo" value="false">' +
						'	<param name="SendPlayStateChangeEvents" value="true">' +
						'	<param name="stretchToFit" value="false">' +
						'	<param name="FullScreen" value="false">' +
						'	<param name="URL" value="' + param[0] + '">' + 
						'	<param name="Filename" value="' + param[0] + '">' + 
						'	<embed ' +
						'		type="application/x-mplayer2" ' +
						'		pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" ' +
						'		src="' + param[0] + '" ' +
						'		width="173" height="180" ' +
						'		autostart="true" ' +
						'		showcontrols="true" ' +
						'		showstatusbar="true" ' +
						'		showdisplay="false" ' +
						'		autorewind="false" ' +
						'		windowlessVideo="false" ' +
						'		fullScreen="false" ' +
						'		SendPlayStateChangeEvents="true" ' +
						'		stretchToFit="false">' +
						'	</embed>' +
						"</object><br><br>" + param[1] + "<tr><td bgcolor='#ffffff' align=center><a style='cursor: pointer; cursor: hand' onclick='chiudiPopup()'><small>chiudi</small></a></td></tr></table>";
		} else if (flash.search(ext) >= 0) {
		}
	}
	dimensionaPopup();
}

function chiudiPopup() {
	var pu = document.getElementById("popupVG");
	if (pu) { 
		pu.innerHTML = "";
		pu.style.display = "none"; 
	}
	var mwBG = document.getElementById("mwBG");
	if (mwBG) { mwBG.style.display = "none"; }
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub vg1_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call vg1_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function caricaVG (idSwf, idGlr, mastro, idLng, clicbl, idImg, albm) {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {  // if we've detected an acceptable version
		// embed the flash movie
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
			'width', '100%',
			'height', '100%',
			'src', '/inc/vg?mastro=' + mastro + '&idGlr=' + idGlr + "&idLng=" + idLng + "&clicbl=" + clicbl + "&idImg=" + idImg + "&albm=" + albm,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', idSwf,
			'bgcolor', '#ffffff',
			'name', idSwf,
			'menu', 'false',
			'allowScriptAccess','sameDomain',
			'allowFullScreen','false',
			'movie', '/inc/vg?mastro=' + mastro + '&idGlr=' + idGlr + "&idLng=" + idLng + "&clicbl=" + clicbl + "&albm=" + albm,
			'salign', ''
			); //end AC code
	} else {  // flash is too old or we can't detect the plugin
		var alternateContent = 'Per la corretta visualizzazione di questo sito, '
			+ 'scaricare ed installare Adobe Flash Player.'
			+ '<a href=http://www.macromedia.com/go/getflash/>Clicca qui.</a>';
		document.write(alternateContent);  // insert non-flash content
	}
}

/*function caricaFlash(fileName, w, h, id) {	
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" id="' + id + '" width="' + w + '" height="' + h + '">');
	document.write ('  <param name="allowScriptAccess" value="sameDomain" />');
	document.write ('  <param name="movie" value="' + fileName +  '">');
	document.write ('  <param name="wmode" value="transparent"');	
	document.write ('  <param name="quality" value="high">');
	document.write ('  <embed src="' + fileName + '" quality="high" wmode="transparent" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" id="' + id + '" width="' + w + '" height="' + h + '"></embed>');
	document.write ('</object>');
}*/

function caricaTV(id, tt, l, a, sc, sb, as, sd, ar, wl, fs) {
	if (sc == 'true') { a += 25; }
	if (sb == 'true') { a += 25; }
	//document.write ('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" width="' + l + '" height="' + a + '" id="' + id + '" title="' + tt + '">');
	document.write ('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-mplayer2" width="' + l + '" height="' + a + '" id="' + id + '" title="' + tt + '">');
	document.write ('	<param name="AutoStart" value="' + as + '">');
	document.write ('	<param name="ShowControls" value="' + sc + '">');
	document.write ('	<param name="ShowStatusBar" value="' + sb + '">');
	document.write ('	<param name="ShowDisplay" value="' + sd + '">');
	document.write ('	<param name="AutoRewind" value="' + ar + '">');
	document.write ('	<param name="windowlessVideo" value="' + wl + '">');
	document.write ('	<param name="SendPlayStateChangeEvents" value="true">');
	document.write ('	<param name="stretchToFit" value="false">');
	document.write ('	<param name="FullScreen" value="' + fs + '">');
	document.write ('	<embed ');
	document.write ('		type="application/x-mplayer2" ');
	document.write ('		pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" ');
	document.write ('		width="' + l + '" height="' + a + '" ');
	document.write ('		autostart="' + as + '" ');
	document.write ('		showcontrols="' + sc + '" ');
	document.write ('		showstatusbar="' + sb + '" ');
	document.write ('		showdisplay="' + sd + '" ');
	document.write ('		autorewind="' + ar + '" ');
	document.write ('		windowlessVideo="' + wl + '" ');
	document.write ('		fullScreen="' + fs + '" ');
	document.write ('		SendPlayStateChangeEvents="true" ');
	document.write ('		stretchToFit="false">');
	document.write ('	</embed>');
	document.write ('</object>');
}

function caricaVideo (id, titolo) {
	TVmon = document.getElementById(id);
	mtdT="";
	for (mtd in TVmon) { 
		mtdT = mtdT + ", " + mtd 
	}
	TVmon.URL= titolo;
	TVmon.start();
	//TVmon.play(); 
}

function videoNewsPlay(idBoxTV, idTV, idImg, idBtPlay, titolo) {
	BoxTV = document.getElementById(idBoxTV);
	Img = document.getElementById(idImg);
	btnPlay = document.getElementById(idBtPlay);
	BoxTV.style.visibility = "visible";
	Img.style.visibility = "hidden";
	btnPlay.style.visibility = "hidden";
	caricaVideo(idTV, titolo);
	
}

function videoNewsStop(idBoxTV, idTV, idImg, idBtPlay, azione) {
	BoxTV = document.getElementById(idBoxTV);
	Img = document.getElementById(idImg);
	TV = document.getElementById(idTV);
	btnPlay = document.getElementById(idBtPlay);
	switch (azione) {
		case "stop":
			BoxTV.style.visibility = "hidden";
			Img.style.visibility = "visible";
			btnPlay.style.visibility = "visible";
			TV.stop();
			break;
		case "pausa":
			TV.Pause();
			break;
		case "play":
			TV.play();
			break;
		case "fullScreen":
			if (TV.playState == 3) {
            	TV.fullScreen = 'true';
			}
			break;
	}
}

function GestMouse (evnt) {	
	if (IE) { 
		MouseX = event.clientX + document.body.scrollLeft;
		MouseY = event.clientY + document.body.scrollTop;
	} else {
		MouseX = evnt.pageX;
		MouseY = evnt.pageY;
	}

}

function Switch_Menu() {
	var trovato = false;
	for (i=0; i < itm; i++) {
		if (Voce_Attiva [i]) {
			if (i >= menu.length) { document.getElementById("menu_td_" + i).className = "HighLightIt"; }
			if ((i < menu.length) && (menu[i] > 0) && (document.getElementById("sm_" + i).style.visibility != "visible")){
				document.getElementById("sm_" + i).style.visibility = "visible";
				document.getElementById("sm_" + i).style.zIndex = 100;
				//document.getElementById("cp").style.opacity = "0.5";
				//document.getElementById("cp").style.filter = "alpha(opacity=50)";
				document.getElementById("sm_" + i).style.top = (getY("menu_td_" + i) + document.getElementById("menu_td_" + i).offsetHeight) + "px";
				var posMenu = Math.min(getX("menu_td_" + i), document.getElementById("menu").offsetWidth - document.getElementById("sm_" + i).offsetWidth);
	 			document.getElementById("sm_" + i).style.left = posMenu + "px";
				document.getElementById("sm_" + i).width = (document.getElementById("sm_" + i).scrollWidth + 10) + "px";
			}
			trovato = true;
		} else {
			if (i >= menu.length) { document.getElementById("menu_td_" + i).className = "UnLightIt"; }
			if (i < menu.length) {
				if (menu[i] > 0) { document.getElementById("sm_" + i).style.visibility = "hidden" }
			}
		}
	}
	if (trovato) { Menu_Check = window.setTimeout("Switch_Menu()", 100); }
}

function getX(obj) {
	var temp = document.getElementById(obj);
	var left = 0;
	while (temp.offsetParent) {
		if (temp.id != "pg" && temp.id != "cp" && temp.id != "head") {	left += temp.offsetLeft;  }
		temp = temp.offsetParent;
	}
	return left - document.body.scrollLeft;
}

function getY(obj) {
	var temp = document.getElementById(obj);
	var top = 0;
	while (temp.offsetParent) {
		if (temp.id != "pg" && temp.id != "cp" && temp.id != "head") { top += temp.offsetTop; }
		temp = temp.offsetParent;
	}
	return top - document.body.scrollTop;
}

function Menu_On (quale) {
	Voce_Attiva [quale] = true;
	Switch_Menu();
}

function Menu_Off (quale) {
	Voce_Attiva [quale] = false;
}

function SottoMenu_On (quale, par) {
	Voce_Attiva [quale] = true;
	Voce_Attiva [par] = true;
}

function SottoMenu_Off (quale, par) {
	Voce_Attiva [quale] = false;
	Voce_Attiva [par] = false;
}

function Apri(a, b) {

	if (href [a][b] != "") {
		frames['frameWork'].location.href = href [a][b];
	}
	
}

function adattaSfondoAlContenuto() {
	if (/MSIE (5\.5|6)/.test(navigator.userAgent)) {
		ext = screen.width > 800 ? "2.gif" : "1.gif";
		document.getElementById('lb').style.backgroundImage = "url(/imgs/cornice/top" + ext + ")";
		document.getElementById('cr').style.backgroundImage = "url(/imgs/cornice/bottom" + ext + ")";
		document.getElementById('cp').style.backgroundImage = "url(/imgs/cornice/middle" + ext + ")";
		document.getElementById('ft').style.backgroundImage = "url(/imgs/cornice/middle" + ext + ")";
	}
	var centro = (document.body.clientWidth - document.getElementById("pg").offsetWidth) / 2;
	fineCSx = document.getElementById("cSx").offsetHeight + document.getElementById("cSx").offsetTop;
	fineHead = document.getElementById("head").offsetHeight + document.getElementById("head").offsetTop;
	document.getElementById("corpo").style.top = (fineHead + 2) + "px";
	fineCorpo = document.getElementById("corpo").offsetHeight + document.getElementById("corpo").offsetTop;
	var cpHeight = fineCSx > fineCorpo ? fineCSx : fineCorpo;
	cpHeight -= 10;
	document.getElementById('ft').style.top = (cpHeight) + "px";
	document.getElementById('nomePagina').style.top = (cpHeight - 25) + "px";
	cpHeight += document.getElementById("ft").offsetHeight;
	document.getElementById('cp').style.height = cpHeight + "px";
	var pgHeight = document.getElementById("pg").offsetHeight > document.body.clientHeight ? document.getElementById("pg").offsetHeight : document.body.clientHeight;
	document.getElementById("bg").style.height = pgHeight + "px";
	document.getElementById("pg").style.left = centro + "px";
	document.getElementById('ft').style.visibility = "visible";
	document.getElementById('cr').style.visibility = "visible";
	var mwBG = document.getElementById("mwBG");
	if (mwBG) {
		mwBG.style.height = Math.max(document.body.scrollHeight,document.body.clientHeight)+'px';
		mwBG.style.width  = Math.max(document.body.scrollWidth,document.body.clientWidth)+'px';
	}
	var pu = document.getElementById("popupVG");
	if (pu) {
		var imm = document.getElementById("imgPU");
		lp = Math.max(document.body.scrollWidth,document.body.clientWidth);
		ap = Math.max(document.body.scrollHeight,document.body.clientHeight);
		li = imm.offsetWidth;
		ai = imm.offsetHeight;
		tu = (ap - ai) / 2;
		lu = (lp - li) / 2;
		pu.style.width = li + "px";
		pu.style.height = ai + "px";
		pu.style.top = tu + "px";
		pu.style.left = lu + "px";
	}
}

function dimensionaPopup() {
	var pu = document.getElementById("popupVG");
	if (pu) {
		pu.style.display = "block";
		var imm = document.getElementById("imgPU");
		lp = Math.max(document.body.scrollWidth,document.body.clientWidth);
		ap = Math.max(document.body.scrollHeight,document.body.clientHeight);
		//li = imm.offsetWidth;
		//ai = imm.offsetHeight;
		li = 660;
		ai = 550;
		tu = (ap - ai) / 2;
		lu = (lp - li) / 2;
		pu.style.width = li + "px";
		pu.style.height = ai + "px";
		pu.style.top = tu + "px";
		pu.style.left = lu + "px";
	}
}

function cambiaOverflow (obj, val) {
	if (val == 0) {
		obj.style.overflow = "hidden";
		//obj.style.padding = "0px 25px 0px 7px";
	} else {
		obj.style.overflow = "auto";
		//obj.style.padding = "0px 15px 0px 7px";
	}
}

function scrollaNews(obj, par) {
	var obj1 = obj + "1";
	if (document.getElementById(obj1).style.visibility == "hidden") {
		document.getElementById(obj1).style.visibility = "visible"; //ripristinare il valore a visible dopo il debug su offsetHeight non interpretato da FireFox
		document.getElementById(obj1).style.top = (document.getElementById(obj).offsetTop + document.getElementById(obj).offsetHeight) + "px";
	}	
	if (document.getElementById(par).style.overflow == "auto") {
		if (document.getElementById(obj).offsetTop != 0) {
			posScroll = document.getElementById(obj).offsetTop;
			document.getElementById(obj).style.top = "0px";
			document.getElementById(obj1).style.top = (document.getElementById(obj).offsetTop + document.getElementById(obj).offsetHeight) + "px";
			document.getElementById(par).scrollTop = -(posScroll);
		}
		scrNwsSI = setTimeout('scrollaNews(\"scrollNews\", \"news\")', 100);
		return false;
	}
	if (document.getElementById(par).scrollTop != 0) {
		document.getElementById(obj).style.top = -document.getElementById(par).scrollTop;
		document.getElementById(obj1).style.top = (document.getElementById(obj).offsetTop + document.getElementById(obj).offsetHeight) + "px";
		document.getElementById(par).scrollTop = 0;
	}
	
	pos = document.getElementById(obj).offsetTop - 1;
	if (pos < -(document.getElementById(obj).offsetHeight)) {
		document.getElementById(obj).style.top = (document.getElementById(obj1).offsetTop) + "px";
		document.getElementById(obj1).style.top = (document.getElementById(obj).offsetTop + document.getElementById(obj).offsetHeight) + "px";
	} else {
		document.getElementById(obj).style.top = pos + "px";
	}
	
	pos = document.getElementById(obj1).offsetTop - 1;
	if (pos < -(document.getElementById(obj1).offsetHeight)) {
		pos = document.getElementById(obj).offsetTop + document.getElementById(obj).offsetHeight;
	}
	document.getElementById(obj1).style.top = pos + "px";
	
	scrNwsSI = setTimeout('scrollaNews(\"scrollNews\", \"news\")', 100);
}

function scrollaAppuntamenti(obj, par, larg, att) {
	prosX = -(Math.floor(Math.abs(document.getElementById(obj).offsetLeft / larg)) + 1) * larg;
	if (prosX <= -document.getElementById(obj).offsetWidth) {
		step = 20;
	} else {
		step = Math.floor(Math.abs((document.getElementById(obj).offsetLeft - prosX) * 10)) / 40;
	}
	if (Math.floor(step) == 0) {
		pos = prosX;
		document.getElementById(obj).style.left = pos + "px";
		timeOut = att * 1000;
	} else {
		pos = document.getElementById(obj).offsetLeft - step;
		if (pos < -(document.getElementById(obj).offsetWidth)) {
			pos = document.getElementById(par).offsetWidth;
		}
		document.getElementById(obj).style.left = pos + "px";
		timeOut = 100;
	}
	setTimeout('scrollaAppuntamenti("' + obj + '", "' + par + '", ' + larg + ', ' + att + ')', timeOut);
}

function creaFeed (indirizzo, titolo) {
	var rssLink = document.createElement("link");
	var headID = document.getElementsByTagName("head")[0];       
	rssLink.type = 'application/rss+xml';
	rssLink.rel = 'alternate';
	rssLink.href = indirizzo;
	rssLink.title = titolo;
	headID.appendChild(rssLink);
}

function ajaxCall(strURL, cnt, fnct, form, prnt) {
	
	// il parametro fnct puņ essere una funzione o una chiamata a funzione passata come stringa. 
	// In quest'ultimo caso si puņ inserire la parola chiave _ajaxResult nell'elenco dei
	// parametri per ottenere il risultato AJAX come argomento.

	
	var xmlHttpReq = false;
	var self = (prnt == undefined) ? this : prnt;
	var cnt = document.getElementById(cnt);
	cnt.innerHTML = "<table width=425 height=240><tr><td height=100% width=100% align=center valign=middle><img src=/imgs/ajax-loader.gif></td></tr></table>";
	// Xhr per Mozilla/Safari/Ie7
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	}
	// per tutte le altre versioni di IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	method = (form == "undefined") ? "get" : "post";
	self.xmlHttpReq.open(method, strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 4) {
			_ajaxResult = self.xmlHttpReq.responseText;
			if (cnt) { cnt.innerHTML = self.xmlHttpReq.responseText; }
			if (fnct != "undefined" && fnct != "") { eval(fnct); }
		}
	}
	parametri = (method == "get") ? "" : getQueryString(form);
	self.xmlHttpReq.send(parametri);
}

function getQueryString(form) {
	form = document.getElementById(form);
	qstr = "";
	for (campo in form) {
		if (form[campo] 
		 && campo != "firstElementChild" 
		 && campo != "firstChild" 
		 && form[campo].value) { qstr += "&" + campo + "=" + form[campo].value; }
	}
	return qstr;
}

//---------------- funzioni mediagallery

function caricaDescrizione (path, imgG, titolo, url) {
	cntPlayer = document.getElementById("divPlayer");
	cntPlayer.innerHTML = "<table width=425 height=240><tr><td height=100% width=100% align=center valign=middle>" +
													 "<img src=/imgs/ajax-loader.gif></td></tr></table>";
	cntPlayer.innerHTML = "<table width=425 height=240><tr><td width=100% height=100% valign=middle align=center>" +
											 " <img src='"+path+"'></td></tr></table>";
	document.getElementById("bordino").onclick = function() { vg1_DoFSCommand("mostraVideo", imgG + "xfsnetx" + titolo); }
	document.getElementById("bordino").style.cursor = "hand";
	document.getElementById("bordino").style.cursor = "pointer";
	ajaxCall(url, "divDescr");
}
//---------------- fine funzioni mediagallery

//---------------- funzioni aggiornatore
	var aggMessaggi, aggDelay, aggCnt, aggLink;
	var cur = 0;

	function aggIniziaScroll(arrayMessaggi, arrayLink, delay, cnt) {
		aggMessaggi = arrayMessaggi;
		aggLink = arrayLink;
		aggDelay = delay;
		aggCnt = cnt;
		aggInit();
	}
	
	function aggInit() {
		var obj = document.getElementById(aggCnt);
		var alt = (obj.offsetHeight * 2);
		var loop = IE ? "2" : "1";
		obj.innerHTML = "<marquee height=" + alt + " scrollamount=2 direction=up behavior=alternate id='aggMrq' loop=" + loop + ">" + aggMessaggi[cur] + "</marquee>";
		document.getElementById("aggLink").href = aggLink[cur];
		var mrq = document.getElementById("aggMrq");
		if (mrq.addEventListener) {	mrq.addEventListener("finish", aggAspetta, true); }
		if (mrq.attachEvent) { mrq.attachEvent("onbounce", aggAspetta); }
	}
	
	function aggAspetta() {
		var mrq = document.getElementById("aggMrq");
		if (mrq.removeEventListener) {	mrq.removeEventListener("finish", aggAspetta, true); }
		if (mrq.detachEvent) { mrq.detachEvent("onbounce", aggAspetta); }
		if (IE) { mrq.stop(); }
		setTimeout(aggFuori, aggDelay*1000);
	}
	
	function aggFuori() {
		var mrq=document.getElementById("aggMrq");
		if (mrq.addEventListener) {	mrq.addEventListener("finish", aggProssimo, true); }
		if (mrq.attachEvent) { mrq.attachEvent("onbounce", aggProssimo); }
		mrq.start();
	}
	
	function aggProssimo() {
		var mrq = document.getElementById("aggMrq");
		if (mrq.removeEventListener) {	mrq.removeEventListener("finish", aggProssimo, true); }
		if (mrq.detachEvent) { mrq.detachEvent("onfinish", aggProssimo); }
		cur++;
		if (cur >= aggMessaggi.length) { cur=0; }
		aggInit();
	}

//---------------- fine funzioni aggiornatore
