 $(document).ready(function(){	
        $(".menu2 a").append("<em></em>");
        $(".menu2 a").hover(function() {
          
            $(this).find("em").animate({opacity: "show", top: "-75"}, "normal");
             var hoverText = $(this).attr("title");
            $(this).find("em").text(hoverText);
        }, function() {
            $(this).find("em").animate({opacity: "hide", top: "-85"}, "fast");
        });

        $("#dol_slider").easySlider({pause: 3000,controlsShow: false,auto: true,continuous: true});
        
        });	
$(function() {

  $('input.text-input').focus(function(){
  $(this).css({backgroundColor:"#fff"}); 
  $(this).attr("value",""); 
  });
  
  $('#tresc').focus(function(){
  $(this).css({backgroundColor:"#fff"}); 
  $(this).attr("value",""); 
  });
  
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#f1f1f1"});
  });
  $('#tresc').blur(function(){
    $(this).css({backgroundColor:"#f1f1f1"});
  });
  $("input.text-input").focus(function() {
              if($("#email").val()=="Twój adres e-mail"){
                $(this).attr("value","");
                }
        });
  $("#tresc").focus(function() {
              if($("#tresc").val()=="Treść Wiadomości"){
                 $(this).attr("value","");
                 }
       });      
        
  $(".button").click(function() {
		// validate and process form

		
		var email = $("input#email").val();
    var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (regex.test(email)) ;
    else {
      $("input#email").attr("value","Prosimy podać poprawny adres e-mail");
      //$("input#email").focus();
      return false;
    }
     
    var tresc = $("#tresc").val();
    	if(tresc=="Treść Wiadomości") {
    
      $("#tresc").focus();
      return false;
    }		
		var dataString = 'email=' + email + '&tresc=' + tresc;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "mail.php",
      data: dataString,
      success: function() {
        $('#form').html("<div id='message'></div>");
        $('#form').html("<h2>Wiadomo¶ć została wysłana</h2>")
        .append("Dziekjemy")
        .hide()
        .fadeIn(1500, function() {
          $('#message').append("<p>.</p>");
        });
      }
     });
    return false;
	});
});