{template header}

<!--{if empty($infloat)}-->
	{subtemplate header_nofloat}
<!--{/if}-->

<div class="float" id="pmsendfloat">
<div class="floatbox" style="height: 410px">
	<h3 class="float_ctrl">
		<em id="return_$handlekey">{lang pm_send}</em>
		<span>
			<!--{if !empty($infloat)}--><a href="javascript:;" class="float_close" onclick="floatwin('close_$handlekey')" title="{lang close}">{lang close}</a><!--{/if}-->
		</span>
	</h3>
	<div id="sendpmmsg" class="postbox">
		<form id="sendpmform" method="post" action="pm.php?action=send&pmsubmit=yes&infloat=yes&sendnew=yes" onsubmit="$('pmsendmessage').value = parseurl($('pmsendmessage').value);ajaxpost('sendpmform', 'return_$handlekey', 'return_$handlekey', 'onerror');return false;">
			<input type="hidden" name="formhash" value="{FORMHASH}" />
			<input type="hidden" name="handlekey" value="$handlekey" />
			<div class="floatwrap">
				<table class="formtable" cellspacing="0" cellpadding="0">
					<tr>
						<td width="60">{lang pm_receiver}: </td>
						<td>
							<input name="msgto" value="$username" class="txt" tabindex="1" />
							<!--{if $buddyarray}--><a href="javascript:display('buddies');" class="dropmenu">{lang pm_to_buddy}</a><!--{/if}-->
						</td>
					</tr>
					<!--{if $buddyarray}-->
					<tbody id="buddies" style="display: none;">
					<tr>
						<td width="60"></td>
						<td>
							<ul class="s_clear">
							<!--{loop $buddyarray $buddy}-->
								<li><label for="msgto_$buddy[uid]"><input id="msgto_$buddy[uid]" name="msgtos[]" type="checkbox" value="$buddy[uid]"> $buddy[username]</label></li>
							<!--{/loop}-->
							</ul>
						</td>
					</tr>
					</tbody>
					<!--{/if}-->
					<tr>
						<td valign="top">{lang content}: </td>
						<td>
						<div class="editor_tb" style="width: 454px;">
							{eval $seditor = array('pmsend', array('bold', 'img', 'link', 'quote', 'code', 'smilies'));}
							{subtemplate seditor}
						</div>
						<textarea id="pmsendmessage" name="message" cols="60" rows="10" class="txtarea" tabindex="1" onKeyDown="seditor_ctlent(event, '$(\'sendpmform\').pmsubmit.click()');" style="width: 450px; height: 160px;">$message</textarea></td>
					</tr>
					<tr>
						<td></td>
						<td><button type="submit" name="pmsubmit" value="true">{lang send}</button>
						{eval $policymsgs = $p = '';}
						<!--{loop $creditspolicy['sendpm'] $id $policy}-->
						<!--{block policymsg}--><!--{if $extcredits[$id][img]}-->$extcredits[$id][img] <!--{/if}-->$extcredits[$id][title] $policy $extcredits[$id][unit]<!--{/block}-->
						{eval $policymsgs .= $p.$policymsg;$p = ', ';}
						<!--{/loop}-->
						<!--{if $policymsgs}-->&nbsp;{lang pm_credit_msg}<!--{/if}-->
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
</div>
</div>

<script type="text/javascript" reload="1">
function messagehandle_$handlekey(key, msg) {
	if(key == 1) {
		$('return_$handlekey').className = $('return_$handlekey').innerHTML = '';
		$('sendpmmsg').className = 'float_message';
		$('sendpmmsg').innerHTML = msg + '<br /><br /><button onclick="floatwinreset = 1;floatwin(\'close_$handlekey\');">{lang close}</button>';
		creditnoticewin();
	}
}
</script>

<!--{if empty($infloat)}-->
	{subtemplate footer_nofloat}
<!--{/if}-->
{template footer}