{if $reportSource}
	<table class="customColumnsLayout">
		<tr>

			<td class="layoutGrid">
				<div id="customColumnsList"></div>
			</td>

			<td class="layoutGrid customColumnsOptions">

				<button type="button" onclick="addCustomColumn();">{$_LANG.reportsManagement.admin.customColumns.addCol}</button>

				<hr class="customColumnsOptSeparator" />

				<div class="customCol_optionsDescription">
					{$_LANG.reportsManagement.admin.customColumns.moduleInfo1}
					<br />
					{$_LANG.reportsManagement.admin.customColumns.moduleInfo2}
					<br />
					{$_LANG.reportsManagement.admin.customColumns.moduleInfo3}
					{if $rmCols}{$_LANG.reportsManagement.admin.customColumns.moduleInfo4|sprintf:"<i>$rmCols</i>"}{/if}
					<br />
					{$_LANG.reportsManagement.admin.customColumns.moduleInfo5}
					<br />
					{$_LANG.reportsManagement.admin.customColumns.moduleInfo6}
					<br />
					{$_LANG.reportsManagement.admin.customColumns.moduleInfo7}
				</div>
				<br class="space5" />

				<table class="customColumnsCalculator" cellspacing="0" cellpadding="0" align="center">
					<tr>
						<td><button type="button" onclick="insertValueIntoFormula('7');">7</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('8');">8</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('9');">9</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('/');">/</button></td>
					</tr>
					<tr>
						<td><button type="button" onclick="insertValueIntoFormula('4');">4</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('5');">5</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('6');">6</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('*');">*</button></td>
					</tr>
					<tr>
						<td><button type="button" onclick="insertValueIntoFormula('1');">1</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('2');">2</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('3');">3</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('-');">-</button></td>
					</tr>
					<tr>
						<td><button type="button" onclick="insertValueIntoFormula('0');">0</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('00');">00</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('.');">.</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('+');">+</button></td>
					</tr>
					<tr>
						<td><button type="button" disabled="1" class="disabled">&nbsp;</button></td>
						<td><button type="button" onclick="insertValueIntoFormula('(');">(</button></td>
						<td><button type="button" onclick="insertValueIntoFormula(')');">)</button></td>
						<td><button type="button" disabled="1" class="disabled">&nbsp;</button></td>
					</tr>
				</table>

				<br class="space5" />

				<select size="1" style="width:150px;" onchange="insertValueIntoFormula(this.value);this.value='';">
					<option value='' selected="1">{$_LANG.reportsManagement.admin.customColumns.chooseColSelector}</option>

					{assign var=lastColCat value=''}{assign var=hasCats value=0}
					{foreach from=$columnsList name="colsLoop" key=colCode item=colName}
						{assign var=thisColCat value=$columnsCfg[$colCode].cat}

						{if $thisColCat!=$lastColCat}
							{if !$smarty.foreach.colsLoop.first}</optgroup>{/if}
							<optgroup label="{$_LANG.reports.columnCategories[$reportSource][$thisColCat]}">
							{assign var=hasCats value=1}
						{/if}

						<option value="%{$colCode}%">{$colName}</option>

						{assign var=lastColCat value=$thisColCat}

					{/foreach}

					{* close the last option group - if opened *}
					{if $thisColCat or $hasCats}</optgroup>{/if}

				</select>

			</td>
		</tr>
	</table>

	<script language="javascript">
		listCustomColumns();
		var activeObject = null;
	</script>

{/if}