/**
 * @author apat1k
 */

/* ------------------------ */
/*  XMLHTTPRequest Enable   */
/* ------------------------ */
function createObject()
{
	var request_type;
	var browser = navigator.appName;
	
	if(browser == "Microsoft Internet Explorer")
	{
		request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		request_type = new XMLHttpRequest();
	}
	
	return request_type;
}

var http = createObject();
//==============================================
var nocache = 0;  //Переменная содержит случайное число, добавляемое в запрос для предотвращения кеширования браузером запроса 

function Marks(type,id_article)
{
	nocache = Math.random();
	var params = 'm=' + type + '&a=' + id_article + '&nocache=' + nocache;

	http.open("GET", "/marks.php?"+params, true);
	http.onreadystatechange = MarksReply;
	http.send(null);
}

function MarksReply() 
{
	if (http.readyState == 4) {
	
		if (http.status == 200) {
			var response = http.responseText;
			if (response != "none") {
				document.getElementById("divmarks").innerHTML = response;
			}
		}
	
	}
}
function MediaMarks(type,id)
{
	nocache = Math.random();
	var params = 'm=' + type + '&a=' + id + '&nocache=' + nocache;

	http.open("GET", "/mediamarks.php?"+params, true);
	http.onreadystatechange = MediaMarksReply;
	http.send(null);
}

function MediaMarksReply() 
{
	if (http.readyState == 4) {
	
		if (http.status == 200) {
			var response = http.responseText;
			if (response != "none") {
				document.getElementById("divmarks").innerHTML = response;
			}
		}
	
	}
}
