<?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.
// -----------------------------------------------------------------------

?>

<style type="text/css">
<!--
@import url(<?php echo $template_path_core;?>css/aroundme_form.css);
-->
</style>

<script type="text/javascript" src="speller/spellChecker.js"></script>
<script type="text/javascript">
	function openSpellChecker() {
		var speller = new spellChecker();
		speller.spellCheckAll();
	}
</script>


<form method="post" action="index.php?amn=core_ann_edit" name="frm" id="id_frm">
<input type="hidden" name="announce_id" value="<?php echo isset($announce['announce_id']) ? $announce['announce_id'] : ''; ?>" />

<div class="col_main">
	<div class="box">
		<div class="box_top">
			<div class="content">
				<h1><?php echo $lang['hdr_announcement']; ?></h1>
			</div>
		</div>

		<div class="box_mid">
			<div class="content">
				<p>
					<label for="announce_title"><?php echo $lang['txt_title']; ?></label>
					<input class="input1" type="text" size="81" name="announce_title" id="id_announce_title" style="width: 480px;" value="<?php echo isset($announce) ? $announce['announce_title'] : ''; ?>" />
				</p>

				<table cellspacing="1" cellpadding="0" border="0" width="100%">
					<tr>
						<td>
							<label for="id_announce_body"><?php echo $lang['txt_announcement'];?></label><br />
						</td>
						<td>
							<?php
							$gui_expert_editor = "id_announce_body";
							include($template_path_core . "inc/form_gui_html_editor.inc.php");
							?>
						</td>
					</tr>
				</table>
					
				<table cellspacing="1" cellpadding="0" border="0" width="100%">
					<tr>
						<td width="1">
							<textarea id="id_announce_body" name="announce_body" cols="72" rows="8" style="width:480px;" onKeyUp="AMEditorSync(this.value, 'wysiwyg_editor');"><?php if (isset($announce['announce_body'])) { echo $announce['announce_body'];}?></textarea>
							<br />
						</td>
						<td>
							<br />
						</td>
					</tr>
					<tr>
						<td width="1">
							<iframe id="wysiwyg_editor" name="wysiwyg_editor" style="height:100px; width:480px;" frameborder="0" width="580"  scrolling="yes"  height="100">
				
							</iframe>
						</td>
						<td valign="top" width="20">
							<img src="<?php echo $template_path_core;?>img/arrow_up.png" width="9" height="12" alt="" border="0" onClick="AmEditorResize();" /><br />
							<img src="<?php echo $template_path_core;?>img/arrow_down.png" width="9" height="12" alt="" border="0" onClick="AmEditorResize('minus');" /><br />
							<img src="<?php echo $template_path_core;?>img/pixel.png" width="20" height="1" alt="" border="0" /><br />
						</td>
					</tr>
				</table>
				
				<script language="javascript" type="text/javascript">
					var wysiwygHeight = 100;
					var thisEditor = new AMEditor('id_announce_body', 'wysiwyg_editor');
				</script>

				<hr />
				
				<p align="right">
					<input type="submit" name="sub_preview" id="id_sub_preview" class="input_submit" value="<?php echo $lang['sub_preview']; ?>"/>
					<?php
					if (isset($allow_spellcheck)) {
					?>
					<input type="button" class="input_submit" value="<?php echo $lang['sub_check_spelling'];?>" onClick="openSpellChecker();" />
					<?php }?>
					<input type="submit" name="sub_insert" id="id_sub_insert" class="input_submit" value="<?php echo $lang['sub_send'];?>"/>
				</p>
				
				<?php
				if (isset($announce['display_announce_body'])) {
				?>
				<p>
					<b><?php echo $announce['announce_title']; ?></b><br />
				</p>
				<p>
					<?php echo $announce['display_announce_body']; ?>
				</p>
				<?php } ?>
			</div>
		</div>
	</div>
</div>

<div class="col_side">
	<div class="box">
		<div class="box_top">
			<div class="content">
				<h1><?php echo $lang['hdr_email_announcement'];?></h1>
			</div>
		</div>

		<div class="box_mid">
			<div class="content">
				<?php
				if ($_SESSION['user_core_permission'] & $core_config['resource']['user']['ext_announce']) {
				?>
				<p>
					<?php echo $lang['txt_email_intro'];?><br />
				</p>
				
				<p>
					<b><?php echo $lang['txt_email_to'];?></b>:<br />
					<?php 
					foreach($core_config['membership_type']['type'] as $key => $i):
					?>
					<input type="checkbox" name="email_membership_types[]" value="<?php echo $i;?>" />&nbsp;<?php echo $lang['membership_type'][$i];?><br />
					<?php
					endforeach;
					?>
				</p>
				<?php }?>
			</div>
		</div>
	</div>

	<div id="editor_help"><?php echo $lang['txt_help_default'];?></div>
</div>

</form>