﻿function clearTextContent(instance)
{
    instance.value = '';
}

function AuthenticateUser()
{
    serviceProxy = new myshoes.dk.Shoehorn();
    
    serviceProxy.set_defaultSucceededCallback(SucceededCallback);
    serviceProxy.set_defaultFailedCallback(FailedCallback);
    
    var login = window.document.getElementById('loginUserName');
    var password = window.document.getElementById('loginPassword');
    
    serviceProxy.AuthenticateUser(login.value, password.value);
}

function SucceededCallback(result)
{    
    if(result)
        window.document.location = window.document.location + '?uid=' + Math.random() * 100000;
    else
        alert('Brugernavn blev ikke fundet'); 
}

// Callback function invoked when a call to 
// the  service methods fails.
function FailedCallback(error, userContext, methodName) 
{
    alert(error.get_message());
}

