









	

/*===========================================================
function cgf_ArraySet(row, col)
function cgf_SaveSpecialChars(as_String)
function cgf_CheckBoxCheck(ao_checkbox,as_gubun) 
function cgf_CenterWindow(as_url, as_name, as_w, as_h, as_scroll, as_resize, as_toolbar)
function cgf_CloseWin()
function cgf_ShowPopup( url, param, option, title )
function cgf_CheckReSet(ao_obj, as_val)
function cgf_SelCheckReSet(ao_obj) 
function cgf_CheckAll(ao_obj) 
function cgf_objCheckTarget(targetObj, allObj) 
function cgf_objCheckAll(obj, targetObj)
function cgf_SessionCheck(as_flag)
function cgf_SessionCheck2()
function cgf_SearchTip(classCd)
==============================================================*/
/*===========================================================
function cgf_NDSLDDSBrief(as_collid, as_objname)
function cgf_NDSLDDSDetail(as_collid, as_objname)
function cgf_NDSLDDSRequest(as_retvalue)
function cgf_NDSLDDSAjaxResult(as_ajaxvalue)
function cgf_NDSLFavoriteBrief(as_collid, as_objname)
function cgf_NDSLFavoriteDetail(as_collid, as_objname)
function cgf_NDSLFavoriteSave(as_retvalue)
function cgf_NDSLFavoriteAjaxResult(as_ajaxvalue)
function cgf_NDSLAlertBrief(as_collid, as_gubun, as_objname)
function cgf_NDSLAlertDetail(as_collid, as_objname)
function cgf_NDSLAlertSave(as_retvalue)
function cgf_NDSLAlertAjaxResult(as_ajaxvalue)
function cgf_KISTIAlertBrief(as_collid, as_gubun, as_objname)

==============================================================*/

//widow.open 전역변수.
var objWin;


/*----------------------------------------------*/
/* function : cfg_toggle			*/
/* 설    명 : 이미지와 레이터 토글		*/
/* 작 성 자 : hwado				*/
/* 작 성 일 : 2007.11.16			*/
/*----------------------------------------------*/
function cgf_toggle(ao_obj, as_id){
	
	if (ao_obj.style.display != "none")  ao_obj.style.display = "none" ;
	else  ao_obj.style.display = "";
	
	var imgid = document.getElementById(as_id);
	if (ao_obj.style.display != "none") {
		imgid.src = "/img/patent/" + as_id.substr(0,as_id.length-2) + "c" + as_id.substr(as_id.length-1,as_id.length) + ".gif";
		imgid.title = "닫기";
		imgid.alt = "닫기";		
	} else {
		imgid.src = "/img/patent/" + as_id.substr(0,as_id.length-2) + "o" + as_id.substr(as_id.length-1,as_id.length) + ".gif";
		imgid.title = "열기";	
		imgid.alt = "열기";
	}
	
}

function cgf_toggle2(ao_obj, as_id){

	if (ao_obj.style.display != "none")  ao_obj.style.display = "none" ;
	else  ao_obj.style.display = "";
	
	var imgid = document.getElementById(as_id);
	if (ao_obj.style.display != "none") {
		imgid.src = "/img/patent/" + as_id+ "_c" + ".gif";
		imgid.title = "닫기";
		imgid.alt = "닫기";		
	} else {
		imgid.src = "/img/patent/" + as_id+ "_o" + ".gif";
		imgid.title = "열기";	
		imgid.alt = "열기";
	}
}

	function lf_displaypassClose(ao_obj,ao_obj2) {
		if (ao_obj.style.display != "none")  ao_obj.style.display = "none" ;
		else  ao_obj.style.display = "";
		
  		if (ao_obj2.style.display != "none"){
  			document.getElementById("tr_pass1").style.display="block";
  			document.getElementById("tr_pass2").style.display="none";
  		} else {
	  		document.getElementById("tr_pass2").style.display="none";
  		}
	}
	
	function lf_displaypassOpen(ao_obj,ao_obj2) {
		if (ao_obj.style.display != "none")  ao_obj.style.display = "none" ;
		else  ao_obj.style.display = "";
		
  		if (ao_obj2.style.display != "none"){
  			document.getElementById("tr_pass2").style.display="block";
  			document.getElementById("tr_pass1").style.display="none";
  		} else {
	  		document.getElementById("tr_pass2").style.display="none";
  		}
	}
function cgf_togglev2(ao_obj,ao_obj2, as_id ,as_id2){
	if (ao_obj.style.display != "none")  ao_obj.style.display = "none" ;
	else  ao_obj.style.display = "";

	var imgid = document.getElementById(as_id);
	var imgid2 = document.getElementById(as_id2);
	if (ao_obj.style.display != "none") {
		imgid.src = "/img/common/" + as_id+ "_closed" + ".gif";
		imgid.title = "닫기";
		imgid.alt = "닫기";
		imgid2.src = "/img/common/" + as_id2+ "_close1" + ".gif";
		imgid2.title = "닫기";
		imgid2.alt = "닫기";		
	
	} else {
		imgid.src = "/img/common/" + as_id+ "_open" + ".gif";
		imgid.title = "열기";	
		imgid.alt = "열기";
		imgid2.src = "/img/common/" + as_id2+ "_open1" + ".gif";
		imgid2.title = "열기";	
		imgid2.alt = "열기";
	}
	
	if (ao_obj2.style.display == "none")  ao_obj2.style.display = "block" ; 
	else  ao_obj2.style.display = "none";
}

function cgf_toggle3(as_objform, ao_obj, as_id){
	
	if (ao_obj.style.display != "none")  ao_obj.style.display = "none" ;
	else  ao_obj.style.display = "";
	
	var imgid = document.getElementById(as_id);
	if (ao_obj.style.display != "none") {
		imgid.src = "/img/patent/" + as_id+ "_c" + ".gif";
		imgid.title = "닫기";
		imgid.alt = "닫기";		
		as_objform.value = "true";
	} else {
		imgid.src = "/img/patent/" + as_id+ "_o" + ".gif";
		imgid.title = "열기";	
		imgid.alt = "열기";
		as_objform.value = "false";
	}
}

/*----------------------------------------------*/
/* function : cfg_objCheckAll			*/
/* 설    명 : 전체선택시 나머지 선택박스 해제	*/
/* 작 성 자 : hwado				*/
/* 작 성 일 : 2007.11.16			*/
/*----------------------------------------------*/
function cgf_objCheckAll(obj, targetObj) {
	if(obj.checked) {	// 전체 선택인 경우
		for(i=0; i < targetObj.length; i++) { 
			targetObj[i].checked = false;
		}
	}
	else {
		obj.checked = true;
	}
}

