    
        
        /**
 * REMOVE RESTRICTIONS GLOBALS
 */
var RR_PLEASE_WAIT_TIMEOUT;

/**
 * rr_please_wait - shows please wait message while file is being processed
 */
function rr_please_wait() 
{
    // FIXME this bit should be conditional
    document.getElementById('rr_action_area1').style.display = 'none';
    document.getElementById('rr_action_area2').style.display = 'block';

    // Rotate dots
    var e_dots = document.getElementById('rr_please_wait_dots');
    var dots = e_dots.innerHTML;
    if (dots.length < 5) {
        dots += '.';
        e_dots.innerHTML = dots;
    } else {
        e_dots.innerHTML = '';
    }

    // Repeat
    RR_PLEASE_WAIT_TIMEOUT = setTimeout('rr_please_wait()', 300)
}

/**
 * rr_error_processing - shows an error message if the restriction removal module returns error
 */
function rr_error_processing()
{
    // Stop the dots
    clearTimeout(RR_PLEASE_WAIT_TIMEOUT);

    // Update UI
    document.getElementById('rr_action_area2').innerHTML = '<p><span class="red">Error! </span>An error occurred while processing your file, please <a href="javascript:;" onClick="javascript: window.location.href = window.location.href;">try again<\/a>.<\/p>';
}

/**
 * rr_download - shows the download link to the processed and hopefully freed file
 * @download_link:  the freed file download link
 */
function rr_download(download_link)
{
    // Stop the dots
    clearTimeout(RR_PLEASE_WAIT_TIMEOUT);

    // Update UI
    document.getElementById('rr_action_area2').innerHTML = '<p><span class="red">Done! </span>You can now <a href="' + download_link + '">download freed<\/a> or <a href="javascript:void(null);" onClick="javascript: window.location.href = window.location.href;">free another file<\/a>.<\/p>';
}

