


function MostraBox(nomepagina)
			{

				if (window.addEventListener)
				window.addEventListener('DOMMouseScroll', wheel, false);
				window.onmousewheel = document.onmousewheel = wheel;
				
				//$('contenutobox').setStyle({ height: '0px'});
				//alert($('contenutobox').getHeight());
				//alert($('provola').offsetTop);
				if($('fondopagina').offsetTop > document.body.clientHeight)
				{
					$('oscuro').style.height = $('fondopagina').offsetTop + 'px';
				}
				else
				{
					$('oscuro').style.height = document.body.clientHeight + 'px';
				}
				
				//alert($('oscuro').style.height);
				$('oscuro').show(); 
				Effect.Appear('box',{duration:0.2});
				
				//alert(document.body.scrollTop);
				//alert($('box').getStyle('marginTop'));
				$('box').style.marginTop = '-200px';
				var marginebox = $('box').getStyle('marginTop').replace('px','');
				marginebox = parseInt(marginebox);


				var scrollbody = $("bodyId").scrollTop;


				//var scrollbody = parseInt(document.body.scrollTop);
				
				var margineboxtot = marginebox + scrollbody;
				
				//alert(margineboxtot);
				
				$('box').style.marginTop = margineboxtot + 'px';
					
				$('box').morph
				('width:700px',
					{
						transition: Effect.Transitions.spring,duration:2, from: 0.5, to: 1 ,
						afterFinish: function(effect) 
						{
							$('box').morph
							('height:400px',
								{
								transition: Effect.Transitions.spring,duration:2,from: 0.5, to: 1,
								afterFinish: function(effect) 
									{
									Effect.Appear('chiudi',{duration:0.3});
									
									
									Effect.Appear('contenutobox',{duration:0,
									
									
									afterFinish: function(effect) 
									{
										//alert('ciao');
										
										$('contenutobox').scrollTop = 0;
										Effect.Appear('contenutoboxcontainer',{duration:0.3});
										
										
										$('contenutobox').scrollTop = 0;
										
									new Ajax.Updater('contenutoboxcontainer', nomepagina, 
									{
									method: 'get',
									onComplete: function() {
									//$('provola').update('pippo' + $('contenutobox').getHeight());
									//alert($('contenutoboxcontainer').clientHeight);
									//alert($('contenutoboxcontainer').getHeight());
										if($('contenutoboxcontainer').getHeight() > 350)
										{
											//alert('pippo');
											Effect.Appear('bottom',{duration:0.3});
											Effect.Appear('top',{duration:0.3});
											
											
										}
									
									}
									
									
									
									});
										
										
									}
									
									
									
									});
																
									
									
									
									}
								}
							);
						}
					}
				);
				
				
			}	



			function ChiudiBox()
			{
				if (window.removeEventListener)
				window.removeEventListener('DOMMouseScroll', wheel, false)
				window.onmousewheel =  document.onmousewheel = null;
				
				Effect.Fade('contenutobox',{duration:0.2});
				//Effect.Fade('contenutoboxcontainer',{duration:0.2});
				
				Effect.Fade('chiudi',{duration:0.3});
				Effect.Fade('bottom',{duration:0.3});
				Effect.Fade('top',{duration:0.3});

				Effect.Fade
				('box', 
					{
						afterFinish: function(effect) 
						{
							effect.element.setStyle({ width: '10px', height: '10px' })
							$('oscuro').hide();
							//alert($('contenutobox').scrollTop);
							//alert($('contenutoboxcontainer').scrollTop);
							
							

						}
				
					}
				);
		
				
			}



var controlclear = 0;
			var scrolltopbody = 0;
			
			function ScrollContenutoBottom(vel)
			{
				//alert('pippo');
				controlclear = 1;
				loop= true;
				scrolltimer= null;
				var element = $('contenutobox');
				var elementStr = 'contenutobox';
				speed= vel;
				
				if (loop == true)
				{
				
					element.scrollTop = element.scrollTop + speed;
					scrolltimer= setTimeout("ScrollContenutoBottom(" + vel + ")",20)

				}
				//scrolltopbody = document.body.scrollTop;
				
			}
			
			function ScrollContenutoTop(vel)
			{
				//alert('inizio');
				controlclear = 1;
				loop= true;
				scrolltimer= null;
				var element = $('contenutobox');
				var elementStr = 'contenutobox';
				speed= - vel;
				//alert('meta');
				
				if (loop == true)
				{
						//alert('prima');
					element.scrollTop = element.scrollTop + speed;
					scrolltimer= setTimeout("ScrollContenutoTop(" + vel + ")",20)
						//alert('dopo');

				}
				
				
				//scrolltopbody = document.body.scrollTop;

			}
			
			function ScrollContenutoStop()
			{
				//$("bodyId").scrollTop = scrolltopbody;

				if (controlclear==1)
				{
					loop = false;
					clearTimeout(scrolltimer);
					//document.body.scrollTop = scrolltopbody;
					
				}
				
			}
			
			
			
			/** This is high-level function; REPLACE IT WITH YOUR CODE.
			 * It must react to delta being more/less than zero.
			 */
			function handle(delta) {
				if (delta < 0)
					{
						//alert($('contenutobox').getStyle('display'));
						/* something. */;
						if ($('contenutobox').getStyle('display') != 'none')
						{
						//alert('ciaoooo2');
						ScrollContenutoBottom(50);
						ScrollContenutoStop();
						}
						
					
					}
					
				else
					{
						if ($('contenutobox').getStyle('display') != 'none')
						{
						/* something. */;
						ScrollContenutoTop(50);
						ScrollContenutoStop();
						}
					}
					
			}

			function wheel(event){

				var delta = 0;
				if (!event) event = window.event;
				if (event.wheelDelta) {
					delta = event.wheelDelta/120; 
					if (window.opera) delta = -delta;
				} else if (event.detail) {
					delta = -event.detail/3;
				}
				if (delta)
					handle(delta);
					if (event.preventDefault)
							event.preventDefault();
					event.returnValue = false;

			}

			/* Initialization code. */
			//if ($('contenutobox').getStyle('display') != 'none')
			//{
				//if (window.addEventListener)
				//window.addEventListener('DOMMouseScroll', wheel, false);
				//window.onmousewheel = document.onmousewheel = wheel;
			//}