	function Hide()
	{
		TimeLeft = Speed/1000;		
						
		var a=document.getElementById('A');
		var b=document.getElementById('B');
		
		var ie=false;
		
		if (navigator.appName=='Microsoft Internet Explorer')
			ie=true;
		
		var des=document.getElementById('Description');
		if (Test==0)
		{ 
			if ((a.style.opacity!=0) && (parseFloat(a.style.opacity)>0))
			{
				des.href=galleriaLink;
				document.getElementById('Progress').innerHTML=(Cur+1)+' di '+nfoto;
				des.innerHTML=descr[Cur];
				if (ie)
				{
					a.filters[0].opacity=a.filters[0].opacity-5;
					b.filters[0].opacity=b.filters[0].opacity+5;
				} 
				a.style.opacity=parseFloat(a.style.opacity)-0.05;
				b.style.opacity=parseFloat(b.style.opacity)+0.05;
			} else {
				clearInterval(showtime);
				if (Cur+1>=imgar.length)
				{
					a.src=imgar[0];
					Cur =0;
				}
				else
				{
					a.src=imgar[Cur+1];
					Cur++;
				}
				setTimeout('dummy(' + Speed + ')',0);
				Test=1;
			}
		} else {
			if ((b.style.opacity!=0) && (parseFloat(b.style.opacity)>0))
			{
				des.href=galleriaLink;
				des.innerHTML=descr[Cur];
				document.getElementById('Progress').innerHTML=(Cur+1)+' di '+nfoto;
				if (ie)
				{
					a.filters[0].opacity=a.filters[0].opacity+5;
					b.filters[0].opacity=b.filters[0].opacity-5;
				} 
				a.style.opacity=parseFloat(a.style.opacity)+0.05;
				b.style.opacity=parseFloat(b.style.opacity)-0.05;
			}
			else
			{
				clearInterval(showtime);
				if (Cur+1>=imgar.length)
				{
					b.src=imgar[0];
					Cur =0;
				} else {
					b.src=imgar[Cur+1];
					Cur++
				}
				setTimeout('dummy(' + Speed + ')',0);
				Test=0;
			}
		}
	}

	function slideshow(){
		showtime = setInterval("Hide()", 50);
	}
	
	function foo() {
		showtime=setInterval("Hide()",50);
	}

	function Init(){
		setTimeout("slideshow()",Speed);
	}
	
	function dummy(t)
	{
		oInterval= window.setInterval("donothing(" + (t/1000) + ")",1000);
	}
	
	function donothing(k)
	{
		TimeLeft--;
		if (TimeLeft==0)
		{
			window.clearInterval(oInterval);
			foo();
		}
	}


	function SetSpeed(t,k)
	{

		Speed = t;
		document.getElementById("Link1").className= document.getElementById("Link2").className=document.getElementById("Link3").className ='LinkNotBold';
		document.getElementById(k).className='LinkBold';
	}
	
	function findPosX(objtesto)
	{
		var obj = document.getElementById(objtesto);
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function findPosY(objtesto)
	{
		var obj = document.getElementById(objtesto);
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}