function ajax() {
  try {
    xml = new ActiveXObject("Microsoft.XMLHTTP");
  } catch(e) {
    try {
      xml = new XMLHttpRequest();
    } catch(e) {
      xml = null;
    }
  }
  if (xml != null) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
        element.innerHTML=xml.responseText;
      }
    }
    xml.open("GET", plik, true);
    xml.send(null);
  }
  return false;
}

function szukaj(formularz, strona) {
  plik = "szukaj-"+formularz.mp3.value+"-"+strona+".html";
  element = document.getElementById("wynik");
 
  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function strona(formularz, strona) {
  plik = "szukaj-"+formularz.mp3.value+"-"+strona+".html";
  element = document.getElementById("wynik");
 
  xml = null;
  ajax();
  return false;
}

function infoMp3(id) {
  plik = "info-"+id+".html";
  element = document.getElementById("wynik");
 
  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function playlista(div, mp3) {
  plik = "zapisz-"+mp3+".html";
  element = document.getElementById(div);
 
  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function playl(div) {
  plik = "otworz_play.html";
  element = document.getElementById(div);
 
  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function zarz() {
  plik = "zarzadzaj.html";
  element = document.getElementById("zarza");
 
  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function dodaj_play() {
  var id = document.form2.nazwapp.value;
  plik = "dodaj-"+id+".html";
  element = document.getElementById("dod2");
  
  document.getElementById("dodaj").style.display = 'none';
 
  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function wys_play(form, idm) {
  plik = "play-"+form.value+"-"+idm+".html";
  element = document.getElementById("dodajp");

  xml = null;
  element.innerHTML='<img src="img/load.gif" />';
  ajax();
  return false;
}

function dodaj() {
	document.getElementById("dodaj").style.display='block';
	document.getElementById("dod2").innerHTML='';
	document.getElementById("zarza").innerHTML='';
	document.getElementById("zap").innerHTML='';
	document.form2.nazwapp.value = '';
	return false;
}

function pusta(div) {
	document.getElementById(div).innerHTML='';
	document.getElementById("dodaj").style.display = 'none';
}

function otworz(form) {
	open("otworz-"+form.value+".html","okno","width=420, resizable=yes, scrollbars=no, menubar=no, height=350");
	document.getElementById("zap").innerHTML='';
}

function edytuj(form) {
	open("edytuj-"+form.value+".html","okno","width=420, resizable=yes, scrollbars=no, menubar=no, height=350");
	document.getElementById("zarza").innerHTML='';
}