function createRequestObject(){

	var req;
	
	if (window.XMLHttpRequest){
		// For Firefox, Safari, Opera
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject){
		// For IE 5+
		req = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		// Error for an old browser
		alert('Your browser is not IE 5 or higher, or Firefox or Safari or Opera');
		return false;
	}
	
	return req;
}

function test(var_rid, var_zid, var_gid, var_link){
	var upit = "opisresorta.class.php?rid=" + var_rid + "&zid=" + var_zid + "&gid=" + var_gid + "&resstr=" +var_link;

	alert(upit);
}
function ucitajDodatnitekst(var_rid, var_zid, var_gid, var_link){
	document.getElementById('lnk_1').style.fontWeight = 'normal';
	document.getElementById('lnk_2').style.fontWeight = 'normal';
	document.getElementById('lnk_3').style.fontWeight = 'normal';
	document.getElementById('lnk_4').style.fontWeight = 'normal';
	
	var link_varijabla = 'lnk_' + var_link;
	document.getElementById(link_varijabla).style.fontWeight = 'bold';
	
	document.getElementById ('tekstopis').innerHTML = 'Molim pričekajte...';
	// Make the XMLHttpRequest Object
	var http = createRequestObject();
	if(!http){
		return false;
	}
	
	var upit = "opisresorta.class.php?rid=" + var_rid + "&zid=" + var_zid + "&gid=" + var_gid + "&resstr=" +var_link;

	http.open('get',upit,true);
	http.onreadystatechange = handleResponse;
	http.send(null);
	
	function handleResponse(){
		if(http.readyState == 4 && http.status == 200){
			var response = http.responseText;
			if(response){
				if(response == 'ne'){
					// ne
					//alert('Korisničko ime več postoji, odaberite drugo');
					document.getElementById ('tekstopis').firstChild.data = response;
				} else {
					// ok
					//window.document.novikorisnik.submit();
					document.getElementById ('tekstopis').innerHTML = response;
				}
			}
		} 		
	}
}
