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=650");
    else
        window.open(URL,"Sele","menubar=0,toolbar=0,location=0,resizable=0,scrollbars=1,height=500,width=650");
}

/* menu briciole di pane */
 $(document).ready(function(){			$("#nav-one li").hover(				function(){ $("ul", this).fadeIn("fast"); }, 				function() { } 			);	  	if (document.all) {				$("#nav-one li").hoverClass ("sfHover");			}	  });	  		$.fn.hoverClass = function(c) {			return this.each(function(){				$(this).hover( 					function() { $(this).addClass(c);  },					function() { $(this).removeClass(c); }				);			});		};	  


/*tooltip initialize*/
/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* JS Modified by Infor
***********************************************/

var offsetxpoint=-190 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext){
if (ns6||ie){
if (thetext.toString().length<1) 
    {
        tipobj.style.width="0";
        enabletip=false;
    }
else
    {
        tipobj.innerHTML=thetext;
        enabletip=true;
    }
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

/* SLIDESHOW IMMAGINI IN TESTATA */

    var slideshowX_noFading = false;	// Just normal show/hide without fading ?
	var slideshowX_timeBetweenSlides = 3500;	// Amount of time between each image(1000 = 1 second)
	var slideshowX_fadingSpeed = 2;	// Speed of fading
		
	/* Don't change any of these values */
   var slideshowX_galleryContainer;   // Reference to the gallery div 
   var slideshowX_galleryWidth;   // Width of gallery 
   var slideshowX_galleryHeight;   // Height of galery 
   var slideshowX_slideIndex = -1;   // Index of current image shown 
   var slideshowX_slideIndexNext = false;   // Index of next image shown 
   var slideshowX_imageDivs = new Array();   // Array of image divs(Created dynamically) 
   var slideshowX_currentOpacity = 100;   // Initial opacity 
   var slideshowX_imagesInGallery = false;   // Number of images in gallery 

	var msiex = navigator.userAgent.indexOf('MSIE')>=0?true:false; 
	if(navigator.userAgent.indexOf('Firefox')>=0)msiex=true; 

	   function getGalleryImageSize(imageIndex) 
   {  
      if(imageIndex==slideshowX_imagesInGallery){       
         if(msiex)slideshowX_galleryContainer.style.visibility='visible';    
         showGallery(); 
      }else{ 
         var imgObj = document.getElementById('galleryImage' + imageIndex); 
         var imgWidth = imgObj.width; 
         var imgHeight = imgObj.height; 
         if(imgWidth>100){                   
           var tmpDiv = document.createElement('DIV'); 
            tmpDiv.id = 'galleryDiv' + imageIndex; 
            tmpDiv.style.visibility = 'hidden'; 
            tmpDiv.className='imageInGallery'; 
            slideshowX_galleryContainer.appendChild(tmpDiv); 
            tmpDiv.appendChild(imgObj); 

            imgObj.style.left = Math.round((slideshowX_galleryWidth - imgWidth)/2)  + "px"; 
            imgObj.style.top = Math.round((slideshowX_galleryHeight - imgHeight)/2)  + "px"; 
            slideshowX_imageDivs.push(tmpDiv); 
            tmpDiv.style.visibility = 'hidden'; 
            imageIndex++; 
            getGalleryImageSize(imageIndex); 
         }else{ 
            setTimeout('getGalleryImageSize(' + imageIndex + ')',10); 
         } 
      }       
   }
	 
	  function showGallery() 
   { 
      if(slideshowX_slideIndex==-1)slideshowX_slideIndex=0; else slideshowX_slideIndex++;   // Index of next image to show 
      if(slideshowX_slideIndex==slideshowX_imageDivs.length)slideshowX_slideIndex=0; 
      slideshowX_slideIndexNext = slideshowX_slideIndex+1;   // Index of the next next image 
      if(slideshowX_slideIndexNext==slideshowX_imageDivs.length)slideshowX_slideIndexNext = 0; 
       
      slideshowX_currentOpacity=100;   // Reset current opacity 

      // Displaying image divs 
      slideshowX_imageDivs[slideshowX_slideIndex].style.visibility = 'visible'; 
      if(navigator.userAgent.indexOf('Opera')<0){ 
         slideshowX_imageDivs[slideshowX_slideIndexNext].style.visibility = 'visible'; 
      } 
       
      if(document.all){   // IE rules 
         slideshowX_imageDivs[slideshowX_slideIndex].style.filter = 'alpha(opacity=100)'; 
         slideshowX_imageDivs[slideshowX_slideIndexNext].style.filter = 'alpha(opacity=1)'; 
      }else{ 
         slideshowX_imageDivs[slideshowX_slideIndex].style.opacity = 0.99;   // Can't use 1 and 0 because of screen flickering in FF 
         slideshowX_imageDivs[slideshowX_slideIndexNext].style.opacity = 0.01; 
      }       
       

      setTimeout('revealImage()',slideshowX_timeBetweenSlides);     
   } 
	
	  
   function revealImage() 
   { 
     if(slideshowX_noFading){ 
         slideshowX_imageDivs[slideshowX_slideIndex].style.visibility = 'hidden'; 
         showGallery(); 
         return; 
      } 
      slideshowX_currentOpacity = slideshowX_currentOpacity - slideshowX_fadingSpeed; 
      if(document.all){ 
         slideshowX_imageDivs[slideshowX_slideIndex].style.filter = 'alpha(opacity='+slideshowX_currentOpacity+')'; 
         slideshowX_imageDivs[slideshowX_slideIndexNext].style.filter = 'alpha(opacity='+(100-slideshowX_currentOpacity)+')'; 
      }else{ 
         slideshowX_imageDivs[slideshowX_slideIndex].style.opacity = Math.max(0.01,slideshowX_currentOpacity/100);   // Can't use 1 and 0 because of screen flickering in FF 
         slideshowX_imageDivs[slideshowX_slideIndexNext].style.opacity = Math.min(0.99,(1 - (slideshowX_currentOpacity/100))); 
      } 
      if(slideshowX_currentOpacity>0){ 
         setTimeout('revealImage()', 10); 
      }else{ 
         slideshowX_imageDivs[slideshowX_slideIndex].style.visibility = 'hidden';          
         showGallery(); 
      } 
   } 

   
   function initImageGalleryX() 
   { 
      slideshowX_galleryContainer = document.getElementById('imageSlideshowHolder'); 
      if(msiex)slideshowX_galleryContainer.style.visibility='hidden'; 
      slideshowX_galleryWidth = slideshowX_galleryContainer.clientWidth; 
      slideshowX_galleryHeight = slideshowX_galleryContainer.clientHeight; 
      galleryImgArray = slideshowX_galleryContainer.getElementsByTagName('IMG'); 
      for(var no=0;no<galleryImgArray.length;no++){ 
         galleryImgArray[no].id = 'galleryImage' + no; 
      } 
      slideshowX_imagesInGallery = galleryImgArray.length; 
      getGalleryImageSize(0);      
       
   }  



// NEWSBAR //

    var slideshowNews_currentOpacity = 100;
    var slideshowNews_direction = -1;
    var slideshowNews_currentnews = 0;
    var slideshowNews_timeBetweenSlides = 4000;
    var slideshowNews_fadingSpeed = 3;	// 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); 
	}
	
/*  RATING SYSTEM */
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:document.getElementById(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.body.scrollLeft,'Y':event.clientY+document.body.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }

star={};

star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;

	document.onmousemove=function(e) { 
	
		var p=abPos(document.getElementById('star0')), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y;

		if(oX<1 || oX>84 || oY<0 || oY>19) { star.stop=1; star.revert(); }
		
		else {
		    document.getElementById('starCur0').style.width=oX+'px';
			//document.getElementById('starUser0').style.color='#111';
			//document.getElementById('starUser0').innerHTML=Math.round(oX/84*100)+'%'; //in percentuale
			document.getElementById('starUser0').innerHTML=Math.ceil(Math.round(oX*100/84)/20)*20 + '%'; //di 20 in 20
		}
	};
} };

star.update=function(e,o) {
    var v=parseInt(document.getElementById('starUser0').innerHTML);
	document.getElementById('starCur0').title=v;
    if (dotxt)
    dotxt(v)
};

star.revert=function() { var v=parseInt(document.getElementById('starCur0').title);
	document.getElementById('starCur0').style.width=Math.round(v*84/100)+'px';
	document.getElementById('starUser0').innerHTML=(v>0?Math.round(v)+'%':'0%');
	//document.getElementById('starUser0').style.color='#111';
	document.onmousemove='';
};