/*----------------------------------------------*/
/* function : cfg_objCheckAll			*/
/* 설    명 : 개별 선택시 전체선택 해제		*/
/* 작 성 자 : hwado				*/
/* 작 성 일 : 2007.11.16			*/
/*----------------------------------------------*/
function cgf_objCheckTarget(targetObj, allObj) {
	allObj.checked = false;
	var ckCnt =0;
	for(i=0; i < targetObj.length; i++) {
		if(targetObj[i].checked) ckCnt++;
	}
	if(ckCnt < 1) allObj.checked = true;
}



/*----------------------------------------------*/
/* function : cfg_objCheckAll			*/
/* 설    명 : 개별 선택시 전체선택 해제		*/
/* 작 성 자 : hwado				*/
/* 작 성 일 : 2007.11.16			*/
/*----------------------------------------------*/
function cgf_CheckAll(ao_obj) {
	var inx=0;
	for(inx=0; inx < ao_obj.length; inx++) {
		ao_obj[inx].checked = true;
	}
}
/* 체크 해제 */
function cgf_SelCheckReSet(ao_obj) {
	if (ao_obj.length == null) {
		if(ao_obj.checked) {
			ao_obj.checked = false;
		}
	}else {
		for(var inx=0; inx < ao_obj.length; inx++) {
			if(ao_obj[inx].checked) {
				ao_obj[inx].checked = false;
			}
		}
	}
}
/*----------------------------------------------*/
/* function : cfg_CheckReSet			*/
/* 설    명 : 개별 선택시 전체선택 해제		*/
/* 작 성 자 : hwado				*/
/* 작 성 일 : 2007.11.16			*/
/*----------------------------------------------*/
function cgf_CheckReSet(ao_obj, as_val) {
	var inx=0;
	for(inx=0; inx < ao_obj.length; inx++) {
		ao_obj[inx].checked = false;
	}
	
	switch (as_val) {
		
		case "PABASIC" :
			for(inx=0; inx < ao_obj.length; inx++) {
				if (ao_obj[inx].value == "IC"
				    || ao_obj[inx].value == "AN"
				    || ao_obj[inx].value == "AD"
				    || ao_obj[inx].value == "PA" ) ao_obj[inx].checked = true;
			}
			break;
		default :
			break;
	}
}

function cgf_CenterWindow(as_url, as_name, as_w, as_h, as_scroll, as_resize, as_toolbar){
	var PosLeft; 
	var PosTop; 

	PosLeft = (window.screen.width/2) - (as_w/2 + 10); 
	PosTop = (window.screen.height/2) - (as_h/2 + 50);

//	as_scroll = 0;

	if(window.screen.width < as_w+10){
		PosLeft = 0;
		as_w = window.screen.width - 10;
		as_scroll = 1;
	}

	if(window.screen.height < as_h+60){
		PosTop = 0;
		if(window.screen.width>as_w+10){
			as_w +=15;
		}

		as_h = window.screen.height - 60;
		as_scroll = 1;
	}

	var objWin = window.open(as_url,as_name,"status,height=" + as_h + ",width=" + as_w + ", scrollbars=" + as_scroll + ",resizable=" + as_resize + ",left=" + PosLeft + ",top=" + PosTop + ",screenX=" + PosLeft + ",screenY=" + PosTop + ",status="+as_toolbar+",toolbar="+as_toolbar+",location=" + as_toolbar+",menubar="+as_toolbar); 
	if(objWin == null){
		alert("팝업창이 차단되었습니다.\n\n팝업창 차단 설정을 해제하여주십시요.\n\n팝업창 차단 설정은\n웹페이지 상단에 나타나는 [알림 표시줄]에서 설정이 가능합니다.\n\n또는 [도구 > 인터넷옵션 > 개인정보 > 팝업차단 > 설정]에서\n설정이 가능합니다.");
	}
}


function cgf_CloseWin() { 
	if(objWin != null)
		objWin.close();
} 

/*=======================================================================================
    함수명 : cgf_ShowPopup
    기  능 : Modal Popup
           : modal popup 화면 생성.
    인  수 : url    = 팝업화면 URL
             param  = 팝업화면에 전달할 파라미터
             option = 팝업화면 옵션( showModalDialog와 동일 )
    용  례 : 
        적용전 : var ls_Result = window.showModalDialog( "/jsp/common/c_charc_pop.jsp","", "dialogWidth:540px; dialogHeight:550px; center:yes;status:y;");
        적용후 : var ls_Result = cfn_ShowPopup( "/jsp/common/c_courtc.jsp","", "dialogWidth:540px; dialogHeight:550px; center:yes;status:no;");
    RETURN : showModalDialog와 동일
=========================================================================================*/
function cgf_ShowPopup( url, param, option, title )
{
    if( title == null ) title = "" ;

    var ar = new Array();
    ar[0] = window
    ar[1] = url ;

    if( param != null ) ar[2] = param ;
    if( option == null ) option = "" ;

    ar[3] = title ;

    return showModalDialog( "modaldlg.do", ar, option ) ;
	
}



/*=======================================================================================
    함수명 : cgf_ArraySet
    기  능 : javascript의 2차원 배열 초기화 - 저장시 넘어갈 DataSet을 만들기 위해 사용
    인  수 : row    = Row수
         col	= 컬럼수
    리  턴 : 데이타셋
=========================================================================================*/
function cgf_ArraySet(row, col) {
	if (row == null) row = 1;
	
	DataSet = new Array(row);
	for (var i=0; i < DataSet.length; i++) {
		DataSet[i] = new Array(col);
	}
	return DataSet;
}

/*=======================================================================================
    함수명 : cgf_ArraySet
    기  능 : 저장시 특수문자 처리
    인  수 : as_String   
    리  턴 : 
=========================================================================================*/
function cgf_SaveSpecialChars(as_String) {
	as_String = Char_Replace(as_String, ',', '%2C');
	as_String = Char_Replace(as_String, '"', '%22');
	as_String = Char_Replace(as_String, '\'', '%27');
	return as_String;
}


