﻿function elementsByClassName() {
var tabl=document.getElementsByTagName('div');
var ret=new Array();
for (a = 0; a < tabl.length; a++)
if (tabl[a].className.indexOf('tresc')==0)
ret.push(tabl[a]);
return ret;}
function findw() {
var tabl=document.getElementsByTagName('div');
var ret = 0;
for (a = 0; a < tabl.length; a++)
{if (tabl[a].className.indexOf('trescw')==0)
return ret;
else if (tabl[a].className.indexOf('tresc')==0)
ret++;}}
var pos = 0, akt = 0, r = 1;
var z = 0, cd = 53, xc = 0;
var tab=new Array();
function ruch(id) {
tab[parseInt(id+(r*xc))].style.height=pos+'px';
tab[parseInt(akt)].style.height=290-pos+'px';
pos+=cd;cd=cd/1.22;z++;
if (pos > 290) {
pos = xc; tab[parseInt(id)].className = "trescw";
tab[parseInt(akt-xc)].className = "tresca";
clearInterval(intv); akt = id; cd = 52 + r;
}}
function przesun(id) {
tab=elementsByClassName();
if (pos == 0) akt=findw();
if (id != akt && pos == 0) {
tab[parseInt(akt)].className = "tresc";
tab[parseInt(id)].className = "tresc";
intv = setInterval("ruch("+id+");", 20);
}}
	function sprawdz(formularz)
{
	for (i = 5; i < formularz.length; i++)
	{
		var pole = formularz.elements[i];
if ((pole.type == "text"  || pole.type == "textarea") && pole.value == "")
		{
			alert("Proszę wypełnić wszystkie pola!");
			return false;
		}
		if(i==6)
		{
//reg = /^[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬]{1,30}@[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬]+(\.[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬]+)+$/;
reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
    wyn = pole.value.match(reg);
    if (wyn == null) {
        alert("Proszę podać poprawny adres email.");
        return false;
				}
		}
	}
	return true;
}

