<!--
	if  (! (NS4 || NS6 || IE4 || IE5) )
	{
		document.write('<h2>Bohužiaľ, Váš internetový prehliadač (' + navigator.appName + " " + parseInt(navigator.appVersion) +') neumožňuje zobrazenie testov.</h2>'); 
		document.write('<strong>Stránku možete prezerať s prehliadačmi <a target = "_blank" href="http://www.microsoft.com/slovakia/windows/downloads/ie/getitnow.mspx">MS Internet Explorer</a>, <a target = "_blank" href="http://www.mozilla.com/en-US/firefox/">Firefox</a>, <a target = "_blank" href="http://browser.netscape.com/ns8/">Netscape Browser</a> alebo <a target = "_blank" href="http://www.opera.com/">Opera</a></strong>');

		if (confirm ("Naspäť na hlavnú stránku?"))
			location = "../";
	}


function chyba(objekt)
{
	alert("Nesprávna hodnota.");
	objekt.focus();
	objekt.select();
	return 1;
}


function cislo(objekt)
{
	if(parseInt(objekt.value) > 0)
		return 1;
	chyba(objekt);
	return 0;
}


function ulozNastaveni() 
{
	with (document.formular)
	{
	  for(i = 0; i < length; i++)
		if(elements[i].type == "text" && ! cislo(elements[i]))
			return false;

	  ZapisCookie("vy", dol.value - 1);
	  ZapisCookie("rr", 0);
	  ZapisCookie("cas", limit.value);
	  ZapisCookie("pak", (hned[1].checked) ? 1 : 0);
	  ZapisCookie("nahoda", (nahoda.checked) ? 1 : 0);
	  ZapisCookie("celkem", celkem);
	  ZapisCookie("pocet", PocetO.value);
	  ZapisCookie("test", zvoleno);
	} /* with */

	return true;
}


function Posun(smer){	

	with (document.formular){

	  if (nahoda.checked){
	     alert("Zablokovaná možnosť - je zvolené náhodné poradie otázok");
	     window.focus();
	     return;
	  }

	  posun = smer * PocetO.value;

	  h_mez = ((h_mez = posun + parseInt(hor.value) ) <= 0) ? parseInt(PocetO.value) : h_mez;
	  h_mez = (h_mez > max[zvoleno]) ? max[zvoleno] : h_mez;

	  d_mez = ((d_mez = posun + parseInt(dol.value) ) <= 0) ? 1 : d_mez;
	  d_mez = (d_mez >= max[zvoleno]) ? max[zvoleno] - parseInt(PocetO.value) + 1 : d_mez;


	  dol.value = d_mez;
	  hor.value = h_mez;
	  PocetO.value = h_mez - d_mez + 1;
	} /* with */

	window.focus();
}

function Pricti(cislo){

	with (document.formular){
	  x = parseInt(PocetO.value);

	  if (isNaN(x)) {
	    PocetO.value = tempot;
	    x = tempot;
	  } /* if */

	if (x == 1 && cislo == 10)
	  cislo--;
	x+= cislo;
	
	if ((parseInt(hor.value) + cislo) > max[zvoleno])
	  x = max[zvoleno] - dol.value + 1;
	
	if (x > max[zvoleno])
	  x = max[zvoleno];
	
	if (x < 1) x = 1;


	PocetO.value = x; tempot = x;
	hor.value = x + parseInt(dol.value) - 1;
	limit.value = PocetO.value;
	} /* with */

	window.focus();
}

function PrictiLimit(cislo) {

	with (document.formular){
	  x = parseInt(limit.value);
	  if (isNaN(x)) {
	    limit.value = templim;
	    x = templim;
	  } /* if */
	  if (x == 1 && cislo == 10) 
	    cislo--;
	  x+= cislo;
	  if (x > 60) x = 60;
	  if (x < 1) x = 1;
	  limit.value = x;
	  templim = x;
	} /* with */
	window.focus();
}


function kontrola_hor() {

	with (document.formular){
	  x = parseInt(hor.value);
	  if ( isNaN(x) || x < 1 || x > max[zvoleno] || x != Math.round(x) ) 
	  {
	    return chyba(hor);
	  }
	  else {
	    x *= 1;
	    if (x < (parseInt(dol.value)) )
	      dol.value = x;
	    PocetO.value = x - parseInt(dol.value) + 1;
	  }
	} 
}


