﻿function send() { 
	var komentarz = jQuery('#komentarz').val();
	var mailto = jQuery('#mailto').val();
	var mailwho = jQuery('#mailwho').val();
	var title = jQuery('#title').val();
	var url = location.href;//jQuery('#url').val();
		jQuery.ajax({
				type: "POST",
                url: "../_controls/recomendcms.aspx",
                data: "komentarz=" + komentarz + "&mailto=" + mailto + "&mailwho=" + mailwho + "&title=" +title+ "&url=" + url,
                success: function(msg){ clear(); hide('recomendform');},
				error: function(msg) { hide('recomendform')},
                fail: function(msg) { hide('recomendform'); }
                });
			}
	function clear()
	{
		jQuery('#komentarz').val('');
		jQuery('#mailto').val('');
		jQuery('#mailwho').val('');
	}
jQuery(document).ready(
        function() {
	       var obj = jQuery('#addartcontent');
	       jQuery('#content').prepend(obj);
		   var oldButton = jQuery('div#recomendform p.buttons input.button');
		   var newButton = jQuery('<input type="button" onclick="send()" value="wyślij" class="button"/>');
		   newButton.insertBefore(oldButton);
		   oldButton.remove();
		   
});