/**
     * Output the Block config screen
     */
    function pmxc_ShowAdmBlockConfig()
    {
        global $context, $settings, $modSettings, $options, $txt;
        echo '
				<tr>
					<td>
						<div class="windowbg" style="margin-top:-3px;">
						<table class="pmx_table">
							<tr>
								<td style="width:50%;padding:4px;">
									<input type="hidden" name="id" value="' . $this->cfg['id'] . '" />
									<input type="hidden" name="pos" value="' . $this->cfg['pos'] . '" />
									<input type="hidden" name="side" value="' . $this->cfg['side'] . '" />
									<input type="hidden" name="active" value="' . $this->cfg['active'] . '" />
									<input type="hidden" name="cache" value="' . $this->cfg['cache'] . '" />
									<input type="hidden" name="contenttype" value="' . ($this->cfg['blocktype'] == 'download' ? 'bbc_script' : $this->cfg['blocktype']) . '" />
									<input type="hidden" name="check_num_vars[]" value="[config][maxheight], \'\'" />
									<div style="height:61px;">
										<div style="float:left;width:100px; padding-top:1px;">' . $txt['pmx_edit_title'] . '</div>';
        // all titles depend on language
        $curlang = '';
        foreach ($context['pmx']['languages'] as $lang => $sel) {
            $curlang = !empty($sel) ? $lang : $curlang;
            echo '
										<span id="' . $lang . '" style="white-space:nowrap;' . (!empty($sel) ? '' : ' display:none;') . '">
											<input style="width:65%;" type="text" name="config[title][' . $lang . ']" value="' . (isset($this->cfg['config']['title'][$lang]) ? htmlspecialchars($this->cfg['config']['title'][$lang], ENT_QUOTES) : '') . '" />
										</span>';
        }
        echo '
										<input id="curlang" type="hidden" value="' . $curlang . '" />
										<div style="clear:both; height:10px;">
											<img style="float:left;" src="' . $context['pmx_imageurl'] . 'arrow_down.gif" alt="*" title="" />
										</div>
										<div style="float:left;width:100px;">' . $txt['pmx_edit_title_lang'] . '
											<img class="info_toggle" onclick=\'Show_help("pmxBH01")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</div>
										<select style="float:left;width:165px;" size="1" onchange="setTitleLang(this)">';
        foreach ($context['pmx']['languages'] as $lang => $sel) {
            echo '
											<option value="' . $lang . '"' . (!empty($sel) ? ' selected="selected"' : '') . '>' . $lang . '</option>';
        }
        echo '
										</select>
										<div style="margin-left:280px;">
											<span style="vertical-align:6px;">' . $txt['pmx_edit_title_align'] . '</span>';
        // title align
        if (!isset($this->cfg['config']['title_align'])) {
            $this->cfg['config']['title_align'] = 'left';
        }
        echo '
											<input type="hidden" id="titlealign" name="config[title_align]" value="' . $this->cfg['config']['title_align'] . '" />';
        foreach ($txt['pmx_edit_title_align_types'] as $key => $val) {
            echo '
											<img id="img' . $key . '" src="' . $context['pmx_imageurl'] . 'text_align_' . $key . '.gif" alt="*" title="' . $txt['pmx_edit_title_helpalign'] . $val . '" style="cursor:pointer;vertical-align:1px;' . ($this->cfg['config']['title_align'] == $key ? 'background-color:#e02000;' : '') . '" onclick="setAlign(\'\', \'' . $key . '\')" />';
        }
        echo '
										</div>
									</div>
									<div id="pmxBH01" style="margin-top:5px;" class="info_frame">' . $txt['pmx_edit_titlehelp'] . '
									</div>';
        // Title icons
        $this->cfg['config']['title_icon'] = empty($this->cfg['config']['title_icon']) || $this->cfg['config']['title_icon'] == 'none.gif' ? 'none.png' : $this->cfg['config']['title_icon'];
        echo '
									<div style="float:left;height:40px;">
										<div style="float:left;width:100px; padding-top:8px;">' . $txt['pmx_edit_titleicon'] . '</div>
										<div class="ttliconDiv" onclick="setNewIcon(document.getElementById(\'pWind.icon_sel\'), event)">
											<input id="post_image" type="hidden" name="config[title_icon]" value="' . $this->cfg['config']['title_icon'] . '" />
											<input id="iconDD" value="' . ucfirst(str_replace('.png', '', $this->cfg['config']['title_icon'])) . '" readonly />
											<img id="pWind.icon" class="pwindiconBlk" src="' . $context['pmx_Iconsurl'] . $this->cfg['config']['title_icon'] . '" alt="*" />
											<img class="ddImageBlk" src="' . $context['pmx_imageurl'] . 'state_expanded.png" alt="*" title="" />
										</div>
										<ul class="ttlicondd Blkedit" id="pWind.icon_sel" onclick="updIcon(this)">';
        foreach ($this->title_icons as $file => $name) {
            echo '
											<li id="' . $file . '" class="ttlicon' . ($this->cfg['config']['title_icon'] == $file ? ' active' : '') . '">
												<img src="' . $context['pmx_Iconsurl'] . $file . '" alt="*" /><span>' . $name . '</span>
											</li>';
        }
        echo '
										</ul>
										<script>$("li").hover(function(){$(this).toggleClass("active")});</script>
									</div>';
        // show registered block types
        echo '
								</td>
								<td style="padding:4px;">
									<div style="min-height:50px;">
										<div style="float:left; width:130px; padding-top:2px;">' . $txt['pmx_edit_type'] . '</div>';
        if (allowPmx('pmx_admin')) {
            echo '
										<select id="pmx.check.type" style="width:56%;" size="1" name="blocktype" onchange="FormFunc(\'chg_blocktype\', 1)">';
            foreach ($this->register_blocks as $blocktype => $blockDesc) {
                echo '
											<option value="' . $blocktype . '"' . ($this->cfg['blocktype'] == $blocktype ? ' selected="selected"' : '') . '>' . $blockDesc['description'] . '</option>';
            }
            echo '
										</select>
										<input id="cache_value" type="hidden" name="cache" value="0" />
										<div style="clear:both; line-height:7px;">&nbsp;</div>';
        } else {
            echo '
										<input type="hidden" name="blocktype" value="' . $this->cfg['blocktype'] . '" />
										<input style="width:50%;" type="text" value="' . $this->cfg['blocktype'] . '" disabled="disabled" />';
        }
        // cache settings
        if (!empty($this->can_cached)) {
            echo '
										<div style="float:left; width:127px; padding-top:4px;">' . $txt['pmx_edit_cache'] . '</div>';
            if (in_array($this->cfg['blocktype'], array_keys($context['pmx']['cache']['blocks']))) {
                echo '
										<input style="float:left; margin-top:9px !important;" id="cacheflag" class="input_check" type="checkbox" name="cacheflag" onclick="checkPmxCache(this, ' . $this->cache_time . ')" value="1"' . (!empty($this->cfg['cache']) ? ' checked="checked"' : '') . ' />
										<div style="float:left; margin-left:15px; padding-top:5px;">' . $txt['pmx_edit_cachetime'] . '</div>
										<input style="float:left; margin-top:3px; margin-left:6px;' . (empty($this->cfg['cache']) ? 'background-color:#8898b0;' : '') . '" onkeyup="check_numeric(this)" id="cacheval" type="text" name="cache" value="' . (empty($this->cfg['cache']) ? '0' : (empty($this->cfg['cache']) ? $this->cache_time : $this->cfg['cache'])) . '" size="7" />
										<div class="smalltext" style="float:left; margin-left:3px; padding-top:7px;">' . $txt['pmx_edit_cachetimesec'];
            }
            echo '
											<img class="info_toggle" style="vertical-align:text-top;" onclick=\'Show_help("pmxBH02")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</div>
										<div style="clear:both; line-height:4px; margin-top:-4px;">&nbsp;</div>
									</div>';
            if (in_array($this->cfg['blocktype'], array_keys($context['pmx']['cache']['blocks']))) {
                echo '
									<div id="pmxBH02" class="info_frame" style="margin-top:4px">' . $txt['pmx_edit_pmxcachehelp'] . '</div>';
            }
        } else {
            echo '
									<div style="float:left; margin-top:5px; height:20px;">';
            if (empty($this->can_cached)) {
                echo '
										' . $txt['pmx_edit_nocachehelp'];
            }
            echo '
									</div>';
        }
        // Pagename
        if ($this->cfg['side'] == 'pages') {
            echo '
									<div class="adm_clear">
										<div class="adm_clear" style="float:left;width:130px; padding-top:7px;">' . $txt['pmx_edit_pagename'] . '
											<img class="info_toggle" onclick=\'Show_help("pmxBH11")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</div>
										<input style="width:56%; margin-top:5px;" onkeyup="check_requestname(this)" type="text" name="config[pagename]" value="' . (!empty($this->cfg['config']['pagename']) ? $this->cfg['config']['pagename'] : '') . '" />
									</div>

									<div id="pmxBH11" class="info_frame" style="margin-top:5px;">' . $txt['pmx_edit_pagenamehelp'] . '
									</div>';
        } else {
            echo '
									<input type="hidden" name="config[pagename]" value="' . (!empty($this->cfg['config']['pagename']) ? $this->cfg['config']['pagename'] : '') . '" />';
        }
        echo '
								</td>
							</tr>
							<tr>';
        /**
         * Call the block depended settings.
         * Because each block can have his own settings, we have to call the settings now.
         */
        $usedClass = $this->pmxc_AdmBlock_content();
        // the group access
        echo '
									<div class="cat_bar catbg_grid grid_padd grid_top">
										<h4 class="catbg catbg_grid">
											<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH03")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
											<span class="cat_msg_title">' . $txt['pmx_edit_groups'] . '</span>
										</h4>
									</div>
									<select id="pmxgroups" onchange="changed(\'pmxgroups\');" style="width:83%;" name="acsgrp[]" multiple="multiple" size="5">';
        if (!empty($this->cfg['acsgrp'])) {
            list($grpacs, $denyacs) = Pmx_StrToArray($this->cfg['acsgrp'], ',', '=');
        } else {
            $grpacs = $denyacs = array();
        }
        foreach ($this->smf_groups as $grp) {
            echo '
										<option value="' . $grp['id'] . '=' . intval(!in_array($grp['id'], $denyacs)) . '"' . (in_array($grp['id'], $grpacs) ? ' selected="selected"' : '') . '>' . (in_array($grp['id'], $denyacs) ? '^' : '') . $grp['name'] . '</option>';
        }
        echo '
									</select>
									<div id="pmxBH03" class="info_frame">' . $txt['pmx_edit_groups_help'] . '</div>
									<script type="text/javascript">
										var pmxgroups = new MultiSelect("pmxgroups");
									</script>';
        // Block moderate && ECL block hidden
        if (!isset($this->cfg['config']['can_moderate'])) {
            $this->cfg['config']['can_moderate'] = allowPmx('pmx_admin') ? 0 : 1;
        }
        if (allowPmx('pmx_blocks', true)) {
            echo '
									<input type="hidden" name="config[can_moderate]" value="' . $this->cfg['config']['can_moderate'] . '" />';
        }
        echo '
									<input type="hidden" name="config[check_ecl]" value="0" />';
        // Block moderate and ECL
        if (!empty($modSettings['pmx_ecl']) || !allowPmx('pmx_blocks', true)) {
            echo '
									<div class="cat_bar catbg_grid grid_padd grid_top">
										<h4 class="catbg catbg_grid">
											<span class="cat_msg_title">' . $txt['pmx_block_other_settings'] . '</span>
											</h4>
									</div>';
        }
        if (!allowPmx('pmx_blocks', true)) {
            echo '
									<div class="adm_check">
										<span class="adm_w80">' . $txt['pmx_block_moderate'] . '
											<img class="info_toggle" onclick=\'Show_help("pmxBModHelp")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</span>
										<input type="hidden" name="config[can_moderate]" value="0" />
										<div><input class="input_check" type="checkbox" name="config[can_moderate]" value="1"' . (!empty($this->cfg['config']['can_moderate']) ? ' checked="checked"' : '') . ' /></div>
									</div>
									<div id="pmxBModHelp" class="info_frame" style="margin-top:0;">' . $txt['pmx_block_moderatehelp'] . '</div>
									<input type="hidden" name="config[check_ecl]" value="0" />
									<input type="hidden" name="config[check_eclbots]" value="0" />';
        }
        // Block hidden on ECL
        if (!empty($modSettings['pmx_ecl'])) {
            echo '
									<div class="adm_check">
										<span class="adm_w80">' . $txt['pmx_check_elcmode'] . '
										 <img class="info_toggle" onclick=\'Show_help("pmxBeclHelp")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</span>
										<div>
											<input class="input_check" type="checkbox" name="config[check_ecl]" value="1"' . (!empty($this->cfg['config']['check_ecl']) ? ' checked="checked"' : '') . ' onclick="showeclbots(this)" />
										</div>
									</div>
									<div id="pmxBeclHelp" class="info_frame" style="margin-top:0;">' . $txt['pmx_block_eclcheckhelp'] . '</div>
									<div id="eclextend" style="display:' . (!empty($this->cfg['config']['check_ecl']) ? 'block' : 'none') . '">
									<div class="adm_check">
										<span class="adm_w80">' . $txt['pmx_check_elcbots'] . '
										 <img class="info_toggle" onclick=\'Show_help("pmxeclHelpbots")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</span>
										<div><input id="eclextendinp" class="input_check" type="checkbox" name="config[check_eclbots]" value="1"' . (!empty($this->cfg['config']['check_eclbots']) ? ' checked="checked"' : '') . ' /></div>
									</div>
									<div id="pmxeclHelpbots" class="info_frame" style="margin-top:0;">' . $txt['pmx_block_eclcheckbotshelp'] . '</div>
									<script type="text/javascript">
										function showeclbots(elm) {if(elm.checked == true) document.getElementById("eclextend").style.display = "block"; else {document.getElementById("eclextend").style.display = "none"; document.getElementById("eclextendinp").checked = false;}}
									</script>';
        }
        // the visual options
        echo '
								</td>
								<td style="padding:4px;">
									<div class="cat_bar catbg_grid grid_padd">
										<h4 class="catbg catbg_grid"><span class="cat_left_title">' . $txt['pmx_edit_visuals'] . '</span></h4>
									</div>
									<div style="float:left; height:30px; width:177px;">' . $txt['pmx_edit_cancollapse'] . '</div>
									<input style="padding-left:141px;" type="hidden" name="config[collapse]" value="0" />
									<input class="input_check" id="collapse" type="checkbox" name="config[collapse]" value="1"' . ($this->cfg['config']['visuals']['header'] == 'none' ? ' disabled="disabled"' : ($this->cfg['config']['collapse'] == 1 ? ' checked="checked"' : '')) . ' />
									<div style="clear:both;" /></div>
									<div style="float:left; height:30px; width:180px;">' . $txt['pmx_edit_collapse_state'] . '</div>
									<select style="width:46%;" size="1" name="config[collapse_state]">';
        foreach ($txt['pmx_collapse_mode'] as $key => $text) {
            echo '
										<option value="' . $key . '"' . (isset($this->cfg['config']['collapse_state']) && $this->cfg['config']['collapse_state'] == $key ? ' selected="selected"' : '') . '>' . $text . '</option>';
        }
        echo '
									</select>
									<br style="clear:both;" />
									<div style="float:left; height:30px; width:180px;">' . $txt['pmx_edit_overflow'] . '</div>
									<select style="width:46%;" size="1" id="mxhgt" name="config[overflow]" onchange="checkMaxHeight(this);">';
        foreach ($txt['pmx_overflow_actions'] as $key => $text) {
            echo '
										<option value="' . $key . '"' . (isset($this->cfg['config']['overflow']) && $this->cfg['config']['overflow'] == $key ? ' selected="selected"' : '') . '>' . $text . '</option>';
        }
        echo '
									</select>
									<br style="clear:both;" />
									<div style="float:left; min-height:30px; width:99%;">
										<div style="float:left; min-height:30px; width:180px;">' . $txt['pmx_edit_height'] . '</div>
										<div style="float:left; width:46%">
											<input onkeyup="check_numeric(this)" id="maxheight" type="text" size="4" name="config[maxheight]" value="' . (isset($this->cfg['config']['maxheight']) ? $this->cfg['config']['maxheight'] : '') . '"' . (!isset($this->cfg['config']['overflow']) || empty($this->cfg['config']['overflow']) ? ' disabled="disabled"' : '') . ' /><span class="smalltext">' . $txt['pmx_pixel'] . '</span><span style="display:inline-block; width:3px;"></span>
											<select id="maxheight_sel" style="float:right;width:52%;margin-right:-1%;" size="1" name="config[height]">';
        foreach ($txt['pmx_edit_height_mode'] as $key => $text) {
            echo '
												<option value="' . $key . '"' . (isset($this->cfg['config']['height']) && $this->cfg['config']['height'] == $key ? ' selected="selected"' : '') . '>' . $text . '</option>';
        }
        echo '
											</select>
										</div>
									</dv>
									<br style="clear:both;" />
									<script type="text/javascript">
										checkMaxHeight(document.getElementById("mxhgt"));
									</script>

									<div style="float:left; height:30px; width:180px;">' . $txt['pmx_edit_innerpad'] . '</div>
									<input onkeyup="check_numeric(this, \',\')" type="text" size="4" name="config[innerpad]" value="' . (isset($this->cfg['config']['innerpad']) ? $this->cfg['config']['innerpad'] : '4') . '" /><span class="smalltext">' . $txt['pmx_pixel'] . ' (xy/y,x)</span>
									<br style="clear:both;" />';
        // CSS class settings
        echo '
									<div class="cat_bar catbg_grid grid_padd">
										<h4 class="catbg catbg_grid grid_botpad">
											<div style="float:left; width:177px;"><span class="cat_left_title">' . $txt['pmx_edit_usedclass_type'] . '</span></div>
											<span class="cat_left_title">' . $txt['pmx_edit_usedclass_style'] . '</span>
										</h4>
									</div>
									<div style="margin:0px 2px;">';
        // write out the classes
        foreach ($usedClass as $ucltyp => $ucldata) {
            echo '
										<div style="float:left; width:180px; height:30px; padding-top:2px;">' . $ucltyp . '</div>
										<select' . ($ucltyp == 'frame' || $ucltyp == 'postframe' ? ' id="pmx_' . $ucltyp . '" ' : ' ') . 'style="width:46%;" name="config[visuals][' . $ucltyp . ']" onchange="checkCollapse(this)">';
            foreach ($ucldata as $cname => $class) {
                echo '
											<option value="' . $class . '"' . (!empty($this->cfg['config']['visuals'][$ucltyp]) ? $this->cfg['config']['visuals'][$ucltyp] == $class ? ' selected="selected"' : '' : (substr($cname, 0, 1) == '+' ? ' selected="selected"' : '')) . '>' . substr($cname, 1) . '</option>';
            }
            echo '
										</select>
										<br style="clear:both;" />';
        }
        echo '
									</div>
									<div class="cat_bar catbg_grid grid_padd" style="margin-top:-2px;">
										<h4 class="catbg catbg_grid"><span class="cat_left_title" style="margin-left:-3px;">' . $txt['pmx_edit_canhavecssfile'] . '</span></h4>
									</div>
									<div style="float:left; margin:0px 2px; width:176px;">' . $txt['pmx_edit_cssfilename'] . '</div>
									<select id="sel.css.file" style="width:46%;margin-bottom:2px;" name="config[cssfile]" onchange="pmxChangeCSS(this)">
										<option value=""></option>';
        // custon css files exist ?
        if (!empty($this->custom_css)) {
            // write out custom mpt/css definitions
            foreach ($this->custom_css as $custcss) {
                if (is_array($custcss)) {
                    echo '
										<option value="' . $custcss['file'] . '"' . ($this->cfg['config']['cssfile'] == $custcss['file'] ? ' selected="selected"' : '') . '>' . $custcss['file'] . '</option>';
                }
            }
            echo '
									</select>
									<div style="clear:both;"></div>';
            // write out all class definitions (hidden)
            foreach ($this->custom_css as $custcss) {
                if (is_array($custcss)) {
                    echo '
									<div id="' . $custcss['file'] . '" style="display:none;">';
                    foreach ($custcss['class'] as $key => $val) {
                        if (in_array($key, array_keys($usedClass))) {
                            echo '
										<div style="float:left; width:180px; padding:0 2px;">' . $key . '</div>' . (empty($val) ? sprintf($txt['pmx_edit_nocss_class'], $settings['theme_id']) : $val) . '<br />';
                        }
                    }
                    echo '
									</div>';
                }
            }
            echo '
									<script type="text/javascript">
										var elm = document.getElementById("sel.css.file");
										var fname = elm.options[elm.selectedIndex].value;
										if(document.getElementById(fname))
											document.getElementById(fname).style.display = "";
										function pmxChangeCSS(elm)
										{
											for(i=0; i<elm.length; i++)
											{
												if(document.getElementById(elm.options[i].value))
													document.getElementById(elm.options[i].value).style.display = "none";
											}
											var fname = elm.options[elm.selectedIndex].value;
											if(document.getElementById(fname))
												document.getElementById(fname).style.display = "";
										}
									</script>';
        } else {
            echo '
									</select>
									<div style="clear:both; height:6px;"></div>';
        }
        echo '
								</td>
							</tr>
							<tr>
								<td colspan="2" style="text-align:center;padding:0px 4px 0 4px;"><hr class="pmx_hr" />
									<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_save_exit'] . '" onclick="FormFunc(\'save_edit\', \'1\')" />
									<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_save_cont'] . '" onclick="FormFunc(\'save_edit_continue\', \'1\')" />
									<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_cancel'] . '" onclick="FormFunc(\'cancel_edit\', \'1\')" />
								</td>
							</tr>';
        // the dynamic visibility options
        if (empty($context['pmx']['settings']['manager']['collape_visibility'])) {
            $options['collapse_visual'] = 1;
        } else {
            $options['collapse_visual'] = intval($this->getExtoptions());
        }
        echo '
							<tr>
								<td colspan="2" style="padding:15px 4px 0 4px;">
									<div class="title_bar">
										<h3';
        echo ' class="catbg">';
        echo '
											<span id="upshrinkImgVisual" class="floatright ' . (!empty($options['collapse_visual']) ? 'toggle_up"' : 'toggle_down"') . ' align="bottom"></span>
											<span class="pmxtitle pmxcenter pmxadj_right"><span>' . $txt['pmx_edit_ext_opts'] . '</span></span>
										</h3>
									</div>

									<div id="upshrinkVisual" style="display:' . (!empty($options['collapse_visual']) ? 'block' : 'none') . ';">
										<div class="info_text plainbox" style="margin:5px 0 0;display:block;">
											<img style="vertical-align:-3px;" onclick=\'Toggle_help("pmxBH05")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
											<span>' . $txt['pmx_edit_ext_opts_help'] . '</span>
											<div id="pmxBH05" style="display:none;"><hr class="pmx_hr" />' . $txt['pmx_edit_ext_opts_morehelp'] . '</div>
										</div>
									</div>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<div id="upshrinkVisual1"' . (!empty($options['collapse_visual']) ? '' : ' style="display:none;"') . '>
										<table class="pmx_table" style="table-layout:fixed;">
											<tr>';
        // on default actions
        echo '
												<td style="padding:4px;">
													<div class="cat_bar catbg_grid grid_padd">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH06")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_ext_opts_action'] . '</span>
														</h4>
													</div>
													<select id="pmxact" onchange="changed(\'pmxact\');" style="width:90%;" name="config[ext_opts][pmxact][]" multiple="multiple" size="8">';
        // get config data
        $data = $this->getConfigData('config, ext_opts, pmxact');
        foreach ($txt['pmx_action_names'] as $act => $actdesc) {
            echo '
														<option value="' . $act . '=' . (array_key_exists($act, $data) ? $data[$act] . '" selected="selected' : '1') . '">' . (array_key_exists($act, $data) ? $data[$act] == 0 ? '^' : '' : '') . $actdesc . '</option>';
        }
        echo '
													</select>
													<div id="pmxBH06" class="info_frame">' . $txt['pmx_edit_ext_opts_selnote'] . '</div>
													<script type="text/javascript">
														var pmxact = new MultiSelect("pmxact");
													</script>';
        // on boards
        echo '
													<div class="cat_bar catbg_grid grid_padd grid_top">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH08")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_ext_opts_boards'] . '</span>
														</h4>
													</div>
													<select id="pmxbrd" onchange="changed(\'pmxbrd\');" style="width:90%;" name="config[ext_opts][pmxbrd][]" multiple="multiple" size="8">';
        // get config data
        $data = $this->getConfigData('config, ext_opts, pmxbrd');
        foreach ($this->smf_boards as $brd) {
            echo '
														<option value="' . $brd['id'] . '=' . (array_key_exists($brd['id'], $data) ? $data[$brd['id']] . '" selected="selected' : '1') . '">' . (array_key_exists($brd['id'], $data) ? $data[$brd['id']] == '0' ? '^' : '' : '') . $brd['name'] . '</option>';
        }
        echo '
													</select>
													<div id="pmxBH08" class="info_frame">' . $txt['pmx_edit_ext_opts_selnote'] . '</div>
													<script type="text/javascript">
														var pmxbrd = new MultiSelect("pmxbrd");
													</script>';
        // on theme
        echo '
													<div class="cat_bar catbg_grid grid_padd grid_top">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH09a")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_ext_opts_themes'] . '</span>
														</h4>
													</div>
													<select id="pmxthm" onchange="changed(\'pmxthm\');" style="width:90%;" name="config[ext_opts][pmxthm][]" multiple="multiple" size="2">';
        // get config data
        $data = $this->getConfigData('config, ext_opts, pmxthm');
        foreach ($this->smf_themes as $thid => $thdata) {
            echo '
														<option value="' . $thid . '=' . (array_key_exists($thid, $data) ? $data[$thid] . '" selected="selected' : '1') . '">' . (array_key_exists($thid, $data) ? $data[$thid] == 0 ? '^' : '' : '') . $thdata['name'] . ' (' . $thid . ')</option>';
        }
        echo '
													</select>
													<div id="pmxBH09a" class="info_frame">' . $txt['pmx_edit_ext_opts_selnote'] . '</div>
													<script type="text/javascript">
														var pmxthm = new MultiSelect("pmxthm");
													</script>
												</td>';
        // custom action
        echo '
												<td style="padding:4px;">
													<div class="cat_bar catbg_grid grid_padd">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH07")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_ext_opts_custaction'] . '</span>
														</h4>
													</div>
													<textarea class="adm_textarea" style="min-height:69px;width:90% !important;" rows="2" name="config[ext_opts][pmxcust]">' . $this->cfg['config']['ext_opts']['pmxcust'] . '</textarea>
													<div id="pmxBH07" class="info_frame" style="margin-top:5px;">' . $txt['pmx_edit_ext_opts_custhelp'] . '</div>';
        // hide on Maintenance?
        echo '
													<div class="adm_check grid_top">
														<span class="adm_w80">' . $txt['pmx_edit_ext_maintenance'] . '</span>
														<input type="hidden" name="config[maintenance_mode]" value="0" />
														<input class="input_check" type="checkbox" name="config[maintenance_mode]" value="1"' . (!empty($this->cfg['config']['maintenance_mode']) ? ' checked="checked"' : '') . ' />
													</div>';
        // on language
        echo '
													<div class="cat_bar catbg_grid grid_padd grid_top">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH09")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_ext_opts_languages'] . '</span>
														</h4>
													</div>
													<select id="pmxlng" onchange="changed(\'pmxlng\');" style="width:90%;" name="config[ext_opts][pmxlng][]" multiple="multiple" size="2">';
        // get config data
        $data = $this->getConfigData('config, ext_opts, pmxlng');
        foreach ($context['pmx']['languages'] as $lang => $sel) {
            echo '
														<option value="' . $lang . '=' . (array_key_exists($lang, $data) ? $data[$lang] . '" selected="selected' : '1') . '">' . (array_key_exists($lang, $data) ? $data[$lang] == 0 ? '^' : '' : '') . ucfirst($lang) . '</option>';
        }
        echo '
													</select>
													<div id="pmxBH09" class="info_frame">' . $txt['pmx_edit_ext_opts_selnote'] . '</div>
													<script type="text/javascript">
														var pmxlng = new MultiSelect("pmxlng");
													</script>';
        // mobile or other devices
        echo '
													<div class="cat_bar catbg_grid grid_padd grid_top">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBHmb")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_blocks_devices'] . '</span>
														</h4>
													</div>
													<input type="hidden" name="config[ext_opts][device]" value="0" />
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_devices']['all'] . '</span>
														<input class="input_check" type="radio" name="config[ext_opts][device]" value="0"' . (empty($this->cfg['config']['ext_opts']['device']) ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_devices']['mobil'] . '</span>
														<input class="input_check" type="radio" name="config[ext_opts][device]" value="1"' . (!empty($this->cfg['config']['ext_opts']['device']) && $this->cfg['config']['ext_opts']['device'] == '1' ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_devices']['desk'] . '</span>
														<input class="input_check" type="radio" name="config[ext_opts][device]" value="2"' . (!empty($this->cfg['config']['ext_opts']['device']) && $this->cfg['config']['ext_opts']['device'] == '2' ? ' checked="checked"' : '') . ' />
													</div>
													<div id="pmxBHmb" class="info_frame">' . $txt['pmx_blocks_deviceshelp'] . '</div>';
        // Frontpage block placing on Page request
        if ($this->cfg['side'] == 'front') {
            echo '
													<div class="cat_bar catbg_grid grid_padd">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBHf1")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_frontplacing'] . '</span>
														</h4>
													</div>
													<input type="hidden" name="config[frontmode]" value="" />
													<input type="hidden" name="config[frontview]" value="" />

													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontplacing_hide'] . '</span>
														<input class="input_check" type="radio" name="config[frontplace]" value="hide"' . (isset($this->cfg['config']['frontplace']) && $this->cfg['config']['frontplace'] == 'hide' || empty($this->cfg['config']['frontplace']) ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontplacing_before'] . '</span>
														<input class="input_check" type="radio" name="config[frontplace]" value="before"' . (isset($this->cfg['config']['frontplace']) && $this->cfg['config']['frontplace'] == 'before' ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontplacing_after'] . '</span>
														<input class="input_check" type="radio" name="config[frontplace]" value="after"' . (isset($this->cfg['config']['frontplace']) && $this->cfg['config']['frontplace'] == 'after' ? ' checked="checked"' : '') . ' />
													</div>
													<div id="pmxBHf1" class="info_frame">' . $txt['pmx_edit_frontplacinghelp'] . '</div>';
        } elseif ($this->cfg['side'] == 'pages') {
            echo '
													<div class="cat_bar catbg_grid grid_padd grid_top">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBHf2")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_frontmode'] . '</span>
														</h4>
													</div>
													<input type="hidden" name="config[frontplace]" value="hide" />
													<input type="hidden" name="config[frontview]" value="" />

													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontmode_none'] . '</span>
														<input class="input_check" type="radio" name="config[frontmode]" value=""' . (empty($this->cfg['config']['frontmode']) ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontmode_center'] . '</span>
														<input class="input_check" type="radio" name="config[frontmode]" value="centered"' . (isset($this->cfg['config']['frontmode']) && $this->cfg['config']['frontmode'] == 'centered' ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontmode_full'] . '</span>
														<input class="input_check" type="radio" name="config[frontmode]" value="fullsize"' . (isset($this->cfg['config']['frontmode']) && $this->cfg['config']['frontmode'] == 'fullsize' ? ' checked="checked"' : '') . ' />
													</div>
													<div id="pmxBHf2" class="info_frame">' . $txt['pmx_edit_frontmodehelp'] . '</div>';
        } else {
            echo '
													<div class="cat_bar catbg_grid grid_padd grid_top">
														<h4 class="catbg catbg_grid">
															<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBHf3")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
															<span class="cat_msg_title">' . $txt['pmx_edit_frontview'] . '</span>
														</h4>
													</div>
													<input type="hidden" name="config[frontplace]" value="hide" />
													<input type="hidden" name="config[frontmode]" value="" />

													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontview_any'] . '</span>
														<input class="input_check" type="radio" name="config[frontview]" value=""' . (empty($this->cfg['config']['frontview']) ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontview_center'] . '</span>
														<input class="input_check" type="radio" name="config[frontview]" value="centered"' . (isset($this->cfg['config']['frontview']) && $this->cfg['config']['frontview'] == 'centered' ? ' checked="checked"' : '') . ' />
													</div>
													<div class="adm_check"><span class="adm_w80">' . $txt['pmx_edit_frontview_full'] . '</span>
														<input class="input_check" type="radio" name="config[frontview]" value="fullsize"' . (isset($this->cfg['config']['frontview']) && $this->cfg['config']['frontview'] == 'fullsize' ? ' checked="checked"' : '') . ' />
													</div>
													<div id="pmxBHf3" class="info_frame">' . $txt['pmx_edit_frontviewhelp'] . '</div>';
        }
        echo '
												</td>
											</tr>
											<tr>
												<td colspan="2" style="text-align:center;padding:4px;"><hr class="pmx_hr" />
													<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_save_exit'] . '" onclick="FormFunc(\'save_edit\', \'1\')" />
													<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_save_cont'] . '" onclick="FormFunc(\'save_edit_continue\', \'1\')" />
													<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_cancel'] . '" onclick="FormFunc(\'cancel_edit\', \'1\')" />
												</td>
											</tr>
										</table>
									</div>
								</td>
							</tr>
						</table>
						</div>
					</td>
				</tr>';
        // add visual upshrink
        $tmp = '
		var upshrinkVis = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ' . (empty($options['collapse_visual']) ? 'true' : 'false') . ',
			aSwappableContainers: [
				\'upshrinkVisual\',
				\'upshrinkVisual1\'
			],
			aSwapImages: [{
					sId: \'upshrinkImgVisual\',
					altCollapsed: ' . JavaScriptEscape($txt['pmx_expand'] . $txt['pmx_edit_ext_opts']) . ',
					altExpanded: ' . JavaScriptEscape($txt['pmx_collapse'] . $txt['pmx_edit_ext_opts']) . '
			}],
			oCookieOptions: {
				bUseCookie: false
			},
			oThemeOptions: {
				bUseThemeSettings: true,
				sOptionName: \'collapse_visual\',
				sSessionVar: ' . JavaScriptEscape($context['session_var']) . ',
				sSessionId: ' . JavaScriptEscape($context['session_id']) . ',
				sThemeId: \'1\'
			}
		});';
        addInlineJavascript(str_replace("\n", "\n\t", PortaMx_compressJS($tmp)), true);
        unset($tmp);
    }
    /**
     * Output the Article config screen
     */
    function pmxc_ShowAdmArticleConfig()
    {
        global $context, $settings, $modSettings, $boarddir, $options, $txt;
        echo '
				<tr>
					<td>
						<div class="windowbg">
						<table class="pmx_table">
							<tr>
								<td style="width:50%;padding:4px;">
									<input type="hidden" name="id" value="' . $this->cfg['id'] . '" />
									<input type="hidden" name="owner" value="' . $this->cfg['owner'] . '" />
									<input type="hidden" name="contenttype" value="' . $this->cfg['ctype'] . '" />
									<input type="hidden" name="config[settings]" value="" />
									<input type="hidden" name="active" value="' . $this->cfg['active'] . '" />
									<input type="hidden" name="approved" value="' . $this->cfg['approved'] . '" />
									<input type="hidden" name="approvedby" value="' . $this->cfg['approvedby'] . '" />
									<input type="hidden" name="created" value="' . $this->cfg['created'] . '" />
									<input type="hidden" name="updated" value="' . $this->cfg['updated'] . '" />
									<input type="hidden" name="updatedby" value="' . $this->cfg['updatedby'] . '" />
									<input type="hidden" name="check_num_vars[]" value="[config][maxheight], \'\'" />
									<div style="height:61px;">
										<div style="float:left;width:100px; padding-top:1px;">' . $txt['pmx_article_title'] . '</div>';
        // all titles depend on language
        $curlang = '';
        foreach ($context['pmx']['languages'] as $lang => $sel) {
            $curlang = !empty($sel) ? $lang : $curlang;
            echo '
										<span id="' . $lang . '" style="white-space:nowrap;' . (!empty($sel) ? '' : ' display:none;') . '">
											<input style="width:65%;" type="text" name="config[title][' . $lang . ']" value="' . (isset($this->cfg['config']['title'][$lang]) ? htmlspecialchars($this->cfg['config']['title'][$lang], ENT_QUOTES) : '') . '" />
										</span>';
        }
        echo '
										<input id="curlang" type="hidden" value="' . $curlang . '" />
										<div style="clear:both; height:10px;">
											<img style="float:left;" src="' . $context['pmx_imageurl'] . 'arrow_down.gif" alt="*" title="" />
										</div>
										<div style="float:left; width:100px;">' . $txt['pmx_edit_title_lang'] . '
											<img class="info_toggle" onclick=\'Show_help("pmxBH01")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</div>
										<select style="float:left; width:165px;" size="1" onchange="setTitleLang(this)">';
        foreach ($context['pmx']['languages'] as $lang => $sel) {
            echo '
											<option value="' . $lang . '"' . (!empty($sel) ? ' selected="selected"' : '') . '>' . $lang . '</option>';
        }
        echo '
										</select>
										<div style="margin-left:280px;">
											<span style="vertical-align:6px;">' . $txt['pmx_edit_title_align'] . '</span>';
        // title align
        if (!isset($this->cfg['config']['title_align'])) {
            $this->cfg['config']['title_align'] = 'left';
        }
        echo '
											<input type="hidden" id="titlealign" name="config[title_align]" value="' . $this->cfg['config']['title_align'] . '" />';
        foreach ($txt['pmx_edit_title_align_types'] as $key => $val) {
            echo '
											<img id="img' . $key . '" src="' . $context['pmx_imageurl'] . 'text_align_' . $key . '.gif" alt="*" title="' . $txt['pmx_edit_title_helpalign'] . $val . '" style="cursor:pointer;vertical-align:1px;' . ($this->cfg['config']['title_align'] == $key ? 'background-color:#e02000;' : '') . '" onclick="setAlign(\'\', \'' . $key . '\')" />';
        }
        echo '
										</div>
									</div>
									<div id="pmxBH01" style="margin-top:4px;" class="info_frame">' . $txt['pmx_edit_titlehelp'] . '
									</div>';
        // Title icons
        $this->cfg['config']['title_icon'] = empty($this->cfg['config']['title_icon']) || $this->cfg['config']['title_icon'] == 'none.gif' ? 'none.png' : $this->cfg['config']['title_icon'];
        echo '
									<div style="float:left;height:40px;">
										<div style="float:left;width:100px; padding-top:8px;">' . $txt['pmx_edit_titleicon'] . '</div>
										<div class="ttliconDiv" onclick="setNewIcon(document.getElementById(\'pWind.icon_sel\'), event)">
											<input id="post_image" type="hidden" name="config[title_icon]" value="' . $this->cfg['config']['title_icon'] . '" />
											<input id="iconDD" value="' . ucfirst(str_replace('.png', '', $this->cfg['config']['title_icon'])) . '" readonly />
											<img id="pWind.icon" class="pwindiconBlk" src="' . $context['pmx_Iconsurl'] . $this->cfg['config']['title_icon'] . '" alt="*" />
											<img class="ddImageBlk" src="' . $context['pmx_imageurl'] . 'state_expanded.png" alt="*" title="" />
										</div>
										<ul class="ttlicondd Artedit" id="pWind.icon_sel" onclick="updIcon(this)">';
        foreach ($this->title_icons as $file => $name) {
            echo '
											<li id="' . $file . '" class="ttlicon' . ($this->cfg['config']['title_icon'] == $file ? ' active' : '') . '">
												<img src="' . $context['pmx_Iconsurl'] . $file . '" alt="*" /><span>' . $name . '</span>
											</li>';
        }
        echo '
										</ul>
										<script>$("li").hover(function(){$(this).toggleClass("active")});</script>
									</div>';
        // show article types
        echo '
								</td>
								<td style="padding:4px;">
									<div style="float:left;width:130px;">' . $txt['pmx_article_type'] . '</div>';
        $RegBlocks = $context['pmx']['RegBlocks'];
        foreach ($RegBlocks as $key => $val) {
            if (!in_array($key, array('html', 'script', 'bbc_script', 'php'))) {
                unset($RegBlocks[$key]);
            }
        }
        function cmpBDesc($a, $b)
        {
            return strcasecmp(str_replace(' ', '', $a["description"]), str_replace(' ', '', $b["description"]));
        }
        uasort($RegBlocks, 'cmpBDesc');
        if (allowPmx('pmx_admin, pmx_create')) {
            echo '
									<select style="width:60%;" size="1" name="ctype" onchange="FormFunc(\'edit_change\', \'1\')">';
            foreach ($RegBlocks as $type => $articleType) {
                echo '
										<option value="' . $type . '"' . ($this->cfg['ctype'] == $type ? ' selected="selected"' : '') . '>' . $articleType['description'] . '</option>';
            }
            echo '
									</select>';
        } else {
            echo '
									<input type="hidden" name="ctype" value="' . $this->cfg['ctype'] . '" />
									<input style="width:60%;" value="' . $RegBlocks[$this->cfg['ctype']]['description'] . '" disabled="disabled" />';
        }
        // all exist categories
        $selcats = array_merge(array(PortaMx_getDefaultCategory($txt['pmx_categories_none'])), $this->categories);
        $ordercats = array_merge(array(0), $context['pmx']['catorder']);
        $isWriter = allowPmx('pmx_create, pmx_articles', true);
        $isAdm = allowPmx('pmx_admin');
        echo '
										<div style="float:left;width:130px;margin-top:9px;">' . $txt['pmx_article_cats'] . '</div>
										<select style="width:60%;margin-top:9px;" size="1" name="catid">';
        foreach ($ordercats as $catorder) {
            $cat = PortaMx_getCatByOrder($selcats, $catorder);
            $cfg = unserialize($cat['config']);
            if (!empty($isAdm) || !empty($isWriter) && empty($cfg['global'])) {
                echo '
											<option value="' . $cat['id'] . '"' . ($cat['id'] == $this->cfg['catid'] ? ' selected="selected"' : '') . '">' . str_repeat('&bull;', $cat['level']) . ' ' . $cat['name'] . '</option>';
            }
        }
        echo '
										</select>
									</div>';
        // articlename
        echo '
									<div style="float:left;width:130px;margin-top:9px">' . $txt['pmx_article_name'] . '
										<img class="info_toggle" onclick=\'Show_help("pmxBH11")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
									</div>
									<input id="check.name" style="width:60%;margin-top:9px" onkeyup="check_requestname(this)" onkeypress="check_requestname(this)" type="text" name="name" value="' . $this->cfg['name'] . '" />
									<span id="check.name.error" style="display:none;">' . sprintf($txt['namefielderror'], $txt['pmx_article_name']) . '</span>
									<div id="pmxBH11" class="info_frame" style="margin-top:5px;">' . $txt['pmx_edit_pagenamehelp'] . '
									</div>
								</td>
							</tr>';
        // the editor area dependent on article type
        echo '
							<tr>
								<td colspan="2" style="padding:4px 4px 10px 4px;">';
        // show the editor
        if ($this->cfg['ctype'] == 'html') {
            $allow = allowPmx('pmx_admin') || allowPmx('pmx_blocks');
            $fnd = explode('/', str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']));
            $smfpath = str_replace('\\', '/', $boarddir);
            foreach ($fnd as $key => $val) {
                $fnd[$key] = $val;
                $rep[] = '';
            }
            $filepath = trim(str_replace($fnd, $rep, $smfpath), '/') . '/CustomImages';
            if (count($fnd) == count(explode('/', $smfpath))) {
                $filepath = '/' . $filepath;
            }
            $_SESSION['pmx_ckfm'] = array('ALLOW' => $allow, 'FILEPATH' => $filepath);
            echo '
								<div class="cat_bar catbg_grid">
									<h4 class="catbg catbg_grid"><span class="cat_left_title">' . $txt['pmx_edit_content'] . '</span></h4>
								</div>
								<textarea name="' . $context['pmx']['htmledit']['id'] . '">' . $context['pmx']['htmledit']['content'] . '</textarea>
								<script type="text/javascript">
									CKEDITOR.replace("' . $context['pmx']['htmledit']['id'] . '", {filebrowserBrowseUrl: "ckeditor/fileman/index.php"});
								</script>';
        } elseif ($this->cfg['ctype'] == 'bbc_script') {
            echo '
								<style type="text/css">
									.sceditor-container iframe{width:99.1% !important;}
									.sceditor-container{max-width:inherit;width:inherit !important; margin-right:-2px;}
									textarea{max-width:99% !important;width:99.2% !important;}
								</style>
								<div class="cat_bar catbg_grid" style="margin-right:1px;">
									<h4 class="catbg catbg_grid"><span class="cat_left_title">' . $txt['pmx_edit_content'] . '</span></h4>
								</div>
								<input type="hidden" id="smileyset" value="PortaMx" />
								<div id="bbcBox_message"></div>
								<div id="smileyBox_message"></div>
								<div style="padding-right:3px;margin-top:-10px;">', template_control_richedit($context['pmx']['editorID'], 'smileyBox_message', 'bbcBox_message'), '</div>';
        } elseif ($this->cfg['ctype'] == 'php') {
            $options['collapse_phpinit'] = empty($context['pmx']['phpInit']['havecont']);
            echo '
								<div class="cat_bar catbg_grid">
									<h4 class="catbg catbg_grid">
										<span style="float:right;display:block;margin-top:-2px;">
											<img onclick="php_syntax(\'' . $context['pmx']['phpShow']['id'] . '\')" style="padding:3px 5px 3px 10px;cursor:pointer;" alt="Syntax check" title="' . $txt['pmx_check_phpsyntax'] . '" src="' . $context['pmx_imageurl'] . 'syntaxcheck.png" class="pmxright" />
										</span>
										<span class="cat_left_title">' . $txt['pmx_edit_content'] . '
										<span id="upshrinkPHPinitCont"' . (empty($options['collapse_phpinit']) ? '' : ' style="display:none;"') . '>' . $txt['pmx_edit_content_show'] . '</span></span>
									</h4>
								</div>

								<div id="check_' . $context['pmx']['phpShow']['id'] . '" class="info_frame" style="line-height:1.4em;margin:1px 0;"></div>

								<textarea name="' . $context['pmx']['phpShow']['id'] . '" id="' . $context['pmx']['phpShow']['id'] . '" style="display:block;resize:vertical;width:' . $context['pmx']['phpShow']['width'] . ';height:' . $context['pmx']['phpShow']['height'] . ';">' . $context['pmx']['phpShow']['value'] . '</textarea>

								<div class="plainbox info_text" style="margin-top:5px;margin-right:0px;padding:5px 0 7px 0;display:block;">
									<div class="normaltext" style="margin:0 10px;">
									' . (empty($context['pmx']['phpInit']['havecont']) ? '<span style="margin-top:2px;margin-right:-4px;" id="upshrinkPHPshowImg" class="floatright ' . (empty($options['collapse_visual']) ? 'toggle_up" align="bottom"' : 'toggle_down" align="bottom"') . ' title="' . (empty($options['collapse_visual']) ? $txt['pmx_collapse'] : $txt['pmx_expand']) . $txt['pmx_php_partblock'] . '">
										</span>' : '') . '
										<span>' . $txt['pmx_php_partblock_note'] . '
											<img class="info_toggle" onclick=\'Toggle_help("pmxPHPH01")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" style="vertical-align: -3px;" />
										</span>
									</div>
									<div id="pmxPHPH01" style="display:none; margin:4px 10px 0;">' . $txt['pmx_php_partblock_help'] . '</div>
								</div>

								<div id="upshrinkPHPshowCont"' . (empty($options['collapse_phpinit']) ? '' : ' style="margin-top:5px;display:none;"') . '>
									<div class="cat_bar catbg_grid">
										<h4 class="catbg catbg_grid">
											<span style="float:right;display:block;margin-top:-2px;">
												<img onclick="php_syntax(\'' . $context['pmx']['phpInit']['id'] . '\')" style="padding:3px 5px 3px 10px;cursor:pointer;" title="' . $txt['pmx_check_phpsyntax'] . '" alt="Syntax check" src="' . $context['pmx_imageurl'] . 'syntaxcheck.png" class="pmxright" />
											</span>
											<span class="cat_left_title">' . $txt['pmx_edit_content'] . $txt['pmx_edit_content_init'] . '</span>
										</h4>
									</div>
									<div id="check_' . $context['pmx']['phpInit']['id'] . '" class="info_frame" style="line-height:1.4em;margin:1px 0;"></div>

									<textarea name="' . $context['pmx']['phpInit']['id'] . '" id="' . $context['pmx']['phpInit']['id'] . '" style="display:block;width:' . $context['pmx']['phpInit']['width'] . ';height:' . $context['pmx']['phpInit']['height'] . ';">' . $context['pmx']['phpInit']['value'] . '</textarea>
								</div>';
            if (empty($context['pmx']['phpInit']['havecont'])) {
                addInlineJavascript("\t" . str_replace("\n", "\n\t", PortaMx_compressJS('
						var upshrinkPHPshow = new smc_Toggle({
							bToggleEnabled: true,
							bCurrentlyCollapsed: ' . (empty($options['collapse_phpinit']) ? 'false' : 'true') . ',
							aSwappableContainers: [
								\'upshrinkPHPshowCont\',
								\'upshrinkPHPinitCont\'
							],
							aSwapImages: [
								{
									sId: \'upshrinkPHPshowImg\',
									altCollapsed: ' . JavaScriptEscape($txt['pmx_expand'] . $txt['pmx_php_partblock']) . ',
									altExpanded: ' . JavaScriptEscape($txt['pmx_collapse'] . $txt['pmx_php_partblock']) . '
								}
							],
							oCookieOptions: {
									bUseCookie: false
								}
						});')), true);
            }
        } else {
            echo '
									<div class="cat_bar catbg_grid">
										<h4 class="catbg catbg_grid"><span class="cat_left_title">' . $txt['pmx_edit_content'] . '</span></h4>
									</div>
									<textarea name="' . $context['pmx']['script']['id'] . '" id="' . $context['pmx']['script']['id'] . '" style="display:block;width:' . $context['pmx']['script']['width'] . ';height:' . $context['pmx']['script']['height'] . ';">' . $context['pmx']['script']['value'] . '</textarea>';
        }
        echo '
								</td>
							</tr>
							<tr>
								<td style="padding:4px;">
									<div style="min-height:182px;">
										<input type="hidden" name="config[settings]" value="" />';
        // show the settings area
        echo '
										<div class="cat_bar catbg_grid grid_padd">
											<h4 class="catbg catbg_grid"><span class="cat_left_title">' . $txt['pmx_articles_types'][$this->cfg['ctype']] . ' ' . $txt['pmx_article_settings_title'] . '</span></h4>
										</div>
										<div>';
        if ($this->cfg['ctype'] == 'html') {
            echo '
											<div class="adm_check">
												<span class="adm_w80">' . $txt['pmx_html_teaser'] . '
													<img class="info_toggle" onclick=\'Show_help("pmxHTMLH01")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
												</span>
												<input type="hidden" name="config[settings][teaser]" value="0" />
												<div><input class="input_check" type="checkbox" name="config[settings][teaser]" value="1"' . (isset($this->cfg['config']['settings']['teaser']) && !empty($this->cfg['config']['settings']['teaser']) ? ' checked="checked"' : '') . ' /></div>
											</div>
											<div id="pmxHTMLH01" class="info_frame" style="margin-top:4px;">' . str_replace('@@', '<img src="' . $context['pmx_imageurl'] . 'pgbreak.png" alt="*" style="vertical-align:-5px;"/>', $txt['pmx_html_teasehelp']) . '</div>';
        } elseif ($this->cfg['ctype'] != 'php') {
            echo '
											<div class="adm_check">
												<span class="adm_w80">' . sprintf($txt['pmx_article_teaser'], $txt['pmx_teasemode'][intval(!empty($context['pmx']['settings']['teasermode']))]) . '
													<img class="info_toggle" onclick=\'Show_help("pmxHTMLH02")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
												</span>
												<div><input type="text" size="5" name="config[settings][teaser]" value="' . (isset($this->cfg['config']['settings']['teaser']) ? $this->cfg['config']['settings']['teaser'] : '') . '" /></div>
											</div>
											<div id="pmxHTMLH02" class="info_frame" style="margin-top:4px;">' . $txt['pmx_article_teasehelp'] . '</div>';
        }
        echo '
											<div class="adm_check">
												<span class="adm_w80">' . $txt['pmx_content_print'] . '</span>
												<input type="hidden" name="config[settings][printing]" value="0" />
												<div><input class="input_check" type="checkbox" name="config[settings][printing]" value="1"' . (!empty($this->cfg['config']['settings']['printing']) ? ' checked="checked"' : '') . ' /></div>
											</div>

											<div class="adm_check">
												<span class="adm_w80">' . $txt['pmx_article_footer'] . '
													<img class="info_toggle" onclick=\'Show_help("pmxARTH01")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
												</span>
												<input type="hidden" name="config[settings][showfooter]" value="0" />
												<div><input class="input_check" type="checkbox" name="config[settings][showfooter]" value="1"' . (isset($this->cfg['config']['settings']['showfooter']) && !empty($this->cfg['config']['settings']['showfooter']) ? ' checked="checked"' : '') . ' /></div>
											</div>
											<div id="pmxARTH01" class="info_frame" style="margin-top:4px;">' . $txt['pmx_article_footerhelp'] . '</div>
											<input type="hidden" name="config[show_sitemap]" value="0" />';
        if ($this->cfg['ctype'] != 'php') {
            echo '
											<div class="adm_check">
												<span class="adm_w80">' . $txt['pmx_articles_disableHSimage'] . '</span>
												<input type="hidden" name="config[settings][disableHSimg]" value="0" />
												<div><input class="input_check" type="checkbox" name="config[settings][disableHSimg]" value="1"' . (isset($this->cfg['config']['settings']['disableHSimg']) && !empty($this->cfg['config']['settings']['disableHSimg']) ? ' checked="checked"' : '') . (!empty($context['pmx']['settings']['disableHS']) ? ' disabled="disabled"' : '') . ' /></div>
											</div>';
        }
        echo '
										</div>
									</div>';
        // the group access
        echo '
									<div class="cat_bar catbg_grid grid_padd grid_top">
										<h4 class="catbg catbg_grid">
											<img class="grid_click_image pmxleft" onclick=\'Show_help("pmxBH03")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
											<span class="cat_msg_title">' . $txt['pmx_article_groups'] . '</span>
										</h4>
									</div>
									<select id="pmxgroups" onchange="changed(\'pmxgroups\');" style="width:83%;" name="acsgrp[]" multiple="multiple" size="5">';
        if (!empty($this->cfg['acsgrp'])) {
            list($grpacs, $denyacs) = Pmx_StrToArray($this->cfg['acsgrp'], ',', '=');
        } else {
            $grpacs = $denyacs = array();
        }
        foreach ($this->smf_groups as $grp) {
            echo '
										<option value="' . $grp['id'] . '=' . intval(!in_array($grp['id'], $denyacs)) . '"' . (in_array($grp['id'], $grpacs) ? ' selected="selected"' : '') . '>' . (in_array($grp['id'], $denyacs) ? '^' : '') . $grp['name'] . '</option>';
        }
        echo '
									</select>
									<div id="pmxBH03" class="info_frame">' . $txt['pmx_article_groupshelp'] . '</div>
									<script type="text/javascript">
										var pmxgroups = new MultiSelect("pmxgroups");
									</script>';
        // article moderate
        if (!isset($this->cfg['config']['can_moderate'])) {
            $this->cfg['config']['can_moderate'] = 1;
        }
        if (allowPmx('pmx_articles, pmx_create', true)) {
            echo '
									<input type="hidden" name="config[can_moderate]" value="' . $this->cfg['config']['can_moderate'] . '" />';
        }
        if (allowPmx('pmx_admin, pmx_articles, pmx_create')) {
            echo '
									<div class="cat_bar catbg_grid grid_padd grid_top">
										<h4 class="catbg catbg_grid">
											<span class="cat_msg_title">' . $txt['pmx_article_moderate_title'] . '</span>
										</h4>
									</div>';
        }
        if (allowPmx('pmx_admin')) {
            echo '
									<div class="adm_check">
										<span class="adm_w80">' . $txt['pmx_article_moderate'] . '
										</span>
										<input type="hidden" name="config[can_moderate]" value="0" />
										<div><input class="input_check" type="checkbox" name="config[can_moderate]" value="1"' . (!empty($this->cfg['config']['can_moderate']) ? ' checked="checked"' : '') . ' /></div>
									</div>';
        }
        echo '
									<input type="hidden" name="config[check_ecl]" value="0" />
									<input type="hidden" name="config[check_eclbots]" value="0" />';
        if (allowPmx('pmx_admin, pmx_articles, pmx_create') && !empty($modSettings['pmx_ecl'])) {
            echo '
									<div class="adm_check">
										<span class="adm_w80">' . $txt['pmx_check_artelcmode'] . '
										 <img class="info_toggle" onclick=\'Show_help("pmxArteclHelp")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</span>
										<div><input class="input_check" type="checkbox" name="config[check_ecl]" value="1"' . (!empty($this->cfg['config']['check_ecl']) ? ' checked="checked"' : '') . ' onclick="showeclbots(this)" /></div>
									</div>
									<div id="pmxArteclHelp" class="info_frame" style="margin-top:0px;">' . $txt['pmx_art_eclcheckhelp'] . '</div>
									<div id="eclextend" style="display:' . (!empty($this->cfg['config']['check_ecl']) ? 'block' : 'none') . '">
									<div class="adm_check">
										<span class="adm_w80">' . $txt['pmx_check_artelcbots'] . '
										 <img class="info_toggle" onclick=\'Show_help("pmxeclHelpbots")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" />
										</span>
										<div><input id="eclextendinp" class="input_check" type="checkbox" name="config[check_eclbots]" value="1"' . (!empty($this->cfg['config']['check_eclbots']) ? ' checked="checked"' : '') . ' /></div>
									</div>
									<div id="pmxeclHelpbots" class="info_frame" style="margin-top:0;">' . $txt['pmx_art_eclcheckbotshelp'] . '</div>
									<script type="text/javascript">
										function showeclbots(elm) {if(elm.checked == true) document.getElementById("eclextend").style.display = "block"; else {document.getElementById("eclextend").style.display = "none"; document.getElementById("eclextendinp").checked = false;}}
									</script>
								</td>';
        }
        // the visual options
        echo '
								<td id="set_col" style="padding:4px;">
									<div class="cat_bar catbg_grid grid_padd">
										<h4 class="catbg catbg_grid"><span class="cat_left_title">' . $txt['pmx_edit_visuals'] . '</span></h4>
									</div>
									<div style="float:left; height:30px; width:177px;">' . $txt['pmx_edit_cancollapse'] . '</div>
									<input style="padding-left:141px;" type="hidden" name="config[collapse]" value="0" />
									<input class="input_check" id="collapse" type="checkbox" name="config[collapse]" value="1"' . ($this->cfg['config']['visuals']['header'] == 'none' ? ' disabled="disabled"' : ($this->cfg['config']['collapse'] == 1 ? ' checked="checked"' : '')) . ' />
									<div style="clear:both;" /></div>
									<div style="float:left; height:30px; width:180px;">' . $txt['pmx_edit_collapse_state'] . '</div>
									<select style="width:46%;" size="1" name="config[collapse_state]">';
        foreach ($txt['pmx_collapse_mode'] as $key => $text) {
            echo '
										<option value="' . $key . '"' . (isset($this->cfg['config']['collapse_state']) && $this->cfg['config']['collapse_state'] == $key ? ' selected="selected"' : '') . '>' . $text . '</option>';
        }
        echo '
									</select>
									<br style="clear:both;" />
									<div style="float:left; height:30px; width:180px;">' . $txt['pmx_edit_overflow'] . '</div>
									<select style="width:46%;" size="1" id="mxhgt" name="config[overflow]" onchange="checkMaxHeight(this);">';
        foreach ($txt['pmx_overflow_actions'] as $key => $text) {
            echo '
										<option value="' . $key . '"' . (isset($this->cfg['config']['overflow']) && $this->cfg['config']['overflow'] == $key ? ' selected="selected"' : '') . '>' . $text . '</option>';
        }
        echo '
									</select>
									<br style="clear:both;" />
									<div style="float:left; min-height:30px; width:99%;">
										<div style="float:left; min-height:30px; width:180px;">' . $txt['pmx_edit_height'] . '</div>
										<div style="float:left; width:46%">
											<input onkeyup="check_numeric(this)" id="maxheight" type="text" size="4" name="config[maxheight]" value="' . (isset($this->cfg['config']['maxheight']) ? $this->cfg['config']['maxheight'] : '') . '"' . (!isset($this->cfg['config']['overflow']) || empty($this->cfg['config']['overflow']) ? ' disabled="disabled"' : '') . ' /><span class="smalltext">' . $txt['pmx_pixel'] . '</span><span style="display:inline-block; width:3px;"></span>
											<select id="maxheight_sel" style="float:right;width:52%;margin-right:-1%;" size="1" name="config[height]">';
        foreach ($txt['pmx_edit_height_mode'] as $key => $text) {
            echo '
												<option value="' . $key . '"' . (isset($this->cfg['config']['height']) && $this->cfg['config']['height'] == $key ? ' selected="selected"' : '') . '>' . $text . '</option>';
        }
        echo '
											</select>
										</div>
									</div>
									<br style="clear:both;" />
									<script type="text/javascript">
										checkMaxHeight(document.getElementById("mxhgt"));
									</script>

									<div style="float:left; height:30px; width:180px;">' . $txt['pmx_edit_innerpad'] . '</div>
									<input onkeyup="check_numeric(this, \',\')" type="text" size="4" name="config[innerpad]" value="' . (isset($this->cfg['config']['innerpad']) ? $this->cfg['config']['innerpad'] : '4') . '" /><span class="smalltext">' . $txt['pmx_pixel'] . ' (xy/y,x)</span>
									<br style="clear:both;" />';
        // CSS class settings
        echo '
									<div class="cat_bar catbg_grid grid_padd">
										<h4 class="catbg catbg_grid grid_botpad">
											<div style="float:left; width:177px;"><span class="cat_left_title">' . $txt['pmx_edit_usedclass_type'] . '</span></div>
											<span class="cat_left_title">' . $txt['pmx_edit_usedclass_style'] . '</span>
										</h4>
									</div>
									<div style="margin:0px 2px;">';
        // write out the classes
        foreach ($this->usedClass as $ucltyp => $ucldata) {
            echo '
										<div style="float:left; width:180px; height:30px; padding-top:2px;">' . $ucltyp . '</div>
										<select' . ($ucltyp == 'frame' || $ucltyp == 'postframe' ? ' id="pmx_' . $ucltyp . '" ' : ' ') . 'style="width:46%;" name="config[visuals][' . $ucltyp . ']" onchange="checkCollapse(this)">';
            foreach ($ucldata as $cname => $class) {
                echo '
											<option value="' . $class . '"' . (!empty($this->cfg['config']['visuals'][$ucltyp]) ? $this->cfg['config']['visuals'][$ucltyp] == $class ? ' selected="selected"' : '' : (substr($cname, 0, 1) == '+' ? ' selected="selected"' : '')) . '>' . substr($cname, 1) . '</option>';
            }
            echo '
										</select>
										<br style="clear:both;" />';
        }
        echo '
									</div>
									<div class="cat_bar catbg_grid grid_padd" style="margin-top:-2px;">
										<h4 class="catbg catbg_grid"><span class="cat_left_title" style="margin-left:-3px;">' . $txt['pmx_edit_canhavecssfile'] . '</span></h4>
									</div>
									<div style="float:left; margin:0px 2px; width:176px;">' . $txt['pmx_edit_cssfilename'] . '</div>
									<select id="sel.css.file" style="width:46%;margin-bottom:2px;" name="config[cssfile]" onchange="pmxChangeCSS(this)">
										<option value=""></option>';
        // custon css files exist ?
        if (!empty($this->custom_css)) {
            // write out custom mpt/css definitions
            foreach ($this->custom_css as $custcss) {
                if (is_array($custcss)) {
                    echo '
										<option value="' . $custcss['file'] . '"' . ($this->cfg['config']['cssfile'] == $custcss['file'] ? ' selected="selected"' : '') . '>' . $custcss['file'] . '</option>';
                }
            }
            echo '
									</select>
									<div style="clear:both; height:2px;"></div>';
            // write out all class definitions (hidden)
            foreach ($this->custom_css as $custcss) {
                if (is_array($custcss)) {
                    echo '
									<div id="' . $custcss['file'] . '" style="display:none;">';
                    foreach ($custcss['class'] as $key => $val) {
                        if (in_array($key, array_keys($this->usedClass))) {
                            echo '
										<div style="float:left; width:180px; padding:0 2px;">' . $key . '</div>' . (empty($val) ? sprintf($txt['pmx_edit_nocss_class'], $settings['theme_id']) : $val) . '<br />';
                        }
                    }
                    echo '
									</div>';
                }
            }
            echo '
									<script type="text/javascript">
										var elm = document.getElementById("sel.css.file");
										var fname = elm.options[elm.selectedIndex].value;
										if(document.getElementById(fname))
											document.getElementById(fname).style.display = "";
										function pmxChangeCSS(elm)
										{
											for(i=0; i<elm.length; i++)
											{
												if(document.getElementById(elm.options[i].value))
													document.getElementById(elm.options[i].value).style.display = "none";
											}
											var fname = elm.options[elm.selectedIndex].value;
											if(document.getElementById(fname))
												document.getElementById(fname).style.display = "";
										}
									</script>';
        } else {
            echo '
									</select>
									<div style="clear:both; height:6px;"></div>';
        }
        echo '
								</td>
							</tr>
							<tr>
								<td colspan="2" style="text-align:center;padding:4px 4px 0 4px;"><hr class="pmx_hr" />
									<div style="height:10px;"></div>
									<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_save_exit'] . '" onclick="FormFuncCheck(\'save_edit\', \'1\')" />
									<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_save_cont'] . '" onclick="FormFuncCheck(\'save_edit_continue\', \'1\')" />
									<input class="button_submit" type="button" style="margin-right:10px;" value="' . $txt['pmx_cancel'] . '" onclick="FormFunc(\'cancel_edit\', \'1\')" />
								</td>
							</tr>
						</table>
						</div>
					</td>
				</tr>';
    }
/**
* Top frame
**/
function Pmx_Frame_top($cfg, $count)
{
    global $context, $scripturl, $options, $txt;
    $context['pmx_framecount']++;
    $context['pmx_frames'][$context['pmx_framecount']] = true;
    if (!empty($cfg['config']['skip_outerframe'])) {
        $context['pmx_frames'][$context['pmx_framecount']] = false;
        return null;
    }
    // get the block title for user language have it or forum default
    $blocktitle = PortaMx_getTitle($cfg['config']);
    // the title align
    $ttladjust = '';
    switch ($cfg['config']['title_align']) {
        case 'left':
            $imgalign = 'right';
            $txtalign = 'left';
            $ttlimg = $txtalign;
            $toggleClass = 'class="float' . $imgalign;
            break;
        case 'right':
            $imgalign = 'left';
            $txtalign = 'right';
            $ttlimg = $txtalign;
            $toggleClass = 'class="float' . $imgalign;
            break;
        case 'center':
            $imgalign = 'right';
            $txtalign = 'center';
            $ttlimg = 'left';
            $toggleClass = 'class="float' . $imgalign;
    }
    if ($cfg['config']['title_icon'] == 'none.png') {
        $cfg['config']['title_icon'] = '';
    }
    if (empty($cfg['config']['title_icon'])) {
        $ttladjust = ' pmxadj';
    }
    if ($cfg['config']['title_align'] == 'center') {
        if (!empty($cfg['config']['title_icon']) && !empty($cfg['config']['collapse']) && $context['pmx']['settings']['shrinkimages'] != 2) {
            $ttladjust = ' pmxadj_center';
        } elseif (empty($cfg['config']['title_icon']) && empty($cfg['config']['collapse'])) {
            $ttladjust = '';
        } elseif (empty($cfg['config']['title_icon'])) {
            $ttladjust = ' pmxadj_' . $imgalign;
        } else {
            $ttladjust = ' pmxadj_' . $ttlimg;
        }
    }
    $cfg['config']['innerpad'] = isset($cfg['config']['innerpad']) ? $cfg['config']['innerpad'] : '4';
    $innerPad = Pmx_getInnerPad($cfg['config']['innerpad']);
    // custom css ?
    if (!empty($cfg['customclass'])) {
        $isCustHeader = !empty($cfg['customclass']['header']);
        $isCustFrame = !empty($cfg['customclass']['frame']);
    } else {
        $isCustHeader = $isCustFrame = false;
    }
    $IDtype = $cfg['blocktype'] . $cfg['id'];
    $frame = false;
    $cfg['noID'] = in_array($cfg['blocktype'], array('category', 'article', 'static_category', 'static_article'));
    $showAcs = allowPmxGroup($cfg['acsgrp']);
    $cfg['active'] = !isset($cfg['active']) ? true : $cfg['active'];
    echo '
						<div' . (empty($cfg['noID']) ? ' id="block.id.' . $cfg['id'] . '" ' : '') . ' style="margin-bottom:' . (empty($count) ? '0' : $context['pmx']['settings']['panelpad']) . 'px; overflow:hidden;' . (in_array(strtolower($cfg['side']), array('left', 'right')) ? 'width:' . $context['pmx']['settings'][strtolower($cfg['side']) . '_panel']['size'] . 'px; padding-' . (strtolower($cfg['side']) == 'left' ? 'right:' : 'left:') . $context['pmx']['settings']['panelpad'] . 'px;' : '') . (empty($cfg['active']) || empty($showAcs) ? 'display:none;' : '') . '">';
    // show the collapse, if set and have a header
    $head_bar = !empty($cfg['config']['visuals']['header']) && $cfg['config']['visuals']['header'] !== 'hide' ? str_replace('bg', '_bar', $cfg['config']['visuals']['header']) : '';
    if (!empty($cfg['config']['visuals']['header']) && $cfg['config']['visuals']['header'] != 'none' || empty($cfg['config']['visuals']['header']) && !empty($cfg['config']['visuals']['body'])) {
        echo '
							<div class="' . (!empty($head_bar) ? $head_bar : 'title_no_bar') . '">
								<h3';
        if (!empty($cfg['config']['collapse']) && $context['pmx']['settings']['shrinkimages'] != 2) {
            if (!isset($options['collapse' . $IDtype])) {
                $cook = pmx_getcookie('pmx_upshr' . $IDtype, false);
                $options['collapse' . $IDtype] = is_null($cook) ? '0' : $cook;
            }
        } else {
            $options['collapse' . $IDtype] = '0';
        }
        echo ' class="' . (!empty($cfg['config']['visuals']['header']) ? $cfg['config']['visuals']['header'] : $cfg['config']['visuals']['body']) . ' cbodypad">';
        // show the collapse / expand icon
        if (!empty($cfg['config']['collapse'])) {
            echo '
									<span id="upshrink_' . $IDtype . '_Img" ' . (empty($options['collapse' . $IDtype]) ? $toggleClass . $context['pmx_img_expand'] : $toggleClass . $context['pmx_img_colapse']) . ' title="' . (empty($options['collapse' . $IDtype]) ? $txt['pmx_collapse'] : $txt['pmx_expand']) . $blocktitle . '"></span>';
        }
        // show the title icon is set
        if (!empty($cfg['config']['title_icon'])) {
            echo '
									<img class="title_images pmx' . $ttlimg . '" src="' . $context['pmx_Iconsurl'] . $cfg['config']['title_icon'] . '" alt="*" title="' . $blocktitle . '" />';
        }
        echo '
									<span class="pmxtitle pmx' . $txtalign . $ttladjust . '">';
        // if quickedit link the title to blockedit?
        if (!empty($context['pmx']['settings']['manager']['qedit']) && allowPmx('pmx_admin') && !empty($blocktitle)) {
            $btyp = str_replace('static_', '', $cfg['blocktype']);
            echo '
										<a href="' . $scripturl . '?action=' . (allowPmx('pmx_admin', true) ? 'portamx' : 'admin') . ';area=pmx_' . (in_array($btyp, array('category', 'article')) ? $btyp == 'category' ? 'categories;sa=edit;id=' . preg_replace('/_[0-9]+/', '', $cfg['catid']) : 'articles;sa=edit;id=' . preg_replace('/_[0-9]+/', '', $cfg['id']) : 'blocks;sa=' . $cfg['side']) . ';edit=' . preg_replace('/_[0-9]+/', '', $cfg['id']) . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="pmxsetEditTop(this)">' . $blocktitle . '</a>';
        } else {
            echo '
									' . (empty($blocktitle) ? '&nbsp;' : $blocktitle);
        }
        echo '
									</span>
								</h3>
							</div>';
    }
    // show content frame
    $frameclass = $cfg['config']['visuals']['frame'] . ' ' . $cfg['config']['visuals']['body'] . (strpos($head_bar, 'notrnd') !== false ? ' notrnd' : '');
    if (!empty($cfg['config']['visuals']['frame']) || $isCustFrame) {
        echo '
							<div' . (!empty($cfg['config']['collapse']) ? ' id="upshrink_' . $IDtype . '"' . (empty($options['collapse' . $IDtype]) ? '' : ' style="display:none;"') : '') . '>
								<div class="' . $frameclass . '" style="padding:' . $innerPad[0] . 'px ' . $innerPad[1] . 'px !important; margin-top:0px;">
									<div';
    } else {
        echo '
							<div' . (!empty($cfg['config']['collapse']) ? ' id="upshrink_' . $IDtype . '"' . (empty($options['collapse' . $IDtype]) ? '' : ' style="display:none;"') : '') . (!empty($cfg['config']['visuals']['body']) ? ' class="blockcontent fr_' . $head_bar . ' ' . $cfg['config']['visuals']['body'] . '"' : '') . '>
								<div' . (!empty($hashead) ? ' class="pmx_noframe_' . $cfg['blocktype'] . '"' : '') . ' style="padding:' . $innerPad[0] . 'px ' . $innerPad[1] . 'px !important;">
									<div';
    }
    // have a bodytext class ?
    if (!empty($cfg['config']['visuals']['bodytext'])) {
        echo ' class="' . $cfg['config']['visuals']['bodytext'] . '"';
    }
    // have overflow and (min-/max-)height?
    if (!empty($cfg['config']['overflow'])) {
        echo ' style="' . (isset($cfg['config']['maxheight']) && !empty($cfg['config']['maxheight']) ? (empty($cfg['config']['height']) ? 'max-height' : $cfg['config']['height']) . ':' . $cfg['config']['maxheight'] . 'px;' : '') . 'overflow:' . $cfg['config']['overflow'] . ';text-overflow:ellipsis;white-space:nowrap;"';
    }
    echo '>';
    // if header or frame and can collaps?
    if (!empty($cfg['config']['collapse']) && $cfg['config']['visuals']['header'] != 'none') {
        $tmp = '
		var ' . $IDtype . ' = new smc_Toggle({
		bToggleEnabled: true,
		bCurrentlyCollapsed: ' . (empty($options['collapse' . $IDtype]) ? 'false' : 'true') . ',
		aSwappableContainers: [
			\'upshrink_' . $IDtype . '\'
		],
		aSwapImages: [
			{
				sId: \'upshrink_' . $IDtype . '_Img\',';
        if ($context['pmx']['settings']['shrinkimages'] == '0') {
            $tmp .= '
				srcCollapsed: \'' . $context['pmx_img_colapse'] . '\',
				altCollapsed: ' . JavaScriptEscape($txt['pmx_expand'] . $blocktitle) . ',';
        } else {
            $tmp .= '
				altCollapsed: ' . JavaScriptEscape($txt['pmx_expand'] . $blocktitle) . ',';
        }
        if ($context['pmx']['settings']['shrinkimages'] == '0') {
            $tmp .= '
				srcExpanded: \'' . $context['pmx_img_expand'] . '\',
				altExpanded: ' . JavaScriptEscape($txt['pmx_collapse'] . $blocktitle) . '
			}';
        } else {
            $tmp .= '
				altExpanded: ' . JavaScriptEscape($txt['pmx_collapse'] . $blocktitle) . '
			}';
        }
        $tmp .= '
		],
		oCookieOptions: {
			bUseCookie: true,
			sCookieName: \'' . 'pmx_upshr' . $IDtype . '\',
			sCookieValue: \'' . $options['collapse' . $IDtype] . '\'
		}
	});';
        addInlineJavascript("\t" . str_replace("\n", "\n\t", PortaMx_compressJS($tmp)), true);
        unset($tmp);
    }
}
    /**
     * AdmBlock_content().
     * Open a textarea, to create or edit the content.
     * Returns the AdmBlock_settings
     */
    function pmxc_AdmBlock_content()
    {
        global $context, $options, $txt;
        // show the content area
        $options['collapse_phpinit'] = empty($context['pmx']['phpInit']['havecont']);
        echo '
					<td valign="top" colspan="2" style="padding:4px;">
						<div class="cat_bar catbg_grid">
							<h4 class="catbg catbg_grid">
								<span style="float:right;display:block;margin-top:-2px;">
									<img onclick="php_syntax(\'' . $context['pmx']['phpShow']['id'] . '\')" style="padding:3px 5px 3px 10px;cursor:pointer;" alt="Syntax check" title="' . $txt['pmx_check_phpsyntax'] . '" src="' . $context['pmx_imageurl'] . 'syntaxcheck.png" class="pmxright" />
								</span>
								<span class="cat_left_title">' . $txt['pmx_edit_content'] . '
								<span id="upshrinkPHPinitCont"' . (empty($options['collapse_phpinit']) ? '' : ' style="display:none;"') . '>' . $txt['pmx_edit_content_show'] . '</span></span>
							</h4>
						</div>
						<div id="check_' . $context['pmx']['phpShow']['id'] . '" class="info_frame" style="line-height:1.4em;margin:1px 0;"></div>

						<textarea name="' . $context['pmx']['phpShow']['id'] . '" id="' . $context['pmx']['phpShow']['id'] . '" style="display:block;width:' . $context['pmx']['phpShow']['width'] . ';height:' . $context['pmx']['phpShow']['height'] . ';">' . $context['pmx']['phpShow']['value'] . '</textarea>

						<div class="plainbox info_text" style="margin-top:5px;margin-right:0px;padding:5px 0 7px 0;display:block;">
							<div class="normaltext" style="margin:0 10px;">
							' . (empty($context['pmx']['phpInit']['havecont']) ? '<span style="margin-top:2px;margin-right:-4px;" id="upshrinkPHPshowImg" class="floatright ' . (empty($options['collapse_visual']) ? 'toggle_up" align="bottom"' : 'toggle_down" align="bottom"') . ' title="' . (empty($options['collapse_visual']) ? $txt['pmx_collapse'] : $txt['pmx_expand']) . $txt['pmx_php_partblock'] . '">
								</span>' : '') . '
								<span>' . $txt['pmx_php_partblock_note'] . '
									<img class="info_toggle" onclick=\'Toggle_help("pmxPHPH01")\' src="' . $context['pmx_imageurl'] . 'information.png" alt="*" title="' . $txt['pmx_information_icon'] . '" style="vertical-align: -3px;" />
								</span>
							</div>
							<div id="pmxPHPH01" style="display:none; margin:4px 10px 0;">' . $txt['pmx_php_partblock_help'] . '</div>
						</div>

						<div id="upshrinkPHPshowCont"' . (empty($options['collapse_phpinit']) ? '' : ' style="display:none;"') . '>
							<div class="cat_bar catbg_grid">
								<h4 class="catbg catbg_grid">
									<span style="float:right;display:block;margin-top:-2px;">
										<img onclick="php_syntax(\'' . $context['pmx']['phpInit']['id'] . '\')" style="padding:3px 5px 3px 10px;cursor:pointer;" title="' . $txt['pmx_check_phpsyntax'] . '" alt="Syntax check" src="' . $context['pmx_imageurl'] . 'syntaxcheck.png" class="pmxright" />
									</span>
									<span class="cat_left_title">' . $txt['pmx_edit_content'] . $txt['pmx_edit_content_init'] . '</span>
								</h4>
							</div>
							<div id="check_' . $context['pmx']['phpInit']['id'] . '" class="info_frame" style="line-height:1.4em;margin:1px 0;"></div>

							<textarea name="' . $context['pmx']['phpInit']['id'] . '" id="' . $context['pmx']['phpInit']['id'] . '" style="display:block;width:' . $context['pmx']['phpInit']['width'] . ';height:' . $context['pmx']['phpInit']['height'] . ';">' . $context['pmx']['phpInit']['value'] . '</textarea>

						</div>';
        if (empty($context['pmx']['phpInit']['havecont'])) {
            addInlineJavascript("\t" . str_replace("\n", "\n\t", PortaMx_compressJS('
						var upshrinkPHPshow = new smc_Toggle({
							bToggleEnabled: true,
							bCurrentlyCollapsed: ' . (empty($options['collapse_phpinit']) ? 'false' : 'true') . ',
							aSwappableContainers: [
								\'upshrinkPHPshowCont\',
								\'upshrinkPHPinitCont\'
							],
							aSwapImages: [
								{
									sId: \'upshrinkPHPshowImg\',
									altCollapsed: ' . JavaScriptEscape($txt['pmx_expand'] . $txt['pmx_php_partblock']) . ',
									altExpanded: ' . JavaScriptEscape($txt['pmx_collapse'] . $txt['pmx_php_partblock']) . '
								}
							],
							oCookieOptions: {
									bUseCookie: false
								}
						});')), true);
        }
        echo '
					</td>
				</tr>
				<tr>';
        // return the default settings
        return $this->pmxc_AdmBlock_settings();
    }