{include file="$admingentemplates/admin_top.tpl"}

<font class=red_header>{$header.add_quickmessage}</font>
<!--{$header.razdel_name}<font class=red_sub_header>&nbsp;|&nbsp;{$header.upm_list}&nbsp;|&nbsp;{$header.add_quickmessage}</font><br><br><br>-->

<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div style="display:block;" class="help_text">
	<div class="close_help">
		<img src="{$site_root}{$template_root}/images/close_help.png" alt="">
	</div>
	<div class="help_body">
		<span class="help_title">{$lang.help}:</span>{$lang.admin_help.av_module}
	</div>
</div>
<div class="cr">&nbsp;</div>
<div style="display:table;width:100%;">
	<ul class="tabs">
		<li>
			<a href="{$site_url}{$site_root}/admin/{$file_name_root}">{$lang.admin_menu.settings}</a>
		</li>
		<li>
			<a href="{$site_url}{$site_root}/topcmm_123flashchat/admin/basicsetting.php">{$lang.settings.123flashchat}</a>
		</li>
		<li>
			<a href="{$site_url}{$site_root}/admin/admin_chat7.php">{$lang.settings.flashcoms}</a>
		</li>
		{*<li>
			<a href="{$site_url}{$site_root}/admin/admin_toksta.php?app=chat">{$lang.settings.toksta}</a>
		</li>*}
		<li>
			<a class="current">{$lang.settings.userplane}</a>
		</li>
		<li>
			<a href="{$site_url}{$site_root}/admin/admin_av_module.php?sel=cometchat">Cometchat</a>
		</li>
	</ul>
	<div class="user_operation_line" style="height:4px;font-size:0px;">&nbsp;</div>
</div>
<div id="ajax_load">
	<div id="user_status_line" class="user_status_line" style="margin-bottom:-1px;float:none;overflow:hidden;">
		<div id="tab_chat" class="user_status_elem" onclick="List('chat')">
			<a>{$lang.av_module.chat}</a>
		</div>
		<div id="tab_mess" class="user_status_elem_active" onclick="List('mess');">
			{$lang.av_module.messenger}
		</div>
		<div id="tab_rec" class="user_status_elem" onclick="List('rec');">
			<a>{$lang.av_module.recorder}</a>
		</div>
	</div>
<table border=0 cellspacing=1 cellpadding=5 width=100%>
<tr class="table_header"><td></td></tr>
<tr bgcolor="#ffffff"><td>
	<div style="margin:10px 0;">
		<select onchange="List_select(this.options[this.selectedIndex].value);">
			<option value="{$site_url}{$site_root}/admin/webmessenger/connlist.php">{$chats.upc_connections}</option>
			<option value="{$site_url}{$site_root}/admin/webmessenger/qmeslist.php" selected>{$chats.upm_quickmessages}</option>
			<option value="{$site_url}{$site_root}/admin/webmessenger/settings.php">{$chats.upc_settings}</option>
		</select>
	</div>
</td></tr>
</table>
	<div class="panel_section" style="width:100%;display:table;">
		<div class="panel_content">
<form action="{$form.action}" name="form1" method="POST" style="margin:0px">
{$form.hiddens}
<table width=100%>
<tr>
	<td class="main_content_text" align="left" width="100px" valign="top">{$header.title} <font class=main_error_text>*</font></td>
	<td class="main_content_text"><input type="text" name="title" value="{$form.title}" size="70"></td>
