function InE(){//detect IE 
	
	if(!window.ActiveXObject) return 0;

	if(document.all && document.all.item && !window.opera){
		var ie7 = (window.XMLHttpRequest) ? true : false;
		if(ie7)	return "Internet Explorer/7";
	}
	else return "Internet Explorer/6";
}

function op(){//detect Opera
	if(window.opera){
		if(window.getSelection)return  "Opera/9" ;
		if(document.createProcessingInstruction && (new XMLHttpRequest()).getAllResponseHeaders) return "Opera/8" ;
		if(document.readyState){return "Opera/7";}
		if(window.print){return "Opera/6" ;}
		return "Opera/6" ;
	}
	return 0
}
 function detectBr(){	
	var res = op();
	if(res != 0) return res;

	res = InE();
	if(res != 0) return res;

	var FF3=(function x(){})[-5]=='x'
	if(FF3)  return "Mozila Firefox/3"

	var FF2=(function x(){})[-6]=='x';
	if(FF2) return "Mozila Firefox/2"

	var Saf=/a/.__proto__=='//'; 
	if(Saf) return "Safari/3"

	var Chr=/source/.test((/a/.toString+''));
	if(Chr) return "Chrome/1"	
}

function main(){
	detectBr();
	var br = detectBr();
	var bv = br.split("/");
	var b = document.getElementById('browser');
	b.innerHTML += "Браузер: " + bv[0] + "<br>";
	b.innerHTML += "Версия: " + bv[1];
}

setTimeout("main()", 150)

