jQuery(document).ready(
	function() {
		
	jQuery("#submitideas").click(function(){					   				   
		jQuery(".error").hide();
		var hasError = false;
			
		var messageVal = jQuery("#shiftidea").val();
		if(messageVal == '') {
			jQuery("#shiftidea").val('Please enter a shift idea.');
			hasError = true;
		}
		
		if(hasError == false) {
			jQuery(this).hide();
			jQuery("#idea-container small").append('<img src="wp-content/themes/shiftyourhabit/images/loading.gif" alt="Sending..." id="sending" />');
			jQuery("#idea-container small a").hide();
			
			jQuery.post("wp-content/themes/shiftyourhabit/library/extensions/sendemail.php",
   				{ mensaje: jQuery("#shiftidea").val()
				},
   				function(data){
					//jQuery("#idea-container").slideUp("normal", function() {
						jQuery("#shiftidea").val('');
						jQuery("#sending").remove();
						jQuery("#submitideas").show();
						jQuery("#idea-container small a").show();				   
						//jQuery("#idea-container").before('<h3 class="idea-sent">Thank you.</h3><p>Your shift idea has been submitted.</p>');
					//});
   				}
			);
		}
		
		return false;
	});

	}//end of jQuery
);