{include file="$admingentemplates/admin_top.tpl" script="qforms"}
<div class="back">
    <a href="{$form.back}">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.events.event_users}</div>
<div class="cr">&nbsp;</div>

<div class="fr" style="margin-bottom: 20px;">
    <form name="search_form" action="{$form.action}" method="post">
    {$search_hiddens}
    <input type="text" style="width:100; height:20" name="search" value="{$search}" {if $root}disabled{/if}>
    <select name="s_type" style="width:70; height:20">
    	{section name=s loop=$types}
    	<option value="{$smarty.section.s.index_next}" {if $types[s].sel}selected{/if}>{$types[s].value}</option>
    	{/section}
	</select>
    {if !$root}<a class="admin_button btn_upload" onclick="javascript: users_search_click();document.search_form.submit();">{$lang.button.search}<span>&nbsp;</span></a>{/if}
    </form>
</div>	


<div class="panel_section">
    <form style="padding: 10px; display: table; width: 100%;" name="addUsers" action="{$form.action}" method="POST" enctype="multipart/form-data">
    {$form.hiddens}
    <div class="fl" >
        <div><b>{$lang.groups.all_users}:</b></div>    
        <div>
            <select name="AllUsers"  size="20" multiple style="width: 400px;" onDblClick="objForm.AllUsers.transferTo('IncUsers');"  {if $root}disabled{/if}>
    		{section name=u loop=$allusers_arr}
    		<option value="{$allusers_arr[u].value}" {if $allusers_arr[u].sel}selected{/if}>{$allusers_arr[u].name}</option>
    		{/section}
    		</select>
        </div>
    </div>
    <div class="fl" style="margin: 100px 25px;">
        {if !$root}
		<input type="button" style="width:40px" value="&gt;&gt;" class="button" onclick="objForm.AllUsers.transferTo('IncUsers', true, 'all');"><br><br>
		<img src="{$site_root}{$template_root}/images/arrow sort right.png" alt="" height="13" style="cursor: pointer;" onclick="objForm.AllUsers.transferTo('IncUsers');" /><br><br><br>
		<img src="{$site_root}{$template_root}/images/arrow sort left.png" alt="" height="13" style="cursor: pointer;" onclick="objForm.AllUsers.transferFrom('IncUsers');" /><br><br>
		<input type="button" style="width:40px" value="&lt;&lt;" class="button" onclick="objForm.AllUsers.transferFrom('IncUsers', true, 'all');"><br><br>
		{/if}
    </div>
    <div class="fl" >
        <div><b>{$lang.events.event_users}:</b></div>
        <div>
            <select name="IncUsers" size="20" multiple style="width: 400px;" onDblClick="objForm.AllUsers.transferFrom('IncUsers');"  {if $root}disabled{/if}>
			{section name=u loop=$gusers_arr}
			<option value="{$gusers_arr[u].value}" {if $gusers_arr[u].sel}selected{/if}>{$gusers_arr[u].name}</option>
			{/section}
			</select>
        </div>
    </div>
    <!-- user hidden list  -->
	{section name=u loop=$goldusers_arr}
	<input type=hidden value="{$goldusers_arr[u].value}" name="prevusers[{$smarty.section.u.index}]">
	{/section}
    </form>
</div>
{if !$root}
	<div class="fl"><a class="admin_button_major" onclick="javascript: document.addUsers.submit();" {if $root}disabled{/if}>{$lang.button.save}<span>&nbsp;</span></a></div>
{/if}

				{literal}
 				<SCRIPT LANGUAGE="JavaScript">
				<!--//
				// initialize the qForm object
				objForm = new qForm("addUsers");
				// make the User field a container, this will ensure that the "reset()"
				// method will restore the values in the select box, even if they've
				// been removed from the select box
				objForm.AllUsers.makeContainer();
				// setting the "dummyContainer" property to false will ensure that no values
				// from this container are included with the value
				objForm.AllUsers.dummyContainer = true;

				// make the "Members" field a container--every item in the "Members" select box
				// will be part of the container, even if the item isn't selected.
				objForm.IncUsers.makeContainer();
				//-->
			
				function users_search_click() {
				 var sel = document.addUsers.IncUsers;
				 var i=0;
				 var res ='';
				 var first = 0;
				 while (i<sel.options.length) {
					res = res + sel.options[i].value+', ';
				   ++i;
				 }
				 document.search_form.IncSUsers.value=res;
				}
					
				</script>
				{/literal}
{include file="$admingentemplates/admin_bottom.tpl"}