<!--
function open_r_zestaw(zest)
{
egzam=newwin_quiz('egzamin','http://www.kurssikory.pl/blank.html', '900', '700','20','20');

	if (document.getElementById('form_id_egzamin'))
		{
			foremka=document.getElementById('form_id_egzamin');
		with (foremka)
			{
			//action='http://www.kurssikory.pl/contents/wyniki/spr.php';
			action='http://www.kurssikory.pl/contents/wyniki/spr.php';
			zestaw.value=zest;
			doo.value='rozwiaz';
			act.value='quiz';
			target='egzamin';
			if (egzam)
			  	{
				submit();
				}
		   if (!egzam)
				{
				submit();
				}
			}
		}
	else
		alert('Błąd inicjowania strony. Prosimy o zgłoszenie go za pośrednictwem Mojej Poczty. Kod błędu: #29');

}

function open_rp_zestaw(zest,num)
{
egzam=newwin_quiz('egzamin','http://www.kurssikory.pl/blank.html', '900', '700','20','20');

	if (document.getElementById('form_id_egzamin'))
		{
			foremka=document.getElementById('form_id_egzamin');
		with (foremka)
			{
			//action='http://www.kurssikory.pl/contents/wyniki/spr.php';
			action='http://www.kurssikory.pl/contents/wyniki/spr.php';
			zestaw.value=zest;
			doo.value='rozwiaz';
			act.value='quiz';
			param1.value='gonr';
			param2.value=num;
			target='egzamin';
			if (egzam)
			  	{
				submit();
				}
		   if (!egzam)
				{
				submit();
				}
			}
		}
	else
		alert('Błąd inicjowania strony. Prosimy o zgłoszenie go za pośrednictwem Mojej Poczty. Kod błędu: #29');

}

function open_r_popup()
{
newwin_quiz('nowe_okienko','/popup-test.html', '300', '300','100','100');

}

function newwin_quiz(nazwaw,url, width, height, top, left) {

        var Win = window.open(url,nazwaw,
        'width=' + width + ',height=' + height + 
        ', left=' + left + ',top=' + top+ 
        ',toolbar=no, directories=no, status=yes, titlebar=no, resizable=yes,scrollbars=yes,menubar=no' );
        Win.focus();
		  return Win;	
}
function newwin_small(nazwaw,url, width, height, top, left) {

        var Win = window.open(url,nazwaw,
        'width=' + width + ',height=' + height + 
        ', left=' + left + ',top=' + top+ 
        ',toolbar=no, directories=no, status=yes, titlebar=no, resizable=yes,scrollbars=yes,menubar=no' );
        Win.focus();
}

function open_r_zestaw_old(zest)
{
ramka=document.getElementById('sprid');
if (ramka)
	{
	ramka.className='spr_frame_show';
	wybor_hide();
	foremka=document.getElementById('form_id_spr');
	with (foremka)
		{
		zestaw.value=zest;
		doo.value='rozwiaz';
		act.value='quiz';
		submit();
		}
	}
}
function wybor_hide()
{
wybor=document.getElementById('wyb_spr');
wybor.style.display="none";
wyborc=document.getElementById('wyb_click');
wyborc.style.display="block";
}

function wybor_show()
{
wybor=document.getElementById('wyb_spr');
wybor.style.display="block";
wyborc=document.getElementById('wyb_click');
wyborc.style.display="none";
}

function newwin(nazwaw,url, width, height) {
			var top=10; 
			var left=10;
        var Win = window.open(url,nazwaw,
        'width=' + width + ',height=' + height + 
        ', left=' + left + ',top=' + top+ 
        ',toolbar=no, directories=no, status=yes, titlebar=no, resizable=yes,scrollbars=yes,menubar=yes' );
        Win.focus();
}


function ed_koment(k_nr,k_file,k_login)
{
newwin('komentarz','edycja_komentarza.php?numer='+k_nr+'&nazwa='+k_file+'&k_login='+k_login+'&zz=mat', '600', '250','1','1');
}
//skopiowane z edycja.js
function del_koment(k_nr,k_file,k_login)
{
newwin('komentarz','edycja_komentarza.php?numer='+k_nr+'&nazwa='+k_file+'&k_login='+k_login+"&act=del&zz=mat", '60', '1','1','1');
}

