function onDisplay($name) {
global $mainframe;
$document = & JFactory::getDocument();
$template = $mainframe->getTemplate();
JHTML::stylesheet( 'phocagallery.css', 'plugins/editors-xtd/phocagallery/css/' );
$link = 'index.php?option=com_phocagallery&view=phocag allerylinks&tmpl=component&e_name='.$name;
if (!$mainframe->isAdmin()){
$link = 'administrator/index.php?option=com_phocagallery&view=phocaga llerylinks&tmpl=component&e_name='.$name;
}
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Phoca Gallery Image'));
$button->set('name', 'phocagallery');
$button->set('options', "{handler: 'iframe', size: {x: 600, y: 400}}");
// if (!$mainframe->isAdmin()) {
// $button = null;
// }
return $button;
}