/*<!--***************************************************************
	함 수 명	: gf_CheckBoxCheck(ao_checkbox)
	설    명	: 해당 checkbox에 체크된 데이터가 있는지 체크한다.
	Argument: ao_checkbox - 체크박스
				as_gubun - 작업구분
****************************************************************-->*/
function cgf_CheckBoxCheck(ao_checkbox, as_gubun) {
	var li_CheckCnt=0;

	if (ao_checkbox==null) return 0;

	if (ao_checkbox.length == null) {
		if(ao_checkbox.checked) li_CheckCnt++;
	}
	else {
		for(var i=0; i < ao_checkbox.length; i++) {
			if(ao_checkbox[i].checked) li_CheckCnt++;
		}
	}
	if (li_CheckCnt == 0) {
		
		if(as_gubun=='ddsRequest'){
			gf_Msg("KOR", 131, 1, "");
		}else if(as_gubun=='favoriteArticleSave'){
			gf_Msg("KOR", 132, 1, "");	
		}else if(as_gubun=='favoriteJournalSave'){
			gf_Msg("KOR", 133, 1, "");
		}else{
			gf_Msg("KOR", 118, 1, "");
		}	

		return 0;
	}
	
	return li_CheckCnt;
}


 /*  Function Equivalent to java.net.URLEncoder.encode(String, "UTF-8")
     Copyright (C) 2002, Cresc Corp.
     Version: 1.0
 */
 function encodeURL(str){
     var s0, i, s, u;
     s0 = "";                // encoded str
     for (i = 0; i < str.length; i++){   // scan the source
         s = str.charAt(i);
         u = str.charCodeAt(i);          // get unicode of the char
         if (s == " "){s0 += "+";}       // SP should be converted to "+"
         else {
             if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                 s0 = s0 + s;            // don't escape
             }
             else {                  // escape
                 if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                     s = "0"+u.toString(16);
                     s0 += "%"+ s.substr(s.length-2);
                 }
                 else if (u > 0x1fffff){     // quaternary byte format (extended)
                     s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                     s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                     s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                     s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                 }
                 else if (u > 0x7ff){        // triple byte format
                     s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                     s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                     s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                 }
                 else {                      // double byte format
                     s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                     s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                 }
             }
         }
     }
     return s0;
 }
 
 /*  Function Equivalent to java.net.URLDecoder.decode(String, "UTF-8")
     Copyright (C) 2002, Cresc Corp.
     Version: 1.0
 */
 function decodeURL(str){
     var s0, i, j, s, ss, u, n, f;
     s0 = "";                // decoded str
     for (i = 0; i < str.length; i++){   // scan the source str
         s = str.charAt(i);
         if (s == "+"){s0 += " ";}       // "+" should be changed to SP
         else {
             if (s != "%"){s0 += s;}     // add an unescaped char
             else{               // escape sequence decoding
                 u = 0;          // unicode of the character
                 f = 1;          // escape flag, zero means end of this sequence
                 while (true) {
                     ss = "";        // local str to parse as int
                         for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
                             sss = str.charAt(++i);
                             if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
                                 ss += sss;      // if hex, add the hex character
                             } else {--i; break;}    // not a hex char., exit the loop
                         }
                     n = parseInt(ss, 16);           // parse the hex str as byte
                     if (n <= 0x7f){u = n; f = 1;}   // single byte format
                     if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
                     if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
                     if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
                     if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
                     if (f <= 1){break;}         // end of the utf byte sequence
                     if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
                     else {break;}                   // abnormal, format error
                 }
             s0 += String.fromCharCode(u);           // add the escaped character
             }
         }
     }
     return s0;
 }

/*=======================================================================================================================*/


/*=======================================================================================
    함수명 : cgf_NDSLDDSBrief/ cgf_NDSLDDSDetail/cgf_NDSLDDSRequest/cgf_NDSLDDSAjaxResult
    기  능 : NDSL 원문복사 신청 담당한다.
    인  수 : as_collid - collection ID
    	  as_objname - CheckBox or cninfo Form
    	  as_retvalue - cn1☆cn2
    	  as_ajaxvalue - Ajax 실행결과 (DDS 신청 자료 XML)
    리  턴 : 
=========================================================================================*/
function cgf_NDSLDDSBrief(as_collid, as_objname)
{
	var value = "";
	var ls_Arg = '';
	var checkbox = document.getElementsByName(as_objname);

	//checkbox에 체크된 데이터가 있는지 체크한다.
	
	var li_CheckCnt = cgf_CheckBoxCheck(checkbox,'ddsRequest');

	if (li_CheckCnt==0) return;

	//checkbox의 CN을 가지고 DDS 신청에 필요한 값 가져온다.
	var x=0;	
	if (checkbox.length == null) {
		if(checkbox.checked) {
			ls_Arg = checkbox.value;
			x = 1;
			//DDS 신청시 통계 테이블 넣기 추가.

		}
	}
	else {
		for(var i=0; i < checkbox.length; i++) {
			if(checkbox[i].checked) {
				if (x==0) ls_Arg = checkbox[i].value;
				else ls_Arg += "☆" + checkbox[i].value;
				x++;
				//DDS 신청시 통계 테이블 넣기 추가.
			}
		}
	}
	
	/**** 10건 제한 없앰
	if (x > 10) {
		gf_Msg("", 122, 1, "");
		return;
	}
	*****/

	var li_TotalCnt = x;	// 전체 신청건수

	//Login Check를 한다.- NDSL은 모든페이지에 ndsl_session.jsp include한다. js에서는 바로 확인이 가능하다.
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		/* 로그인 처리 한다. - 팝업사용 안한다.
		value = encodeURIComponent(ls_Arg);
		var ls_Url = "loginpop.do?flag=RDDS&value=" + value;
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 437, 227, 1, 0);
		***/
		
		//로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();

		return;
	}else{
		/* 로그인 되어 있으면 DDS Request 탄다..*/
		value = encodeURIComponent(ls_Arg);
		cgf_NDSLDDSRequest(value);
	}
	return;
}

function cgf_NDSLDDSDetail(as_collid, as_objname) {
	var value = "";
	var cn = eval("document."+as_objname+".cn.value");
	ls_Arg = cn;
	//DDS 신청시 통계 테이블 넣기 추가.

	//Login Check를 한다
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		/* 로그인 처리 한다. - 팝업사용 안한다.
		value = encodeURIComponent(ls_Arg);
		var ls_Url = "loginpop.do?flag=RDDS&value=" + value;
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 437, 227, 1, 0);
		**/

		//로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();
		return;
	}else{
		/* 로그인 되어 있으면 DDS Request 탄다..*/
		value = encodeURIComponent(ls_Arg);
		cgf_NDSLDDSRequest(value);
	}
	return;
}

