// Biblioteka Caps
// Ajax Query - funkcja klienta do wykonywania zapytań w bazie danych
// Wszystko odbywa się synchronicznie

var result = new Array(); 
//Browser Support Code
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;
}

function list_proj(type,dest){
 var ajaxQRequest;  // The variable that makes Ajax possible!  	 

 ajaxQRequest = getXMLHTTPRequest()
 ajaxQRequest.open("GET", "lib/list.php?type=" + encodeURIComponent(type), false);
 ajaxQRequest.send(null);
     
   var div=decodeURIComponent(ajaxQRequest.responseText);
 
  document.getElementById(dest).innerHTML= div;
}

function detail_proj(id,dest){
 var ajaxQRequest;  // The variable that makes Ajax possible!  	 
 
 ajaxQRequest = getXMLHTTPRequest()
 ajaxQRequest.open("GET", "projekt.php?id=" + encodeURIComponent(id), false);
 ajaxQRequest.send(null);
     
   var div=decodeURIComponent(ajaxQRequest.responseText);
 
  document.getElementById(dest).innerHTML= div;
}

function show_div(src,dest){
 var ajaxQRequest;  // The variable that makes Ajax possible!  	 
 
 ajaxQRequest = getXMLHTTPRequest()
 ajaxQRequest.open("GET", src, false);
 ajaxQRequest.send(null);
     
   var div=decodeURIComponent(ajaxQRequest.responseText);

  document.getElementById(dest).innerHTML= div;
}

function show_img(projekt,numer,dest){
 var ajaxQRequest;  // The variable that makes Ajax possible!  	 
 
 ajaxQRequest = getXMLHTTPRequest()
 ajaxQRequest.open("GET", "img.php?id="+projekt+"&nr="+numer, false);
 ajaxQRequest.send(null);
     
   var div=decodeURIComponent(ajaxQRequest.responseText);

  document.getElementById(dest).innerHTML= div;
}
