if("undefined" == check_user || !check_user || check_user === null){
	check_user = new Object();
}
var check_user;

check_user.ready = false;

check_user.main = function()
{
	check_user.ready = true;
}

check_user.init = function()
{
	loader = new YAHOO.util.YUILoader();
	loader.require('connection');
	loader.loadOptional = true;
	loader.insert({ onSuccess: check_user.main }); 
}

if (window.attachEvent)
{
	window.attachEvent("onload", function()
	{
		check_user.init();
	});
}
else
{
	window.addEventListener("load", function()
	{
		check_user.init();
	}, true);
}

checkUserTrans = null;

check_user.checkUser = function()
{
	email = document.getElementById('CheckUserUsername').value;
	if(email != '' && check_user.ready)
	{
		if(checkUserTrans != null)
		{
			YAHOO.util.Connect.abort(checkUserTrans)
		}
		var callback = { success: checkUserResponse };
		var post_data = escape('_method')+'=POST&'+escape('data[CheckUser][username]')+'='+escape(email);
		checkUserTrans = YAHOO.util.Connect.asyncRequest('POST', '/users/checkUser', callback, post_data);
	}
}

checkUserResponse = function(o)
{
	eval('response = ' + o.responseText);
	if(!response)
	{
		alert("You are not registered with USA Football under this e-mail address. Please click the Continue button at the bottom of the page to get started.\nIf you need additional assistance, please contact USA Football Member Services @ 877-536-6822.");
	}
	else
	{
		alert('Good News! You are registered with USA Football. Please sign in using this e-mail address and your password. If you have forgotten your password, please use the convenient Forgot Password link on this page.');
		document.getElementById('LoginNewUserUsername').value = document.getElementById('CheckUserUsername').value;
	}
}

