	function getXMLHTTPRequest() 
	{
		try {
		req = new XMLHttpRequest();
		} catch(err1) {
		  try {
		  req = new ActiveXObject("Msxml2.XMLHTTP");
		  } catch (err2) {
			try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err3) {
			  req = false;
			}
		  }
		}
		return req;
	}
	
	var http = getXMLHTTPRequest();
	
	// funkcija za gradiva 
	function getGradiva()
	{
		var naslov="./query/gradiva.php";
		// zato ker ni parametrov
		myRand = parseInt(Math.random()*999999999999999);
		var url = naslov + "?rand=" + myRand;
		http.open("GET", url, true);
		http.onreadystatechange = gradivaResponse;
		http.send(null);
		setTimeout("getGradiva()", 2000);	
	}
	
	function gradivaResponse()
	{
		if(http.readyState == 4)
		{
			if(http.status == 200)
			{
				var pregledGradiv = http.responseText;
				document.getElementById('gradiva').innerHTML = pregledGradiv;
			}
		}	
	}	
	// konec gradiva
	
	//funkcija za obvestila
	function getObvestila()
	{
		var naslov="./query/obvestila.php";
		myRand = parseInt(Math.random()*999999999999999);		
		var url = naslov + "?rand=" + myRand;
		http.open("GET", url, true);
		http.onreadystatechange = obvestilaResponse;
		http.send(null);
		setTimeout("getObvestila()", 2000);	
	}
	
	function obvestilaResponse()
	{
		if(http.readyState == 4)
		{
			if(http.status == 200)
			{
				var pregledObvestil = http.responseText;
				document.getElementById('obvestila').innerHTML = pregledObvestil;
			}
		}
	}	
	// konec obvestil
	
	//funkcija za skupine
	function getSkupina(par1)
	{
		var naslov="./query/skupine.php";
		myRand = parseInt(Math.random()*999999999999999);
		var url = naslov + "?id=" + par1 + "&rand=" + myRand;
		http.open("GET", url, true);
		http.onreadystatechange = skupinaResponse;
		http.send(null);
		setTimeout("getSkupina('" + par1 + "')", 2000);	
	}
	
	function skupinaResponse()
	{
		if(http.readyState == 4)
		{
			if(http.status == 200)
			{
				var pregledSkupin = http.responseText;
				document.getElementById('teme').innerHTML = pregledSkupin;
			}
		}
	}
	// konec skupine
	
	
	// domaca spletna stran
	function index(par)
	{
		var naslov="./ajax/" + par + ".php";
		myRand = parseInt(Math.random()*999999999999999);		
		var url = naslov + "?rand=" + myRand;
		http.open("GET", url, true);
		http.onreadystatechange = indexResponse;
		http.send(null);
		setTimeout(2000);
	}
	
	function indexResponse()
	{
		if(http.readyState == 1)
		{
			document.getElementById('vsebina').innerHTML = "Loading...";	
		}
		if(http.readyState == 4 && http.status == 200)
		{
			var pregledObvestil = http.responseText;
			document.getElementById('vsebina').innerHTML = pregledObvestil;
		}	
	}	
	// konec 
	
	
		
		
