var ajaxdestination="";

function getdata(what,where) {
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* nic nie rob */ }

 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
// xmlhttp.overrideMimeType('text/html; charset=ISO-8859-2');
 return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 1) {
             if (ajaxdestination == "hot1" || ajaxdestination == "hot2" || ajaxdestination == "hot4" || ajaxdestination == "hot10") {
                document.getElementById(ajaxdestination).innerHTML ="<div class='box_hot_in'><div class='greenBorder' style='display: table; height: 133px; width:466px;  #position: relative; overflow: hidden;'><div style=' #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;'><div class='greenBorder' style=' #position: relative; #top: -50%; text-align:center; background:url(img/loading.gif) center center no-repeat; width:466px;'>Pobieranie danych...<br />&nbsp;<br />&nbsp;</div></div></div></div>";
             } else if (ajaxdestination == "ogloszenia_ajax") {
                 document.getElementById(ajaxdestination).innerHTML ="<h3><img src='img/bullet_h3.png' alt='' />Ogłoszenia</h3><div class='greenBorder' style='display: table; height: 162px; width:252px;  #position: relative; overflow: hidden; border:1px solid #CFCDD9; border-width:0px 1px 0px 1px; background-color:#ffffff;'><div style=' #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;'><div class='greenBorder' style=' #position: relative; #top: -50%; text-align:center; background:url(img/loading.gif) center center no-repeat; width:252px;'>Pobieranie danych...<br />&nbsp;<br />&nbsp;</div></div></div>        <div class='center line_up'><div class='wloc_wszystkie'><a href='ogloszenia.html'>Zobacz wszystkie</a></div>&nbsp;/&nbsp;<div class='wloc_dodaj'><a href='ogloszenia,dodaj.html'>Dodaj ogłoszenie</a></div></div>";
             } else if (ajaxdestination == "randki_ajax") {
                 document.getElementById(ajaxdestination).innerHTML ="<div class='greenBorder' style='display: table; height: 162px; width:252px;  #position: relative; overflow: hidden; border:1px solid #CFCDD9; border-width:0px 1px 0px 1px; background-color:#ffffff;'><div style=' #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;'><div class='greenBorder' style=' #position: relative; #top: -50%; text-align:center; background:url(img/loading.gif) center center no-repeat; width:252px;'>Pobieranie danych...<br />&nbsp;<br />&nbsp;</div></div></div>";
             } else if (ajaxdestination == "scroll_box") {
                 document.getElementById(ajaxdestination).innerHTML ="<div class='greenBorder' style='display: table; height: 184px; width:252px;  #position: relative; overflow: hidden; border:1px solid #CFCDD9; border-width:0px 1px 0px 1px; background-color:#ffffff;'><div style=' #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;'><div class='greenBorder' style=' #position: relative; #top: -50%; text-align:center; background:url(img/loading.gif) center center no-repeat; width:252px;'>Pobieranie danych...<br />&nbsp;<br />&nbsp;</div></div></div>";
//             } else if (ajaxdestination == "video_right_playlist") {
//                 document.getElementById(ajaxdestination).innerHTML ="<div class='greenBorder' style='display: table; height: 300px; width:382px;  #position: relative; overflow: hidden; background-color:#000000;'><div style=' #position: absolute; #top: 50%;display: table-cell; vertical-align: middle;'><div class='greenBorder' style=' #position: relative; #top: -50%; text-align:center; background:url(img/loading.gif) center center no-repeat #000000; width:282px;'>Pobieranie danych...<br />&nbsp;<br />&nbsp;</div></div></div>";
             } else {
             }
    }
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) {
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
    }
}

