<!--

/* ************** Unsupported Browser ? ********************** */

	if  (! (NS4 || NS6 || IE4 || IE5) )
	{
		document.write('<h2>Bohužel, Váš prohlížeč (' + navigator.appName + " " + parseInt(navigator.appVersion) +') neumožňuje zobrazení testů.</h2>'); 
		document.write('<strong>Pokud chcete stránku zobrazit, nainstalujte si alespoň <a href="http://www.microsoft.cz/ie">Internet Explorer 4</a>, <a href="http://mozilla.org">Mozillu</a> nebo <a href="http://www.netscape.com"><nobr>Netscape Navigator 4</nobr></a></strong>');

		if (confirm ("Chcete zpět na hlavní stránku?"))
			location = "http://www.aj.cz";
	} /* jen vyvoleni... */


function chyba(objekt)
{
	alert("Nesprávná 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){	/* posuvnik po poctu otazek */

	with (document.formular){

	  if (nahoda.checked){
	     alert("To bohužel nelze - je zapnuto náhodné pořadí otázek");
	     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);
	  } /* if */

	  else {
	    x *= 1;
	    if (x < (parseInt(dol.value)) )
	      dol.value = x;
	    PocetO.value = x - parseInt(dol.value) + 1;
	  } /* else */
	} /* with */
}


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);
	  } /* if */
  
	  else	{
	    x*= 1;
	    if (x > hor.value)
	      hor.value = x;
	      PocetO.value = parseInt(hor.value) - parseInt(dol.value) + 1;
	  } /* else */
	
	} /* with */
}



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);
		
	} /* with */
}




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();
	} /* with */
	window.focus();

}


