$(document).ready(function(){
	
	// Czyszczenie inputów
	$("input[type=text], textarea").toggle(
		function() {			
			$(this).removeAttr("value");
		},
		function() {
			//$(this).attr({ value: valueInput });
		}
	);
	
	// Formularz kontaktowy
	$("form").submit(function() {
      if( $("input[name=nazwisko]").val() == "Imię i nazwisko") {
        alert('Musisz podać imię i nazwisko');
      } else {
    	  $.ajax({
    			type: "POST",
    			url: "/kontakt.php",
    			data: "nazwisko=" + $(this).find("input[name=nazwisko]").val() + "&firma=" + $(this).find("input[name=firma]").val() + "&telefon=" + $(this).find("input[name=telefon]").val() + "&email=" + $(this).find("input[name=email]").val() + "&tresc=" + $(this).find("textarea[name=tresc]").val(),
    			success: function(){
    				$("#msg").css({ display:"block" }).text("Twoja wiadomość została wysłana.");
    				$("input[type=text], textarea").removeAttr("value");
    			}
    	  });
	  }
	  
	  return false; 
    });
	
	$('a.tooltip').ToolTip({
		className: 'inputsTooltip',
		position: 'mouse',
		delay: 200
	});
	
	
	
	
});
