<div id="actions">
	
	<ul id="for_messages">
<?php 	if($this->global['install_type'] == 'server' && $this->userData['UMasterAdmin'] == 1 ) : ?>
		<li id="action_contact_newdomain" title="<?php echo $this->translate("New Domain") ?>"><a href="#"><span><strong><?php echo $this->translate('New Domain') ?></strong></span></a></li>
<?php 	endif; ?>
<?php 	if($this->userData['UMasterAdmin'] == 1) : ?>
		<li id="action_contact_newgroup" title="<?php echo $this->translate("New Group") ?>"><a href="#"><span><strong><?php echo $this->translate('New Group') ?></strong></span></a></li>
<?php 	endif; ?>
<?php 	if($this->global['install_type'] == 'server') : ?>
<?php 	if($this->userData['UMasterAdmin'] == 1 || $this->userData['UAdd'] == 1) : ?>
		<li id="action_contact_newuser" title="<?php echo $this->translate("New User") ?>"><a href="#"><span><strong><?php echo $this->translate('New User') ?></strong></span></a></li>
<?php 		endif ?>
<?php 	endif; ?>
<?php if($this->userData['UMasterAdmin'] == 1 || $this->userData['UModify'] == 1) : ?>
		<li id="action_contact_edituser" title="<?php echo $this->translate("Edit User") ?>"><a href="#"><span><strong><?php echo $this->translate('Edit User') ?></strong></span></a></li>
<?php endif; ?>
<?php 	if($this->global['install_type'] == 'server') : ?>
<?php 	if($this->userData['UMasterAdmin'] == 1 || $this->userData['UAdd'] == 1) : ?>
		<li id="action_contact_importuser" title="<?php echo $this->translate("Import Users") ?>"><a href="#"><span><strong><?php echo $this->translate('Import Users') ?></strong></span></a></li>
<?php 		endif ?>
<?php 	endif; ?>
<?php if($this->userData['UMasterAdmin'] == 1 || $this->userData['UDelete'] == 1) : ?>
		<li id="action_contact_deleteuser" title="<?php echo $this->translate("Delete User") ?>"><a href="#"><span><strong><?php echo $this->translate('Delete User') ?></strong></span></a></li>		
<?php endif; ?>
		
		<!--
		<li id="action_contact_import"><a href="#"><span><strong>Import</strong></span></a></li>
		-->
		
	</ul>

	<ul id="jsddm">
		<li id="action_more" title="<?php echo $this->translate("More") ?>"><a href="#" class="moredrop"><span><strong><?php echo $this->translate('More') ?><span class="arrow">▼</span></strong></span></a>
			<ul class="menu_drop_more">
				<li id='action_more_selectall'><a href="#"><?php echo $this->translate('Select All') ?></a></li>
				<li id='action_more_deselectall' class="bottom"><a href="#"><?php echo $this->translate('Deselect') ?></a></li>
			</ul>
		</li>
	</ul>
		
</div>

<div id="primary">
	<div id="primary_header">
		<h1><?php echo $this->translate('All Users') ?></h1>
	</div>
	<div id="contact-hold">
		<div id="primary_content">
			<div id="primary_content_inner" style="display:none">
				<div id="address_contacts">
				</div>
			</div>
			<div id="contact_info">
			</div>
		</div>
	</div>
</div>

<div id="secondary">
<?php echo $this->render('users/listdomains.phtml'); ?>
</div>

<script type="text/javascript" language="JavaScript">
var actions_disabled_users = false;
$( function() { 

	$('#Users #jsddm').bind('mousedown', jsddm_open);
	
	//$('#Users #jsddm > li').bind('mouseout',  jsddm_timer)});

	$("BODY").removeClass('no_actions');

	$('#action_contact_edituser a').bind("click", function() { 
		
		if( userIsDisabled($(this)) || actions_disabled_users == true )
		{
			
			return false
			
		}

		//this block of code mainly put here for cleaner structure and also to access $this->translate
		if($(this).attr("demo") == 'true') 
		{
		
			alert('<?php echo $this->translate("Disabled in online demo") ?>')
			return false
		
		}
		
		userEditFirstSelected(); 
		return false; 
	} );
	
	$('#action_contact_deleteuser a').bind("click", function() 
	{
		
		if( userIsDisabled($(this)) || actions_disabled_users == true )
		{
			
			return false
			
		}

		if($(this).attr("demo") == 'true') 
		{
		
			alert('<?php echo $this->translate("Disabled in online demo") ?>')
			return false
		
		}
		
		var listType = $('#listType', '#Users').attr('value');
		if( listType == 'user' )
		{
			
			confirmMessage = '<?php echo str_replace("'", "\'", $this->translate("Are you sure you want to delete users from this group? (Will not delete the user account)")) ?>';
			
		}																												 
		else
		{
			
			confirmMessage = '<?php echo str_replace("'", "\'", $this->translate("Are you sure you want to delete the selected users from this domain?")) ?>';
			
		}
		
		if( !confirm(confirmMessage) )
		{
			
			return false
			
		}
		
		userDeleteSelected(); 
		return false; 
		
	} );
	
	$('li#action_contact_newuser a').bind("click", function() 
	{ 

		if( userIsDisabled($(this)) || actions_disabled_users == true )
			return false; 
		userNew('<?php echo $this->siteBaseUrl ?>');
		return false; 

	});
	

	$('li#action_contact_importuser a').bind("click", function() 
	{ 

		userImport(); 

	});	
	//enabled initially, and listusers must en/disable accordingly
	
	// More menu
	$('#action_more_selectall a').bind("mousedown", function() { selectAll(); return false; } );
	$('#action_more_deselectall a').bind("mousedown", function() { deselectAll(); return false; } );

	var search_timeout = undefined;

	$('#searchQuery').bind('keyup', function() 
	{
			if(search_timeout != undefined)
			{
				clearTimeout(search_timeout);
			}
			var thecall = this; // save reference to 'this' so we can use it in timeout function
			// auto search is broken
		/* search_timeout = setTimeout(function() {
			search_timeout = undefined;
			searchAbook(thecall)
		}, 300); */
	});

	listUsersClick( $('.groupLink', '#folder_all') );

});

</script>
<div id="draggableContactsContainer" style="position:absolute;"></div>
