function IncludeJavaScript(jsFile)
{
  document.write('<script type="text/javascript" src="'
    + jsFile + '"></scr' + 'ipt>');
}

function sendDataForm() {
	$('#send').click(function(){
		
		if((!$('[name=name]').is('.unfocused')) || (!$('[name=mail]').is('.unfocused')) || (!$('[name=desc]').is('.unfocused'))){
			$('#msgx').animate({height: '92px'}, 200, function(){
				$(this).html('<p><b>Uwaga</b><br />Pola: <span>Imię i Nazwisko</span>, <span>email</span> i <span>treść</span> nie mogą pozostać puste</p>');
				$('input, textarea').focus(function(){
					$('#msgx').animate({height: '0px'}, 200, function(){ $(this).empty(); });
				})
			});
			return;
		}	
		
		$.post("/lib/sm.php", {
            name		: $('[name=name]').val(),
            firm		: $('[name=firm]').val(),
            phone		: $('[name=phone]').val(),
            mail		: $('[name=mail]').val() ,
            desc		: $('[name=desc]').val(),
		}
        ,
        function(data){
        if(data != 0)
        	alert('Nie wysłane');
        else
        	$('#msgx').animate({height: '132px'}, 200, function(){
				$(this).html('<p><b>Dziekujemy</b><br /> Twoja wiadomość została wysłana </p>');
				$('input, textarea').focus(function(){
					$('#msgx').animate({height: '0px'}, 200, function(){ $(this).empty(); });
				})
			});
        });
		
	});
}

$(document).ready(function() {
    var contactForm = new eform();
    sendDataForm();
});