// 2010.04.22. 김진성. 논문 목록화면에서 원문복사신청.
function cgf_NDSLDDSDetail_list(cn) {
	var value = "";
	ls_Arg = cn;
	// DDS 신청시 통계 테이블 넣기 추가.

	// Login Check를 한다
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1") {
		// 로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();
		return;
	} else {
		// 로그인 되어 있으면 DDS Request 탄다.
		value = encodeURIComponent(ls_Arg);
		cgf_NDSLDDSRequest(value);
	}
	return;
}

function cgf_NDSLDDSRequest(as_retvalue) {
	/* as_retvalue - cn1☆cn2 | ls_DDSRequestList - cn1☆cn2 */

	var ls_return = decodeURIComponent(as_retvalue);

	if (ls_return == null || ls_return == '') {
		// Return 값 에러..
		gf_Msg("KOR", 123, 1, "");
		return;
	}	

	var ls_DDSRequestList = ls_return;
	//ls_DDSRequestList(CN리스트) 를 가지고  ddsvalue get 한다.
	var value = encodeURIComponent(ls_DDSRequestList);
	var url = "/ndslddsrequest.co";
	
	var params  = "value=" + value;

	sendNDSLDDSRequest( url, params, "POST");
	
	return;
}


function cgf_NDSLDDSAjaxResult(as_ajaxvalue)
{
	var strDDS = "";

	//j1425:p2154 의 형태로 되어있음.
	strDDS = as_ajaxvalue;
	if (strDDS == null || strDDS == '' ){
		gf_Msg("KOR", 123, 1, "");
		return;
	}

	//논문 DDS 신청 로그 저장.
	cgf_NDSLLogSave('1108',strDDS,0,'1');

 	var memberid = "";	
 	var libid = "";	

	if (memberid == "" || memberid == "null") {
	   	document.ddsrequestinfo.action = "/ddsrequest.co";
	} else {
		document.ddsrequestinfo.action = "/kistiddsrequest.co";
	}
	window.open("", "ddsWin", "width=807, height=700, scrollbars=1, menubars=0, status=0");
 	document.ddsrequestinfo.target = "ddsWin";
	document.ddsrequestinfo.method = "post";
	document.ddsrequestinfo.ddstype.value = 'a';
	document.ddsrequestinfo.prodata.value = strDDS;
	document.ddsrequestinfo.submit();
	return;
}


/*=======================================================================================
    함수명 : cgf_NDSLDDSVOLRequest
    기  능 : NDSL 권호 데이타 DDS신청
    인  수 : as_value	- mtrlkind:bibctrlno:seqno--> (j:7492:85)
    리  턴 : 
=========================================================================================*/
function cgf_NDSLDDSVOLRequest(as_value)
{
	//Login Check를 한다
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		lf_openConfirm();
		return;
	}else{
		/* 로그인 되어 있으면 DDS Request 탄다..*/

		//권호  DDS 신청 로그 저장.
		cgf_NDSLLogSave('1116',as_value,0,'1');

		var memberid = "";	
 		var libid = "";	
 	
		if (memberid == "" || memberid == "null") {	
			document.ddsrequestinfo.action = "/ddsrequest.co";
		} else {
	       	document.ddsrequestinfo.action = "/kistiddsrequest.co";			
        }
		window.open("", "ddsWin", "width=807, height=700, scrollbars=1, menubars=0, status=0");
	 	document.ddsrequestinfo.target = "ddsWin";
		document.ddsrequestinfo.method = "post";
		document.ddsrequestinfo.ddstype.value = 'v';
		document.ddsrequestinfo.prodata.value = as_value;
		document.ddsrequestinfo.submit();
	}
	return;
}


/*=======================================================================================
    함수명 : cgf_NDSLFavoriteBrief/ cgf_NDSLFavoriteDetail/cgf_NDSLFavoriteSave/cgf_NDSLFavoriteAjaxResult
    기  능 : NDSL Data 즐겨찾기 저장.
    인  수 : as_collid - collection ID
    	  as_objname - CheckBox or cninfo Form
    	  as_retvalue - cn1☆cn2★Gubun
    	  as_ajaxvalue - Ajax 실행결과 (SaveFavorite 실행결)
    리  턴 : 
=========================================================================================*/
var gs_NDSLFavorite = "";
function cgf_NDSLFavoriteBrief(as_collid, as_objname)
{

	var ls_Arg = "";
	var ls_Gubun = "";
	var sgubun = "";
	var checkbox = document.getElementsByName(as_objname);

	//checkbox에 체크된 데이터가 있는지 체크한다.
	if(as_collid == "1") 
		paramflag = 'favoriteArticleSave';
	else if(as_collid == "2") 
		paramflag = 'favoriteJournalSave';
	else	
		paramflag = '';
	
	var li_CheckCnt = cgf_CheckBoxCheck(checkbox,paramflag);
	if (li_CheckCnt==0) return;

	//checkbox의 CN을 가지고 Favorite Save 에 필요한 값 가져온다.
	var x=0;
	if (checkbox.length == null) {
		if(checkbox.checked) {
			ls_Arg = checkbox.value;
			x = 1;
			//Favorite Save 통계 테이블 넣기 추가.
		}
	}
	else {
		for(var i=0; i < checkbox.length; i++) {
			if(checkbox[i].checked) {
				if (x==0) ls_Arg = checkbox[i].value;
				else ls_Arg += "☆" + checkbox[i].value;
				x++;
				//Favorite Save 통계 테이블 넣기 추가.
			}
		}
	}
	
	if (x > 200) {
		gf_Msg("KOR", 122, 1, "");
		return;
	}

	var li_TotalCnt = x;	// 전체 신청건수

	if(as_collid == "1"){
		ls_Gubun = "SFA";	//즐겨찾는 논문 저장
		sgubun = "art";
	}else if(as_collid == "2"){
		ls_Gubun = "SFJ";	//즐겨찾는 저널 저장
		sgubun = "jour";		
	}else if(as_collid == "3"){
		ls_Gubun = "SFP";	//즐겨찾는 특허 저장
		sgubun = "pat";		
	}else if(as_collid == "6"){
		ls_Gubun = "SFG";	//즐겨찾는 분석/동향 저장
		sgubun = "gtb";		
	}else{
		gf_Msg("KOR", 125, 1, "");
		return;
	}

	var value = "";
	ls_Arg += "★" + ls_Gubun;

	//Login Check를 한다.- NDSL은 모든페이지에 ndsl_session.jsp include한다. js에서는 바로 확인이 가능하다.
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		/* 로그인 처리 한다. - 팝업사용 안한다.
		value = encodeURIComponent(ls_Arg);
		var ls_Url = "/loginpop.do?flag=SPRO&value=" + value;
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 437, 227, 1, 0);
		***/

		//로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();
		
		return;
	}else{
		/* 로그인 되어 있으면 FavoriteSave 탄다..*/
		gs_NDSLFavorite = ls_Arg;
		//폴더 선택 팝업창 띄운다..
		var ls_Url = "/popfolderTree.co?sgubun="+sgubun+"&callGubun=ndslfavorite";
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 400, 384, 0, 0); 	
		 //cgf_NDSLFavoriteSave(as_folderId)
	}
     
	return;
}


