
var web_url = "/home/_addons/notes/";
var http = createRequestObject();

function createRequestObject() {
	var xmlhttp;
	try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	catch(f) { xmlhttp=null; }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
	xmlhttp=new XMLHttpRequest();
  }
	return  xmlhttp;
}
function get_notes() {
	field = document.getElementById('notes_info');
	http.open('POST',web_url+'get_info.php');
	field.innerHTML="<img src='"+web_url+"loading.gif' width=16 height=16 > Đang kiểm tra thông báo ...";
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http.onreadystatechange = handleResponse;
	http.send('update=1');
	return false;
}

function handleResponse() {
	try {
		if((http.readyState == 4)&&(http.status == 200)){
			response = http.responseText;
			field.innerHTML=http.responseText;
			load_notes();
		}
  	}
	catch(e){}
	finally{}
}
function load_notes() {
	setTimeout('get_notes()',150*1000); // Update mỗi xx giây
}
