function RRequest(url, pars, fn, method){
	var xmlHttp = (function(){
		try{
			return new XMLHttpRequest();	
		}catch(e){
			try{
				return new ActiveXObject('Msxml2.XMLHTTP');	
			}catch(e){
				return new ActiveXObject('Microsoft.XMLHTTP');	
			}
		}
	})();
	
	if(!method) method = 'post';
	var val = [];
	for(var pro in pars)
		val.push(pro+'='+encodeURIComponent(pars[pro]));
	val = val.join('&');
	if(method.toLowerCase() == 'get') {
		url = url+'?'+val;
		val = null;
	}
	xmlHttp.open(method, url);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8") 
	xmlHttp.onreadystatechange = function(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status == 200){
				fn(xmlHttp);	
			}
		}
	};
	xmlHttp.send(val);

}

function set_hits(xmlHttp){
	var hits = document.getElementById('hits');
	hits.innerHTML = xmlHttp.responseText;
}

function get_hits (){
	var id = document.getElementById('hits').className;
	RRequest('/gethits.php', {id: id}, set_hits);
}

function get_hitsu(){
	var id = document.getElementById('hits').className;
	RRequest('/gethits.php', {id: id, u:1}, set_hits);
}