function cgf_NDSLFavoriteDetail(as_collid, as_objname)
{
	var value = "";
	var ls_Arg = "";
	var ls_Gubun = "";
	var sgubun = "";
	var cn = "";

	if(as_collid == "1"){
		ls_Gubun = "SFA";	//즐겨찾는 논문 저장
		sgubun = "art";
		cn = eval("document."+as_objname+".cn.value");
	}else if(as_collid == "2"){
		ls_Gubun = "SFJ";	//즐겨찾는 저널 저장
		sgubun = "jour";		
		cn = eval("document."+as_objname+".cn.value");
	}else if(as_collid == "3"){
		ls_Gubun = "SFP";	//즐겨찾는 특허 저장
		sgubun = "pat";		
		cn = as_objname;
	}else if(as_collid == "6"){
		ls_Gubun = "SFG";	//즐겨찾는 분석동향 저장
		sgubun = "gtb";		
		cn = as_objname;
	}else{
		gf_Msg("KOR", 125, 1, "");
		return;
	}

	ls_Arg = cn;
	ls_Arg += "★" + ls_Gubun;

	//Login Check를 한다.- NDSL은 모든페이지에 ndsl_session.jsp include한다. js에서는 바로 확인이 가능하다.
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		/* 로그인 처리 한다. - 팝업사용 안한다.
		value = encodeURIComponent(ls_Arg);
		var ls_Url = "/loginpop.do?flag=SPRO&value=" + value;
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 437, 227, 1, 0);
		***/

		//로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();

		return;
	}else{
		/* 로그인 되어 있으면 FavoriteSave 탄다..*/
		gs_NDSLFavorite = ls_Arg;
		//폴더 선택 팝업창 띄운다..
		var ls_Url = "/popfolderTree.co?sgubun="+sgubun+"&callGubun=ndslfavorite";
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 400, 384, 0, 0); 		
		//cgf_NDSLFavoriteSave(as_folderId)
	}

	return;
}
		
function cgf_NDSLFavoriteSave(as_folderId)
{
	/* as_retvalue - cn1☆cn2★SFA */
	var ls_return_arr=gs_NDSLFavorite.split('★');//"★"

	if (gs_NDSLFavorite == null || gs_NDSLFavorite == '' || ls_return_arr.length < 2) {
		// Return 값 에러..
		gf_Msg("KOR", 125, 1, "");
		return;
	}	

	var ls_row_arr 	= ls_return_arr[0].split('☆');//"☆"
	var row = ls_row_arr.length;
	var col = 2;
	var gubun 	= ls_return_arr[1];
	var folderId 	= as_folderId;

	DataSet = cgf_ArraySet(row, col);
	for(var i=0; i < ls_row_arr.length; i++) {
		DataSet[i][0] = ls_row_arr[i];
		DataSet[i][1] =folderId;
	}

	var url = "/ndslfavoritesave.co";
	var params  = "Row="+row;
		params += "&Col="+col;
		params += "&DataSet="+DataSet;
		params += "&Gubun="+gubun;

	sendNDSLFavoriteSave( url, params, "POST");
	return;
}

function cgf_NDSLFavoriteAjaxResult(as_ajaxvalue)
{
	var Gubun = gf_Trim(as_ajaxvalue.substr(0,3),'a');
	var Flag  = gf_Trim(as_ajaxvalue.substr(3,2),'a');

	if(Flag == "NO"){ //NOWORK
		//선택된 데이타 없음.
		gf_Msg("KOR", 118, 1, "");
		return;
	}

	//check box 객체이름은 모두 docCheckBox 로 통일한다.
	//즐겨찾는 저널 저장
	if(Gubun == "SFJ"){
		if(Flag == "SU") gf_Msg("KOR", 120, 1, "");
		if(Flag == "FA") gf_Msg("KOR", 120, 1, "");//125:실패
		cgf_SelCheckReSet(document.getElementsByName('docCheckBox')) ;
	}
	//즐겨찾는 논문 저장
	if(Gubun == "SFA"){
		if(Flag == "SU") gf_Msg("KOR", 120, 1, "");
		if(Flag == "FA") gf_Msg("KOR", 120, 1, "");//125:실패
		cgf_SelCheckReSet(document.getElementsByName('docCheckBox')) ;
	}

	//즐겨찾는 특허 저장
	if(Gubun == "SFP"){
		if(Flag == "SU") gf_Msg("KOR", 120, 1, "");
		if(Flag == "FA") gf_Msg("KOR", 120, 1, "");//125:실패
	}
	
	//즐겨찾는 분석동향 저장
	if(Gubun == "SFG"){
		if(Flag == "SU") gf_Msg("KOR", 120, 1, "");
		if(Flag == "FA") gf_Msg("KOR", 120, 1, "");//125:실패
	}
	
	return;
}

