jQuery(document).ready(function() {
	
	//adds the shortcode with gallery id to the editor
	jQuery('#fg-add-gallery').click(function() {
		tinymce.EditorManager.activeEditor.selection.setContent("[fancygallery id='"+ jQuery('#fg-galleries').val() +"']");
		return false;
	});
	
});