function zakaz_rozsah(){

	with (document.formular){

	  if (nahoda.checked) {
	    dol.value = 1;
	    odecti_max();
	    if (! Netscape)
	       dol.style.background = "#dddddd";
	    dol.disabled = true;
	    
	  } /* if */
	
	  else	{
	    dol.disabled = false;
	    if (! Netscape)
	       dol.style.background = "#ffffff";
	  } /* else */

	} /* with */
}



function odecti_max(){

	with (document.formular){
	  
	  x = parseInt(PocetO.value);
	  if (x > max[zvoleno] || isNaN(x) )
	  {
		return chyba(PocetO);
	  } /* if */

	  hor.value = parseInt(dol.value) + x - 1;
	  limit.value = x;
	} /* with */
}


function zakaz_nahodu() {

	with (document.formular){
	
	  x = dol.value;
	  if ( isNaN(x) || x < 1 || x > max[zvoleno] || x != Math.round(x) ) {
         return chyba(dol);
	  }   
	  else	{
	    x*= 1;
	    if (x > hor.value)
	      hor.value = x;
	      PocetO.value = parseInt(hor.value) - parseInt(dol.value) + 1;
	  }
	} 
}



function ZobrazPocet(){

	with (document.formular){
  	  zvoleno = tst.selectedIndex;
	  celkem = max[zvoleno];

	  limit.value = PrednastavenyLimit;
	  templim = limit.value;
	  
	  if (parseInt(dol.value) > max[zvoleno])
	     dol.value = max[zvoleno];
	  if (parseInt(hor.value) > max[zvoleno])
	     hor.value = max[zvoleno];
	  PocetO.value = parseInt(hor.value) - parseInt(dol.value) + 1;	
	  tempot = parseInt(PocetO.value);
		
	}
}




function nuluj1(){

	zvoleno = PrectiCookie("test");
	PrednastavenyPocet = (n = PrectiCookie("pocet")) ? n : 1;

	vy = (n = PrectiCookie("vy")) ? ++n : 1;
	if (max[zvoleno] > (n = vy + parseInt(PrednastavenyPocet)))
	     vy = n;
	else
	     vy = 1;

	PrednastavenyLimit = (n = PrectiCookie("cas")) ? n : PrednastavenyPocet;
	pak = (PrectiCookie("pak") == "1") ? 1 : 0;

	with (document.formular)
	{
	  if(! okruh)
 		tst.selectedIndex = zvoleno;
	  ZobrazPocet();
	  hned[pak].checked = true;
	  PocetO.value = PrednastavenyPocet;
	  dol.value = vy;
	  nahoda.checked = (PrectiCookie("nahoda") == "1") ? true : false;
	  zakaz_rozsah();
	  odecti_max();
	  ZobrazPocet();
	}
	window.focus();

}


