﻿var buttonAttributesArray = new Array(); // to hold button attributes

// this will disable any printable style buttons
function DisablePrintableButton(buttonId)
{
	var button = $(buttonId);
	var buttonAttributes = {
                    onclick: button.onclick,
                    href: button.getAttribute("href")
                };
    if (typeof (buttonAttributesArray[buttonId]) == 'undefined') 
    {
        buttonAttributesArray[buttonId] = buttonAttributes;
    }                
    button.onclick = function() { return false; }
    button.setAttribute("href", "javascript:void(0);");
    if (button.className.indexOf('btn-l') > -1)
        button.addClassName('btn-l-disabled');
    else if (button.className.indexOf('btn-m') > -1)
        button.addClassName('btn-m-disabled');
    else if (button.className.indexOf('btn-s') > -1)
        button.addClassName('btn-s-disabled');
    
    try { button.disabled = true; } catch(e) {}
}

// this will enable any printable style buttons
function EnablePrintableButton(buttonId)
{
    var buttonBookmarkOnClick = null;
    var buttonBookmarkHref = null;
    if (typeof (buttonAttributesArray[buttonId]) != 'undefined') 
    {
        buttonBookmarkOnClick = buttonAttributesArray[buttonId].onclick;
        buttonBookmarkHref = buttonAttributesArray[buttonId].href;
    }
	var button = $(buttonId);
	button.onclick = buttonBookmarkOnClick;   
    button.setAttribute("href", buttonBookmarkHref);             
    button.removeClassName('btn-l-disabled');
    button.removeClassName('btn-m-disabled');
    button.removeClassName('btn-s-disabled');
    try { button.disabled = false; } catch(e) {}
}