function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}//-->//------------------------------------function set_cookie(name, value){	document.cookie= name + "=" + escape(value);}function get_cookie(name){	var dc = document.cookie;	var prefix = name + "=";	var begin = dc.indexOf("; " + prefix);	if (begin == -1)	{		begin = dc.indexOf(prefix);		if (begin != 0)		{			return null;		}	}	else	{		begin += 2;	}	var end = document.cookie.indexOf(";", begin);	if (end == -1)	{		end = dc.length;	}	return unescape(dc.substring(begin + prefix.length, end));}function set_nodes_status(){	var divs = document.getElementsByTagName('div');	var ids_str = '';	for (i = 0; i < divs.length; i++)	{		if (divs[i].id.substring(0, 3) == 'div')		{			if (divs[i].style.display == '')			{				var id = divs[i].id.substring(3, divs[i].id.length);				ids_str = ids_str + '[' + id + ']';			}		}	}					set_cookie('node_status', ids_str);}function init_menu_nodes(){	var ids_str = get_cookie('node_status');	var divs = document.getElementsByTagName('div');	for (i = 0; i < divs.length; i++)	{		if (divs[i].id.substring(0, 3) == 'div')		{			var id = divs[i].id.substring(3, divs[i].id.length);			if (ids_str.indexOf('[' + id + ']') != -1)			{											var theImg = document.getElementById('img' + id);									divs[i].style.display = '';				theImg.src = 'img/down.gif';			}		}	}				}function ocopen(node){	var theDiv = document.getElementById('div' + node);	var theImg = document.getElementById('img' + node);		if (theDiv.style.display == 'none')	{		theDiv.style.display = '';		theImg.src = 'img/down.gif';	}	else	{		theDiv.style.display = 'none';		theImg.src = 'img/next.gif';	}	set_nodes_status();}function close_all(){	var divs = document.getElementsByTagName('div');	for (i = 0; i < divs.length; i++)	{		if (divs[i].id.substring(0, 3) == 'div')		{			var id = divs[i].id.substring(3, divs[i].id.length);			var theImg = document.getElementById('img' + id);								divs[i].style.display = 'none';			theImg.src = 'img/next.gif';		}	}	set_nodes_status();}      //------------------------------------function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_changeProp(objName,x,theProp,theValue) { //v6.0  var obj = MM_findObj(objName);  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){    if (theValue == true || theValue == false)      eval("obj."+theProp+"="+theValue);    else eval("obj."+theProp+"='"+theValue+"'");  }}function emailCheck (emailStr){var emailPat=/^(.+)@(.+)$/var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"var validChars="\[^\\s" + specialChars + "\]"var quotedUser="(\"[^\"]*\")"var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/var atom=validChars + '+'var word="(" + atom + "|" + quotedUser + ")"var userPat=new RegExp("^" + word + "(\\." + word + ")*$")var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")var matchArray=emailStr.match(emailPat)if (matchArray==null) { 	alert("L'indirizzo e-mail inserito è scorretto ")	return false}var user=matchArray[1]var domain=matchArray[2]if (user.match(userPat)==null) {    alert("Inserire il nome utente della mail.")    return false}var IPArray=domain.match(ipDomainPat)if (IPArray!=null) {	  for (var i=1;i<=4;i++) {	    if (IPArray[i]>255) {	        alert("L'indirizzo ip di destinazione è invalido!")		return false	    }    }    return true}var domainArray=domain.match(domainPat)if (domainArray==null) {	alert("Il nome del domino è scorretto.")    return false}var atomPat=new RegExp(atom,"g")var domArr=domain.match(atomPat)var len=domArr.lengthif (domArr[domArr.length-1].length<2 ||     domArr[domArr.length-1].length>3) {   alert("L'indirizzo deve terminare con due o tre lettere indicanti il dominio.")   return false}if (len<2) {   var errStr="This address is missing a hostname!"   alert(errStr)   return false}return true;}function zoom(file) {var finestra = null;bName=navigator.appName;finestra=window.open('../scripts/img.php?file='+file,'zoom','toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes,width=50,height=50');finestra.focus();}function galleria(file_img) {        var wdt = screen.width;        var hgt = screen.height;        rslt = new Image();	    rslt.src = file_img;	    lar=rslt.width+20;	    alt=rslt.height+20;        var x = Math.round( (wdt / 2) - (lar / 2) );        var y = Math.round( (hgt / 2) - (alt / 2) );        var finestra = null;        bName=navigator.appName;        finestra=window.open('scripts/img.php?file='+file_img,'zoom','width=' + lar + ',height=' + alt + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes');        finestra.focus();}function dettagli(id,file) {var finestra = null;bName=navigator.appName;finestra=window.open('newsletter/'+file+'.php?id='+id,'','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,menubar=no,resizable=yes,width=500,height=350');if (bName=="Netscape") { finestra.focus(); }}function guida(dir,file) {    var guida = null;        x_g=300;    x=screen.availWidth-x_g;    y=screen.availHeight;    self.moveTo(0,0);    self.resizeTo(x-10,y);    guida=window.open('guida.php?file='+file+'&dir='+dir,'guida','toolbar=yes,location=no,directories=no,status=no,scrollbars=yes,menubar=no,resizable=yes,width='+x_g+',height='+y+',left='+(x));    guida.focus();}function loadGuida(dir,file) {    guida.location='guida.php?file='+file+'&dir='+dir;}function cancella(url){if (confirm("Confermi la cancellazione?")){ redir(url); return true; }return false;}function nuovalingua(id) {  var url = String(window.location) ;  set_cookie('lang', id);  var index2 = url.indexOf('#');	  a=url.split('#');  url=a[0];    var index = url.indexOf('?');      conc=(index == -1)?"?":"&";  //conc2=(a[1] <>'')?"#"+a[1]:"";        url = url + conc+"lang="+id;  //alert (url);  window.location=url;}function redir(url){window.location=url;}// -----------------------------------------------------------------------------// --- Controllo dei dati nel form di richiesta informazioni// -----------------------------------------------------------------------------function controllo_richiesta(){		var risultato = true;	var ragione_sociale = document.forms['informazioni'].ragione.value;	var nome = document.forms['informazioni'].nome_.value;	var cognome = document.forms['informazioni'].cognome_.value;	var telefono = document.forms['informazioni'].telefono_.value;	var email = document.forms['informazioni'].email_.value;		if (ragione_sociale == '')	{		document.getElementById('td_ragione').style.color = '#FF0033';		document.getElementById('td_ragione').style.fontWeight = 'bold';		risultato = false;	}	else	{		document.getElementById('td_ragione').style.color = '';		document.getElementById('td_ragione').style.fontWeight = '';	}	if (cognome == '')	{		document.getElementById('td_cognome').style.color = '#FF0033';		document.getElementById('td_cognome').style.fontWeight = 'bold';		risultato = false;	}	else	{		document.getElementById('td_cognome').style.color = '';		document.getElementById('td_cognome').style.fontWeight = '';	}		if (nome == '')	{		document.getElementById('td_nome').style.color = '#FF0033';		document.getElementById('td_nome').style.fontWeight = 'bold';		risultato = false;	}	else	{		document.getElementById('td_nome').style.color = '';		document.getElementById('td_nome').style.fontWeight = '';	}	var tel_re = /^\d+$/;	if ((telefono == '') || (!telefono.match(tel_re)))	{		document.getElementById('td_telefono').style.color = '#FF0033';		document.getElementById('td_telefono').style.fontWeight = 'bold';		risultato = false;	}	else	{		document.getElementById('td_telefono').style.color = '';		document.getElementById('td_telefono').style.fontWeight = '';	}	var email_re = /^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/;  if ((email == '') || (!email.match(email_re)))	{		document.getElementById('td_email').style.color = '#FF0033';		document.getElementById('td_email').style.fontWeight = 'bold';		risultato = false;	}	else	{		document.getElementById('td_email').style.color = '';		document.getElementById('td_email').style.fontWeight = '';	}		if (risultato == false)	{		alert('Sono stati rilevati dei campi non validi. Ricontrollare i campi evidenziati in rosso.');	}	return risultato;}//-------------------------------------------- UPLOAD AREADOWNLOAD  -----------------------------------------//-----------------------------------------------------------------------------------------------------------var exts = "jpg|jpeg|gif|png|rar|zip|mp3|avi|txt|csv|mpg|mpeg|mov|wmv|pdf|doc|xls|3gp";//var exts = ".*"; //Use this to accept all Extensionsvar UID,NF=0,cx=0;function openStatusWindow(){ 	   var nome_file=document.forms['F1'].file1x.value;      a= nome_file.split('\\');   end=a.length-1;   win1 = window.open('/cgi-bin/upload/upload_status.cgi?upload_id='+UID+'&allegato='+a[end],'win1','width=320,height=240,resizable=1');   win1.window.focus();}function generateSID(){ UID = Math.round(10000*Math.random())+'0'+Math.round(10000*Math.random()); var f1=document.F1; f1.action = f1.action.split('?')[0]+'?upload_id='+UID;}function StartUpload(){    NF=0;    for (var i=0;i<document.F1.length;i++)    {     current = document.F1.elements[i];     if(current.type=='file' && current.value!='')      {         if(!checkExt(current.value))return false;         NF++;      }    }    if(NF==0){alert('Selezionare il file da caricare!');return false;};    generateSID();    openStatusWindow();}function checkExt(value){    if(value=="")return true;    var re = new RegExp("^.+\.("+exts+")$","i");    if(!re.test(value))    {        alert("Estensione non valida per il file: \"" + value + "\"\nSono concesse solo le seguenti estensioni: "+exts.replace(/\|/g,',')+" \n\n");        return false;    }    return true;}// -----------------------------------------------------------------------------// -----------------------------------ajax------------------------------------------//Create a boolean variable to check for a valid IE instance.var xmlhttp = false;//Check if we are using IE.try {//If the javascript version is greater than 5.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {//If not, then use the older active x object.try {//If we are using IE.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {//Else we must be using a non-IE browser.xmlhttp = false;}}//If we are using a non-IE browser, create a JavaScript instance of the object.if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {xmlhttp = new XMLHttpRequest();}/*function showCalendar(x) {  //The location we are loading the page into.  var objID = "calendar";    var serverPage = "/admin/function.php?dir="+dir+"&file="+file+"&f="+f;  //Set the open close tracker variable.    var obj = document.getElementById(objID);  xmlhttp.open("GET", serverPage);    xmlhttp.onreadystatechange = function() {    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {    obj.innerHTML = xmlhttp.responseText;    }  }  xmlhttp.send(null);}*/function PopolaUtenti(oElem,oTarget,dir,file){      var objID = "listboxutenti";   var strParams = "&q=";   for(var i=0;i<oElem.options.length;i++){         if(oElem.options[i].selected){         strParams += oElem.options[i].value+"," ;      }   }     var serverPage = 'function.php?dir='+dir+'&file='+file+'&'+strParams;   //Set the open close tracker variable.    var obj = document.getElementById(objID);  xmlhttp.open("GET", serverPage);    xmlhttp.onreadystatechange = function() {    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {    obj.innerHTML = xmlhttp.responseText;    }  }  xmlhttp.send(null);}