// Webtip.cz - DHTML knihovna
// verze 0.5

function objGet(x) {
	if (typeof x != 'string') return x;
	else if (Boolean(document.getElementById)) return document.getElementById(x);
	else if (Boolean(document.all)) return eval('document.all.'+x);  // pro MSIE 4
	else return null;
}

function objSetStyle (obj,prop,val) {
	var o = objGet(obj);
	if (o && o.style) {
		eval ('o.style.'+prop+'="'+val+'"');
		return true;
		}
	else return false;
	}

function objShow (obj,on) {
	return objSetStyle(obj,'visibility',(on) ? 'visible':'hidden');
	}

function objDisplay (obj,on,type) {
	if (on && !type) type = 'block';
	return objSetStyle(obj,'display',(on) ? type:'none');
	}

// Ceske ekvivalenty funkci:

var objNajdi = objGet;
var objNastavStyl = objSetStyle;
var objZobraz = objShow;


// MyOpen
var actMenu=0
function myopen (a) {
  if (a==actMenu) {
    objDisplay('s'+a,false);
    actMenu = 0;
    }
  else {
    if (actMenu) objDisplay('s'+actMenu,false);
      objDisplay('s1',false);
      objDisplay('s2',false);
      objDisplay('s3',false);
      objDisplay('s4',false);
      objDisplay('s5',false);
      objDisplay('s6',false);
      objDisplay('s7',false);
      objDisplay('s'+a,true);
      actMenu = a;
      }
  }
  

// Otevření fotky/obrázku v novém okně s popiskem

function FotoOpen(path,title,popis,autor) {
  msg=open("","DisplayWindow","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600,");
  msg.document.write('<HTML><HEAD><TITLE>'+title+'</TITLE>');
  msg.document.write('<link rel="stylesheet" type="text/css" href="styly.css">');
  msg.document.write('</HEAD>');
  msg.document.write('<BODY style="background-color:#FFFFCC">');
  msg.document.write('<TABLE spacing=0 style="padding:0; margin-top:20px auto 10px auto; text-align:center"><TR><TD padding=0>');
  msg.document.write('    <A href="#0" onclick="window.close(); return false">');
  msg.document.write('      <IMG SRC="'+path+'" style="margin:0px auto 0px auto" ALT="zvětšený obrázek" title="Kliknutím okno zavřete">');
  msg.document.write('    </A>');
  msg.document.write('  </TD></TR><TR><TD padding=0>');
  msg.document.write('    <P style="font-size:100%; text-align=center; font-weight:bold; margin:0px auto 0px auto">'+popis+'</P>');
  msg.document.write('  </TD></TR><TR><TD padding=0>');
  msg.document.write('    <P style="font-size:80%; text-align=center; margin:0 auto 0 auto">Foto: <A href="autor_foto.htm">'+autor+'</A></P>');
  msg.document.write('</TD></TR></TABLE>');
  msg.document.write('</BODY>');
  msg.document.write('</HTML>');
  return true;
}




// Testy podle mne

  
function TestOpen() {
  var d=0;
  var s=0;
  msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=no,scrollbars=yes");
  msg.document.write('<HTML><HEAD><TITLE>Vyhodnoceni</TITLE>');
  msg.document.write('<link rel="stylesheet" type="text/css" href="styly.css">');
  msg.document.write('</HEAD>');
  msg.document.write('<BODY style="background-color:#FFFFCC"><br><H1 style="text-align:center">Vyhodnocení testu</H1>');
  msg.document.write('<table border="1" bordercolor="black" style="margin-left:auto; margin-right:auto;border:1px solid black; font-size:80%; border-collapse: collapse"><tr><th align="center">Otázka č.</th><th align="center">Odpověď</th></tr>');
  msg.document.write('<tr><td align="center">');
  for(var i=1; i < 11; i++) 
    { if (MyArray[i]==od[i])
        {msg.document.write(i+'</td><td align="center"><font color="#336600"><strong>OK</strong></font></td></tr><tr><td align="center">');d+=1}
      else {if (od[i]=="0")
        {msg.document.write(i+'</td><td align="center"><span style="color:#FF6600"><strong>Nevyplněno</strong></span><br>(správně za <strong>'+MyArray[i]+'</strong>)</td></tr><tr><td align="center">');s+=1}
            else {msg.document.write(i+'</td><td align="center"><font color="red"><strong>Špatná odpověď</strong></font><br>(správně za <strong>'+MyArray[i]+'</strong>)</td></tr><tr><td align="center">');s+=1};};};
  msg.document.write('</td><td></td></tr></table>');
  msg.document.write('<p style="text-align:center"><strong>Počet správných odpovědí: '+d+'<br>Počet špatných: '+s+'</strong></html>');
  }


function initArray() {
  this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++)
    this[i+1] = initArray.arguments[i];
  } 
