var adapterURI = "";

function UserLogIn()
{
    adapterURI = "http://games-auth.netzero.net/ProcessAuthentication.ashx?channel=110266250&cmd=1";
    StartAuthenticationFlow(false);
}

function UserLogOut()
{
    	adapterURI = "http://games-auth.netzero.net/ProcessAuthentication.ashx?channel=110266250&cmd=2";
    	StartAuthenticationFlow(true);
}

function UserRegister()
{
    adapterURI = "http://games-auth.netzero.net/ProcessAuthentication.ashx?channel=110266250&cmd=3";
    StartAuthenticationFlow(false);
}

function StartAuthenticationFlow(IsLogout)
{
    var FullURL = window.location.href;
    if(FullURL.indexOf("Launcher") > -1)
    {
		if(IsLogout == true)
		{
			window.open(adapterURI + "&sender=la","logout","scrollbars=no,resizable=no, width=1,height=1,top=500, left=500");  
			window.focus();
		}
		else
		{
			window.open(adapterURI + "&sender=la","login","scrollbars=yes,resizable=yes, width=800,height=450");    
		}
    }
    else
    {
		if(IsLogout == true)
		{
			window.open(adapterURI + "&sender=la","logout","scrollbars=no,resizable=no, width=1,height=1,top=500, left=500");    
			window.focus();
		}
		else
		{
				window.location = adapterURI + "&sender=gc";   
		}
	}
}