	//Menu//
	var numMenu = 4;
	var srctemp=""
	//for each submenu know the correct position
	temp=navigator.appVersion.split('MSIE');
	// Parse the string for the "6" in 6.0
	ieVer=parseInt(temp[1]);
	// Is it greater than 6?
	var isIE6up=(ieVer <= 6)?1:0;
	
	function showMenu(num,src){
		num=num.substring(1,2);
		srctemp=document.getElementById('m'+num).src;
		document.getElementById('m'+num).src=src;
		if (document.getElementById('s'+num)) {
			document.getElementById('s'+num).style.display='block';
			/* not mandatory
			for (i=1; i<=numMenu; i++) {
				if (i!=num)
					if (document.getElementById('s'+i)){
						document.getElementById('s'+i).style.display='none';
					}
			}	
			*/
		}
	}
	
	function hiddenMenu(num){
		num=num.substring(1,2);
		document.getElementById('m'+num).src=srctemp;
		if (document.getElementById('s'+num)) document.getElementById('s'+num).style.display='none';
	}
	
	function SearchOnWebSite(SearchType){
		if (SearchType == "Header"){
			if (document.frmSearch.TextSearch.value == "") alert("Insert word(s)")
			else if (document.frmSearch.TextSearch.value != "" && document.frmSearch.TextSearch.value.length <= 2) alert("The word(s) must be at least 3 characters")
			else document.frmSearch.submit();
		}
		else{
			if (document.frmBoxSearch.TextBoxSearch.value == "") alert("Insert word(s)")
			else if (document.frmBoxSearch.TextBoxSearch.value != "" && document.frmBoxSearch.TextBoxSearch.value.length <= 3) alert("The word(s) must be at least 3 characters")
			else document.frmBoxSearch.submit();			
		} 
	} 	
	
	function posSubMenu(){		
		var spaceIE6=0;
		var marginLeft=201;
		var paddingLeft=0;
		var minimunLenght=0;
		var border=2;
		var borderRight=0;
		
		//if (isIE6up) spaceIE6=-2;
		
		for (i=1; i<=numMenu; i++) {
			if (document.getElementById('s'+i)){
				var spaceLeft=0;
				for (k=(i-1); k>=1; k--) {
					if (document.getElementById('m'+k)) {
						if(k!=i) {
							spaceLeft+=document.getElementById('m'+k).scrollWidth;
						}
					}
				}
				if (i==1)				
					document.getElementById('s'+i).style.left=spaceLeft+marginLeft+spaceIE6+"px";
				else
					//OLNLY DOR LAST AT THE END OF PAGE
					//if (i==numMenu)
						//document.getElementById('s'+i).style.right=marginLeft-borderRight+"px"; 
					//else
						document.getElementById('s'+i).style.left=spaceLeft+marginLeft+paddingLeft-border+spaceIE6+1+"px";
				if (document.getElementById('m'+i).scrollWidth<minimunLenght) 
					document.getElementById('s'+i).style.width=document.getElementById('m'+i).scrollWidth-paddingLeft-border+spaceIE6+"px";				
			}
		}
	}
	//Email//
	function checkEmail(emailAddress) {
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
		if (!Filtro.test(emailAddress)) {
			alert('Please correct the following invalid email address:\n'+emailAddress);
		}
	}
	
	function cryptMailto(s) {	//
	// JS function for uncrypting spam-protected emails:
		var n=0;
		var r="";
		for(var i=0; i < s.length; i++) {
			n=s.charCodeAt(i);
			if (n>=8364) {n = 128;}
			r += String.fromCharCode(n+(1));
		}
		alert(r);
	}
	
	function UnCryptMailto(s) {	//
	// JS function for uncrypting spam-protected emails:
		var n=0;
		var r="";
		for(var i=0; i < s.length; i++) {
			n=s.charCodeAt(i);
			if (n>=8364) {n = 128;}
			r += String.fromCharCode(n-(1));
		}
		return r;
	}
	
	function linkTo_UnCryptMailto(s)	{	//
	// JS function for uncrypting spam-protected emails:
		location.href=UnCryptMailto(s);
		//alert(UnCryptMailto(s));
	}
	
	function openDiv(n){
		if (document.getElementById('r'+n).style.display=='none') {
			document.getElementById('r'+n).style.display='block';
		}else{
			document.getElementById('r'+n).style.display='none';
		}
	}
	
	
	// JavaScript Document
	function Right(str, n){
		if (n <= 0)
		   return "";
		else if (n > String(str).length)
		   return str;
		else {
		   var iLen = String(str).length;
		   return String(str).substring(iLen, iLen - n);
		}
	}
		
	function setToggle(id,image) {
		/*var totalfaq=0;
		var sfEls = document.getElementById(id).getElementsByTagName("DIV");
		for (var i=0; i<sfEls.length; i++) {
			if (sfEls[i].id.substring(0,4)=="main") totalfaq++;
		}	
								
		for (var i=1;i<=totalfaq;i++){
			eval("var slide"+i+" = new Fx.Slide('section"+i+"')");
		}
		*/
		
		//window.addEvent('domready', function() {
			for (var i=1;i<=totalfaq;i++){
				 eval("slide"+i+".hide();");
			}
		//});
		
		for (var i=1;i<=totalfaq;i++){
			$('toggle'+i).addEvent('click',function(e){
				i=parseInt(Right(this.id,2));
				if (isNaN(i)) i=parseInt(Right(this.id,1));									
				e = new Event(e);
				eval("slide"+i+".toggle();");
				e.stop();
				if (image)
					if (Right($('img'+i).src,20)=='/images/icone/su.gif'){ 
						$('img'+i).src='/images/icone/giu.gif';
						//$('section'+i).style.visibility='hidden';
						//$('main'+i).style.background='#f4eef8';											 
					}else {
						$('img'+i).src='/images/icone/su.gif';
						//$('section'+i).style.visibility='visible';
					}
			});
		}
			
		for (var i=1;i<=totalfaq;i++){
			eval("slide"+i+".addEvent('complete', function() { i=Right(this.id,2); if (isNaN(i)) i=parseInt(Right(this.id,1)); });"); //if (!slide"+i+".open) $('main"+i+"').style.background='#ffffff';
		}
	}
	
	function Apri(){
		for (var i=1;i<=totalfaq;i++){
			if ($('img'+i)) $('img'+i).src='/images/icone/giu.gif';
			eval("slide"+i+".show();");
			//$('main'+i).style.background='#f4eef8';
		}
	}
	
	function Chiudi(){
		for (var i=1;i<=totalfaq;i++){
			if ($('img'+i)) $('img'+i).src='/images/icone/su.gif';
			eval("slide"+i+".hide();");
			//$('main'+i).style.background='#ffffff';
		}
	}
	
	function setTab(id) {
		var sfEls = document.getElementById(id).getElementsByTagName("A");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				sfEls2 = document.getElementById(this.id).getElementsByTagName("IMG");
				for (var j=0; j<sfEls2.length; j++) {
					sfEls2[j].src=sfEls2[j].src.replace('.gif','_a.gif');
				}
			}
			sfEls[i].onmouseout=function() {
				sfEls2 = document.getElementById(this.id).getElementsByTagName("IMG");
				for (var j=0; j<sfEls2.length; j++) {
					sfEls2[j].src=sfEls2[j].src.replace('_a.gif','.gif');
				}
			}
		}
	}
	
	
	function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
		var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
		var slider = new Slider(scrollbar, handle, {	
			steps: steps,
			mode: (horizontal?'horizontal':'vertical'),
			onChange: function(step){
				// Scrolls the content element in x or y direction.
				var x = (horizontal?step:0);
				var y = (horizontal?0:step);
				content.scrollTo(x,y);
			}
		}).set(0);
		if( !(ignoreMouse) ){
			// Scroll the content element when the mousewheel is used within the 
			// content or the scrollbar element.
			$$(content, scrollbar).addEvent('mousewheel', function(e){	
				e = new Event(e).stop();
				var step = slider.step - e.wheel * 30;	
				slider.set(step);					
			});
		}
		// Stops the handle dragging process when the mouse leaves the document body.
		$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
	}
