function submit_ezsurvey_form( button, node_id, image, error )
{
	var id_tab = button.getAttribute( "id" ).split('_');
	var id = id_tab[2];
	
	var dataString = "";
	$("#ezsurvey_form_" + id + " input").each( function(){
		value = false;
		switch( this.getAttribute( "type" ) )
		{
			case "checkbox":
			case "radio":
				if( this.checked )
				{
					value = this.getAttribute( "value" );
				}
			break;
			
			default:
				value = this.value;
			break;
		}
		if( value !== false )
		{
			if( dataString != "" )
			{
				dataString += "&";
			}
			dataString += this.getAttribute( "name" ) + "=" + value;
		}
	});
	$("#ezsurvey_form_" + id + " select option:selected").each( function(){
		if( dataString != "" )
		{
			dataString += "&";
		}
		if( this.parentNode.getAttribute( "multiple" ) )
		{
			dataString += this.parentNode.getAttribute( "name" ) + "[]=" + this.getAttribute( "value" );
		}
		else
		{
			dataString += this.parentNode.getAttribute( "name" ) + "=" + this.getAttribute( "value" );
		}
	});
	$("#ezsurvey_form_" + id + " textarea").each( function(){
		if( dataString != "" )
		{
			dataString += "&";
		}
		dataString += this.getAttribute( "name" ) + "=" + this.value;
	});
	
	var url = $("#ezsurvey_form_" + id).attr("action");
	
	$("#ezsurvey_formblock_"+node_id).html(image);
	$.ajax({
		type: "POST",  
		url: url,
		data: dataString,
		dataType: "html",
		success: function( msg ) {
			console.log(msg);
			$("#ezsurvey_formblock_"+node_id).html(msg);
		},
		error: function() {
			$("#ezsurvey_formblock_"+node_id).html(error);
		}
	});
}