</tr>
<tr valign="top">
        <td align="right" width="100px" class="main_header_text">&nbsp;</td>
        <td class="main_content_text" align="left">
		<table>
		
		<tr valign=center>
			<td>
			<input type="button" style="width:40px" value="{$tools.b}" class="button" onclick="SetNewsFont('b', '')">
			</td>
			<td>
			<input type="button" style="width:40px" value="{$tools.i}" class="button" onclick="SetNewsFont('i', '')">
			</td>
			<td>
			<input type="button" style="width:40px" value="{$tools.u}" class="button" onclick="SetNewsFont('u', '')">
			</td>
			<td>
			<input type="button" style="width:40px" value="{$tools.br}" class="button" onclick="SetNewsFont('br', '')">
			</td>
			<td>
			<select name="color" onchange="SetNewsFont('color', this.form.color.options[this.form.color.selectedIndex].value); this.form.color.selectedIndex=0;" style="width:90">
				<option value="">{$color.select_fontcolor}</option>{include file="$admingentemplates/admin_options_color.tpl"}
			</select>&nbsp;
			</td>
			<td>
			<select name="bgc" onchange="SetNewsFont('bgc', this.form.bgc.options[this.form.bgc.selectedIndex].value); this.form.bgc.selectedIndex=0;" style="width:90">
				<option value="">{$color.select_bgcolor}</option>{include file="$admingentemplates/admin_options_color.tpl"}
			</select>&nbsp;
			</td>
		</tr>
		<tr valign=center>
			<td>
			<input type="button" style="width:40px" value="{$tools.a}" class="button" onclick="SetNewsFont('a', '')">
			</td>
			<td>
			<input type="button" style="width:40px" value="{$tools.sup}" class="button" onclick="SetNewsFont('sup', '')">
			</td>
			<td>
			<input type="button" style="width:40px" value="{$tools.sub}" class="button" onclick="SetNewsFont('sub', '')">
			</td>
			<td>
			<input type="button" style="width:40px" value="{$tools.code}" class="button" onclick="SetNewsFont('code', '')">
			</td>
			<td>
			<select name="face" onchange="SetNewsFont('face', this.form.face.options[this.form.face.selectedIndex].value); this.form.face.selectedIndex=0;" style="width:90">
				<option value="">{$font.select_fontface}</option>{include file="$admingentemplates/admin_options_face.tpl"}
			</select>&nbsp;
			</td>
			<td>
			<select name="size" onchange="SetNewsFont('size', this.form.size.options[this.form.size.selectedIndex].value); this.form.size.selectedIndex=0;" style="width:90">
				<option value="">{$font.select_fontsize}</option>{include file="$admingentemplates/admin_options_size.tpl"}
			</select>&nbsp;
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td class="main_content_text" align="left" width="100px" valign="top">{$header.body} <font class=main_error_text>*</font></td>
	<td class="main_content_text"><div valign="bottom" id="view_area" style="display: none; padding:5">{$form.body}</div>
		<textarea name="body" cols="70" rows="10" onclick="MemADMINRange('form1', event)" onkeydown="MemADMINRange('form1', event)">{$form.body}</textarea>
		<a id="edit_view" class="admin_button" onclick="javascript: ViewTextArea();"><span>&nbsp;</span>{$button.view}</a>
		<input type=hidden name=view_sel value="1">
	</td>
</tr>
</table>
</div>
</div>
<table width=100%><tr>
<td width=70>
	<a class="admin_button_major" onClick="javascript: if (CheckForm()) document.form1.submit();"><span>&nbsp;</span>{$button.save}</a>
</td>
<td>
	<a class="admin_button" onClick="javascript: location.href='{$form.back_link}'"><span>&nbsp;</span>{$button.back}</a>
</td>
</tr>
</table>

</form>
</div>
{literal}

<SCRIPT LANGUAGE="JavaScript">
<!-- //hide
function CheckForm()
{
  if (!document.forms[0].body.value)
     {
      {/literal} 
      alert('{$header.err.announcement_empty}');
      {literal} 
      return false;
     }
  return true;
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
var theSelection = false;
var LAST_Range;
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));

var ADMIN_LAST_Range;

