/** * Controllo generale per verificare se il browser supporta il DHTML: * la variabile ? true nel caso in cui il browser supporti uno dei tre * DOM ad oggi presenti */    var DHTML = (document.getElementById || document.all || document.layers);//------------------------------------------------------------------------------// Ritorna l'oggetto il cui id viene passato per parametro// - objID: id dell'oggetto che si vuole ottenere come risultato//------------------------------------------------------------------------------	function getObj(objID) {				if (!DHTML) return;	    	return (document.getElementById)? document.getElementById(objID): eval(objID);	}			function setStyle(elemID, newStyle) {		if (!DHTML) return;		elem = getObj(elemID);		elem.className = newStyle;	}			function evidMenu(elemID, boolValue) {		styleMenu = 'menuVoce';		styleMenuSopra= 'menuSopra';		if (boolValue==true) {			styleMenu = 'menuVoceEvid';			styleMenuSopra = 'menuSopraEvid';		}		changeStyle(elemID, styleMenu);		changeStyle(elemID+'Sopra', styleMenuSopra);	}			function setElemVisibility(elemID, boolValue) {		if (!DHTML) return;		elem = getObj(elemID);		if (boolValue)			elem.style.visibility = 'visible'		else			elem.style.visibility = 'hidden';	}		function setElemDisplay(elemID, boolValue) {		if (!DHTML) return;		elem = getObj(elemID);		if (boolValue)			elem.style.display = 'block'		else			elem.style.display = 'none';	}		function changeElemDisplay(elemID) {		if (!DHTML) return;		elem = getObj(elemID);		if (elem.style.display == 'block') {			elem.style.display == 'none'		} else {			elem.style.display == 'block'		}	}			function stendiVelo() {        // Il velo si stende dall'inizio della pagina fino all'ordinata del        // punto che si trova alla fine della pagina (nel footer perci?        // bisogna che la pagina sia caricata tutta        browserWidth = getBrowserWidth();        veloObj = getObj('velo');        imgFinePagina = getObj('finePagina');        veloObj.style.width = browserWidth+'px';        veloObj.style.height = findPosY(imgFinePagina)+'px';		veloObj.style.visibility = 'visible';    }   		//------------------------------------------------------------------------------// Determina le dimensioni attuali della finestra del browser	//------------------------------------------------------------------------------	function getBrowserWidth() {	  browserWidth=0;	  if (DHTML) {		  if( typeof( window.innerWidth ) == 'number' ) {		    //Non-IE		    browserWidth = window.innerWidth;		  } else {		    if( document.documentElement &&		        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {		      //IE 6+ in 'standards compliant mode'		      browserWidth = document.documentElement.clientWidth;		    } else {		      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {		        //IE 4 compatible		        browserWidth = document.body.clientWidth;		      }		    }		  }		}	  return browserWidth;	}			function getBrowserHeight() {	  browserHeight=0;	  if (DHTML) {		  if( typeof( window.innerWidth ) == 'number' ) {		    //Non-IE		    browserHeight = window.innerHeight;		  } else {		    if( document.documentElement &&		        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {		      //IE 6+ in 'standards compliant mode'		      browserHeight = document.documentElement.clientHeight;		    } else {		      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {		        //IE 4 compatible		        browserHeight = document.body.clientHeight;		      }		    }		  }		}	  return browserHeight;	}	/**	 * La funzione findPosX(obj) trova la posizione dell'oggetto	 * obj all'interno della pagina lungo l'asse delle ascisse	 */	  function findPosX(obj)	  {	      var curleft = 0;	      if (DHTML) {		      if (obj.offsetParent)		      {		          while (obj.offsetParent)		          {		              curleft += obj.offsetLeft		              obj = obj.offsetParent;		          }		      }		      else if (obj.x)		          curleft += obj.x;		  }	      return curleft;	  }		/**	 * La funzione findPosY(obj) trova la posizione dell'oggetto	 * obj all'interno della pagina lungo l'asse delle ordinate	 */	  function findPosY(obj)	  {	      var curtop = 0;	      if (DHTML) {		      if (obj.offsetParent)		      {		          while (obj.offsetParent)		          {		              curtop += obj.offsetTop		              obj = obj.offsetParent;		          }		      }		      else if (obj.y)		          curtop += obj.y;		  }		  return curtop;		  }//------------------------------------------------------------------------------// Funzioni di DOM parsing	//------------------------------------------------------------------------------/** * La funzione deleteChild(writeroot) elimina tutti i figli * dell'elemento writeroot */function deleteChild(writeroot) {		if (!writeroot) return;	while(writeroot.hasChildNodes())	{		writeroot.removeChild(writeroot.childNodes[0]);	}}//------------------------------------------------------------------------------// Funzioni controllo stringhe//------------------------------------------------------------------------------/** * La funzione isEmpty(string) ritorna true se string è vuota, * false altrimenti */function isEmpty(string) {   if ((string.length==0) ||   (string==null)) {      return true;   }   else { return false; }}function truncate(stringId, length) {	var p = getObj(stringId);	if (p) {		  var trunc = p.innerHTML;	  if (trunc.length > length) {		    /* Truncate the content of the P, then go back to the end of the	       previous word to ensure that we don't truncate in the middle of	       a word */	    trunc = trunc.substring(0, length);	    trunc = trunc.replace(/\w+$/, '');		    /* Add an ellipses to the end and make it a link that expands	       the paragraph back to its original size 	    trunc += '<a href="#" ' +	      'onclick="this.parentNode.innerHTML=' +	      'unescape(\''+escape(p.innerHTML)+'\');return false;">' +	      '...<\/a>';	      */	    p.innerHTML = trunc;	    	  }	}}//------------------------------------------------------------------------------// Funzioni popup//------------------------------------------------------------------------------function popitup(url, height, width){	newwindow=window.open(url,'name','scrollbars=yes,height='+height+',width='+width);	if (window.focus) {newwindow.focus()}	return false;}// -------------------------------------------------- Funzioni predefinite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];}}
