How would i detect netscape 6 within a javascript, and distingush between netscape 4.7 and earlier, with NS6?

for example:

//var IE = (document.all)? 1 : 0;
//var NS = (document.layers)? 1: 0;