/** * 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 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'		}	}   		//------------------------------------------------------------------------------// 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;}
