function init() {
	tinyMCEPopup.resizeToInnerSize();
}

function mfn_mce_submit() {

	var output;
	var shortcode = document.getElementById('shortcode').value;
	
	switch( shortcode ) {
		case 0:
		case "0":
			tinyMCEPopup.close();
			break;
	
		// ************************* content **********************
		case "blockquote":
			output = "[" + shortcode + " photo=\"\" author=\"\" company=\"\" link=\"\" target=\"_blank\"]" +
				" Insert your content here " +
				"[/" + shortcode + "]";
			break;
			
		case "button":
			output = "[" + shortcode + " title=\"\" link=\"\" target=\"_blank\" size=\"\" color=\"\" class=\"\"]";
			break;
			
		case "divider":
			output = "[" + shortcode + " height=\"30\" line=\"1\"]";
			break;
			
		case "dropcap":
			output = "[" + shortcode + " background=\"\" color=\"\" circle=\"0\"]" +
				" I " +
				"[/" + shortcode + "] nsert your content here";
			break;
			
		case "highlight":
			output = "[" + shortcode + " background=\"\" color=\"\"]" +
			" Insert your content here " +
			"[/" + shortcode + "]";
			break;
			
		case "ico":
			output = "[" + shortcode + " type=\"fa-phone\"]";
			break;

		case "image":
			output = "[" + shortcode + " src=\"\" align=\"\" caption=\"\" link=\"\" link_type=\"\" target=\"\" alt=\"\"]";
			break;
			
		case "table":
			output = "<table><thead><tr><th>Column 1 heading</th><th>Column 2 heading</th><th>Column 3 heading</th></tr></thead><tbody><tr><td>Row 1 col 1 content</td><td>Row 1 col 2 content</td><td>Row 1 col 3 content</td></tr><tr><td>Row 2 col 1 content</td><td>Row 2 col 2 content</td><td>Row 2 col 3 content</td></tr></tbody></table>";
			break;	
			
		case "tooltip":
			output = "[" + shortcode + " hint=\"Insert your hint here\"]" +
			" Insert your content here " +
			"[/" + shortcode + "]";
			break;

		case "vimeo":
			output = "[" + shortcode + " video=\"1084537\" width=\"700\" height=\"400\"]";
			break;
			
		case "youtube":
			output = "[" + shortcode + " video=\"YE7VzlLtp-4\" width=\"700\" height=\"420\"]";
			break;
	
		// ************************* builder **********************
		case "article_box":
			output = "[" + shortcode + " image=\"\" slogan=\"\" title=\"\" link_text=\"\" link=\"\" target=\"_blank\"]";
			break;
			
		case "call_to_action":
			output = "[" + shortcode + " image=\"\" title=\"\" btn_title=\"\" btn_link=\"\" class=\"\"]";
			break;	
			
		case "clients":
			output = "[" + shortcode + " in_row=\"6\"]";
			break;
			
		case "contact_box":
			output = "[" + shortcode + " title=\"\" lat=\"\" lng=\"\" zoom=\"13\" address=\"\" telephone=\"\" email=\"\" www=\"\"]";
			break;
			
		case "counter":
			output = "[" + shortcode + " icon=\"fa-heart\" color=\"#222222\" image=\"\" number=\"44\" title=\"\"]";
			break;
			
		case "fancy_heading":
			output = "[" + shortcode + " title=\"\" icon=\"fa-heart\"]" +
				" Insert your content here " +
				"[/" + shortcode + "]";
			break;
			
		case "feature_box":
			output = "[" + shortcode + " title=\"\" image=\"\" link_text=\"\" link=\"\" target=\"_blank\" border=\"1\"]" +
				" Insert your content here " +
				"[/" + shortcode + "]";
			break;
			
		case "icon_box":
			output = "[" + shortcode + " title=\"\" icon=\"fa-heart\" image=\"\" link_title=\"\" link=\"\" target=\"_blank\"]" +
			" Insert your content here " +
			"[/" + shortcode + "]";
			break;			
			
		case "map":
			output = "[" + shortcode + " lat=\"\" lng=\"\" height=\"200\" zoom=\"13\"]";
			break;
			
		case "our_team":
			output = "[" + shortcode + " image=\"\" title=\"\" subtitle=\"\" email=\"\" phone=\"\" facebook=\"\" twitter=\"\" linkedin=\"\"]";
			break;
			
		case "pricing_item":
			output = "[" + shortcode + " title=\"\" price=\"\" currency=\"\" period=\"\" link_title=\"\" link=\"\" featured=\"\"]" +
			"<ul><li><strong>List</strong> item</li></ul>" +
			"[/" + shortcode + "]";
			break;	
			
		case "progress_bars":
			output = "[" + shortcode + " title=\"\"]" +
			"[bar title=\"Bar1\" value=\"50\"]" +
			"[/" + shortcode + "]";
			break;
			
		case "testimonials":
			output = "[" + shortcode + " category=\"\" orderby=\"menu_order\" order=\"ASC\" border=\"1\"]";
			break;
			
		// ************************* default **********************
		default:
			output = "[" + shortcode + "] Insert your content here [/" + shortcode + "]";
	}
	

	if (window.tinyMCE) {
		window.tinyMCE.execInstanceCommand('content', 'mceInsertContent',false, output);
		tinyMCEPopup.editor.execCommand('mceRepaint');
		tinyMCEPopup.close();
	}
	return true;
}