function showSubscribeOptions(id)
{
	hideElement("opt1");
	hideElement("opt2");
	hideElement("opt3");

	showElement(id);

	var	tb = (username == null ? "uname" : "pass");

	if (id == "opt1")
		document.forms['logon'].elements[tb].focus();
	else if (id == "opt2")
		document.forms['transfer'].elements['uname'].focus();
}

function transferAcct(f, dest)
{
//	var	f = document.forms["transfer"];

	var	a = new ajaxRequest();

	a.setCallbackParam(f.uname.value);

	if (typeof(dest) != "undefined")
		a.setCallbackParam(dest);

	a.getData("/servlet/proxy?tgt=user&attr=transfer&uname=" + f.uname.value + "&pass=" + f.pass.value + (typeof(clientID) != "undefined" ? "&clientID=" + clientID : ""), transferAcctCallback);

	return false;
}

function transferAcctCallback(xml, params)
{
//	alert(xml);

	var	error = getValue(xml, "user.transfer.error");

	if (error != null)
	{
		switch (error)
		{
			case "UT001":
				alert("An account already exists for the user name \"" + params[0] + "\".\n\nMake sure this is the correct user name for your Day At The Track account, otherwise your account has already been transferred and you can log in using Option #1 above.");
			break;

			case "UT002":
				alert("Your account was located on Day At The Track, but it could not be created on Racing Day because of an internal error.\n\nPlease try again in a few minutes or contact Customer Service.");
			break;

			case "UT003":
				alert("An account for user name \"" + params[0] + "\" could not be found on Day At The Track.\n\nPlease contact Customer Service for assistance.");
			break;

			case "UT004":
				alert("An account for user name \"" + params[0] + "\" found, but password is not correct.\n\nPlease make sure you are using the correct password or contact Customer Service for assistance.");
			break;

			default:
				alert("An unknown error has occurred transferring your account.\n\nPlease contact Customer Service for assistance.");
			break;
		}
	}
	else
	{
		alert("Your account has been successfully transferred.\n\nYou can begin using Racing Day immediately.");

		if (params.length > 1)
			document.location = params[1];
		else
			document.location.reload();
	}
}

function showOverlay()
{
	if (isIE)
		document.body.style.overflow = "hidden";
	else
		document.styleSheets[0].insertRule("html { overflow:hidden; }",
			document.styleSheets[0].cssRules.length);

	var	div = getElement("overlay");

	// DHTML menu builder call to control visibility

	if (typeof(tbVisC) != "undefined")
	{
		tbVisC[1] = new Function("return false");
		SetupToolbar();
	}

	div.style.width = document.body.clientWidth;
	div.style.height = document.body.clientHeight;

	div.style.visibility = "visible";

	window.onresize = function() { if (onresizeFunc) onresizeFunc(); showOverlay() };

	showSubscribeOptions('opt1');
}

function hideOverlay()
{
	if (isIE)
		document.body.style.overflow = "auto";
	else
		document.styleSheets[0].insertRule("html { overflow:-moz-scrollbars-vertical; }",
			document.styleSheets[0].cssRules.length);

	var	div = getElement("overlay");

	div.style.width = 100;
	div.style.height = 100;

	div.style.visibility = "hidden";

	// DHTML menu builder call to control visibility

	tbVisC[1] = new Function("return true");
	SetupToolbar();

	// needed to trigger menu to position itself correctly

	window.scroll(1,1);
	window.scroll(0,0);

	window.onresize = new function() { if (onresizeFunc) onresizeFunc(); };
}

var onresizeFunc = window.onresize;