function  SetNewsFont(par, value){
	if(!ADMIN_LAST_Range){
		ADMIN_LAST_Range = document.forms['form1'].body.createTextRange();
	}
	if ((clientVer >= 4) && is_ie && is_win) {
		
		theSelection = document.selection.createRange();

		if(par == "b" || par == "i" || par == "u" || par == "sup" || par == "sub" || par == "code"){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<"+par+"></"+par+">";
			}else{
				theSelection.text ="<"+par+">" +theSelection.text+"</"+par+">";
			}
		}

		if(par == "br"){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<"+par+">";
			}else{
				theSelection.text ="<"+par+">";
			}
		}

		if(par == "a" ){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<"+par+" href=\"\"></"+par+">";
			}else{
				theSelection.text ="<"+par+" href=\"\">" +theSelection.text+"</"+par+">";
			}
		}
		if(par == "color" ){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<font color=\""+value+"\"></font>";
			}else{
				theSelection.text ="<font color=\""+value+"\">" +theSelection.text+"</font>";
			}
		}
		if(par == "size" ){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<font style=\"font-size:"+value+"pt\"></font>";
			}else{
				theSelection.text ="<font style=\"font-size:"+value+"pt\">" +theSelection.text+"</font>";
			}
		}
		if(par == "bgc" ){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<font style=\"background-color:"+value+"\"></font>";
			}else{
				theSelection.text ="<font style=\"background-color:"+value+"\">" +theSelection.text+"</font>";
			}
		}
		if(par == "face" ){
			if(!theSelection.text){
				ADMIN_LAST_Range.text = ADMIN_LAST_Range.text + "<font face=\""+value+"\"></font>";
			}else{
				theSelection.text ="<font face=\""+value+"\">" +theSelection.text+"</font>";
			}
		}

		document.forms['form1'].body.focus();
	}
}
function MemADMINRange(form, event){
	//TagNameEl = event.srcElement.tagName;
	TagNameEl = (event.target) ? event.target.tagName : event.srcElement.tagName;
///////////////////// refresh TEXT_Range on every click in text area
	if(TagNameEl == "TEXTAREA" && event.type=="click"){
		ADMIN_LAST_Range = document.forms[form].body.createTextRange();
		ADMIN_LAST_Range.moveToPoint(event.clientX, event.clientY); 
	}else if(TagNameEl == "TEXTAREA" && event.type=="keydown" && (event.keyCode == 37 || event.keyCode == 39 )){
		if(!ADMIN_LAST_Range){
			ADMIN_LAST_Range = document.forms[form].body.createTextRange();
		}
		switch(event.keyCode){
			case 37 :  type = "character"; move = -1; break;
			case 39 :  type = "character"; move = 1; break;
		}
		ADMIN_LAST_Range.move(type, move); 
	}
} 

function ViewTextArea(){
	action = document.forms['form1'].view_sel.value;	//// if action=1 - view else (=2) - edit
	if(action == 1){
		document.getElementById('edit_view').value = '{/literal}{$button.edit}{literal}';
		document.all['view_area'].innerHTML = document.forms['form1'].body.value;
		document.all['view_area'].style.display = '';
		document.forms['form1'].body.style.display = 'none';
		document.forms['form1'].view_sel.value = 2;

	}else{
		document.getElementById('edit_view').value = '{/literal}{$button.view}{literal}';
		document.all['view_area'].innerHTML = '';
		document.all['view_area'].style.display = 'none';
		document.forms['form1'].body.style.display = '';
		document.forms['form1'].view_sel.value = 1;
	}
}
//-->
</SCRIPT>

{/literal}

{include file="$admingentemplates/admin_bottom.tpl"}
{literal}
<script language="JavaScript" type="text/javascript" >  
if ({/literal}"{$ajax}"{literal} == 0) 
    var tab_id_last = 'chat';
	var site_url = {/literal}"{$site_url}"{literal};
	var site_root = {/literal}"{$site_root}"{literal};
	var path = site_url+site_root+"/admin/admin_av_module.php";
		
function List(subtabs) {
	if ($('#tab_'+subtabs).find('a').text() == '') return;
	
	var ajax = 1;
	$('#tab_'+tab_id_last).html("<a>"+$('#tab_'+tab_id_last).text()+"<\/a>");
	$('#tab_'+subtabs).text($('#tab_'+subtabs).text());
	$('#tab_'+tab_id_last).removeClass('user_status_elem_active');
	$('#tab_'+tab_id_last).addClass('user_status_elem');
	$('#tab_'+subtabs).removeClass('user_status_elem');
	$('#tab_'+subtabs).addClass('user_status_elem_active');
	
	if (subtabs == "rec")
		path = site_url+site_root+"/admin/webrecorder/recslist.php";
	if (subtabs == "chat"){
		path = site_url+site_root+"/admin/webchat/roomlist.php";
		ajax = 0;
	}
	tab_id_last = subtabs;
	if (subtabs != "chat"){
		ajaxLoadingImage(1, 'ajax_load');
		$.post(path, {par:'4',subtabs:subtabs,ajax:ajax}, function(data){
			ajaxLoadingImage(0, 'ajax_load');
			$('#ajax_load').html(data);
		});
	}
	else{document.location = path;}
}
function List_select(value) {
	ajaxLoadingImage(1, 'ajax_load');
	$.post(value, {ajax:'1'}, function(data){
		ajaxLoadingImage(0, 'ajax_load');
		$('#ajax_load').html(data);
	});
}
</script>
{/literal}