/**
* Ajax errors will show on staging only
* OR when querystring contains 'ajax_debug" param
*/
if (location.host.match(/scramble/)
    || location.search.match(/ajax_debug/))
{
    $(setAjaxErrorHandler);
}

function setAjaxErrorHandler()
{
    //set up global AJAX error handler
    $('body').ajaxError(function(e, XMLHttpRequest, settings)
    {
        var msg = '';
        for (var i in settings) {
            msg += i + ': '+ settings[i] + '\n';
        }
        if (XMLHttpRequest && XMLHttpRequest.responseText) {
            msg += 'response (if available): ' + XMLHttpRequest.responseText;
        }
        alert('Oops, sorry. There was an ajax error. Here is some troubleshooting information:\n' + msg);
    });
}

//set the global site_id variable; required for User Profile, Universal Feed
var site_id = 127;