/*=======================================================================================
    함수명 : cgf_NDSLAlertBrief/ cgf_NDSLAlertDetaill/ cgf_NDSLAlertSave/ cgf_NDSLAlertAjaxResult
    기  능 : 알리미저장  
    인  수 : as_collid - collection ID
    	  as_objname - CheckBox or cninfo Form
    	  as_gubun - 작업구분 (SAI:리스트선택, SAH:히스토리에서선택)
    	  as_retvalue - (SAI:cn1☆cn2★Gubun★colid, SAH:1◇0☆2◇1★Gubun★colid)
    	  as_ajaxvalue - Ajax 실행결과 (Save Alert 실행결과)
    리  턴 : 
=========================================================================================*/
function cgf_NDSLAlertBrief(as_collid, as_gubun, as_objname) {
	var ls_Arg = "";
	var ls_Gubun = "";

	var checkbox = document.getElementsByName(as_objname);

	// checkbox에 체크된 데이터가 있는지 체크한다.
	var li_CheckCnt = cgf_CheckBoxCheck(checkbox,'');
	if (li_CheckCnt==0) return;

	//checkbox의 Value을 가지고 Alert Save 에 필요한 값 가져온다.
	var x=0;	
	if (checkbox.length == null) {
		if(checkbox.checked) {
			ls_Arg = checkbox.value;
			x = 1;
			//Alert Save 통계 테이블 넣기 추가.
		}
	} else {
		for(var i=0; i < checkbox.length; i++) {
			if(checkbox[i].checked) {
				if (x==0) ls_Arg = checkbox[i].value;
				else ls_Arg += "☆" + checkbox[i].value;
				x++;
				//Alert Save 통계 테이블 넣기 추가.
			}
		}
	}
	
	if (x > 10) {
		gf_Msg("KOR", 122, 1, "");
		return;
	}

	var li_TotalCnt = x;	// 전체 신청건수

	ls_Gubun = as_gubun;	//Save Alert Info

	var value = "";
	ls_Arg += "★" + ls_Gubun + "★" + as_collid;

	//Login Check를 한다.- NDSL은 모든페이지에 ndsl_session.jsp include한다. js에서는 바로 확인이 가능하다.
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		/* 로그인 처리 한다. - 팝업사용 안한다.
		value = encodeURIComponent(ls_Arg);
		var ls_Url = "/loginpop.do?flag=SALT&value=" + value;
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 437, 227, 1, 0);
		***/

		//로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();

		return;
	} else {
		/* 로그인 되어 있으면 FavoriteSave 탄다..*/
		value = encodeURIComponent(ls_Arg);
		cgf_NDSLAlertSave(value);
	}
	return;
}

function cgf_NDSLAlertDetaill(as_collid, as_objname)
{
	var value = "";
	var cn = eval("document."+as_objname+".cn.value");
	ls_Arg = cn;
	ls_Gubun = "SAI";	//Save Alert Info
	ls_Arg += "★" + ls_Gubun + "★" + as_collid;


	//Login Check를 한다.- NDSL은 모든페이지에 ndsl_session.jsp include한다. js에서는 바로 확인이 가능하다.
	SesCommonLoginType = cgf_SessionCheck2();
	if(SesCommonLoginType != "1"){
		/* 로그인 처리 한다. - 팝업사용 안한다.
		value = encodeURIComponent(ls_Arg);
		var ls_Url = "/loginpop.do?flag=SALT&value=" + value;
		cgf_CloseWin();
		cgf_CenterWindow( ls_Url,"popWin", 437, 227, 1, 0);
		***/

		//로그인 NEW 방식 - 로그인 처리만 하게 하고, 이용자가 다시 기능을 수행하게 한다.
		lf_openConfirm();

		return;
	}else{
		/* 로그인 되어 있으면 FavoriteSave 탄다..*/
		value = encodeURIComponent(ls_Arg);
		cgf_NDSLAlertSave(value);
	}
	return;
}

// 알리미 등록
function cgf_NDSLAlertSave(as_retvalue) {
	/* as_retvalue - cn1☆cn2★SAI★colid  || 1◇0☆2◇1★SAH★colid  */
	var ls_return = decodeURIComponent(as_retvalue);
	var ls_return_arr=ls_return.split('★');//"★"
	if (ls_return == null || ls_return == '' || ls_return_arr.length < 3) {
		// Return 값 에러..
		gf_Msg("KOR", 126, 1, "");
		return;
	}

	var ls_row_arr 	= ls_return_arr[0].split('☆');//"☆"
	var row = ls_row_arr.length;
	var col = 0;
	var gubun 	= ls_return_arr[1];
	var colid 	= ls_return_arr[2];

	if(gubun == "SAI"){
		col = 2;
	}else if(gubun == "SAH"){
		col = 3;
	}
	
	DataSet = cgf_ArraySet(row, col);
	for(var i=0; i < ls_row_arr.length; i++) {
		if(gubun == "SAI"){
			DataSet[i][0] = ls_row_arr[i];
			DataSet[i][1] = colid;
		}else if(gubun == "SAH"){
			ls_dataset_arr = ls_row_arr[i].split('◇');//"◇"
			DataSet[i][0] = ls_dataset_arr[0];//seqno
			DataSet[i][1] = ls_dataset_arr[1];//templag
			DataSet[i][2] = colid;
		}
	}
	
	var url = "/ndslalertsave.co";
	var params  = "Row="+row;
		params += "&Col="+col;
		params += "&DataSet="+DataSet;
		params += "&Gubun="+gubun;

	// 알리미 등록.
	// 2010.05.11. 김진성. 저널 검색일 경우에 3년간 입수된 논문이 있는지 검색해서 저장합니다.
	if (gubun == 'SAI') {
		// var confirmurl = '/ndslalertsaveconfirm.co?param=' +ls_row_arr;
		var confirmurl = '/ndslalertsaveconfirm.co';
		sendNDSLAlertSaveConfirm(confirmurl, ls_row_arr, params, 'POST');
	} else {
		sendNDSLAlertSave( url, params, "POST");
		return;
	}
}

function cgf_NDSLAlertAjaxResult(as_ajaxvalue)
{
	var Gubun = gf_Trim(as_ajaxvalue.substr(0,3),'a');
	var Flag  = gf_Trim(as_ajaxvalue.substr(3,2),'a');

	if(Flag == "NO"){ //NOWORK
		//선택된 데이타 없음.
		gf_Msg("KOR", 118, 1, "");
		return;
	}

	//Alert Save
	if(Gubun == "SAI"){
		if(Flag == "SU") gf_Msg("KOR", 120, 1, "");
		if(Flag == "FA") gf_Msg("KOR", 120, 1, "");//115:실
		cgf_SelCheckReSet(document.getElementsByName('docCheckBox')) ;
	}
	if(Gubun == "SAH"){
		if(Flag == "SU") gf_Msg("KOR", 120, 1, "");
		if(Flag == "FA") gf_Msg("KOR", 120, 1, "");
		cgf_SelCheckReSet(document.getElementsByName('cbx_history')) ;
	}

	return;
}





