var interwal;
var progres = 0;
function init_preloader(czas, zdjecie){
	document.getElementById('preloader').innerHTML = '<div style="width: 100%; height: 100%;background: url(templates/gfx/preloader/tlo.jpg) no-repeat center;filter: alpha(opacity=100); opacity: 1.0;margin: auto auto; position:absolute; top:0px; left:0px;z-index:50;">'
	+'</div>'
	+'<div style="width: 800px; height: 600px; padding-top: 20px;margin: 50px auto; filter: alpha(opacity=100); opacity: 1;position:relative;z-index:60;">'
	+'<div style="width: 800px; color: #ae0300;text-align: center;font-size: 16px;font-weight: bold;">Trwa ładowanie strony. Proszę czekać...</div>'
	+'<div style="width: 800px; margin-top:75px;text-align: center;"><img src="'+zdjecie+'" alt="" /></div>'
	+'<div style="width: 500px; margin: 0px auto;">'
	+'<div id="prog0" style="width: 82px; height: 28px;float: left; background: url(templates/gfx/preloader/preloader_start.png) no-repeat; display: none;"></div>'
	+'<div id="prog1" style="width: 82px; height: 28px;float: left; background: url(templates/gfx/preloader/preloader_srodek.png) no-repeat; display: none;"></div>'
	+'<div id="prog2" style="width: 82px; height: 28px;float: left; background: url(templates/gfx/preloader/preloader_srodek.png) no-repeat; display: none;"></div>'
	+'<div id="prog3" style="width: 82px; height: 28px;float: left; background: url(templates/gfx/preloader/preloader_srodek.png) no-repeat; display: none;"></div>'
	+'<div id="prog4" style="width: 82px; height: 28px;float: left; background: url(templates/gfx/preloader/preloader_srodek.png) no-repeat; display: none;"></div>'
	+'<div id="prog5" style="width: 82px; height: 28px;float: left; background: url(templates/gfx/preloader/preloader_koniec.png) no-repeat; display: none;"></div>'
	+'</div></div>';
	interwal = setInterval('progress_preloader()',czas/6);
}

function progress_preloader(){
	if (progres==6) {
		close_preloader();
	} else
	{
		prog='prog'+progres;
		document.getElementById(prog).style.display='block';
		progres++;
	}
	
}

function close_preloader(){
	document.getElementById('preloader').innerHTML ='';
	clearInterval(interwal);
}