function quiz_post(actt,pytt,param2t,kk,ocena)
{
document.forms[0].act.value=actt;
if (pytt!='')
	document.forms[0].pyt.value=pytt;
if (param2t!='')
	{
	document.forms[0].param2.value=param2t;
	}
if (kk!='')
	document.forms[0].kk.value=kk;
if (ocena!='')
	{
	if (ocena=="1") ocena='ocena';
	document.forms[0].ocena.value=ocena;
	}
document.forms[0].submit();
}

function rys(to)
{

//ten=window.event.srcElement;
//alert(ten.id);
ten=document.getElementById(to);
if (ten)
	wid=ten.width;
	{
	//alert(ten.title);
	if (ten.title=="pomniejsz")
		{
		ten.title="powieksz";
		ten.width=Math.round(wid/2);
		}
	else
		{
		ten.title="pomniejsz";
		ten.width=wid*2;
		}
	}
}

function wydruk_pyt(pytt)
{
document.forms[0].act.value='wydruk';
if (pytt!='')
	document.forms[0].pyt.value=pytt;
document.forms[0].target='wydruk';
newwin('wydruk','/blank.html', '800', '800','1','1');
document.forms[0].submit();
document.forms[0].target='';
quiz_post('go',pytt,'');
}

function wydruk_pyt_all(pytt)
{
document.forms[0].act.value='wydruk_all';
if (pytt!='')
	document.forms[0].pyt.value=pytt;
document.forms[0].target='wydruk';
newwin('wydruk','/blank.html', '800', '800','1','1');
document.forms[0].submit();
document.forms[0].target='';
quiz_post('go',pytt,'');
}
function wydruk_pyt_all_n(pytt,kk,ocena)
{
newwin('wydruk_n','/blank.html', '800', '800','1','1');
document.forms[0].act.value='wydruk_all';
if (pytt!='')
	document.forms[0].pyt.value=pytt;
if (kk!='')
	document.forms[0].kk.value=kk;
if (ocena!='')
	{
	if (ocena=="1") ocena='ocena';
	document.forms[0].ocena.value=ocena;
	}
document.forms[0].target='wydruk_n';

document.forms[0].submit();
document.forms[0].target='';
//quiz_post('go',pytt,'');
}
function get_klucz(zest)
{
document.forms[1].doo.value='rozwiaz';
document.forms[1].act.value='import_klucz';
document.forms[1].zestaw.value=zest;
document.forms[1].target='_self';
document.forms[1].action='/contents/wyniki/spr.php';
document.forms[1].submit();
}

function get_stats(zest)
{
newwin_small('stats','/blank.html', '900', '800','20','20');
document.forms[1].doo.value='rozwiaz';
document.forms[1].act.value='statystyki';
document.forms[1].zestaw.value=zest;
document.forms[1].target='stats';
document.forms[1].action='/contents/wyniki/spr.php';
document.forms[1].submit();
}

function edit_uwagi(zest,czyokno)
{
if (czyokno)
	{
newwin_small('uwagi','/blank.html', '900', '800','20','20');
	ax=1;
	}
else
	ax=0;
//document.forms[1].elements('do').value='rozwiaz';
document.forms[ax].doo.value='rozwiaz';
document.forms[ax].act.value='uwagi_edycja';
document.forms[ax].zestaw.value=zest;
document.forms[ax].target='uwagi';
document.forms[ax].action='/contents/wyniki/spr.php';
document.forms[ax].submit();
}

function edit_uwagi_n(zest,czyokno,naucz)
{
if (czyokno)
	{
	ax=0;
newwin_small('uwagi','/blank.html', '900', '800','20','20');
document.forms[ax].zapisz.value=zest;
document.forms[ax].act.value='uwagi_edit';
document.forms[ax].rob.value=naucz;
	}
else
	{
	ax=0;
//document.forms[1].elements('do').value='rozwiaz';
document.forms[0].act.value='uwagi_edit';
document.forms[0].param1.value=naucz;
document.forms[0].param2.value=zest;
	}
document.forms[ax].target='uwagi';
document.forms[0].action='/contents/naucz/nwyniki.php';
document.forms[ax].submit();
}



function edit_uwagi_zapisz(zest)
{
//document.forms[0].elements('do').value='rozwiaz';
document.forms[0].doo.value='rozwiaz';
document.forms[0].act.value='uwagi_edycja';
document.forms[0].zestaw.value=zest;
document.forms[0].target='uwagi';
document.forms[0].action='/contents/wyniki/spr.php';
document.forms[0].submit();
}

