<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ include file="/jsp/work/taglib.jsp" %>
<%@ page import="kr.co.hsnc.j2ee.waf.controller.web.util.WebKeys" %>

<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%  
	ctx.init(request, response);
	HandlerStorage storage = ctx.getHandlerStorage();

	ValueObject user = ctx.getUser();
	ValueObject params = ctx.getParams();

	RowSet notiRowSet = storage.getRowSet("notiRowSet");
	int rowSize = notiRowSet.size(); 
	
	if(rowSize > 5) {
		rowSize = 5;
	}
	
	 boolean signedOn = false;
     
     HttpSession htSession = request.getSession();
     
     if( request.getSession().getAttribute(WebKeys.SIGNED_ON_USER) != null ) {
         signedOn = true;
     }
     String yyyymmdd = (new java.text.SimpleDateFormat ("yyyyMMdd")).format (new java.util.Date());
     
%>

	
		<style type="text/css">
			.pop-layer {display:none; position: absolute; top: 50%; left: 50%; width: 310px; height:auto;  background-color:#fff; border: 5px solid #3571B5; z-index: 10;}	
			.pop-layer .pop-container {padding: 20px 25px;}
			.pop-layer p.ctxt {color: #666; line-height: 25px;}
			.pop-layer .btn-r {width: 100%; margin:10px 0 20px; padding-top: 10px; border-top: 1px solid #DDD; text-align:right;}
		
		</style>
		<link rel="stylesheet" type="text/css" href="/css/supplier/login.css" />
		<script language="JavaScript" src="/js/login.js"></script>
		
		<script type="text/javascript">
			jQuery(document).ready(function() {
			    
			    
			    //레이어창 닫았다 다시열 시 리사이징 때문인지 입력폼 먹통되는 현상(IE9, 크롬 이상없음) 레이어 바깥쪽 클릭하면 정상으로 돌아옴. 왜지??
			    $("#_searchId").click();
			    
			    $("#join").click(function(){
				    location.href="/supplier/portal/join/TermsAgree.screen";
				});
			    
			    $("#search_id").click(function(){
			        var win_id = "_searchId";
			        var link = "/supplier/portal/join/SuppSearchId.screen";
				    link += "?pop_win_id="+win_id+"&layerYn=Y";
					fLayerPop(win_id, link, 610,110, '', '', 'auto', 100);
			    });
			    
			    
			    $("#ContSearch").click(function(){
			        var win_id = "_ContSearchPopup";
			        var link = "/portal/cont/ContSearchPopup.screen";
				    link += "?pop_win_id="+win_id+"&layerYn=Y";
					fLayerPop(win_id, link, 600,150, '', '', 'auto');
			        
			    });
			    
				$("#btn_login").click(function(){
				    
				    var f = document.loginForm;
			        
			        $("#fevent").val("USER_APPR_CHK");
	                submitXmlRequest("/supplierLogin_form.screen", $("#fevent").val(), f, "VALUEOBJECT");
	                
			    });
			    
				/*************************************
					협력업체 포탈 안내 팝업					
				*************************************/
				if(<%=yyyymmdd%> <= '20231231') fOpenNotiPop();
			});
	
			function goReference() {
			    var win_id = "_searchReference";
				var link = "/supplier/portal/center/SuppReferenceListPopup.screen";
				    link += "?pop_win_id="+win_id+"&layerYn=Y";
				fLayerPop(win_id, link, 810,410, '', '', 'auto');
			}
				
			function searchReferenceClose(){
				fLayerPopClose('_searchReference');
			}
			
			function getNotiList() {
				var win_id = "_searchNotice";
				var link = "/supplier/portal/center/SuppNotiListPopup.screen";
				    link += "?pop_win_id="+win_id+"&layerYn=Y";
				    fLayerPop(win_id, link, 810,400, '', '', 'auto');
			}
			
			function searchNoticeClose(result){
				fLayerPopClose('_searchNotice');
			}
			function goSmartbill(){
				//var url = "http://www.smartbill.co.kr/";
				var url = "https://www.wehago.com/";
				window.open(url, "_blank");
			}
			function getNotiDetail(seq) {
				var win_id = "_searchNotice";
				var link = "/supplier/portal/center/SuppNotiDetailPopup.screen";
				    link += "?pop_win_id="+win_id+"&seq="+seq+"&layerYn=Y";

				    fLayerPop(win_id, link, 810,400, '', '', 'auto');
			}
			//2015.7.17
			function openPopUpSc(){
				var url = "http://www.bizrating.co.kr";
				window.open(url, "_blank");
			}
			function openPopUpStep(){
				var url = "/html/join_step_guide.html";
				
				//window.open(url, "join_step");
				openPopup(url, "_blank", "no", "800", "800");
			}
			function openPopUpCrossCert(){
				var url = "https://raadmin.crosscert.com/customer/etecenc/index.html";
				window.open(url, "_blank");
			}
			function openPopUpUser() {
				var url = "/html/portal_user_popup.html";
				openPopup(url, "_blank", "no", "800", "320");
			}
			
			/**
			 * Cookie 읽기
			 */
			function _fGetCookie( name ) {
				var nameOfCookie = name + "=";
				var x = 0;
				while ( x <= document.cookie.length ) {
					var y = (x+nameOfCookie.length);
					if ( document.cookie.substring( x, y ) == nameOfCookie ) {
						if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
							endOfCookie = document.cookie.length;
						return unescape( document.cookie.substring( y, endOfCookie ) );
					}
					x = document.cookie.indexOf( " ", x ) + 1;
					if ( x == 0 )
						break;
				}
				return "";
			}
			
			/*******************************
				협력업체 공지 팝업
			*******************************/
			function fOpenNotiPop()
			{	
				//1. 대금안내 팝업(2014)
				/* if(_fGetCookie("pop_141219") != "no")
				{
					var url = "/html/pop_141219.html";
					openPopup(url, "_blank", "pop_141219", "541", "450");	
				} */
				//2. 외주 우수협력사 안내 공지 팝업(2022)
				/* if(_fGetCookie("portal_out_supp_best") != "no")
				{
					var url = "/html/portal_out_supp_best.html";
					openPopup(url, "_blank", "portal_out_supp_best", "370", "330");	
				} */
				//3. 견적 시스템 오픈 공지(2023)
				if(_fGetCookie("portal_quot_popup") != "no")
				{
					var url = "/html/portal_quot_popup.html";
					openPopup(url, "_blank", "portal_quot_popup", "720", "880");	
				}
			}
		</script>
		
	<form type="post" name="loginForm">
	<INPUT type="hidden" name="fevent" id="fevent" value="">
	<INPUT type="hidden" name="layerYn" id="layerYn">
		<div id="wrap">
			<div id="header">
				<div id="supplier-main-menu">
					<ul class="main-menu">
						<li class="logo">
							<a href="/supplierLogin.screen"><img src="/img/supplier/portal_logo.png" /></a>
						</li>
					</ul>
				</div>
			</div>
			<div id="content-wrap" style="padding-bottom: 0px;">
				<div id="content">
					<div id="login-banner">
						<img src="/img/supplier/login/login_banner.gif" />
					</div>
					<div id="login-form">
						<table class="form">
							<colgroup>
								<col width="680" />
								<col width="*" />
							</colgroup>
							<tr>
								<td align="center">
									<table>
										<colgroup>
											<col width="120" />
											<col width="40" />
											<col width="160" />
											<col width="180" />
											<col width="14" />
											<col width="*" />
										</colgroup>
										<tr>
											<td rowspan="2"><img src="/img/supplier/login/login_form_title.gif" /></td>
											<td><img src="/img/supplier/login/login_id.gif" /></td>
											<td><input type="text" id="login_id" name="login_id" onkeypress="JavaScript:enter(1);" tabindex="1"/></td>
											<td><input type="checkbox" id="chk_save_id" /> 아이디저장</td>
											<td rowspan="2"><img src="/img/supplier/login/split.gif" /></td>
<!-- 											<td rowspan="2"><a href="javascript:doLoginPortal();"><img src="/img/supplier/login/btn_login.gif" /></a></td> -->
											<td rowspan="2"><img src="/img/supplier/login/btn_login.gif" id="btn_login" name="btn_login" style="cursor: pointer;"/></td>
										</tr>
										<tr>
											<td><img src="/img/supplier/login/login_pw.gif" /></td>
											<td><input type="password" id="login_pw" name="login_pw" onkeypress="JavaScript:enter(2, 'Y');" tabindex="2"/></td>
											<td><img src="/img/supplier/login/btn_find.gif" id="search_id" name="search_id" style="cursor: pointer;" /></td>
										</tr>
									</table>
								</td>
								<td class="companyBtn">
									<a href="#" ><img src="/img/supplier/login/btn_company_reg.gif" id="join" name="join" /></a>
								</td>
							</tr>
						</table> 
					</div>
					<div id="login-notice">
						<div id="notice">
							<table>
								 
								<!-- <IFRAME width="380" height="240" name='worker' frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></IFRAME> -->
								 
								 
								<!--  
								<thead>
									<a onClick="javascript:getNotiList();"><img src="/img/supplier/login/login_notice_title.gif" style="cursor: pointer;"/></a>
								</thead>
								<colgroup>
									<col width="10" />
									<col width="284" />
									<col width="*" />
								</colgroup>
								<tbody>
									<tr>
										<td><img src="/img/supplier/ico/green_a.gif" /></td>
										<td><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
										<td class="right">2014-05-29</td>
									</tr>
									<tr>
										<td><img src="/img/supplier/ico/green_a.gif" /></td>
										<td><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
										<td class="right">2014-05-29</td>
									</tr>
									<tr>
										<td><img src="/img/supplier/ico/green_a.gif" /></td>
										<td><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
										<td class="right">2014-05-29</td>
									</tr>
									<tr>
										<td><img src="/img/supplier/ico/green_a.gif" /></td>
										<td><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
										<td class="right">2014-05-29</td>
									</tr>
									<tr>
										<td><img src="/img/supplier/ico/green_a.gif" /></td>
										<td><a href="#">SGC이앤씨 협력업체 포털 시스템을 오픈하였습니다.</a></td>
										<td class="right">2014-05-29</td>
									</tr>
								
								</tbody>
								
									 -->
									
								<thead>
									<img src="/img/supplier/login/login_notice_title01.gif" style="cursor: normal;"/><a onClick="javascript:getNotiList();"><img src="/img/supplier/login/login_notice_title02.gif" style="cursor: pointer;"/></a>
									<!-- <a onClick="javascript:getNotiList();"><img src="/img/supplier/login/login_notice_title.gif" style="cursor: pointer;"/></a> -->
								</thead>
								<colgroup>
									<col width="10" />
									<col width="284" />
								</colgroup>
								<tbody>
									<tr>
										<%
											for( int i=0; i<rowSize; i++ ) {	
										%>
											<tr>
												<td>
													<img src="/img/supplier/ico/green_a.gif" />
												</td>
												<td><a onClick="javascript:getNotiDetail(<%= notiRowSet.getRow(i).get("seq") %>);" style="cursor: pointer;">
															<%
																if( notiRowSet.getRow(i).get("title").length() > 22 ) {
															%>
																	<%=notiRowSet.getRow(i).get("title").substring(0, 22) + "..."%>
															<%
																}
																else {
															%>
																	<%=notiRowSet.getRow(i).get("title")%>
															<%		
																}
															%>
													</a>
												</td>
												<td class="right">
															<%= notiRowSet.getRow(i).get("noti_dy").substring(0,4) + "-" + 
															notiRowSet.getRow(i).get("noti_dy").substring(4,6) + "-" + 
															notiRowSet.getRow(i).get("noti_dy").substring(6,8) %>
												</td>
											</tr>
										<%
											}
										%>
									</tr>
								</tbody>
							</table>
						</div>
						<!-- 
						<div id = "temp">
							<table>
								<thead>
									<tbody>
										<tr><td width="50">23232323232323232</td></tr>	
									</tbody>
								</thead>
							</table>
						</div>
						 -->
						<div id="econtract">
							<img src="/img/supplier/login/btn_econtract_check.gif"  id="ContSearch" name="ContSearch" style="cursor: pointer;"/>
						</div>
						<div id="btn">
							<table>
								<tr>
									<td><a href="#" ><img src="/img/supplier/login/btn_registration_step.gif" onclick="javascript:openPopUpStep();"/></a></td>
									<td><a href="#" ><img src="/img/supplier/login/btn_certi.gif" onclick="javascript:openPopUpCrossCert();"/></a></td>
								</tr>
								<tr>
	 								<td><a href="#"><img src="/img/supplier/login/btn_charger.gif" onclick="javascript:openPopUpUser();"/></a></td>
<!--								<td><a href="#"><img src="/img/supplier/login/btn_cert_sc.gif" onclick="javascript:openPopUpSc();"/></a></td>
                                        <td><a href="#"><img src="/img/supplier/login/btn_pds.gif" onclick="javascript:goReference();"/></a></td> -->
									<td align="center"><a href="#"><img src="/img/supplier/login/btn_wehago.gif" onclick="javascript:goSmartbill();"/></a></td>
								</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
			<div id="footer" style="z-index: 100;">
				<p><img src="/img/supplier/login/footer.gif" /></p>
			</div>
		</div>
<SCRIPT language="javascript">
	var str_saveid = getCookie(CookieID);
	if( str_saveid != "" ) {
	    document.loginForm.login_id.value = str_saveid;
	    document.loginForm.chk_save_id.checked = true;
    }
	
	function doSignData(corp_reg_no, job_div){
		
		var sColumDelimiter = "┃";
		
		var sContHash=job_div		+sColumDelimiter
					+corp_reg_no	+sColumDelimiter;
		
 		unisign.SignDataNVerifyVID( sContHash, null, corp_reg_no, function( resultObject ) {
			if( !resultObject || resultObject.resultCode != 0 ){
				if( resultObject.resultCode == '14208'){
					alert("선택하신 인증서가 로그인한 사업자의 인증서가 아닙니다.[사업자번호 불일치]");	
				} else if( resultObject.resultCode == '999'){
					alert("사용자 DN 선택이 취소 되었습니다.");
				} else {
					alert( resultObject.resultMessage);
				}
				return;
			}
			
			var signeddata = resultObject.signedData;
			var userdn = resultObject.certAttrs.subjectName;
			
			$('.b-iframe').get(0).contentWindow.doSetPop(signeddata);
			
		});
		
	}

</SCRIPT>		
	</form>



<!-- 전자인증 모듈 설정 //-->
<link rel="stylesheet" type="text/css" href="/CrossCert/CC_WSTD_home/unisignweb/rsrc/css/certcommon.css?v=1" />
<script type="text/javascript" src="/CrossCert/CC_WSTD_home/unisignweb/js/unisignwebclient.js?v=1"></script>
<script type="text/javascript" src="/CrossCert/UniSignWeb_Multi_Init_Nim.js?v=1"></script>
<!-- 전자인증 모듈 설정 //-->