

/**
 * Returns the HTML contents of the imagebrowser control.
 */
function TinyMCE_imagebrowser_getControlHTML(control_name) {
	switch (control_name) {
		case "imagebrowser":
			return '<img id="{$editor_id}_imagebrowser" src="{$pluginurl}/images/imagebrowser.gif" title="Insert an Image" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceimagebrowser\');">';
	}

	return "";
}

/**
 * Executes the mceimagebrowser command.
 */
function TinyMCE_imagebrowser_execCommand(editor_id, element, command, user_interface, value) {
	// Handle commands
	switch (command) {
		case "mceimagebrowser":
			var template = new Array();

			template['file'] = '../../../../../wp-admin/iimage-browser.php'; // Relative to theme
			template['width'] = 600;
			template['height'] = 420;
			tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "yes"});

			return true;
	}

	// Pass to next handler in chain
	return false;
}
