<?php
// -----------------------------------------------------------------------
// This file is part of AROUNDMe
//
// Copyright (C) 2003 - 2007 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
// 02110-1301, USA.
// -----------------------------------------------------------------------

?>

<table cellspacing="1" cellpadding="0" border="0" width="100%">
	<tr>
		<td valign="top">
			<div id="colourpicker1"></div><br />
		</td>
		<td valign="top" align="right">
			<select accesskey="s" name="styles" class="gui_select" onChange="javascript:insertTags(this.value, '<?php echo $txtarea;?>'); this.value=0;">
				<option value="0">styles</option>
				<option value="b">bold text</option>
				<option value="i">italic text</option>
				<option value="h1">Headline big</option>
				<option value="h2">Headline bigger</option>
				<option value="h3">Headline normal</option>
				<option value="h4">Headline small</option>
				<option value="h5">Headline tiny</option>
				<option value="tt">teletype text</option>
				<option value="code">code</option>
				<option value="center">centered text</option>
				<option value="ol">ordered list item</option>
				<option value="ul">unordered list item</option>
				<option value="color">coloured text</option>
				<option value="hr">horizontal rule</option>
			</select><br />
		</td>
		<?php
		if (isset($images)) {
		
		if (!isset($module_id)) {
			$module_id = 0;
		}
		?>
		<td valign="top" align="right">
			<select accesskey="i" name="files" class="gui_select" onChange="javascript:insertTags('image', '<?php echo $txtarea;?>', this.value);">
			<option value="">images</option>
			<?php
			foreach ($images as $key => $i):
			?>
			<option value="<?php echo $module_id . "-" . $i['file_md5_name'];?>"><?php echo $i['file_save_name'];?></option>	
			<?php
			endforeach;
			?>
		</td>
		<?php }?>
		<?php
		if (isset($files)) {
		
		if (!isset($module_id)) {
			$module_id = 0;
		}
		?>
		<td valign="top" align="right">
			<select accesskey="i" name="files" class="gui_select" onChange="javascript:insertTags('file', '<?php echo $txtarea;?>', this.value);">
			<option value="">files</option>
			<?php
			foreach ($files as $key => $i):
				$suffix = explode ('/', $i['file_type']);
				$suffix = $suffix[1];
				
			?>
			<option value="<?php echo $module_id . "-" . $i['file_md5_name'] . "--" . $suffix;?>"><?php echo $i['file_save_name'];?></option>	
			<?php
			endforeach;
			?>
		</td>
		<?php }?>
	</tr>
</table>


<script type="text/javascript">
	var inputfield = '<?php echo $txtarea;?>';
	initColourPicker('colourpicker1', 30);
	
	function setcolour(id) {
		var swatch = document.getElementById(this.id);
		insertTags('color', '<?php echo $txtarea;?>', swatch.id);
	}
</script>


