
jQuery(document).ready(function($) {

	function mbInsertCF7(id)
	{
			var button = jQuery('.media-buttons .maxbutton-' + id).parents('.shortcode-container').children().clone();

			$('input[name="cf7_maxbutton"]').val('[cf7_maxbutton id:' + id + ']');
			$('#mbcf7_insert_tag').trigger('click');

			return false; 
	}
	
	var mbtag = $('#tag-generator-list a.button[href*="maxbutton"]');

	$(mbtag).addClass('maxbutton_media_button');
	$(mbtag).removeClass('thickbox');
	$(mbtag).data('callback', mbInsertCF7);
	$(mbtag).removeAttr('href');
	
	$(document).on('mb_media_put_results', function (e, res, maxm) 
	{

		maxm.setTitle(mbcf7.title);
		
		maxm.currentModal.find('.modal_content .hint').text(mbcf7.note);
	});
	

});


