var browser = new Browser();

function Browser() {  
		
	var _info = navigator.userAgent; 
	// alert(_info);
	this.ns = ( _info.indexOf("Netscape") > 0 );

	this.ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0
	  && _info.indexOf("Opera") < 0 && !this.ns );
	this.mz = (_info.indexOf("Mozilla") > -1 && _info.indexOf("Gecko") > 0
	   && _info.indexOf("MSIE") < 1 && _info.indexOf("Opera") < 0 );
	this.op = ( _info.indexOf("Opera") > -1 );
	
	if( this.ns ) {
		var ve = _info.indexOf("Netscape");
		this.version = parseFloat( _info.substr( ve+9 ) );
	}
	 else if (this.ie){ // Internet Explorer return '4.0 (compatible; MSIE 5.5...'
		var ve = _info.indexOf("MSIE");
		this.version = parseFloat(_info.substr(ve+4));
	}
	 else if(this.op) {
		var ve = _info.indexOf("Opera");
		this.version = parseFloat(_info.substr(ve+6));
	}
	 else if( this.mz ) {
		var ve = _info.indexOf("rv:");
		this.version = parseFloat(_info.substr(ve+3));
	}
	 else {
		this.version = parseFloat(_info);
	}

//	this.ns = (this.bw == "ns" && this.v >= 4);
//	this.ns4 = (this.bw == "ns" && this.v == 4);
	this.ns8 = (this.ns && Math.floor( this.version ) == 8 );

	this.ie4  = (_info.indexOf('MSIE 4') > 0);
	this.ie5  = (_info.indexOf('MSIE 5') > 0);
	this.ie55 = (_info.indexOf('MSIE 5.5') > 0); 
	this.ie6  = (_info.indexOf('MSIE 6') > 0); 

	this.toString = function() {
		var name = "";
		var ver = this.version;
		if( this.ie ) {
			name = "MSIE";
			ver = ( this.version == 6 ) ? this.version+".0" : this.version;
		}
		else if( this.mz ) name = "Mozilla";
		else if( this.op ) name = "Opera";
		else if( this.ns ) {
			name = "Netscape";
			ver = ( this.version == 8 ) ? this.version+'.0' : this.version;
		}

		return name +" "+ ver;
	}

	this.winNT_40 = ( _info.indexOf('Windows NT 4.0') > 0 );
	
	this.dom  = (document.getElementById) ? true : false;
	
}