﻿function onLinkedInLoad() {
    IN.User.logout();

    IN.Event.on(IN, "auth", onLinkedInAuth);
}

function onLinkedInAuth() {
    IN.API.Profile("me").result(displayProfiles);
}

// 2. Runs when the Profile() API call returns successfully
function displayProfiles(profiles) {
    member = profiles.values[0];
    document.location.href = "/SocialProcess/LinkedInAuth/" + member.id;
}

$(document).ready(function () {
    $("#SignOnWithLK").click(function () {
        IN.User.logout();
        IN.User.authorize(onLinkedInAuth);
    });
    //alert(session_config.facebook_apiKey);
    social_load(session_config.facebook_apiKey);

    if ($.browser.mozilla) {
        $(document).keyup(checkKey)
    }
    else {
        $(document).keydown(checkKey);
    }

    $("form:first").validate();

    $("#password").focus(function (e) {
        $("#loginError").remove();
    });
});


function Submit() {
    //document.forms[0].submit();
    $("input:submit").click();

}

 function checkKey(e) {
    switch (e.keyCode) {
        case 13:
            $("#sign-in").click();
            break;
        default:
            break;
    }
}

