function loadimg_gallery() { var perc = Math.round((loaded_gallery/count_el_gallery)*100); document.getElementById("loader_perc_gallery").style.width = perc + "px"; if (loaded_gallery == count_el_gallery) { startup_gallery(); } else { window.setTimeout("loadimg_gallery();", 200); } } loadimg_gallery(); function startup_gallery() { document.getElementById("gallery_0").style.zIndex = 10; opacity("loader_gallery", 100, 0, 500); window.setTimeout("switcher_gallery()", 3000); } function switcher_gallery() { cur_el_gallery++; if (cur_el_gallery >= count_el_gallery) { cur_el_gallery = 0; } var this_el = "gallery_"+cur_el_gallery; changeOpac(0, this_el); document.getElementById(this_el).style.zIndex = zorder_gallery; zorder_gallery++; opacity(this_el, 0, 100, 1200); window.setTimeout("switcher_gallery()", 5000); }