
function getHTTPObject() {
  if (typeof XMLHttpRequest != 'undefined') {
    return new XMLHttpRequest();
  } try {
    return new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      return new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
  } return false;
}


function ajx_switch(htmlid,script,id) {

var myurl="http://power.malopolska.pl/" + script + '.php?ajxid=' + id;
var innercontent = htmlid + "_innerhtml";

   document.getElementById(innercontent).innerHTML='ładuje się';

  http = getHTTPObject();
  http.open("GET", myurl, true);
  http.onreadystatechange = function() {
    if (http.readyState == 4) {
      var textout = http.responseText;
      document.getElementById(htmlid).innerHTML=textout;      
    }
  };

  http.send(null);

}
