function Ajax(url, metoda, funkcija, formData){
		
		http_request = false;

		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
			}
		} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			errLog("Msxml2.XMLHTTP"+e.description);
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {"Microsoft.XMLHTTP"+errLog(e.description);}
			}
		}
		
		if (!http_request) {
			alert('Giving up :( Cannot create an XMLHTTP instance');
			return false;
		}
		http_request.onreadystatechange = eval(funkcija);
		if(metoda!=""){
			http_request.open('POST', url, true);
			http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			http_request.send(formData);
		}else{
			http_request.open('GET', url, true);
			http_request.send(null);
		}
}



function getNews(godina){

	if (!godina && window.location.hash.indexOf("#y=") > -1) {
		godina = window.location.hash.replace("#y=", "");
	}
	
	if (!godina) godina = "";
    
    if (godina != "") window.location.hash = "y=" + godina;
	
	var url = "ajaxnews.aspx?y=" + godina;

	Ajax(url, "", "prenesiNews", "");

}


function prenesiNews(){
	
	try{
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var Details = document;
				var tekst=http_request.responseText;
				Details.getElementById("novostidiv").innerHTML = tekst
		}
	}
	}catch(e){alert(e.description)}
}
