	function getStageHeight()
	{
		//alert(document.body.clientHeight + ":" + document.body.clientWidth);
	}
	
	function gotoURL(url)
	{
		window.location.href = url;
	}
	
	function bigImageName(image)
	{
		var string = image.src;
		string = string.slice(0,(string.length - 7));
		return string;
	}
	function hidebigimage()
	{
		document.getElementById("bigimage").style.display = "none";
		document.getElementById("bigimageback").style.display = "none";
		document.getElementById("bigimagenote").style.display = "none";
		document.getElementById("theweed").style.display = "none";
		document.getElementById("midnightsnaque").style.display = "none";		
		document.getElementById("3dreel").style.display = "none";
	}
	function URL()
	{
		return "http://www.meltygames.com/shionyr/";
	}
	function showimgpreview(event, image)
	{
		var mouseX = event.clientX;
		var mouseY = event.clientY;
		
		//change image and get width and height.
		document.getElementById("imgpreviewframeimg").removeAttribute("width");
		document.getElementById("imgpreviewframeimg").removeAttribute("height");
		
		document.getElementById("imgpreviewframeimg").src = bigImageName(image) + "_small.jpg";

		var imgHeight = document.getElementById("imgpreviewframeimg").height;
		var imgWidth = document.getElementById("imgpreviewframeimg").width;

		//calculate the max of the width / height and use that to determine the ratio height of other things.
		var Ratio = 300 / Math.max(imgHeight, imgWidth);
		imgHeight *= Ratio;
		imgWidth *= Ratio;
			//alert ("ELSE");

		if (DocumentHeight() < (mouseY + imgHeight))
		{
			//if thing goes below bottom of page, reposition.
			document.getElementById("imgpreviewframeimg").style.height = imgHeight + "px";
			document.getElementById("imgpreviewframeimg").style.width = imgWidth + "px";
			document.getElementById("imgpreviewframeimg").style.bottom = "10px";
			document.getElementById("imgpreviewframeimg").style.left = "10px";
			
			document.getElementById("imgpreview").style.display = "block";
			document.getElementById("imgpreview").style.top = mouseY - imgHeight - 35 + "px";
			document.getElementById("imgpreview").style.left = mouseX - imgWidth - 35 + "px";
			document.getElementById("imgpreview").style.width = imgWidth + 30 + "px";
			document.getElementById("imgpreview").style.height = imgHeight + 30 + "px";
			
			document.getElementById("imgpreviewframe").style.width = imgWidth + 20 + "px";
			document.getElementById("imgpreviewframe").style.height = imgHeight + 20 + "px";
			document.getElementById("imgpreviewframe").style.top = "0px";
	
			document.getElementById("imgpreviewpointer").style.top = "auto";
			document.getElementById("imgpreviewpointer").style.bottom = "0px";
			document.getElementById("imgpreviewpointer").style.right = "0px";
			document.getElementById("imgpreviewpointer").src = "images/pointerlow.gif";

		}
		
		else
		{
			document.getElementById("imgpreviewframeimg").style.height = imgHeight + "px";
			document.getElementById("imgpreviewframeimg").style.width = imgWidth + "px";
			document.getElementById("imgpreviewframeimg").style.bottom = "10px";
			document.getElementById("imgpreviewframeimg").style.left = "10px";
			
			document.getElementById("imgpreview").style.display = "block";
			document.getElementById("imgpreview").style.top = mouseY + 5 + "px";
			document.getElementById("imgpreview").style.left = mouseX - imgWidth - 35 + "px";
			document.getElementById("imgpreview").style.width = imgWidth + 30 + "px";
			document.getElementById("imgpreview").style.height = imgHeight + 30 + "px";
			
			document.getElementById("imgpreviewframe").style.width = imgWidth + 20 + "px";
			document.getElementById("imgpreviewframe").style.height = imgHeight + 20 + "px";
			document.getElementById("imgpreviewframe").style.bottom = "0px";
	
			document.getElementById("imgpreviewpointer").style.top = "0px";
			document.getElementById("imgpreviewpointer").style.bottom = "auto";
			document.getElementById("imgpreviewpointer").style.right = "0px";
			document.getElementById("imgpreviewpointer").src = "images/pointer.gif";
		}
	}
	function hideimgpreview()
	{
		document.getElementById("imgpreview").style.display = "none";
	}
	function showYoutubeMovie(name)
	{
		document.getElementById("theweed").style.display = "none";
		document.getElementById("midnightsnaque").style.display = "none";
		document.getElementById("3dreel").style.display = "none";

		document.getElementById("bigimageloading").style.left = (DocumentWidth() / 2) - 50 + "px";
		document.getElementById("bigimageloading").style.top = (DocumentHeight() / 2) - 50 + "px";

		document.getElementById("bigimageback").style.display = "block";

		document.getElementById(name).style.top = (DocumentHeight() / 2) - 192 + "px";
		document.getElementById(name).style.left = (DocumentWidth() / 2) - 240 + "px";
		document.getElementById(name).style.display = "block";
	}
	
	function loadFullImage(a)
	{		
		getStageHeight();

		document.getElementById("theweed").style.display = "none";
		document.getElementById("midnightsnaque").style.display = "none";		
		document.getElementById("3dreel").style.display = "none";
		
		hideimgpreview();

		document.getElementById("bigimage").removeAttribute("width");
		document.getElementById("bigimage").removeAttribute("height");		
		document.getElementById("bigimage").removeAttribute("src");		
		document.getElementById("bigimage").src = bigImageName(a) + ".jpg";
		
		document.getElementById("bigimageloading").style.left = (DocumentWidth() / 2) - 50 + "px";
		document.getElementById("bigimageloading").style.top = (DocumentHeight() / 2) - 50 + "px";

		document.getElementById("bigimageback").style.display = "block";
		var t=setTimeout("imageLoadCallback()",100);
	}
	
	function imageLoadCallback()
	{
		//alert("CALLBACK");
		if (document.getElementById("bigimage").complete)
		{
			displayFullImage();
		}
		else
		{
			var t=setTimeout("imageLoadCallback()",100);	
		}
	}
	/*
	*/
	function displayFullImage()
	{
		//alert("LOADED");
		var Width = document.getElementById("bigimage").width;
		var Height = document.getElementById("bigimage").height;

		//downsize it to be the size of the screen by finding out if it's a vertical or horizontal image.
		var Ratio = Math.max(Width / (DocumentWidth()), Height / (DocumentHeight()));
		Width = Width / Ratio - 40;
		Height = Height / Ratio - 40;
		
		document.getElementById("bigimage").height = Height;
		document.getElementById("bigimage").width = Width;		
		
		document.getElementById("bigimage").style.left = (DocumentWidth() / 2) - Width/2 + "px";
		//document.getElementById("bigimage").style.top = (window.innerHeight / 2) - Height/2 + "px";
		document.getElementById("bigimage").style.top = 0;

		document.getElementById("bigimage").style.display = "block";		

		document.getElementById("bigimagenote").style.left = (DocumentWidth() / 2) - 300 + "px";
		document.getElementById("bigimagenote").style.display = "block";
	}
	function openLink(a)
	{
		//alert(a);
		window.location.href = a;
	}
	function alertHello(a)
	{
		//alert("HELLO");
		//alert("ScreenY: " + window.pageYOffset);
		document.getElementById("bgLayer2").style.top = window.pageYOffset * -0.2 + "px";
	}
	
	function DocumentHeight()
	{
		if (navigator.appName == "Netscape") return window.innerHeight;
		else return document.documentElement.clientHeight;
	}
	
	function DocumentWidth()
	{
		if (navigator.appName == "Netscape") return window.innerWidth;
		else return document.documentElement.clientWidth;
	}
	
	function centerBG()
	{
		//add functionality for setting #container.style.minHeight.
		//alert(document.body.clientHeight);
		/*
		if (navigator.appName == "Netscape") document.getElementById("container").style.minHeight = window.innerHeight + "px";
		else 
		{
			document.getElementById("container").style.minHeight = document.documentElement.clientHeight + "px";
			//document.getElementById("container").style.marginBottom = "-50px";
		}
		*/
		document.getElementById("container").style.minHeight = DocumentHeight() + "px";
		
		//document.getElementById("container").style.minHeight = document.body.clientHeight + "px";
		//alert("HELLO");
		//document.getElementById("container").style.minHeight = document.body.offsetHeight + "px";
		//alert(document.readyState);
		
		//document.getElementById("bgLayer1").style.left = (window.innerWidth/2 - 512);
		//document.getElementById("bgLayer2").style.left = (window.innerWidth/2 - 512);
		//document.getElementById("wrap").style.minHeight = (window.innerHeight - 243);
		//document.getElementById("bgLayer2").style.left = window.innerWidth * * -0.2;		
	}

	function centerBG2()
	{
		//add functionality for setting #container.style.minHeight.
		//alert(document.documentElement.clientHeight);
		//document.getElementById("container").style.minHeight = document.getElementById("screensize").height + "px";
		document.getElementById("container").style.minHeight = document.documentElement.clientHeight + "px";
		//document.getElementById("container").style.height = "100%";
		
		//document.getElementById("bgLayer1").style.left = (window.innerWidth/2 - 512);
		//document.getElementById("bgLayer2").style.left = (window.innerWidth/2 - 512);
		//document.getElementById("wrap").style.minHeight = (window.innerHeight - 243);
		//document.getElementById("bgLayer2").style.left = window.innerWidth * * -0.2;		
	}