function vypis_form()
{

/*
 ***************** Zacatek vypisu stranky ***************************
 */

	
	if (! Netscape)
	    document.write ('<div align="right" style="width: 102%; align: right; background-color: #dddddd; position: absolute; top: 0; left: 0;">');
	else 
	    document.write ('<table width=100% bgcolor=#dddddd><td align=right>');


	document.write ('&nbsp;<a href="http://www.aj.cz" title="Zpět na hlavní stránku">');
	document.write ('<img src="img/left_off.gif" border="0" alt="Na hlavní stránku" width="11" height="13" name="menu">');
	document.write ('Na hlavní stránku</a>&nbsp;|&nbsp;');


/* ********************** nepouzito ***********************************
	  document.write ('<a href="#" title="Uložit nastavení"><img src="img/save.gif" border="0" alt="Uložit nastavení" align=absmiddle width=14 height=14></a>');
	  document.write ('&nbsp;<a href="#" title="Uložit nastavení">Uložit nastavení</a>&nbsp;|&nbsp;');
*/

	document.write ('<a href="javascript:help(\'nabidka\',2)"');

	document.write((Netscape) ? "" : " style=\"cursor: help;\"");

	document.write ('><img src="img/help.gif" border="0" alt="Nápověda" align=absmiddle width="16" height="16">Nápověda</a>');
	document.write ('&nbsp;|&nbsp;');
	
  
	if (! Netscape)
	  document.write('</div>');
	else 
	  document.write('</td></table>');

	document.write('<form name="formular" action="test.html" onSubmit="return ulozNastaveni();">');	

	document.write('<center><br/><table border="0" cellspacing="0" cellpadding="0" bgcolor="#EEEA9B">');


// Hlavicka formulare **********************************************
	document.write('<caption align="top"><strong>Nabídka testů z angličtiny </strong>verze ',build, ' <span class="master">( ',den, ".", mesic, ".",rok, ' )</span></font></caption>');

// Druh testu **********************************************
	document.write('<tr align=left><td height=50 align=left colspan=2>&nbsp;&nbsp;Okruh otázek:&nbsp;&nbsp;&nbsp;&nbsp;');
	document.write('<select name="tst" title="Vyberte okruh otázek" 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ázek)");
	} /* for */

	document.write("</select>&nbsp;&nbsp;");
	document.write('</td>');


// Cvičný / ostrý test **********************************************


	document.write('<td height=40><input type="radio" name="hned" title="Vyhodnotit ihned" value="0" id="radio_cvicny" checked><label for="radio_cvicny">Cvičný test</label>');
	document.write('&nbsp;&nbsp;&nbsp;<input type="radio" name="hned" value="1" id="radio_ostry" title="Vyhodnotit nakonec"><label for="radio_ostry">Ostrý test</label>');


//  zacatek 2. radku **********************************************
	  
	document.write(' </tr><tr valign="middle">');	


// Pocet otazek **********************************************

	document.write('</td><td height=40>&nbsp;&nbsp;Počet otázek:&nbsp;&nbsp;</td>');

	NahrejObr("menu", "left");

	NahrejObr("minus10", "minus10");
	NahrejObr("minus", "minus");
	NahrejObr("plus", "plus");
	NahrejObr("plus10", "plus10");

	document.write('<td width=230><a href="javascript:Pricti(-10)" OnMouseOver=zapni("minus10");  OnMouseOut=vypni("minus10");><img src="img/minus10_off.gif" border="0" width=22 height=22 alt="-10" align="' + img_align + '" name="minus10"></a>');
	document.write('<a href="javascript:Pricti(-1)" OnMouseOver=zapni("minus"); OnMouseOut=vypni("minus");><img src="img/minus_off.gif" width=22 height=22 border="0" alt="-1" align="' + img_align + '" name="minus"></a>');
	document.write(' <input type="text" size="' + txt_size + '" maxlength="3" name="PocetO" value="10" OnBlur="odecti_max();" title="Zadejte počet otázek"> ');
	document.write('<a href="javascript:Pricti(1)" OnMouseOver=zapni("plus"); OnMouseOut=vypni("plus");><img src="img/plus_off.gif" width=22 height=22 border="0" alt="+1" align="' + img_align + '" name="plus"></a>');
	document.write('<a href="javascript:Pricti(10)" OnMouseOver=zapni("plus10"); OnMouseOut=vypni("plus10");><img src="img/plus10_off.gif" width=22 height=22 border="0" alt="+10" align="' + img_align + '" name="plus10"></a>');


	document.write('</td><td>&nbsp;Otázky č. : ');
	document.write('<a href="javascript:Posun(-1)"><img src="img/left_off.gif" border="0" alt="<" width="11" height="13"></a><input type="text" size="' + txt_size + '" name="dol" value="1" OnBlur="zakaz_nahodu();" maxlength="3">');
	document.write(' až ');
	document.write('<input type="text" size="' + txt_size + '" name="hor" value="10" OnBlur="kontrola_hor();" maxlength="3">');


	document.write('<a href="javascript:Posun(1)"><img src="img/right_off.gif" border="0" alt=">"width="11" height="13"></a></td>');
 	document.write('</tr>');


// konec 2. radku **********************************************



//Dalsi nastaveni **********************************************

	document.write('<tr valign="middle" bgcolor="#F7A793">');


// Casovy limit **********************************************

	NahrejObr("min10", "minus10");
	NahrejObr("min", "minus");
	NahrejObr("pl", "plus");
	NahrejObr("pl10", "plus10");

	document.write('<td>&nbsp;&nbsp;Časový limit:&nbsp;</td>');

	document.write('<td colspan=1 height=40><a href="javascript:PrictiLimit(-10)" OnMouseOver=zapni("min10"); OnMouseOut=vypni("min10","minus10");><img src=img/minus10_off.gif width=22 height=22 border="0" alt=-10 align="' + img_align + '" name="min10"></a>');

	document.write('<a href="javascript:PrictiLimit(-1)" OnMouseOver=zapni("min"); OnMouseOut=vypni("min");><img src="img/minus_off.gif" width=22 height=22 border="0" alt="-1" align="' + img_align + '" name="min"></a>');

	document.write('&nbsp;<input type="text" name="limit" size="' + txt_size + '" maxlength=2 title="Zadejte časový limit" value="10" OnBlur="cislo(this);">&nbsp;');

	document.write('<a href="javascript:PrictiLimit(1)" OnMouseOver=zapni("pl"); OnMouseOut=vypni("pl");><img src="img/plus_off.gif" width=22 height=22 border="0" alt="+1" align="' + img_align + '" name="pl"></a>');
	document.write('<a href="javascript:PrictiLimit(10)" OnMouseOver=zapni("pl10"); OnMouseOut=vypni("pl10");><img src="img/plus10_off.gif" width=22 height=22 border="0" alt="+10" align="' + img_align + '" name="pl10"></a>');

	document.write('&nbsp;minut<td>');



// Nahodne poradi **********************************************

	document.write('<input type="checkbox" name="nahoda" value="1" id="check_nahoda" OnClick="zakaz_rozsah();">&nbsp;<label for="check_nahoda">Náhodné pořadí otázek</label>');
	document.write('</td></tr>');

/*
 * Posledni radek - *********************************************
 */
 
	document.write('<tr>');

//  vymazat /odeslat **********************************************

	document.write('<td align=right COLSPAN=3 height=20><hr /></tr><tr valign=middle><td height=30 colspan=2>&nbsp;');

	document.write('<! input type="button" value="Reset" OnClick="nuluj1();">&nbsp;');
	document.write('<a href="javascript:nuluj1()"><img src="img/open_off.gif" border="0" alt="Načíst nastavení" width=15 height=16 align=absmiddle>&nbsp;Načíst nastavení</a>&nbsp;&nbsp;');

	if ( ! Netscape)
		document.write('<a href="javascript:upravNastaveni()" title="Zvolit pozadí pro test"><img src="img/settings.gif" border="0" alt="Zvolit pozadí" width="16" height="16" align=absmiddle>&nbsp;Zvolit pozadí</a>');

	document.write('<td align=right>&nbsp;<input type="reset" name="reset" value="Reset">&nbsp;'); 

	document.write('<input type="submit" value="Zobrazit test">&nbsp;&nbsp;');
	document.write('</td></tr></table></center><dir></form></ul></dir>');


	zapati();
/*
 * konec vypisu **********************************************
 */

	  nuluj1();	/* nastaveni parametru */

	  window.focus();
}

/*
 * konec funkce vypis form **********************************************
 */



// --> 
