/**
 * @author Piotrek
 */

function animujText(i,j){
	var text1 = new Array(
		"Ile będę miała dzieci ?",
		"Zrób test na płodność !",
		"Domowy test na płodność ?",
		"Chcesz mieć szczęśliwą gromadkę dzieci ?",
		"Nie trafiłaś tu bez powodu !",
		"Kalkulator przyszłego rodzica"
		);
	var text2 = new Array(
		"Tylko 20 pytań dzieli Cię od odpowiedzi.",
		"Przekonaj się jak liczną rodzinę będziesz miała.",
		"Dowiedz się wszystkiego nie wychodząc z domu.",
		"Sprawdź ile dzieci będziesz mieć w przyszłości.",
		"Rozwiąż szczegółowy test na płodność.",
		"Sprawdź ile będziesz miała dzieci ?"
		);
	var t = new String();
	if (j > 2) {
		j = 0.0;
		i = i + 1;
	}
		t = "<h1 style=\"text-align: left;\">"+text1[i]+"</h1>";
		t += "<h2 style=\"text-align: left;\">"+text2[(i)]+"</h2>";
	document.getElementById('animowany_text').innerHTML = t;
	document.getElementById('animowany_text').style.opacity = j;
	document.getElementById('animowany_text').style.filter = 'alpha(opacity = '+(j*100)+')'; // for IE
	j+=0.1;
	if (i==text1.length)
		i = 0;
	setTimeout("animujText("+i+","+j+")", 100);
}

function miga(j, divname){
	if (j > 2) {
		j = 0.0;
	}
	document.getElementById(divname).style.opacity = j;
	document.getElementById(divname).style.filter = 'alpha(opacity = '+(j*100)+')'; // for IE
	j+=0.1;
	setTimeout("miga("+j+", '"+divname+"')", 100);
}

function radiostyle(){
	var tab = document.getElementsByTagName('input');
	for (var i = 0; i < tab.length; i++) {
		if (tab[i].type == "radio") {
			tab[i].style.display = "none";
		}
	}
}

function zmiana(i, ile){
	for (var j=1; j<=ile; j++){
		if (j!=i)
			document.getElementById('zmiana'+j).innerHTML = '<img src=\'/public/img/radio-button.gif\'> ';
	}
	var a = document.getElementById('zmiana'+i);
	a.checked = true;
	a.innerHTML = '<img src="/public/img/radio-button-active.gif"> ';
	setTimeout("document.getElementById('formularz_glowny').submit()", 1000);
}

function zmianachbox(){
	
	if (document.getElementById('do_zmiany').innerHTML == '<img src="/public/img/radio-button-active.gif">') {
		document.getElementById('do_zmiany').innerHTML = '<img src="/public/img/radio-button.gif">';
		document.getElementById('chbox').checked = false;
	}
	else {
		document.getElementById('do_zmiany').innerHTML = '<img src=\'/public/img/radio-button-active.gif\'>';
		setTimeout("document.getElementById('f').submit()", 1000);
	}
}

function listapytan(nr_pyt){
	for (var i=0 ; i<nr_pyt ; i++) {
		document.getElementById('em'+(i+1)).style.background = 'url(/public/img/pp-before-active.png)';
		
	}
	document.getElementById('em'+(nr_pyt+1)).style.background = 'url(/public/img/pp-active.png)';
	for (var i=nr_pyt+1 ; i<21 ; i++) {
		document.getElementById('em'+(i+1)).style.background = 'url(/public/img/pp-after-active.png)';
		
	}
}

