function marquee(x, typ, p){
    typ = {
        'up': [-1, 'top', 'offsetHeight'],
        'down': [1, 'top', 'offsetHeight'],
        'left': [-1, 'left', 'offsetWidth'],
        'right': [1, 'left', 'offsetWidth']
    }[typ];
    var m = this, mOut, mIn, turlaj, T, i = typ[0], j = 0, p = p || 30;
    (mOut = document.getElementById(x)).onmouseover = function(){
        T = clearInterval(T)
    };
    mOut.appendChild((mIn = mOut.childNodes)[0].cloneNode(1));
    mOut.onmouseout = function(e){
        e = e || event;
        e = e.toElement || e.relatedTarget;
        if (e) 
            do {
                if (e == this) 
                    return !1
            }
            while (e = e.parentNode)
        T = setInterval(turlaj, p)
    };
    mOut = mIn[0][typ[2]];
    turlaj = function(){
        mIn[0].style[typ[1]] = (-2 * i * (j += i) < (i - 1) * mOut ? (j = (-i - 1) / 2 * mOut + i) : j) + 'px';
        mIn[1].style[typ[1]] = j + mOut + 'px';
    }
    T = setInterval(turlaj, p);
}


function submitenter(myfield, e){
    var keycode;
    if (window.event) 
        keycode = window.event.keyCode;
    else 
        if (e) 
            keycode = e.which;
        else 
            return true;
    
    if (keycode == 13) {
        document.form.submit();
        return false;
    }
    else 
        return true;
}


function hideDiv(){
              if (document.getElementById) { // DOM3 = IE5, NS6
                  document.getElementById('error').style.display = 'none';
              }
              else {
                  if (document.layers) { // Netscape 4
                      document.error.display = 'none';
                  }
                  else { // IE 4
                      document.all.error.style.display = 'none';
                  }
              }
          }
          
          function showDiv(){
              if (document.getElementById) { // DOM3 = IE5, NS6
                  document.getElementById('error').style.display = 'block';
              }
              else {
                  if (document.layers) { // Netscape 4
                      document.error.display = 'block';
                  }
                  else { // IE 4
                      document.all.error.style.display = 'block';
                  }
              }
          }
          
          function email_validate(src){
              var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
              return regex.test(src);
          }
          
          
          function checkForm(){
              
			  stan=0;
			  var formularz = document.forms[1];
              text = "";
              
              
              if (formularz.surname.value == "") {
                  stan = 1;
                  text += "- Nie wypełniono pola Nazwisko  <br>\n";
              }
              
              if (formularz.name.value == "") {
                  stan = 1;
                  text += "- Nie wypełniono pola Imię <br>\n";
              }
              
              
              if(!email_validate(formularz.email.value)) {
			  	stan = 1;
                text += "- Nie poprawny adres e-mail <br>\n";
			  }
			  
              
              if((!formularz.zgoda1.checked) ||  (!formularz.zgoda3.checked)) {
                 stan = 1;
                 text += "- Nie wyrażono zgody na przetwarzanie danych osobowych <br>\n";
              }
              
              if (stan == 1) {
                  document.getElementById('error').innerHTML = text;
                  showDiv()
              }
              else {
              	hideDiv();
				document.formularz.submit();
              }
          }
             function resetform() {
     document.formularz.reset();
}
      
          

