<%@ 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>

function goSearch(){
	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"><span class="title-1" name="siteCommonTitle" id="siteCommonTitle">${councilNm}</span><span class="title-2">소장자료관</span></a></h1>
            
            <div class="search-wrap">
                <h2 class="blind">검색</h2>
                <form id="searchHeaderForm" name="searchHeaderForm" method="post" action="/search/searchList.do">
                    <fieldset>
                        <legend>검색</legend>
                        <div class="search-input">
                            <input type="text" placeholder="" title="검색어 입력" name="query" id="top_query" class="ark_query" value="" autocomplete="off">
                            <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" onclick="javascript:fn_layerPop('${pageContext.request.contextPath}/search/getDetailedSearchFormPopup.do');">상세검색</button> -->
                            <button type="button" class="btn-search-detail" id="btn-search-detail-cl">상세검색</button>
                        </div> 
                        <div class="condition_sear">
                            <select name="sfield" id="sfield" class="sear_depth">
                                <option value="" selected="selected">전체</option>
                                <option value="TITLE">제목</option>
                            </select>
                        </div>
                    </fieldset>
                </form>
            </div>
           
            <div class="log">
                <ul>
                    <sec:authorize access="not isAuthenticated()">
                        <li><!-- 개발자 확인용 타이틀 임시 추가  DDDDDDDDDDD -->
                            <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><!-- 개발자 확인용 타이틀 임시 추가  DDDDDDDDDDD -->
                            <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>