﻿$(document).ready(function () {

    // Expand Panel
    $("form").submit(function () {

        FindJobOpportunities();

        return false;
    });

    $("#fb_logout").click(function () {

        FB.logout(function (response) {
            // user is now logged out
            location.reload(true);
        });

    });

});

$(document).ajaxStart(function () {
    $("#ajax_busy").show();
}).ajaxStop(function () {
    $("#ajax_busy").hide();
});


function FindJobOpportunities() {

    var url = '/services/jobopportunities?position=' + document.getElementById('txtPosition').value;
    $.ajax({
        type: "GET",
        url: url,
        success: function (data, textStatus, XMLHttpRequest) {
            // Set parameters
            $('#job_result').html(data);
        },
        error: function () {
            alert('FEJL');
        }

    });

}