/*=======================================================================================
    함수명 : cgf_KISTIAlertBrief/ cgf_KISTIAlertDetaill/ cgf_KISTIAlertSave/ cgf_KISTIAlertAjaxResult
    기  능 : 알리미저장  
    인  수 : as_collid - collection ID
    	  as_objname - CheckBox or cninfo Form
    	  as_gubun - 작업구분 (SAI:리스트선택, SAH:히스토리에서선택)
    	  as_retvalue - (SAI:cn1☆cn2★Gubun★colid, SAH:1◇0☆2◇1★Gubun★colid)
    	  as_ajaxvalue - Ajax 실행결과 (Save Alert 실행결과)
    리  턴 : 
=========================================================================================*/
function cgf_KISTIAlertBrief(as_collid, as_gubun, as_objname)
{
	var ls_Arg = "";
	var ls_Gubun = "";

	var checkbox = document.getElementsByName(as_objname);

	//checkbox에 체크된 데이터가 있는지 체크한다.
	var li_CheckCnt = cgf_CheckBoxCheck(checkbox,'');
	if (li_CheckCnt==0) return;

	//checkbox의 Value을 가지고 Alert Save 에 필요한 값 가져온다.
	var x=0;	
	if (checkbox.length == null) {
		if(checkbox.checked) {
			ls_Arg = checkbox.value;
			x = 1;
			//Alert Save 통계 테이블 넣기 추가.
		}
	}
	else {
		for(var i=0; i < checkbox.length; i++) {
			if(checkbox[i].checked) {
				if (x==0) ls_Arg = checkbox[i].value;
				else ls_Arg += "☆" + checkbox[i].value;
				x++;
				//Alert Save 통계 테이블 넣기 추가.
			}
		}
	}
	
	if (x > 10) {
		gf_Msg("KOR", 122, 1, "");
		return;
	}

	var li_TotalCnt = x;	// 전체 신청건수

	ls_Gubun = as_gubun;	//Save Alert Info
	var value = "";
	ls_Arg += "★" + ls_Gubun + "★" + as_collid;
	

	//Login Check를 한다.- NDSL은 모든페이지에 ndsl_session.jsp include한다. js에서는 바로 확인이 가능하다.
	
		lf_openConfirm();
	
	return;
}

function cgf_AlertSave(as_retvalue)
{
	/* as_retvalue - cn1☆cn2★SAI★colid  || 1◇0☆2◇1★SAH★colid  */
	var ls_return = decodeURIComponent(as_retvalue);
	var ls_return_arr=ls_return.split('★');//"★"
	if (ls_return == null || ls_return == '' || ls_return_arr.length < 3) {
		// Return 값 에러..
		gf_Msg("KOR", 126, 1, "");
		return;
	}	

	var ls_row_arr 	= ls_return_arr[0].split('☆');//"☆"
	var row = ls_row_arr.length;
	var col = 0;
	var gubun 	= ls_return_arr[1];
	var colid 	= ls_return_arr[2];

	if(gubun == "SAI"){
		col = 2;
	}else if(gubun == "SAH"){
		col = 3;
	}

	DataSet = cgf_ArraySet(row, col);
	for(var i=0; i < ls_row_arr.length; i++) {
		if(gubun == "SAI"){
			DataSet[i][0] = ls_row_arr[i];
			DataSet[i][1] = colid;
		}else if(gubun == "SAH"){
			ls_dataset_arr = ls_row_arr[i].split('◇');//"◇"
			DataSet[i][0] = ls_dataset_arr[0];//seqno
			DataSet[i][1] = ls_dataset_arr[1];//templag
			DataSet[i][2] = colid;
		}
	}

	var url = "/alertsave.co";
	var params  = "Row="+row;
		params += "&Col="+col;
		params += "&DataSet="+DataSet;
		params += "&Gubun="+gubun;

	sendNDSLAlertSave( url, params, "POST");
	return;
}



function cgf_goMainPage(as_target){

	var target_url = "";
	
	switch(as_target.toLowerCase()){
		case "yeskisti" :
			target_url = "http://www.ndsl.kr";
			break;
		case "ndsl" :
			target_url = "http://scholar.ndsl.kr";
			break;
		case "patent" :
			target_url = "http://patent.ndsl.kr";
			break;
		case "report" :
			target_url = "http://report.ndsl.kr";
			break;
		case "analysis" :
			target_url = "http://radar.ndsl.kr";
			break;
		case "standard" :
			target_url = "http://standard.ndsl.kr";
			break;
		case "fact" :
			target_url = "http://fact.ndsl.kr";
			break;
		case "human" :
			target_url = "http://human.ndsl.kr";
			break;
		case "articles" :
			target_url = "http://paperplus.ndsl.kr";
			break;
		case "degree" :
			target_url = "http://paperplus.ndsl.kr";
			break;
		case "oa" :
			target_url = "http://paperplus.ndsl.kr/oaArticlesrch.do?menuid=oaArticlesrch";
			break;			
		default :
			target_url = "http://human.ndsl.kr";
			break;
	
	}
	
	window.location =  target_url;

}



function lf_go(colid)
{  
    //논문
	if(colid==1)
	{
	    location.href="http://scholar.ndsl.kr/index.do";
	//  location.replace("http://scholar.ndsl.kr/index.do");
	}else if(colid==3)//특허
	{
	  location.href="http://patent.ndsl.kr/index.do";  
	}else if(colid==4)//연구보고서
	{
	  location.href="http://report.ndsl.kr/index.do";  
	}else if(colid==6)//분석동향
	{
	   location.href="http://radar.ndsl.kr/index.do"; 
	}else if(colid==7)//
	{
	  location.href="http://standard.ndsl.kr/index.do";  
	}else if(colid==8)//사실
	{
	  location.href="http://fact.ndsl.kr/index.do";  
	}else if(colid==9)//인력
	{
	  location.href="http://human.ndsl.kr/index.do";  
	}else if(colid==0)//포탈인덱스
	{
	  location.href="http://www.ndsl.kr/index.do";  
	}
	target="_self";
}

/*******************************************
자바스크립트 함수에서 session 체크 후 로그인 창 띄우거나, 
index 화면으로 이동.
prarm - index화면이동으로 구분 
0: yesKISTI potal index 이동
1: NDSL index 이동
*******************************************/
function cgf_SessionCheck(as_flag)
{
		http = jQuery.ajax( {
			url: "/sessioncheck.co",  
			type: "POST",
			async:false,
			complete:function(res, status) {
				result = jQuery.trim(res.responseText); //로그인 여부..
				if(result=='1'){
					return;
				}
				gf_Msg("KOR", 128, 1, "");
				lf_go(as_flag);
			}
		});

	return;
}

//session check 후 LoginType을 return
function cgf_SessionCheck2()
{
		var result = "0"; //Login Type 0:미로그인.
		http = jQuery.ajax( {
			url: "/sessioncheck.co",  
			type: "POST",
			async:false,
			complete:function(res, status) {
				result = jQuery.trim(res.responseText); //로그인 여부..
			}
		});

		return result;
}

