	var scrollspeed;
	scrollspeed = 2;
	document.onmousedown = faster
	document.onmouseup = slower
	
	function faster() {
		if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
			return false;
		}
		else {
			if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
			//alert("imparOnline: piattaforma di e-learning");
			return false;
			}
			else {
				scrollspeed = 5;
				return true;
				
			}
		}
	}

	function slower() {
		scrollspeed = 1;
	}
		
	/*******************************************************
		Scrolling di un layer DIV
		parametri: 
		vsDivN - nome del layer da scrollare
		dir - direzione di scroll ("up" oppure "down")
		nfld - numero delle righe da scrollare (cambiare, 
		più avanti in questa funzione, il valore (x*nfld) a 
		seconda del font utilizzato)
	**********************************************************/
	function verScroll(vsDivN, dir, nfld) {
		loop = true;
		scrolltimer = null;
		if(document.all)
		contentLayer = document.all.tags("DIV")(vsDivN);
		else if(document.getElementById)
			contentLayer = document.getElementById(vsDivN);

		var page = contentLayer.style;

		direction = dir;
		var y_pos = parseInt(page.top);
		
		if (loop == true) {
			if (dir == "down" && y_pos > (7*nfld*-1)) {
				page.top = (y_pos - (scrollspeed));
			} 
			else {
				if (dir == "up" && y_pos <5) {
					page.top = (y_pos + (scrollspeed));
				} 
			}
			scrolltimer = setTimeout("verScroll('"+vsDivN+"', '"+dir+"', " + nfld.toString() + ")", 1);
		}
	}

	function stopScroll() {
		loop = false;
		clearTimeout(scrolltimer);
	}

	/********************************************************************
		Apertura/Chiusura verticale di un layer DIV
		parametri: 
		dvn - nome del layer da aprire/chiudere
		op - operazione da effettuare ("open" oppure "close")
		minsize - dimensioni, in pixel, del DIV da chiuso
		maxsize - dimensioni, in pixel, del DIV da aperto
	********************************************************************/
	function openCloseDiv(ocDivN, op, minsize, maxsize) {
		opencloseloop= true;
		speed = 5; //velocità di apertura/chiusura, in numero di pixel (nel loopDiv apre, o chiude di "speed" pixels alla volta)
		openclosetimer = null;

		lyr = parent.frames.Main.document.all.tags("DIV")(ocDivN).style;
		h = parseInt(lyr.height);

		if (opencloseloop == true) {
			switch (op) {
				case "close":
					if( h > (minsize+speed) ) {
						lyr.height = (h - speed);
						var tocall = "openCloseDiv('" + ocDivN + "', '" + op + "', " + minsize + ", " + maxsize + ")"
						openclosetimer = setTimeout(tocall, 1);
					}
					else {
						stoploopDiv();
					}
					break;
				case "open":
					if( h < maxsize ) {
						lyr.height = (h + speed);
						var tocall = "openCloseDiv('" + ocDivN + "', '" + op + "', " + minsize + ", " + maxsize + ")"
						openclosetimer = setTimeout(tocall, 1);
					}
					else {
						stoploopDiv();
					}
					break;
			}
			
		} // -- end if opencloseloop == true --
	}

	function stoploopDiv() {
		opencloseloop = false;
		clearTimeout(openclosetimer);
	}

	function openCloseLoadDiv(oclDivN, contDivN, op, minsize, maxsize, url) {
		speed = 5; //velocità di apertura/chiusura, in numero di pixel (nel loopDiv apre, o chiude di "speed" pixels alla volta)

		lyr = parent.frames.Main.document.all.tags("DIV")(oclDivN).style;
		h = lyr.pixelHeight;

		switch (op) {
			case "close":
				if( h > (minsize+speed) ) {
					lyr.height = (h - speed);
					var tocall = "openCloseLoadDiv('" + oclDivN + "', '" + contDivN + "', '" + op + "', " + minsize + ", " + maxsize + ", '" + url + "')"
					openclosetimer = setTimeout(tocall, 1);
				}
				else {
					stoploopDiv();

					update(contDivN,url) // *** CARICAMENTO DIV ***
					
					op = "open"
					var tocall = "openCloseLoadDiv('" + oclDivN + "', '" + contDivN + "', '" + op + "', " + minsize + ", " + maxsize + ", '" + url + "')"
					openclosetimer = setTimeout(tocall, 1000);
				}
				break;
				
			case "open":
				if( h < maxsize ) {
					lyr.pixelHeight = (h + speed);
					var tocall = "openCloseLoadDiv('" + oclDivN + "', '" + contDivN + "', '" + op + "', " + minsize + ", " + maxsize + ", '" + url + "')"
					openclosetimer = setTimeout(tocall, 1);
				}
				else {
					stoploopDiv();
				}
				break;
		}
			
	}


	/********************************************************************************
	CARICAMENTO DINAMICO DI UN DIV/LAYER CROSSBROWSER
	********************************************************************************/

	var doAll = (document.all!=null)

	function getFramePath(id) {
		
		// puntamento all'insieme dei frames
		var FramePath = top.frames;
		var found = 0;

		// ciclo per identificare il numero dei frames presenti
		for(i=0;i<FramePath.length;i++) {
			if(FramePath[i].document.all(id) != null) {
				found = 1;
				break;
			}
		}
		if(found == 1) {				
			return FramePath[i].name;
		}
		else {
			return "";
		}
	}
	

	// Ritorna l'elemento specificato dall'ID
	function getCSSPElement(id) {    

		var framePath = getFramePath(id);

		if(framePath != "") {
			if (doAll) { // DIV IE in un frame
				return top.frames(framePath).document.all[id]
			}
			else { // LAYER NS in un frame
			  return top.frames(framePath).document.layers[id]  
			}
		}
		else {       
			if (doAll) { // DIV IE nel documento corrente
				return document.all[id]
			}
			else { // LAYER NS nel documento corrente
				return document.layers[id]  
			}
		}

	 }

	function checkIFrame(destID) {
	  var iframe = document.frames[destID+"target"]
	  if (iframe==null) {
	    document.body.insertAdjacentHTML("beforeEnd","<IFRAME STYLE='width: 0pt; height: 0pt' NAME='"+destID+"target' SRC='' ></IFRAME>")
	    iframe = document.frames[destID+"target"]
	  }
	  return iframe
	}

	function updateContents(destID, src) {
	  var el = getCSSPElement(destID)
	  if (doAll) {
	    destFrame = checkIFrame(destID)
	    destFrame.location.href = src        
	    setTimeout("pollIFrame('"+destID+"')",200)
	  }
	  else
	    el.src = src      
	}

	function pollIFrame(destID) {
	  var destFrame = checkIFrame(destID)
	  if (destFrame.document.readyState=='complete') {
	    var el = getCSSPElement(destID)
	    el.innerHTML = destFrame.document.body.innerHTML
	  } else
	    setTimeout("pollIFrame('"+destID+"')",200)        
	}

	function update(destID, src) {
	  if (src=="none") {
	    var el = getCSSPElement(destID)
	    if (doAll)
	      el.innerHTML = ""
	    else {
	      el.document.open()
	      el.document.write("")
	      el.document.close()
	    }
	  }
	  else
	    updateContents(destID, src)
	}

	function showElement(id) {        
	  var pEl = getCSSPElement(id)
	  if (pEl != null)          
	    if (doAll)
	        pEl.style.visibility = "visible"          
	    else
	        pEl.visibility = "show"
	 }      
	  
	 function hideElement(id) {
	    var pEl = getCSSPElement(id)        
	    if (pEl != null)          
	    if (doAll)
	        pEl.style.visibility = "hidden"          
	    else
	        pEl.visibility = "hide"      
	 }

	 function hideShow(destID,cb) {
	   if (cb.checked)
	     showElement(destID)
	   else
	     hideElement(destID)
	 }

	/*******************************************************************************/

	/*
		Apertura di una finestra senza bordi, posizionata a centro schermo
		parametri: 
		urlPop - pagina Html da caricare all'interno della finestra
		windowW - larghezza della finestra
		windowH - altezza della finestra
		scroll - barre di scorrimento all'interno della finestra ("yes" oppure "no")
	*/
	function openFrameless(urlPop, windowW, windowH, scroll) {
		var windowX = getHorzPos(windowW)
		var windowY = getVertPos(windowH)
		var title =  "imparOnline"

		s = "width="+windowW+",height="+windowH;
		var beIE = document.all?true:false

		if (beIE) {
			NFW = window.open(urlPop,"popFrameless","scrollbars=" + scroll + ", fullscreen,"+s);
			NFW.blur();
			window.focus();
			NFW.resizeTo(windowW,windowH);
			NFW.moveTo(windowX,windowY);
		}
		else {
			NFW = window.open(urlPop,"popFrameless","scrollbars=" + scroll + ","+s);
			NFW.blur();
			window.focus();
			NFW.resizeTo(windowW,windowH);
			NFW.moveTo(windowX,windowY);
		}
		NFW.focus();
	}

	// Recupero del centro orizzontale dello schermo
	function getHorzPos(wsize) {
		return (window.screen.width/2) - (wsize/2);
	}
		
	// Recupero del centro verticale dello schermo
	function getVertPos(hsize) {
		return (window.screen.height/2) - (hsize/2);
	}
