var xmlhttp=false;
var lastlink=null;

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

//http://www.jibbering.com/2002/4/httprequest.html

function category_ajax(link_obj)
{
	var prvok=document.getElementById('content');
	if(!prvok)
	{
		//nemame content div, presmerovat usera ako keby nemal JS, ale pockat aj kym sa mu menu "krasne rozbali"
		setTimeout(function(){document.location.href=link_obj.href;},3000);
		return false;
	}
	if(xmlhttp!=null)
	{
		prvok.innerHTML="<center><img src='img/wait.gif' alt='Prosím čakajte' border='0' /><h1>Spracováva sa...</h1></center>";
		document.title=link_obj.title+" | "+RSNAME_SHORT;
		xmlhttp.open("GET",link_obj.href+"&ajax=1",true);
		xmlhttp.onreadystatechange=category_ajax_process;
 		xmlhttp.send(null);
	}
	else
	{
  		//co uz...
		setTimeout(function(){document.location.href=link_obj.href;},3000);
		return false;
	}
	return true;
}

function category_ajax_process()
{
	if(xmlhttp.readyState==4)
	{
		//ok		
		if(xmlhttp.status==200)
   		{
   			var prvok=document.getElementById('content');
	    		if(prvok)
	    		{
	    			$("#content").fadeTo(0, 0);
	    			prvok.innerHTML=xmlhttp.responseText;
	    			$("#content").fadeTo(500, 1);
	    		}		}
	}
	return true;
}

function vyber_link(link_obj)
{
	if(lastlink)
		lastlink.className="";
	link_obj.className="vybrata";
	lastlink=link_obj;
	return true;
}
	