//session check 후 NDSLCertStat (실명인증)을 return
function cgf_SessionCheck3()
{
		var result = "0"; //NDSLCertStat 0:실명인증안한상태. 1:실명인증한상태 
		http = jQuery.ajax( {
			url: "/sessioncheck.co",  
			type: "POST",
			data: { flag : 'certcheck'},
			async:false,
			complete:function(res, status) {
				result = jQuery.trim(res.responseText); //실명인증  여부..
			}
		});

		return result;
}
			
			
/*=======================================================================================
	함수명 : cgf_SearchTip
	기  능 : 검색화면 도움말 POPUP
	인  수 : classCd - 호출한  페이지 ID
	RETURN : 
=========================================================================================*/
function cgf_SearchTip(classCd) {
	var surl = 'http://www.ndsl.kr/pop_help_view.co?classCd='+classCd;
	window.open(surl,'','toolbar=no,scrollbars=yes,top=200,left=300,width=678,height=920');

}

/*=======================================================================================
	함수명 : CenterWindow
	기  능 : 팝업창 center에 띄우기
	인  수 : 가로세로 사이즈
	RETURN : 
=========================================================================================*/
function CenterWindow(href,WinName,w,h,scroll,resize) { 
	var PosLeft; 
	var PosTop; 

	PosLeft = (window.screen.width/2) - (w/2 + 10); 
	PosTop = (window.screen.height/2) - (h/2 + 50);

//	scroll = 0;

	if(window.screen.width < w+10){
		PosLeft = 0;
		w = window.screen.width - 10;
		scroll = 1;
	}

	if(window.screen.height < h+60){
		PosTop = 0;
		if(window.screen.width>w+10){
			w +=15;
		}

		h = window.screen.height - 60;
		scroll = 1;
	}

	objWin = window.open(href,WinName,"status,height=" + h + ",width=" + w + ", scrollbars=" + scroll + ",resizable=" + resize + ",left=" + PosLeft + ",top=" + PosTop + ",screenX=" + PosLeft + ",screenY=" + PosTop + ",status=no"); 
	if(objWin == null){
		alert("팝업창이 차단되었습니다.\n\n팝업창 차단 설정을 해제하여주십시요.\n\n팝업창 차단 설정은\n웹페이지 상단에 나타나는 [알림 표시줄]에서 설정이 가능합니다.\n\n또는 [도구 > 인터넷옵션 > 개인정보 > 팝업차단 > 설정]에서\n설정이 가능합니다.");
	}
}

//======================= 공지사항 팝업 뜨우기 관련 함수들 =====================================
function gf_noticeopen()
{
	var result = "0"; //창을 띄울지 여부 1: 띄움, 0:안띄움

	//1) 로그인 할때 DDS비용지원알림창 - noticecalreq.jsp 띄움. 완료되면 여기서 막을것. 
/******
	http = jQuery.ajax( {
		url: "/noticecheck.co",  
		type: "POST",
		async:false,
		complete:function(res, status) {
			result = jQuery.trim(res.responseText); //로그인 여부..
		}
	});

	var ls_Url = "/jsp/notice/noticecalreq.jsp";
	if(result == "1") {
		var ls_date=gf_get_today();
		popUpCenteredWindow('noticecalreq'+ls_date, ls_Url, 485, 380);
	}
*********/
	//1) 로그인 할때 DDS비용지원알림창 - 끝.





	return;
}


function setCookieNotice( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString()  + ";"
}

function closeNoticeWin() 
{ 
	if (document.DontShowNext.PopupCloseCheckbox.checked ) 
 		setCookieNotice( self.name, "DontOpenPopupWindowCookie" , parseInt(DontShowNext.expires.value)); 

	self.close(); 
}

function getCookieNotice( 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 "";
}

// Popup Centered Window
function popUpCenteredWindow(PopupWindowName, URL, x_size, y_size) {

	if ( getCookieNotice( PopupWindowName ) != "DontOpenPopupWindowCookie" ) {

  	var iMyWidth;
  	var iMyHeight;

  	//gets top and left positions based on user's resolution so hint window is centered.
  	iMyWidth = (window.screen.width/2) - (x_size/2 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
  	iMyHeight = (window.screen.height/2) - (y_size/2 + 50); //half the screen height minus half the new window height (plus title and status bars).
  	var win2 = window.open(URL, PopupWindowName,"status=no ,height=" + y_size + ",width=" + x_size + ",resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no");
  	if(win2 == null){
		alert("팝업창이 차단되었습니다.\n\n팝업창 차단 설정을 해제하여주십시요.\n\n팝업창 차단 설정은\n웹페이지 상단에 나타나는 [알림 표시줄]에서 설정이 가능합니다.\n\n또는 [도구 > 인터넷옵션 > 개인정보 > 팝업차단 > 설정]에서\n설정이 가능합니다.");
	}else{
	  	win2.focus();
  	}
	}

}
// 현재일자을 가지고 오는 함수...
function gf_get_today() {
	var yy = "";
	var mon = "";
	var day = "";

	currdate = new Date();
	
	tmpyy = currdate.getYear();
	yy = (tmpyy > 99) ? tmpyy : 1900 + tmpyy;
	
	tmpmon = currdate.getMonth();
	if(tmpmon < 9) {
		mon = "0" + (tmpmon + 1);
	}
	else
		mon = tmpmon + 1;
		
	tmpday = currdate.getDate();
	if(tmpday < 10) 
		day = "0" + tmpday;
	else
		day = tmpday;
	
	return yy.toString()+mon.toString()+day.toString();
}


//----------------------------------------------//
// 쿠키 핸들링 관련 함수들
//----------------------------------------------//
var CookieName = "NDSL.KR.ID";
function gf_NDSLsetCookie (value,path,domain,secure) {
   var expires = new Date();
   expires.setMonth(expires.getMonth() + 1)
  document.cookie = CookieName + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function gf_NDSLgetCookie () {
 var arg = CookieName + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen) {
     var j = i + alen;
     if (document.cookie.substring(i, j) == arg)
       return getCookieVal (j);
     i = document.cookie.indexOf(" ", i) + 1;
     if (i == 0) break;
 }
 return null;
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}


//NTIS 연계.
function lf_ntisLink(as_projectNo){
	http = jQuery.ajax( {
			url: "/ntisGate.co",
			type: "POST",
			data: {	projectNo: as_projectNo},
			async:false,
			complete:function(res, status) {
				result = jQuery.trim(res.responseText);
				if(result != "") {
					window.open("http://www.ntis.go.kr/gw.do?key=" + result,"ntisLink");
				}							
			}
		});
}