function edit_uwagi_zapisz_n(zest,naucz)
{
ax=0;
document.forms[0].act.value='uwagi_zapisz';
document.forms[0].param1.value=naucz;
document.forms[0].param2.value=zest;
document.forms[0].target='uwagi';
document.forms[0].action='/contents/naucz/nwyniki.php';
document.forms[0].submit();
}

function get_uwagi(zest)
{
newwin_small('uwagi','/blank.html', '900', '800','20','20');
document.forms[1].doo.value='rozwiaz';
document.forms[1].act.value='uwagi_show';
document.forms[1].zestaw.value=zest;
document.forms[1].target='uwagi';
document.forms[1].action='/contents/wyniki/spr.php';
document.forms[1].submit();
}

function get_uwagi_n(zest,naucz)
{
ax=0;
newwin_small('uwagi','/blank.html', '900', '800','20','20');
document.forms[ax].act.value='nau';
document.forms[ax].zapisz.value=zest;
document.forms[ax].etap.value='uwagi_show';
document.forms[ax].rob.value=naucz;
document.forms[ax].target='uwagi';
document.forms[0].action='/contents/naucz/nwyniki.php';
document.forms[ax].submit();
}

function get_uwagi_n_admin(zest)
{
ax=0;
newwin_small('uwagi','/blank.html', '900', '800','20','20');
document.forms[ax].act.value='nau';
document.forms[ax].zapisz.value=zest;
document.forms[ax].etap.value='uwagi_show';
document.forms[ax].rob.value='admin';
document.forms[ax].target='uwagi';
document.forms[0].action='/contents/naucz/nwyniki.php';
document.forms[ax].submit();
}

function get_uwagi_n_all(zest)
{
ax=0;
newwin_small('uwagi','/blank.html', '900', '800','20','20');
document.forms[ax].act.value='nau';
document.forms[ax].zapisz.value=zest;
document.forms[ax].etap.value='uwagi_show';
document.forms[ax].rob.value='all';
document.forms[ax].target='uwagi';
document.forms[0].action='/contents/naucz/nwyniki.php';
document.forms[ax].submit();
}

function get_uwagi_przed_all(przed)
{
ax=0;
newwin_small('uwagi','/blank.html', '900', '800','20','20');
document.forms[ax].act.value='nau';
document.forms[ax].zapisz.value=przed;
document.forms[ax].etap.value='uwagi_show';
document.forms[ax].rob.value='all_przed';
document.forms[ax].target='uwagi';
document.forms[0].action='/contents/naucz/nwyniki.php';
document.forms[ax].submit();
}


function cele_zmiana()
{
document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value='zmiana';
document.forms[1].submit();
}

//BS
function przewidywany_wynik_zmiana()
{
document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param2.value='zmiana_pw';
document.forms[1].submit();
}

function rzeczywisty_wynik_zmiana()
{
document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param2.value='zmiana_rw';
document.forms[1].submit();
}


//BS end


function cele_zapisz()
{
wynik=document.getElementById('cele_cel').value;
if (wynik>=0&&wynik<=100&&!isNaN(wynik))
	{
document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value='zapisz';
document.forms[1].submit();
	}
else
	{
	alert ('Wpisz zakładany wynik - od zera do stu procent.');
	}
}

//BS
function przewidywany_wynik_zapisz()
{
wynik=document.getElementById('cele_przewidywany_wynik').value;
if (wynik>=0&&wynik<=100&&!isNaN(wynik))
	{
document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param2.value='zapisz_pw';
document.forms[1].submit();
	}
else
	{
	alert ('Wpisz zakładany wynik - od zera do stu procent.');
	}
}

function rzeczywisty_wynik_zapisz()
{
wynik=document.getElementById('cele_rzeczywisty_wynik').value;
if (wynik>=0&&wynik<=100&&!isNaN(wynik))
	{
document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param2.value='zapisz_rw';
document.forms[1].submit();
	}
else
	{
	alert ('Wpisz zakładany wynik - od zera do stu procent.');
	}
}

//BS end


function rev_check(ell,elt)
{
if (elll=document.getElementById(ell))
	{
	if (elll.checked==true&&elt=='checkbox') elll.checked=false;
	else elll.checked=true;
	}
}

