<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<%
String councilCd = (String)session.getAttribute("councilCd");
String councilNm = (String)session.getAttribute("councilNm");
%>
<script>
$(document).ready(function() {
	DOC_VIEW_URL = "${docViewUrl}";
	VIDEO_VIEW_URL = "${videoViewUrl}";
	IMAGE_VIEW_URL = "${imageViewUrl}";
});

function goSearch(){
	/* if($("#top_query").val() != "")
   	{
		$('#searchHeaderForm input[name=filter_mylist]').val("search_query,");   	
	} */
    
	document.searchHeaderForm.submit();
}

function fn_getMemberCard() {

	fn_layerPopWithClass("/userInfo/getMemberQrcodeFormPopup.do", "pop-member");
}

</script>

        <h2 class="blind">헤더영역</h2>
        <div class="inner">

            <h1><a href="javascript:void(0)" onclick="javascript:location.href='/';"><img src="/images/img/img-logo.svg" alt="로고"><span class="title-1" id="siteCommonTitle">${councilNm}</span><span class="title-2">소장자료관</span></a></h1>
            
            <div class="search-wrap">
                <h2 class="blind">검색</h2>
                <div class="search-close"><button type="button"></button></div>
                <form id="searchHeaderForm" name="searchHeaderForm" method="post" action="/search/searchList.do">
                    <input type="hidden" name="filter_mylist">
                    <fieldset>
                        <legend>검색</legend>
                        <div class="search-input">
                            <input type="text" placeholder="" title="검색어 입력" name="query" id="top_query" class="ark_query" value="" autocomplete="off"><label for="top_query" style="display:none">검색어</label>
                            <button type="button" class="btn-search" id="searchHeaderButton" onclick="goSearch();"><span>검색</span></button>
                            <button type="button" class="btn-search-detail" id="btn-search-detail-cl">상세<span>검색</span></button>
                        </div> 
                        <div class="condition_sear">
                            <select name="sfield" id="sfield" class="sear_depth" title="검색대상">
                                <option value="" selected="selected">전체</option>
                                <option value="TITLE">제목</option>
                            </select>
                            <label for="sfield" style="display:none">검색대상</label>
                        </div>
                    </fieldset>
                </form>
            </div>
           
            <div class="log">
                <ul>
                    <sec:authorize access="not isAuthenticated()">
                        <li>
                            <a href="javascript:void(0)" onclick='fn_layerPopWithClass("/login/loginFormPopup.do", "pop-login")' title="${councilNm}(${councilCd})" class="login-btn">로그인</a></li>
                    </sec:authorize>
                    <sec:authorize access="isAuthenticated()">
                        <sec:authentication property="principal.name" var="userName" />
                        <sec:authentication property="principal.loginUserId" var="userId" />
                        
                        <li>
                            <a href="javascript:void(0)" onclick="javascript:location.href='${pageContext.request.contextPath}/logout';" 
                               title="${userId} - ${councilNm} (${councilCd})" class="login-btn">
                            ${userName}님 로그아웃</a>
                        </li>
                        <li><a href="javascript:void(0)" class="member-btn" onclick="fn_getMemberCard();">회원증</a></li>
                    </sec:authorize>
                    
                    <sec:authorize access="isAuthenticated()">
                        <li><a href="javascript:void(0)" onclick="javascript:location.href='${pageContext.request.contextPath}/cmm/listNotifications.do';" class="noti-btn">알림(<span class="count">${unreadNotiCnt }</span>)</a></li>
                    </sec:authorize>
                    <li><a href="javascript:void(0)" onclick="javascript:location.href='${pageContext.request.contextPath}/cart/listCartItems.do';">카트(<span class="count">${cartCnt }</span>)</a></li>
                </ul>
            </div>
        </div>

        <script>
        
        </script>