isNN = document.layers ? 1 : 0; 

function noContext(){return false;}

function noClick(e){
    if(isNN){
        if(e.which > 1) {return false;}
    } else { 
        if(event.button > 1){return false;}
    }
}

if(isNN){ 
    document.captureEvents(Event.MOUSEDOWN);
}

document.oncontextmenu = noContext;
document.onmousedown   = noClick;
document.onmouseup     = noClick;