function vypis_form()
{

	document.write('<form class = "form" name = "formular" action = "test.php" onSubmit = "return ulozNastaveni();">');	

	document.write('<h1>Online testy z angličtiny</h1>');
	document.write('<table class = "hlavny_formular">');

	document.write('<tr><td colspan = "2"><label for = "test">Okruh otázok:</label><br />');
	document.write('<select id = "test" name="tst" title="Vyberte okruh otázok" OnChange=ZobrazPocet(); >');

	okruh = PrectiCookie("tst",1);

	for(i = 0; i <= o; i++)
	{
		selected = (okruh == typ[i]) ? " selected" : "";
	      document.write("<option value=\"" + typ[i] + "\"" + selected + ">" + jmeno[i]+ " (" + max[i] + " otázok)");
	}

	document.write("</select>");
	document.write('</td>');

	document.write('<td><label for = "radio_cvicny">Cvičný test</label><br /><input type = "radio" name = "hned" title = "Vyhodnotit hned" value = "0" id = "radio_cvicny" checked = "checked" /></td>');
	document.write('<td><label for = "radio_ostry">Ostrý test</label><br /><input type = "radio" name = "hned" value = "1" id = "radio_ostry" title = "Vyhodnotit nakoniec"></td>');
	  
	document.write(' </tr><tr>');	

	document.write('</td><td><label for = "poceto">Počet otázok:</label></td>');

	NahrejObr("menu", "left");

	NahrejObr("minus10", "minus10");
	NahrejObr("minus", "minus");
	NahrejObr("plus", "plus");
	NahrejObr("plus10", "plus10");

	document.write('<td><a href = "javascript:Pricti(-10)" onmouseover = zapni("minus10");  onmouseout = vypni("minus10");><img src = "img/minus10_off.gif" width = "22px" height = "22px" alt = "-10" name = "minus10" /></a>');
	document.write('<a href = "javascript:Pricti(-1)" onmouseover = zapni("minus"); onmouseout = vypni("minus");><img src = "img/minus_off.gif" width = "22px" height = "22px" alt = "-1" name = "minus" /></a>');
	document.write(' <input type = "text" maxlength = "3" id = "poceto" name = "PocetO" value = "10" onblur = "odecti_max();" title = "Zadajte počet otázok" /> ');
	document.write('<a href = "javascript:Pricti(1)" onmouseover = zapni("plus"); onmouseout = vypni("plus");><img src = "img/plus_off.gif" width = "22px" height = "22px" alt = "+1" name = "plus" /></a>');
	document.write('<a href = "javascript:Pricti(10)" onmouseover = zapni("plus10"); onmouseout = vypni("plus10");><img src = "img/plus10_off.gif" width = "22px" height = "22px" alt = "+10" name = "plus10" /></a>');


	document.write('</td><td colspan = "2"><label for = "dol">Otázky č.:</label>&nbsp;');
	document.write('<a href = "javascript:Posun(-1)"><img src = "img/left_off.gif" alt = "<" width = "11px" height = "13px" /></a><input type = "text" name = "dol" value = "1" onblur = "zakaz_nahodu();" maxlength = "3" />');
	document.write(' až ');
	document.write(' <input type = "text" id = "hor" name = "hor" value = "10" onblur = "kontrola_hor();" maxlength = "3" />');


	document.write('<a href = "javascript:Posun(1)"><img src = "img/right_off.gif" alt = ">" width = "11px" height = "13px" /></a></td>');
 	document.write('</tr>');


	document.write('<tr>');

	NahrejObr("min10", "minus10");
	NahrejObr("min", "minus");
	NahrejObr("pl", "plus");
	NahrejObr("pl10", "plus10");

	document.write('<td><label for = "limit">Časový limit:</label></td>');

	document.write('<td colspan = "1"><a href = "javascript:PrictiLimit(-10)" onmouseover = zapni("min10"); onmouseout = vypni("min10");><img src = img/minus10_off.gif width = "22px" height = "22px" alt = "-10" name="min10" /></a>');

	document.write('<a href = "javascript:PrictiLimit(-1)" onmouseover = zapni("min"); onmouseout = vypni("min");><img src = "img/minus_off.gif" width = "22px" height = "22px" alt = "-1" name = "min" /></a>');

	document.write(' <input type = "text" id = "limit" name = "limit" maxlength = "2" title = "Zadajte časový limit" value = "10" onblur = "cislo(this);" /> ');

	document.write('<a href = "javascript:PrictiLimit(1)" onmouseover = zapni("pl"); onmouseout = vypni("pl");><img src = "img/plus_off.gif" width = "22px" height = "22px" alt = "+1" name = "pl" /></a>');
	document.write('<a href = "javascript:PrictiLimit(10)" onmouseover = zapni("pl10"); onmouseout = vypni("pl10");><img src = "img/plus10_off.gif" width = "22px" height = "22px" alt = "+10" name = "pl10" /></a>');

	document.write('&nbsp;minút</td>');

	document.write('<td colspan = "2"><input type = "checkbox" name = "nahoda" value = "1" id = "check_nahoda" onclick = "zakaz_rozsah();">&nbsp;<label for = "check_nahoda">Náhodné poradie otázok</label>');
	document.write('</td></tr>');

	document.write('<tr>');

	/*document.write('<! input type = "button" value = "Reset" onclick = "nuluj1();">');
	document.write('<a href = "javascript:nuluj1()"><img src = "img/open_off.gif" alt = "Nacitat nastavenie" width = "15px" height = "16px" />&nbsp;Načítať nastavenie</a>');

	if ( ! Netscape)
		document.write('<a href = "javascript:upravNastaveni()" title = "Zvolit pozadie pre test"><img src = "img/settings.gif" alt="Zvolit farbu pozadia" width = "16px" height = "16px" />Zvoliť farbu pozadia</a>');*/

	document.write('<td><input type = "submit" value = "Zobraziť test" style = "width: auto" />&nbsp;&nbsp;&nbsp;');
	document.write('<input type = "reset" name = "reset" value = "Reset" />'); 
	document.write('</td></tr></table></form>');

	/*zapati();*/

	  nuluj1();	/* nastaveni parametru */

	  window.focus();
}

// --> 
