	var http = false;
	var by_ajax = false;
	
	if(navigator.appName == "Microsoft Internet Explorer") {
	  http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  http = new XMLHttpRequest();
	}
	
	function ajax_get(url) {
		http.open("GET", url);
		http.onreadystatechange=function() {
		  if(http.readyState == 4) {
		  	by_ajax=true; 	// globalni flag, rekne napr. formulari ze nema odesilat ale jen si stahnout vysledek
		    //alert(http.responseText);	//zde bude napln div
		    ajax_fill(http.responseText);
		  }
		}
		http.send(null);
	}
	
	function ajax_link(o) {
		url=parseUrl(o.href);
		tab_switch(o);
    //zamenit ? za &
		path = url.path.split('?').join('&');

		ajax_get('/ajax.php?page='+path);
	}
	
	
	function ajax_fill(content) {
		el=document.getElementById('content-fill');
		el.innerHTML=content;
		//initLightbox();
	}
	
	function tab_switch(o) {
		el=o;		while (t=el.previousSibling) {
			if (t.className=='active') t.className='';
			el=t;
		} 
		el=o;		while (t=el.nextSibling) {
			if (t.className=='active') t.className='';
			el=t;
		} 
		o.className='active';
		o.blur();
	}
	
	function parseUrl(data) {
    var e=/((http|ftp):\/)?\/?([^:\/]+)\/(.*)/;
    if (data.match(e)) {
        return  {url: RegExp['$&'],
                protocol: RegExp.$2,
                host:RegExp.$3,
                path:RegExp.$4};
    }
    else {
        return  {url:"", protocol:"",host:"",path:""};
    }
	}