function refresh()
{
document.forms[0].act.value='odswiez';
document.forms[0].submit();
}
 
var data_end=0;
var timer_end=null;
var timer_start=null;
var koniec=false;

function show_time()
{

if (koniec==false)
	{
if (qt=document.getElementById('quiz_time'))
	{
	
	if (timer_end==null) timer_end=0;
	if (timer_start==null) timer_start=0;
	if (data_end==0) 
		{
		data_system= new Date();
		czas=data_system.getTime();
		if (timer_start!=0)
			roznica=czas-timer_start;
		else 
			roznica=0;
		data_end= new Date(timer_end+roznica);
		czas_end= data_end.getTime();
		}
	time_now= new Date( ).getTime( );
	reszta=new Date(czas_end-time_now);
	
	mili="";
	zero=new Date(0);
	minuty=reszta.getMinutes();
	koniec=false;
	if (minuty>2)
		span="<span style=\"font-weight:bold;color:#A4FFA4;font-family:Courier,Verdana\">";
	else if (minuty>1)
		span="<span style=\"font-weight:bold;color:#FFCA40;font-family:Courier,Verdana\">";
	else 
		span="<span style=\"font-weight:bold;color:#FF7B20;font-family:Courier,Verdana\">";
		militime=reszta.getTime()-Math.floor(reszta.getTime()/1000)*1000;
		if (militime<10) militime="00"+militime;
		if (militime<100&&militime>=10) militime="0"+militime;
		
	godziny=reszta.getHours()-1;
	if (minuty<1)
		mili="<br><span style=\"color:#FFFF00;font-size:12px;font-family:Courier,Verdana\">"+militime+"</span>";
	
	if (minuty<10) minuty="0"+minuty;
	sekundy=reszta.getSeconds();
	if (sekundy<10) sekundy="0"+sekundy;
	if (minuty<=0&&sekundy<=0) 
		{
		minuty=0;
		sekundy=0;
		mili='';
		}//
 //	alert (document.getElementById('quiz_time').innerHTML);
	inner=span+godziny+":"+minuty+":"+sekundy+mili+"</span>";
	
	document.getElementById('quiz_time').innerHTML=inner;
  //	alert (document.getElementById('quiz_time').innerHTML);
	ilet=1000;
	if (mili!='') ilet=1;
	//alert (qt.innerHTML);
	window.setTimeout('show_time()', ilet);
	//window.status=span;
	if (reszta.getTime()<0)
		koniec=true;
	if (koniec)
		{
		quiz_post('go','koniec','');
		}
	}
	}
}
function open_n_zestaw(zest,kod)
{
newwin_quiz('egzamin','/blank.html', '900', '700','0','20');

	if (foremka=document.getElementById('form_mag'))
		{
		with (foremka)
 			{
  			target='egzamin';
			zestaw.value=zest;
  			kk.value=kod;
			ocena.value='ocena';
			doo.value='rozwiaz';
			act.value='quiz';
			action='http://www.kurssikory.pl/contents/wyniki/spr.php';
 			submit();
  			}
		}

}

function check_ocena(item,maks)
{
tenit=document.getElementById(item);
if (parseInt(tenit.value)>parseInt(maks)||parseInt(tenit.value)<0)
	{
	alert ('Zakres ocen dla tego pytania: od 0 do '+maks+'. Wpisano: '+tenit.value);
	tenit.value='';
	}
}

function show_hide(element)
{
if (tenit=document.getElementById(element))
	{
	if (tenit.style.display=='none')
		tenit.style.display='block';
	else
		{
		tenit.style.display='none';
		}
	}
}
 
 function drukuj_lista()
{
document.forms[0].etap.value='lista_nie_druk';
document.forms[0].zapisz.value=document.forms[1].data_druk.value;
document.forms[0].target='lista';
newwin('lista','/blank.html', '800', '800','1','1');
document.forms[0].submit();


}

function get_tm(zest)
{
document.forms[1].doo.value='rozwiaz';
document.forms[1].act.value='pobierz_wydruk';
document.forms[1].zestaw.value=zest;
document.forms[1].target='_self';
//document.forms[1].action='http://www.kurssikory.pl/contents/wyniki/spr.php';
document.forms[1].action='http://www.kurssikory.pl/contents/wyniki/spr.php';
document.forms[1].submit();
}

function instr_gotowe()
{
document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value='gotowe';
document.forms[1].target='_self';
document.forms[1].submit();
}

