// JavaScript Document
	function lfGetWindowWidth()
	{
		var liWinWidth		= 0;
		if (self.innerWidth) 
		{ 
			// all except Explorer
			liWinWidth = self.innerWidth;
		} 
		else if (document.documentElement && document.documentElement.clientWidth) 
		{ 
			// Explorer 6 Strict Mode
			liWinWidth = document.documentElement.clientWidth;
		}
		else if (document.body) 
		{ 
			// other Explorers
			liWinWidth = document.body.clientWidth;
		}
		return liWinWidth;
	}
	
	function lfGetWindowHeight()
	{
		var liWinHeight	= 0;
		if (self.innerHeight) 
		{ 
			// all except Explorer
			liWinHeight = self.innerHeight;
		} 
		else if (document.documentElement && document.documentElement.clientHeight) 
		{ 
			// Explorer 6 Strict Mode
			liWinHeight = document.documentElement.clientHeight;
		}
		else if (document.body) 
		{ 
			// other Explorers
			liWinHeight = document.body.clientHeight;
		} 
		return liWinHeight;
	}
		
	function lfLoad()
	{
		lfSoundOnOff(false);
	}

	function lfCleanLogo()
	{
		if (document.getElementById('imgLogo') != null)
		{
			if (document.getElementById('imgLogo').filters.alpha.opacity < 100)
			{
				document.getElementById('imgLogo').filters.alpha.opacity += 20;
			}
		}
	}
	
	function lfCheckPosition(loObj, liLeft, liTop, liWidth, liHeight)
	{
		var windowWidth	= lfGetWindowWidth();
		var windowHeight= lfGetWindowHeight();
		var liMyLeft	= Math.round((liLeft * windowWidth) / 1024);
		var liMyTop		= Math.round((liTop * windowHeight) / 768);
		var liMyX		= Math.round(((liLeft + liWidth) * windowWidth) / 1024);
		var liMyY		= Math.round(((liTop + liHeight) * windowHeight) / 768);
		
		if ((event.clientX >= liMyLeft) && (event.clientX <= liMyX))
		{
			if ((event.clientY >= liMyTop) && (event.clientY <= liMyY))
			{
				loObj.style.cursor	= 'hand';
			}
			else
			{
				loObj.style.cursor	= 'auto';
			}
		}
		else
		{
			loObj.style.cursor	= 'auto';
		}
	}
	
	function lfDoClick(loObj, lsUrl)
	{
		if (loObj.style.cursor == 'hand')
		{
			document.location.href = lsUrl;
		}
	}
	
	function lfImgWindow(lsImgUrl, liLarghezza, liAltezza, liPosX, liPosY)
	{
		lfOpenWindow(lsImgUrl, liLarghezza, liAltezza, liPosX, liPosY, 0, 0, 0, 0, 0, 0, 0);
	}
	
	function lfOpenWindow(lsPagina, liLarghezza, liAltezza, liPosX, liPosY, liDirectories, liLocation, liMenubar, liResizable, liScrollbars, liStatus, liToolbar)
	{
		window.open(lsPagina, null, 'width=' + liLarghezza + ',height=' + liAltezza + ',left=' + liPosX + ',top=' + liPosY +
					',screenX=' + liPosX + ',screenY=' + liPosY + ',directories=' + liDirectories + ',location=' + liLocation + 
					',menubar=' + liMenubar + ',resizable=' + liResizable + ',scrollbars=' + liScrollbars + ',status=' + liStatus +
					',toolbar=' + liToolbar);
	}
	
	function lfSoundOnOff(lbOn)
	{
		if (document.all.Musica != null)
		{
			if (lbOn)
			{
				document.all.Musica.src	= 'audio/Bubble.bobble.01.mid';
			}
			else
			{
					
				document.all.Musica.src	= '';
			}
		}
	}
	
	/* Gestione QueryString */
	function PageQuery(q)
	{
		if (q.length > 1)
		{
			this.q	= q.substring(1, q.length);
		}
		else
		{
			this.q	= null;
		}
		this.keyValuePairs	= new Array();
		if (q) 
		{
			for (var i=0; i < this.q.split("&").length; i++) 
			{
				this.keyValuePairs[i]	= this.q.split("&")[i];
			}
		}
		this.getKeyValuePairs	= 	function() { return this.keyValuePairs; }
		this.getValue 			=	function(s) 
									{
										for (var j=0; j < this.keyValuePairs.length; j++) 
										{
											if (this.keyValuePairs[j].split("=")[0] == s)
											{
												return this.keyValuePairs[j].split("=")[1];
											}
										}
										return false;
									}
		this.getParameters		=	function() 
									{
										var a		= new Array(this.getLength());
										for (var j=0; j < this.keyValuePairs.length; j++)
										{
											a[j]	= this.keyValuePairs[j].split("=")[0];
										}
										return a;
									}
		this.getLength			=	function() { return this.keyValuePairs.length; }
	}
	
	function queryString(key)
	{
		var page = new PageQuery(window.location.search);
		return unescape(page.getValue(key));
	}
	/* Fine Gestione QueryString */
	
	function preloadImages() 
	{
		if (!document.images) return;
		var wl = new Array();
		var arguments = preloadImages.arguments;
		for (var i = 0; i < arguments.length; i++) 
		{
			wl[i] = new Image();
			wl[i].src = arguments[i];
		}
	}
	
	function ViewImage(lsImg, lbView, liWinHeight, liWinWidth)
	{
		if (lsImg != '')
		{
			window.parent.document.getElementById('imgLayer').src	= lsImg;
		}
		else
		{
			window.parent.document.getElementById('imgLayer').src	= '';
		}
		if (lbView)
		{
			var liImgWidth	= 450;
			var liImgHeight	= 366;
			window.parent.document.getElementById('divImages').style.display	= 'block';
			window.parent.document.getElementById('divImages').style.left		= Math.round((liWinWidth - liImgWidth) / 2);
			window.parent.document.getElementById('divImages').style.top		= Math.round((liWinHeight - liImgHeight) / 2);
			/*if (event.screenX > 500)
			{
				window.parent.document.getElementById('divImages').style.left	= 500;
			}
			else
			{
				window.parent.document.getElementById('divImages').style.left	= event.screenX;
			}
			window.parent.document.getElementById('divImages').style.top		= event.y;*/
		}
		else
		{
			window.parent.document.getElementById('divImages').style.display	= 'none';
		}
	}
	
	var goDiv;
	var goDivChiudi;
	var goDivTesto;
	var goImg;
	var gsImgSrc;
	
	function AppearDiv(lsDiv, /*lsDivChiudi,*/ lsDivTesto, lbView, liWidth, liHeight)
	{
		goDiv		= $(lsDiv);
		//goDivChiudi	= $(lsDivChiudi);
		goDivTesto	= $(lsDivTesto);
		/*goImg		= $(lsImg);
		gsImgSrc	= lsImgSrc;*/
		if (lbView)
		{
			/*if (lsImgSrc != '')
			{
				goImg.src			= lsImgSrc;
			}*/
			var liWinHeight 		= lfGetWindowHeight();
			var liWinWidth			= lfGetWindowWidth();
			goDiv.style.left		= Math.round((liWinWidth - liWidth) / 2) + document.body.scrollLeft;
			goDiv.style.top			= Math.round((liWinHeight - liHeight) / 2) + document.body.scrollTop;
			goDiv.style.width		= liWidth;
			goDiv.style.height		= liHeight;
			//goDivChiudi.style.width	= liWidth;
			goDivTesto.style.width	= liWidth;
			if ((goDiv.style.display == '') || (goDiv.style.display == 'inline') || (goDiv.style.display == 'block'))
			{
				goDiv.style.display	= 'none';
			}
			Effect.Appear(goDiv/*, {beforeStart: BeforeAppear, afterUpdate: AfterUpdate}*/);
		}
		else
		{
			Effect.Fade(goDiv/*, {afterFinish: AfterDisappear}*/);
		}
	}
	
	function AfterDisappear(loObj)
	{
		goImg.src		= '';
	}
	
	function BeforeAppear(loObj)
	{
		document.body.style.cursor	= 'wait';
		if (gsImgSrc != '')
		{
			goImg.src	= gsImgSrc;
		}
	}
	
	function AfterUpdate(loObj)
	{
		if (!goImg.src.complete)
		{
			return;
		}
		document.body.style.cursor	= 'default';
	}
	
	//setInterval('lfCleanLogo()', 100);