wolf.loginServices.onSignInSuccess      = signInHandler;
wolf.loginServices.onSignedOut          = signoutHandler;
wolf.loginServices.onBeforeFormLogin    = beforeFormLogin;
wolf.loginServices.appId				= "workspace";
wolf.loginServices.publicKey			= "91029832776182818272828";
wolf.loginServices.hostURL				= "http://workspace.wolfframeworks.com";

function beforeFormLogin()
{

    wolf.loginServices.loginBox     =   document.getElementById("te_sysUsers.WFlogin");
    wolf.loginServices.passwordBox  =   document.getElementById("te_sysUsers.WFpassword");

}

function signInHandler(inSession)
{
    //this is the place where any redirections or screen updations would need to be performed 
    //This function is only called on successfull sign in.
    
    var signinlinkElement = window.document.getElementById("signinlink");
    
    if(signinlinkElement == null)
    {
        setTimeout(function(){signInHandler(inSession)}, 100);
        return;
    }
    
    if(inSession == true)
    {
        var signInFormElement = document.getElementById("signinform");
        
        if(signInFormElement != null)
        {
            signInFormElement.style.display = "none"
        }

        if(signinlinkElement != null)
        {
            signinlinkElement.innerHTML = window.profileDocument.record.UserName + "<a title='Sign out' href='javascript:wolf.loginServices.signOut()'> ( Sign Out )</a>"
        }
    }
}

function signoutHandler()
{
    window.location = window.location.href;// "http://demo.wolfframeworks.com/signin.html";
}

wolf.loginServices.init();