function sel(percorso,campo)
	{
	    opener.document.getElementById(campo).value=percorso;
	    window.close();
	}

function openfilearchive(campo,tipo)
{
    URL="_filer.aspx?tipogal="+tipo+"&campo="+campo
    if (campo=="")
		window.open(URL,"Gest","menubar=0,toolbar=0,location=0,resizable=0,scrollbars=1,height=500,width=520");
    else
        window.open(URL,"Sele","menubar=0,toolbar=0,location=0,resizable=0,scrollbars=1,height=500,width=520");
}

function charcounter(n,campo,counter)
{
	testo=document.getElementById(campo).value+""
	if ( n - testo.length >= 0)
		{document.getElementById(counter).value = n - testo.length}
	else
		{
			document.getElementById(counter).value=0
			document.getElementById(campo).value=testo.substr(0,n)
		}
}

// NEWSBAR //

    var slideshowNews_currentOpacity = 100;
    var slideshowNews_direction = -1;
    var slideshowNews_currentnews = 0;
    var slideshowNews_timeBetweenSlides = 5000;
    var slideshowNews_fadingSpeed = 2;	// da 1 a 5
    var containerId = ''
    var currentnewscontainerId = ''
    
    function initSlidingContent(newcontainerId,newcurrentnewscontainerId)
	{
	    containerId=newcontainerId;
	    currentnewscontainerId=newcurrentnewscontainerId;
    	setTimeout('SlidingContent()',1);
	}
    
	function SlidingContent()
	{
	  var fadingtimeX = 10
      slideshowNews_currentOpacity=slideshowNews_currentOpacity + slideshowNews_direction; 
      if(document.all){ 
         document.getElementById(containerId).style.filter = 'alpha(opacity='+slideshowNews_currentOpacity+')'; 
         document.getElementById(containerId).style.filter = 'alpha(opacity='+(100-slideshowNews_currentOpacity)+')'; 
      }else{ 
         document.getElementById(containerId).style.opacity = Math.max(0.01,slideshowNews_currentOpacity/100);   // Can't use 1 and 0 because of screen flickering in FF 
         document.getElementById(containerId).style.opacity = Math.min(0.99,(1 - (slideshowNews_currentOpacity/100))); 
      } 
      if(slideshowNews_currentOpacity<6){ 
         slideshowNews_direction = 1 * slideshowNews_fadingSpeed;
         fadingtimeX = slideshowNews_timeBetweenSlides;
      } 
      if(slideshowNews_currentOpacity>94){ 
         slideshowNews_direction = -1 * slideshowNews_fadingSpeed;
         slideshowNews_currentnews++;  
         if(document.getElementById(currentnewscontainerId + slideshowNews_currentnews))
            { 
            document.getElementById(containerId).innerHTML=document.getElementById(currentnewscontainerId + slideshowNews_currentnews).innerHTML;
            }
         else
            { 
            slideshowNews_currentnews = 1;
             if(document.getElementById(currentnewscontainerId + slideshowNews_currentnews))
            { 
            document.getElementById(containerId).innerHTML=document.getElementById(currentnewscontainerId + slideshowNews_currentnews).innerHTML;
            }
            }
      } 
	    setTimeout('SlidingContent()',fadingtimeX); 
	}
	

