}, false);
    
    plot.addEventListener('mouseup', function(e){
        invalidate_plot_named(name);
    }, false);

    plot.addEventListener('mouseleave', function(e){
       draw_plot_named(name, 0, 0, false);
    }, false);
}

function draw_plot_named(name, client_x, client_y, do_guides) {
    plot = document.getElementById(name);
    var context = plot.getContext("2d");

    // background
    context.fillStyle="#eeeeee";
    context.fillRect(0, 0, w, h);
    
    // equations
    for(var i = 0; i < e