var egzamin=false;

function submitActiv(f) {
  f.przycisk.disabled=false;
  f.przycisk.className='sactive'
}


function java_enable(t) {
  t.js.value=9;
  return true;
}
function setTime(id_prz)
{
  //if (plik!='getdata') return false; // zabezpieczenie
  var xml = null;
  var wynik = document.getElementById("czas");
  //wynik.innerHTML = "wczytuje";
 
	if (window.XMLHttpRequest) xml = new XMLHttpRequest();
	else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
 
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          wynik.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "czas/getdata.php?id_prz="+id_prz, true);
    xml.send(null);
  }
  setTimeout("setTime("+id_prz+")", 10000)  
}

function punkty(czas){
	if( czas > (czas_na_odpowiedz - czas_premiowany) ) {
		
		document.getElementById("punkty").style.color = "gold";
		document.getElementById("punkty").innerHTML = "Odpowiadasz za "+punkty_premiowane+" pkt";
	}
	else {
		document.getElementById("punkty").style.color = "#FFFF68";
		document.getElementById("punkty").innerHTML = "Odpowiadasz za "+punkty_poprawna+" pkt";
	}
}

function liczCzas() 
{
	ile--;		

	 // wyliczanie roznicy
	  var sekund = ile;
	  var minut = Math.floor(sekund/60);
	  var godzin = Math.floor(minut/60);
 
	  // wyliczanie calego okresu 
	  sekund = Math.floor(sekund - minut * 60);
	  if(sekund<10) sekund='0'+sekund;
	  
	  minut = Math.floor(minut - godzin * 60);
	  

	if (ile >= 0) {
		if(egzamin) punkty(ile);
		if(ile<10) document.getElementById("czas").style.color = "red"; 
		document.getElementById("czas").innerHTML = "Pozostało: "+minut+" min : "+sekund+" s";
	} else {
		document.getElementById("czas").innerHTML = "Czas upłynął.";
		document.getElementById("f1").submit();
	}

setTimeout("liczCzas()", 1000);
}
function Potwierdz() {
var jest_potw = confirm('Na pewno chcesz usunąć?');
return jest_potw;
};
function otworz(adr){
zm=new Image();
zm.src=adr;

F=window.open('','','width='+zm.width+',height='+zm.height);
F.document.open();
F.document.write('<HTML><body style="margin:0" onclick="window.close()"><img src="'+adr+'"></BODY></HTML>');
F.document.close();
}
function blokuj(f) {
  if (f.wyslane) return false;
  f.wyslane=true;
  return true;
}
function FontSize(size, wyb) {
	document.getElementById("srodek").style.fontSize = size;	
	document.getElementById("size1").style.color = "black";
	document.getElementById("size2").style.color = "black";
	document.getElementById("size3").style.color = "black";
	document.getElementById(wyb).style.color = "#FF6805";	
}
