/*function validateForm(){
    $("#error_email").empty();
    var email = $("#email").val();
    var errors = 0;

    if (email == null || email == "") {
        $("#error_email").text("Pole Imie jest wymagane");
        errors++;
    }
    if (errors > 0) {
        alert ("Znaleziono bledy");
        return false;
    }
}*/

$(document).ready(function() {

    Cufon.replace('#body-top');

    Cufon.replace('#menu-top span');
    Cufon.replace('.cufon');
   


//    $('.macewy_link').click(function(){
//       $('#macewy').toggle();
//    });

    $('.article-more-button').toggle(function() {
       // $(this).prev('.article-more').toggle();
       //$(this).toggle(function() {
          $(this).prev('.article-more').slideDown('normal');
          $(this).attr('src', 'img/more-cross-left.jpg');
          $(this).attr('title', 'Pokaż mniej');
          //alert('First handler for .toggle() called.');
        }, function() {
          $(this).prev('.article-more').slideUp('normal');
          $(this).attr('src', 'img/more-cross.jpg');
          $(this).attr('title', 'Pokaż więcej');
    });


//VALIDACJA SKRYPT
//   $('#form_newsletter').validate();



$("#form_newsletter").submit(function(){
	  var email = $("#email").val();
          var valid=/^[0-9a-z]+([\.\-_][0-9a-z]+)*\@[0-9a-z]+([\.\-][0-9a-z]+)*\.[a-z]{2,4}$/;
          
          if (email != "") {
                    var odp = valid.test(email);
                    if (!odp) {
                        //alert (email);
                        $("#error_email").text("Niepoprawny e-mail!");
                        return false;
                    }
          } else if (email == ""){
              //alert (email);
              $("#error_email").text("Musisz podać e-mail!");
              return false;
          }

          

          /*
	  if (null == email || "" == email) {
		 $("#error_email").text("Niepoprawny e-mail!");
		 return false;
	  }*/
 });

 
/*
$(document).ready(function(){
    $('#form_newsletter').ajaxForm({
        beforeSubmit: validateForm
    });
});

*/









    $('.gallery-click').click(function(){
        var dane = $(this).attr('alt');
        $('#foto-projects').attr('src', dane);
    })

   

/*

            $(this).attr('src', 'img/more-cross-left.jpg');
            alert('jeden');
        }, function(){
            $(this).attr('src', 'img/more-cross.jpg');
            alert('dwa');
        });
    });
  */
});



