    
        
        /**
 * CONVERT WEB TO PDF GLOBALS
 */
var WTP_PLEASE_WAIT_TIMEOUT;

/**
 * wtp_please_wait - shows please wait message while the request is being processed
 */
function wtp_please_wait() 
{
    // FIXME this bit should be conditional
    document.getElementById('wtp_action_area1').style.display = 'none';
    document.getElementById('wtp_action_area2').style.display = 'block';

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

    // Repeat
    WTP_PLEASE_WAIT_TIMEOUT = setTimeout('wtp_please_wait()', 300)
}

/**
 * wtp_error_processing - shows an error message if the convert WEB to PDF module returns error
 */
function wtp_error_processing()
{
    // Stop the dots
    clearTimeout(WTP_PLEASE_WAIT_TIMEOUT);

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

/**
 * wtp_download - shows the download link to the created PDF
 * @download_link:  the PDF download link
 */
function wtp_download(download_link)
{
    // Stop the dots
    clearTimeout(WTP_PLEASE_WAIT_TIMEOUT);

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

