
    var maxCharsCount = 512;

    function countChars() {
        var txt = document.getElementById('text');
        if( txt.value.length > maxCharsCount ) {
            txt.value = txt.value.substr(0, maxCharsCount);
            return false;
        }
    }

    function countWords() {
        var TabCont = document.getElementById('text').value.split(" ");
        for( var idx in TabCont ) {
            if( TabCont[idx].length > 45 ) return false;
        }
        return true;
    }

    //sprawdzenie wypelnienia formy//
    function checkData() {

        var chBylaw = document.getElementById('chBylaw') ;

        if( !chBylaw.checked ) {
            alert( 'Proszę przeczytać oraz zaakceptować regulamin.' );
            return false;
        }

        if( !countWords() ) {
            alert( 'Niektóre wyrazy są zbyt długie. Proszę poprawić.' );
            return false;
        }

        return confirm("Czy napewno wysłać ogłoszenie?");
    }


function CheckForm(form) {

	var fname = document.getElementsByName('nazwisko');
	var lname = document.getElementsByName('imie');
	var email = document.getElementsByName('email');
	var text = document.getElementsByName('pytanie');
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;

    if(fname[0].value!="" && lname[0].value!="" && email[0].value!="" && text[0].value!="" && text[0].value!=" ") {

  //  if ((regex.test(email)!=false)) { alert('Adres email jest nieprawidłowy.'); return false;}
    
    var hidform = document.getElementsByName('hidform');
    hidform[0].value = "isok";
    form.submit();
    }
    else {
    alert('Proszę uzupełnić wymagane pola.');
    return false;
    }
}

function email_validate()
{
  
  var blad = false;


    
  
 
} 
