var xmlhttp;

function updateVideoViewsDisplay(category,topic) {	
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null) {
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	var url="../inc/videoViewsUpdateDisplay_ajax.php";
	url=url+"?category=" + category + "&topic=" + topic;
	url=url+"&sid="+Math.random();
	//xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState == 4){
			document.getElementById("videoViewsDisplay_" + category + "_" + topic).innerHTML=xmlhttp.responseText;
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function GetXmlHttpObject() {
	if (window.XMLHttpRequest) {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	  // code for IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
  		alert("Your browser does not support XMLHTTP!");
  	}
	return null;
}
