function ajaxKlient(ajdi, tabelka, cel, plikas, klient){



    var ajaxRequest; // The variable that makes Ajax possible!
    try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } 
    catch (e) {
        // Internet Explorer Browsers
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {
                // Something went wrong
                alert("Błąd przy wymianie danych!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    
    
    
    var url = "ajax/" + plikas;
    var params = "id=" + ajdi + "&tabelka=" + tabelka + "&cel" + cel;
    
    
    ajaxRequest.open("POST", url, true);
    
    //Send the proper header information along with the request
    ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajaxRequest.setRequestHeader("Content-length", params.length);
    ajaxRequest.setRequestHeader("Connection", "close");
    
    /*
     ajaxRequest.onreadystatechange = function() {//Call a function when the state changes.
     if(http.readyState == 4 && http.status == 200) {
     alert(ajaxRequest.responseText);
     }
     }
     */
    ajaxRequest.onreadystatechange = function(){
    
    
        if (ajaxRequest.readyState == 4) {
        
            // alert(""+ajaxRequest.responseText+"");
            var tabelki = ajaxRequest.responseText.split("*");
            var tabelka = tabelki[0].split("^");
            
            var linki = tabelki[1];
            
            
            
            
            /*
 for(var i=0; i<tabelki.length; i++){
             
             document.write("komórka "+i+"<br />"+tabelki[i]+"<br />");
             }
*/
             
            document.getElementById(cel).innerHTML = tabelka[3] + tabelka[5];
            document.getElementById(cel).href = tabelka[6];
            
             
            document.getElementById("klientLinki").innerHTML = linki;
            
            
        }
    }
    
    document.getElementById(klient).className = "klientAktywny";
    
    
    
    
    ajaxRequest.send(params);
    
    if (klient == "klientBiznesowy") {
    
        document.getElementById('klientIndywidualny').className = "klientNieaktywny";
    }
    else {
    
        document.getElementById('klientBiznesowy').className = "klientNieaktywny";
    }
};


function ajaxAktualnosci(ajdi, tabelka, cel, plikas){



    var ajaxRequest; // The variable that makes Ajax possible!
    try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } 
    catch (e) {
        // Internet Explorer Browsers
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {
                // Something went wrong
                alert("Błąd przy wymianie danych!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    
    
    
    var url = "ajax/" + plikas;
    var params = "id=" + ajdi + "&tabelka=" + tabelka + "&cel" + cel;
    
    
    ajaxRequest.open("POST", url, true);
    
    //Send the proper header information along with the request
    ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajaxRequest.setRequestHeader("Content-length", params.length);
    ajaxRequest.setRequestHeader("Connection", "close");
    
    /*
     ajaxRequest.onreadystatechange = function() {//Call a function when the state changes.
     if(http.readyState == 4 && http.status == 200) {
     alert(ajaxRequest.responseText);
     }
     }
     */
    ajaxRequest.onreadystatechange = function(){
    
    
        if (ajaxRequest.readyState == 4) {
        
        
        
            var tabelka = ajaxRequest.responseText.split("^");
            
            // document.write(ajaxRequest.responseText);
            /*
             for(var i=0; i<tabelka.length; i++){
             
             document.write("<h1>komórka "+i+"</h1><br />"+tabelka[i]+"<br />");
             }
             */
            document.getElementById(cel).innerHTML = tabelka[5];
            document.getElementById(cel).href = tabelka[6];
            document.getElementById('wiecej').href = tabelka[8];
            
            if (tabelka[21] != "") {
                document.getElementById("poprzedniNews").href = "javascript: ajaxAktualnosci(" + tabelka[21] + ", 'aktualnosci', 'aktualnosc', 'ajaxAktualnosci.php')";
            }
            else {
            
                document.getElementById("poprzedniNews").href = "#";
            }
            
            
            if (tabelka[11] != "") {
            
                document.getElementById("nastepnyNews").href = "javascript: ajaxAktualnosci(" + tabelka[11] + ", 'aktualnosci', 'aktualnosc', 'ajaxAktualnosci.php')";
            }
            else {
                document.getElementById("nastepnyNews").href = "#";
            }
            
            
            var ostatnia = tabelka.length - 1;
            
            //alert(tabelka[ostatnia]);
        
        
        }
    }
    
    ajaxRequest.send(params);
    
    
};

function ajaxNewsletter(ajdi, tabelka, cel, plikas){



    var ajaxRequest; // The variable that makes Ajax possible!
    try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } 
    catch (e) {
        // Internet Explorer Browsers
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {
                // Something went wrong
                alert("Błąd przy wymianie danych!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    
    
    
    var url = "ajax/" + plikas;
    var params = "id=" + ajdi + "&tabelka=" + tabelka + "&cel" + cel;
    
    
    ajaxRequest.open("POST", url, true);
    
    //Send the proper header information along with the request
    ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajaxRequest.setRequestHeader("Content-length", params.length);
    ajaxRequest.setRequestHeader("Connection", "close");
    
    /*
     ajaxRequest.onreadystatechange = function() {//Call a function when the state changes.
     if(http.readyState == 4 && http.status == 200) {
     alert(ajaxRequest.responseText);
     }
     }
     */
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState != 4){
            
            document.getElementById("komunikat").innerHTML = "<div class='ladowanie'><img  src='img/loading.gif' width='16' height='16' /><br /> Wykonywanie operacji w toku...</div>";
        }
    
        if (ajaxRequest.readyState == 4) {
        
        
            document.getElementById(cel).innerHTML = "" + ajaxRequest.responseText + "";
            
        }
    }
    
    ajaxRequest.send(params);
    
    
};


function ajaxFormularzKontaktowy(imieINazwisko, nazwaFirmy, dzialalnosc, miejscowosc, telefon, email, pytanie, plikas){


    

    var ajaxRequest; // The variable that makes Ajax possible!
    try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } 
    catch (e) {
        // Internet Explorer Browsers
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {
                // Something went wrong
                alert("Błąd przy wymianie danych!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    
    
    
    var url = "ajax/" + plikas;
    var params = "imieINazwisko=" + imieINazwisko +
    "&nazwaFirmy=" +
    nazwaFirmy +
    "&dzialanosc=" +
    dzialalnosc +
    "&miejscowosc=" +
    miejscowosc +
    "&telefon=" +
    telefon +
    "&email=" +
    email +
    "&pytanie=" +
    pytanie;
    
    
    ajaxRequest.open("POST", url, true);
    
    //Send the proper header information along with the request
    ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajaxRequest.setRequestHeader("Content-length", params.length);
    ajaxRequest.setRequestHeader("Connection", "close");
    
    /*
     ajaxRequest.onreadystatechange = function() {//Call a function when the state changes.
     if(http.readyState == 4 && http.status == 200) {
     alert(ajaxRequest.responseText);
     }
     }
     */
    ajaxRequest.onreadystatechange = function(){
    
    
        if (ajaxRequest.readyState == 4) {
        
            // alert(""+ajaxRequest.responseText+"");
            
            var tabelka = ajaxRequest.responseText.split("^");
            
            
            var id;
            
            for (var i = 0; i < tabelka.length; i += 2) {
            
                //document.write("komórka "+i+"<br />"+tabelka[i]+"<br />");
                
                
                var cel = removeNL(tabelka[i]);
                
                
                
                document.getElementById(cel).innerHTML = tabelka[i+1];
            }
            
            
            
            
            //
        
        
        
        }
    }
    
    ajaxRequest.send(params);
    
    
};



function removeNL(s) {
  /*
  ** Remove NewLine, CarriageReturn and Tab characters from a String
  **   s  string to be processed
  ** returns new string
  */
  r = "";
  for (i=0; i < s.length; i++) {
    if (s.charAt(i) != '\n' &&
        s.charAt(i) != '\r' &&
        s.charAt(i) != '\t') {
      r += s.charAt(i);
      }
    }
  return r;
  };
