<div class="sys-service-menu-wrp">
	<div class="sys-service-menu">
		<bx_if:show_for_visitor>
			<div class="sys-sm-item sys-smi-join bx-def-margin-sec-left-auto" __script__">
				<div class="sys-sm-profile">
					<span class="sys-smp-thumbnail">
						<i class="sys-icon __icon__"></i>
					</span>
					<span class="sys-smp-title bx-def-margin-sec-left bx-def-margin-right">
						__caption__
					</span>
				</div>
	        </div>
		</bx_if:show_for_visitor>
		<bx_if:show_for_user>
			<div class="sys-sm-item sys-smi-profile bx-def-margin-sec-left-auto" onclick="javascript:oBxEvoServiceMenu.showMenu(this);">
				<div class="sys-sm-profile">
					<span class="sys-smp-thumbnail">
						<bx_if:show_fu_thumb_image>
							<img class="sys-smp-thumbnail bx-img-retina" src="__image__" src-2x="__image_2x__" />
						</bx_if:show_fu_thumb_image>
						<bx_if:show_fu_thumb_icon>
							<i class="sys-icon user"></i>
						</bx_if:show_fu_thumb_icon>
					</span>
					<span class="sys-smp-title bx-def-margin-sec-left">__title__</span>
				</div>
	            <span class="sys-sm-item">
	            	<i class="sys-icon chevron-down"></i>
	            </span>
	            <div id="__menu_popup_id__"  class="sys-sm-item-submenu">__menu_popup_content__</div>
	        </div>
		</bx_if:show_for_user>
	</div>
	<script type="text/javascript">
		function BxEvoServiceMenu(oOptions) {
			this._sMenuPopupId = oOptions.sMenuPopup == undefined ? 'sys-service-menu' : oOptions.sMenuPopup;
	    }

		BxEvoServiceMenu.prototype.showSearch = function() {
			if($('#sys_search input[name="keyword"]').val().length > 2)
				$('#sys_search form')[0].submit();
		};

		BxEvoServiceMenu.prototype.showMenu = function(oLink) {
			$(oLink).find('.sys-sm-item > .sys-icon').toggleClass('chevron-down').toggleClass('chevron-up');

			$('#' + this._sMenuPopupId).dolPopup({
	    		pointer:{
	    			el:$(oLink)
	    		},
	        }); 	
	    };

	    var oBxEvoServiceMenu = new BxEvoServiceMenu({
	    	sMenuPopup: '__menu_popup_id__'
	    });
	</script>
</div>