	// These functions are used throughout the site, many of which are included purely for historic and backward-compatibility issues.

	function GetHeightWidth(height, width)
	{
		var xposition=0, yposition=0, text;

		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;

		text = "height=" + height + ",width=" + width + ",screenx=" + xposition + ",screeny=" + yposition + ",left=" + xposition + ",top=" + yposition;
		return(text);
	}
	
	function OpenProfileWin(user_id)
	{
		window.open('/gold/profile/template.php3?id=' + user_id, 'profile' + user_id, GetHeightWidth(400, 490) + ',location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0');
	}

	function OpenGGWin()
	{
		window.open('/gold/account.php', 'goldwin');
	}

	function OpenSignupWin()
	{
		window.open('/gold/signup.php', 'signupwin');
	}

	function OpenTellFriendWin(topic, url)
	{
		window.open('/tellfriend.php3?title=' + escape(topic) + '&url=' + escape(url), 'tfwin', GetHeightWidth(450, 450) + ',location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0');
	}

	function OpenFlash(file, height, width, url, name)
	{
		window.open('/show_flash.php?file=' + file + '&height=' + height + '&width=' + width + '&url=' + url + '&name=' + name, name, GetHeightWidth(height + 42, width) + ',location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,hotkeys=0');
	}

	function OpenRememberExplainWin()
	{
		window.open('/gold/explainremember.html', 'explwin', GetHeightWidth(350, 400) + ',location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0');
	}

	function CheckSearch()
	{
		if(document.forms["search"].elements["terms"].value.length == 0)
		{
			document.forms["search"].elements["terms"].focus();
			alert("You must enter your search terms before clicking \"Search\".");
			return(false);
		}
		
		return(true);
	}
	
	function DoEncEmail(dom, recip, name)
	{
		var dom_parts = dom.split("|");

		document.write('<a href="mailto:');
		document.write(recip + "@");

		for(var i=(dom_parts.length-1); i>=0; i--)
		{
			document.write(dom_parts[i]);
			if(i!=0)
			{
				document.write(".");
			}
		}
		document.write('">' + name + '</a>');
	}

	function GetObject(name)
	{
		if(document.getElementById)
		{
			return document.getElementById(name);
		} else
		if(document.all)
		{
			return document.all[name];
		} else
		if(document.layers)
		{
			return document.layers[name];
		}
	}