﻿/* global ajax handlers
--------------- */

$(document).ready(function() {

    // error
    $("#global_error").ajaxError(function(event, request, settings) {
        $(this).html("<strong class='failure'>Error requesting page " + settings.url + "</strong>");
    });
    // loading... div
    $("#loader_background").bind("ajaxSend", function() {
        $(this).show();
    }).bind("ajaxComplete", function() {
        $(this).hide();
    }).bind("ajaxError", function() {
        $(this).hide();
    });
    $("#loader").bind("ajaxSend", function() {
        $(this).show();
    }).bind("ajaxComplete", function() {
        $(this).hide();
    }).bind("ajaxError", function() {
        $(this).hide();
    });
    // job description dialog
    if (typeof(language) != 'undefined') {
        var jobDescriptionButtons = {};
        jobDescriptionButtons[language['Print']] = function() {
            window.print();
            $(this).dialog('close');
        };
        jobDescriptionButtons[language['Apply']] = function() {
            __ApplyForJob();
            $(this).dialog('close');
        };
        $('#job_description_dialog').dialog({
            autoOpen: false,
            bgiframe: true,
            position: [10, 100],
            width: 960,
            buttons: jobDescriptionButtons
        });    
    }
});