
		var js_ajax_is_working = false;
		var js_ajax_httpobject = null;
		var js_ajax_target = null;
		var js_ajax_handlefunction = null;
		
		function js_ajax_loadurl(surl,starget,shandlefunction,npostponed,stemphtml) {
			if(starget==undefined) starget = "ajaxtarget";
			if(shandlefunction==undefined) shandlefunction = "js_ajax_handleresponse";
			if(npostponed==undefined) npostponed = 0;
			//if(stemphtml==undefined) stemphtml = "<center><img src='img/ajax/"+starget+".gif' /></center>";
			window.status = "ajax target="+starget+" postponed="+npostponed;
			window.status = ' ';
	
			if(npostponed==0) if(stemphtml!=undefined) {
				//set the icon to loading
				var obj = getObject(starget);
				//if(IsObject(obj)) 
				obj.innerHTML = stemphtml;	
			}
			
			if(js_ajax_is_working) {				
				//postpone
				setTimeout("js_ajax_loadurl('"+surl+"','"+starget+"','"+shandlefunction+"',"+(npostponed+1)+")",100);
				return;
			}			
			
			js_ajax_is_working = true;
			if(!js_ajax_httpobject) js_ajax_httpobject = js_ajax_gethttpobject();			
			js_ajax_target = starget;
			//alert("shandlefunction:"+shandlefunction);
			if(isFunction(eval(shandlefunction))) js_ajax_handlefunction = shandlefunction;
			else js_ajax_handlefunction = "js_ajax_handleresponse";
			setTimeout("js_ajax_startretrieval('"+surl+"')",100);
		}
		
		function js_ajax_startretrieval(surl) {
			js_ajax_httpobject.open("GET", surl, true);
			//if(isFunction(eval(js_ajax_handlefunction))) alert("is:"+js_ajax_handlefunction);
			//else alert("is not:"+js_ajax_handlefunction);
			js_ajax_httpobject.onreadystatechange = eval(js_ajax_handlefunction);
         js_ajax_httpobject.send(null);
      }
		
		function js_ajax_handleresponse() {
			if(js_ajax_httpobject.readyState==4) {
				//alert("respons target="+js_ajax_target);
				var obj = getObject(js_ajax_target);
				obj.innerHTML = js_ajax_httpobject.responseText;	
				
				/* wyciagamy javascript */
				var buf = js_ajax_httpobject.responseText;
				i=1;
				while(buf.indexOf("<script ")>0) {
					sodscript = buf.substring(buf.indexOf("<script "),buf.length);
					sodpoczatku = sodscript.substring(sodscript.indexOf(">")+1,sodscript.length);
					sjustscript = sodpoczatku.substring(1,sodpoczatku.indexOf("</script>"));
					
					//alert("just:"+sjustscript);
					i++;
					setTimeout(sjustscript,i*100);
					
					buf = buf.substring(buf.indexOf("<script ")+sodscript.indexOf(">")+sodpoczatku.indexOf("</script>")+10,buf.length);
				}
				js_ajax_is_working = false;
			}
		}
		
		
      function js_ajax_gethttpobject() {
            var xmlhttp;
            /*@cc_on
            @if (@_jscript_version >= 5)
                try {
                    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (E) {
                        xmlhttp = false;
                    }
                }
            @else
                xmlhttp = false;
            @end @*/
        
            if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
                try {
                    xmlhttp = new XMLHttpRequest();
                } catch (e) {
                    xmlhttp = false;
                }
            }
            return xmlhttp;
      }
        
      
      
      /* ta funkcja to obejscie na BUGa w javascripcie(!), ktory nie radzi sobie z literka o, l i % */
//       function ajax_escape(wej) {
// 			s = new String(wej);
// 			s= s.replace("%","%u0025");
// 			//s= s.replace("[/o]","[/o/o]");
// 			//s= s.replace(/ó/g,"[/o]");			
// 			s= s.replace(/ó/g,"%u00F3");			
// 			//s= s.replace("[/l]","[/l/l]");
// 			//s= s.replace(/ł/g,"[/l]");
// 			s= s.replace(/ł/g,"%u0142");
// 			s= s.replace(/ć/g,"%u0107");
// 			out = escape(s);
// 			return out;
// 		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		function js_ajax_loadpost(surl,spost,starget,shandlefunction,npostponed) {
			if(starget==undefined) starget = "ajaxtarget";
			if(shandlefunction==undefined) shandlefunction = "js_ajax_handleresponse";
			if(npostponed==undefined) npostponed = 0;
			window.status = "ajax target="+starget+" postponed="+npostponed;
			window.status = ' ';
			
			if(npostponed==0) {
				//set the icon to loading
				var obj = getObject(starget);
				obj.innerHTML = "<img src='img/ajax/working.gif' />";	
			}
			
			if(js_ajax_is_working) {				
				//postpone
				setTimeout("js_ajax_loadpost('"+surl+"','"+spost+"','"+starget+"','"+shandlefunction+"',"+(npostponed+1)+")",100);
				return;
			}			
			
			js_ajax_is_working = true;
			if(!js_ajax_httpobject) js_ajax_httpobject = js_ajax_gethttpobject();			
			js_ajax_target = starget;
			if(isFunction(eval(shandlefunction))) js_ajax_handlefunction = shandlefunction;
			else js_ajax_handlefunction = "js_ajax_handleresponse";
			setTimeout("js_ajax_startretrievalpost('"+surl+"','"+spost+"')",100);
		}
		
		function js_ajax_startretrievalpost(surl,spost) {
			js_ajax_httpobject.open("POST", surl, true);
			js_ajax_httpobject.onreadystatechange = eval(js_ajax_handlefunction);
			js_ajax_httpobject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
         js_ajax_httpobject.send(spost);
      }
		


		function js_ajax_sendpost(surl,spost) {
			var ajax_obj = js_ajax_gethttpobject();
			ajax_obj.open("POST", surl, true);
			ajax_obj.onreadystatechange = new Function();
			ajax_obj.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			ajax_obj.send(spost);
		}
 