function PE_wybor(zest,slot)
{
document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value='wybor_slotu';
document.forms[1].param2.value=slot;
document.forms[1].zestaw.value=zest;
document.forms[1].target='_self';
document.forms[1].submit();
}

function Q_dates(zest,kkod)
{
document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value='check_activity';
document.forms[1].param2.value=kkod;
document.forms[1].zestaw.value=zest;
document.forms[1].target='_self';
document.forms[1].submit();
}

function Q_reset(zest,kkod)
{
if (confirm("Czy na pewno chcesz zresetowac egzamin "+zest+" dla kodu kursanta "+kkod+"???"))
	{
	document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
	document.forms[1].param1.value='reset_quiz';
	document.forms[1].param2.value=kkod;
	document.forms[1].zestaw.value=zest;
	document.forms[1].target='_self';
	document.forms[1].submit();
	}
}

function QTE_reset(zest,kkod,uzas)
{
if (uzas!="")
	{
if (confirm("Czy na pewno chcesz zresetowac egzamin "+zest+" dla kodu kursanta "+kkod+"???"))
	{
	document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
	document.forms[1].param1.value='reset_quiz';
	document.forms[1].param2.value=kkod;
	document.forms[1].zestaw.value=zest;
	document.forms[1].data_new.value=' ';
	document.forms[1].uzas.value=uzas;
	document.forms[1].target='_self';
	document.forms[1].submit();
	}
	}
else
	alert ('Opisz przyczyne wykonania interwencji.');
}

function QTE_data(zest,kkod,uzas,dat)
{
if (uzas!="")
	{
	if (dat!="")
		{
		if (confirm("Czy na pewno chcesz zmienic date konca pisania egzaminu "+zest+" dla kodu kursanta "+kkod+" na "+dat+"???"))
			{
			document.forms[1].doo.value='wybor';
		//document.forms[1].action='http://www.kurssikory.pl/spr';
		document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
			document.forms[1].param1.value='data_quiz';
			document.forms[1].param2.value=kkod;
			document.forms[1].zestaw.value=zest;
			document.forms[1].uzas.value=uzas;
			document.forms[1].data_new.value=dat;
			document.forms[1].target='_self';
			document.forms[1].submit();
			}
		}
		else
			{
			alert ('Podaj nowa date!');
			}
			
	}
else
	alert ('Opisz przyczyne wykonania interwencji.');
}

function QTE_dates(zest,kkod,uzas)
{
document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value='check_log';
document.forms[1].param2.value=kkod;
document.forms[1].zestaw.value=zest;
document.forms[1].uzas.value=uzas;
document.forms[1].target='_self';
document.forms[1].submit();
}

function odswiez()
{
document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].param1.value='';
document.forms[1].param2.value='';
document.forms[1].zestaw.value='';
document.forms[1].target='_self';
document.forms[1].submit();
}

function lekcje_slot_edit(tyg)
{

document.forms[1].doo.value='wybor';
document.forms[1].target='_self';
document.forms[1].dod.value='wybor';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
document.forms[1].param1.value=tyg;
document.forms[1].param2.value='edytuj_slot';
document.forms[1].submit();
	
}

function QTE_Renew(przed,kkod)
{
if (przed!="")
	{

	document.forms[1].doo.value='wybor';
//document.forms[1].action='http://www.kurssikory.pl/spr';
document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
	document.forms[1].param1.value='renew_quiz';
	document.forms[1].param2.value=kkod;
	document.forms[1].zestaw.value=przed;
	document.forms[1].target='_self';
	document.forms[1].submit();
	
 	}
}

function QTE_lekcje_zmiana(tyg,kkod,ileh,uzas)
{
if (uzas!="")
	{

	document.forms[1].doo.value='wybor';
	//document.forms[1].action='http://www.kurssikory.pl/spr';
	document.forms[1].action='http://www.kurssikory.pl/index.php?page=358';
	document.forms[1].param1.value='lekcje_zmiana_h';
	document.forms[1].zestaw.value=tyg;
	document.forms[1].param2.value=kkod;
	document.forms[1].uzas.value=uzas;
	document.forms[1].last_pyt.value=ileh;
	document.forms[1].target='_self';
	document.forms[1].submit();
	
 	}
else
	alert ('Opisz przyczyne wykonania interwencji.');
}
  -->