function b4aaUploadReturn(data, statusText, form_pfx)  {

	if(data.form_name != 'b4aa'){
		return false;
	}

	b4aaUploadSuccess(data, statusText, form_pfx);
	return true;  //Need to return true or stand Success function will continue.
}


// Callback for successful Ajax image upload
// Displays the image or error messages
function b4aaUploadSuccess(data, statusText, form_pfx)  {

	//Reset the Form
	$j('#' + form_pfx + 'bwbps_submitBtn').removeAttr('disabled');
	$j('#' + form_pfx + 'bwbps_imgcaptionInput').removeAttr('disabled');
	
	
	bwbpsUploadStatus = true;
	if (statusText == 'success') {
		if(data == -1){
				//Security failed
				alert('Nonce check failed. Invalid security.');
			//The nonce	 check failed
			$j('#' + form_pfx + 'bwbps_message').html("<span class='error'>Upload failed due to invalid authorization.  Please reload this page and try again.</span>");
			return false;
	 	}
	 	
		if( data.succeed == 'false'){
			//Failed for some reason
			$j('#' + form_pfx + 'bwbps_message').html(data.message); 
			return false;
		}
		
		if (data.img != '') {
			//We got an image back...show it
			$j('#' + form_pfx + 'bwbps_result').html('<img src="' + bwbpsThumbsURL + data.before_image +'" width="60px" height="72px" />'); 

			var ahref = $j('<a></a>').attr('href', bwbpsBlogURL + '?p=' + data.post_id + '&amp;preview=true').attr('title','Preview new post').attr('target','_blank').html('Preview New Post');
			
			$j('#' + form_pfx + 'bwbps_result2').html('<img src="' + bwbpsThumbsURL + data.after_image +'" width="60px" height="72px" /><br/>');
			ahref.appendTo('#' + form_pfx + 'bwbps_result2');
			
			$j('#' + form_pfx + 'bwbps_message').html('<b>Upload successful!</b>'); 
			
			
			
		} else {
			$j('#' + form_pfx + 'bwbps_message').html( data.error); 
		}
	} else {
		$j('#' + form_pfx + 'bwbps_message').html('Unknown error!'); 
	}
	
	return true;
} 
