// Zendesk's Dropbox init
// To use the dropbox, apply the attribute class="support_link" on an html element
$(document).ready(function (){
    if (typeof(Zenbox) !== "undefined") {
        var user = null;
        $.ajax(
        {
            url: '/sfGuardUser/current/',
            dataType: 'json',
            success: function (data) {
                data = $.parseJSON(data);
                Zenbox.init({
                    dropboxID:   "20019023",
                    url:         "https://touscoprod.zendesk.com",
                    tabID:       "support",
                    tabColor:    "black",
                    tabPosition: "Right",
                    hide_tab:    "True",
                    requester_name: data.firstname + " " + data.lastname,
                    requester_email: data.email
                });
            },
            error: function () {
                Zenbox.init({
                    dropboxID:   "20019023",
                    url:         "https://touscoprod.zendesk.com",
                    tabID:       "support",
                    tabColor:    "black",
                    tabPosition: "Right",
                    hide_tab:    "True"
                });
            }
        });
        
        
    }
    var links = $('.support_link');
    links.css('cursor', 'pointer');
    links.bind('click', function (){
        window.Zenbox.show();
    });
});
