/* per nascondere il preload */
function lost()
{
	document.getElementById('loadingline').style.visibility = "hidden";
	document.getElementById('contentcenter').style.visibility = "visible";
}


function SelectFilter (theKind, theSelect, source, theSelIndex)
{
	if (source)
	{
		if (theSelIndex == '')	theSelIndex = 0;
		theModList = (document.getElementById(theKind + 'data').value).match (new RegExp ('#' + source + '[^#]*'));
		
		if (theModList)
		{
			theModItems = theModList[0].split ('|');
			with (theSelect.form[theKind])
			{
				options.length = 0;
				options[0] = new Option( '', '')
				
				for ( theIndex = 1; theIndex < theModItems.length -1; theIndex++) 
				{
					options[theIndex] = new Option( theModItems[theIndex], theModItems[theIndex])
					if (theModItems[theIndex] == theSelIndex)	
					{
						options.selectedIndex=theIndex;
					}
				}
			}
		}
		else
			theSelect.form[theKind].options.length = 0;
	}
	else
		theSelect.form[theKind].options.length = 0;
}
function ca(va1,va2)
{ 
//	alert("entrato "+va1+ " "+ va2);
//	document.getElementById('XFormField_mar').selectedIndex = va1;
	SelectFilter('mod', document.getElementById('XFormField_mar'), va1,va2);
}


function apri_menu(i,url)
{
//		alert("qui "+document.getElementById('div_'+i).style.visibility )
		if (document.getElementById('div_'+i).style.visibility == "visible")
		{
		document.getElementById('div_'+i).style.visibility = "hidden";
		document.getElementById('div_'+i).style.position = "absolute";
		document.getElementById('fr_'+i).src = url+ "arrowmenu_user.gif";	
		}
		else
		{
		document.getElementById('div_'+i).style.visibility = "visible";
		document.getElementById('div_'+i).style.position = "relative";
		document.getElementById('fr_'+i).src = url+ "downmenu_user.gif";
		}
}
var posizione = "";
var liveSearchReq;
function riempi(stringa)
{
//	alert("pos: "+ posizione + " = " + document.getElementById("altri_"+posizione).innerHTML)
//	alert(stringa+"##FINE##")
	document.getElementById("altri_"+posizione).innerHTML = stringa;
//	document.getElementById("altri").innerHTML = stringa;
}

function agg_menu(url,from,site,who) 
{
	var strRes; 
	posizione = who;
	var today = new Date();
	var url = url + "out_menu.asp?azione=all&pm="+ from+"&config_id="+site+"&time="+today.getTime();
//	alert("URL : "+url);
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq = new XMLHttpRequest();
        liveSearchReq.onreadystatechange = ricevi; 
        liveSearchReq.open("GET",url,true);
        liveSearchReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq) {
            liveSearchReq.onreadystatechange = ricevi; 
            liveSearchReq.open("GET",url,true);
            liveSearchReq.send();
        }
    }	
}
function cerca(from,to,all,who) 
{
	var strRes; 
	posizione = who;
	var url = "out_menu.asp?da="+from+"&a="+to+"&tot="+all+"&who="+who;
//	alert("URL : "+url);
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        liveSearchReq = new XMLHttpRequest();
        liveSearchReq.onreadystatechange = ricevi; 
        liveSearchReq.open("GET",url,true);
        liveSearchReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (liveSearchReq) {
            liveSearchReq.onreadystatechange = ricevi; 
            liveSearchReq.open("GET",url,true);
            liveSearchReq.send();
        }
    }	
}
function ricevi() 
{   
    var strRes;      	
	if (liveSearchReq.readyState == 4) {	   
		strRes=liveSearchReq.responseText;
		riempi(strRes);
	}
	
}
function change_class(oggetto,newclass)
{
//	alert (document.getElementById(oggetto).className + " -- " + newclass)
	document.getElementById(oggetto).className = newclass;
}

function change_class2(oggetto,newclass,newclass2)
{
	if (document.getElementById(oggetto).className==newclass2)
	{
		document.getElementById(oggetto).className = newclass;
	}
	else
	{
		document.getElementById(oggetto).className = newclass2;
	}
	
}

function change_image(oggetto,urlfoto,urlfoto2)
{
	if ( document.images.oggetto.src==urlfoto) { 
		document.images.oggetto.src=urlfoto2;
	} 
	else { 
		document.images.oggetto.src=urlfoto;
	}

}

function change_classdiv(newclass1,newclass2,newclass3,newclass4,newclass5,newclass6)
{
//	alert (document.getElementById("tddiv1").className + " -- " + newclass1)
	document.getElementById("tddiv1").className = newclass1;
	document.getElementById("tddiv2").className = newclass2;
	document.getElementById("tddiv3").className = newclass3;
	document.getElementById("td1").className = newclass4;
	document.getElementById("td2").className = newclass5;
	document.getElementById("td3").className = newclass6;
}
function copia(area) {
var appoggio=eval("document."+area)
appoggio.focus()
appoggio.select()
//intervallo=appoggio.createTextRange()
//intervallo.execCommand("Copy")
}

function refreshChart(DOMId,urlXML){
//	alert("eccomi " + DOMId +  " --- " + urlXML )
	//Get reference to chart object using Dom ID
	var chartObj = getChartFromId(DOMId);
	//Update it's URL
	chartObj.setDataURL(urlXML); 				
}
