function fncLoginChk2(obj,obj2) {
	var acfLoginForm = null;
	if ( obj2 == "" ) { 
		if (confirm("α  մϴ! α  ̵մϴ") ){
			document.loginForm.mustGoUrl.value=obj; 
			document.loginForm.submit();
		}
	}
}

function fncLoginChk(obj,obj2) {
	var acfLoginForm = null;
	if ( obj2 == "" ) { 
		if ( confirm("α  մϴ! α  ̵մϴ") ) {
			document.loginForm.submit();
		}	
	}
}

function fncLoginInit() {
	var acfLoginForm = null;
	document.loginForm.submit();
}

function fncMbrSub() {
	location.href = "/wmn.mbr.MbrSubsInit.moge";
}

function fncMyPage() {
	location.href = "/wmn.mypage.indv.IndvInfoPwdConfInit.moge";
}

function fncNewsInfo(seq) {
	location.href = "/new_women/women/common/bbs/view.do?menuId=M00223&selectedSeq="+seq;
}
function fncNewsInfo2(seq) {
	location.href = "/new_women/women/common/bbs/view.do?menuId=M00224&selectedSeq="+seq;
}

function fncNoticeInfo(seq,bbsid) {
	location.href = "/new_women/women/common/bbs/view.do?menuId=M00061&selectedSeq="+seq;
}

var font_size = 9;

function contenFont(opt,val) {   
   	var contentStyle = document.getElementById.content_area.style;
	switch(opt) {
       	case 1:
      		font_size++;
         		contentStyle.fontSize=font_size;
         		break;
       	case 2:
      		font_size--;
         		contentStyle.fontSize=font_size;
         		break;
     	}
}

// print
function fncBbsPrint(seq, type){
	var f = document.btnForm;
	var url = "/new_women/women/common/print.do";
	var param = "type="+type;
	url = url+"?"+param;
	window.open(url, 'printArticle', 'width=740, height=650, scrollbars=yes');
}

// scrap
function fncScrab(type) {
	var f = document.detailForm;
	var url = "/new_women/common/scrab/CommonScrabCreate.do";
	//var param = "type="+type+"&bbsSeq="+f.bbsSeq.value+"&ntcSeq="+f.ntcSeq.value;
	//url = url+"?"+param;
	window.open('', 'scrapArticle', 'width=300, height=300, scrollbars=no');
	f.target = "scrapArticle";
	f.action = url;
	f.submit();
}

// email
function fncEmail(type) {
	var f = document.btnForm;
	var url = "/new_women/women/common/popupem/popupem.do";
	window.open(url, 'emailArticle', 'width=500, height=380, scrollbars=no');
}

// main view
function fncMainShow(type) {
	var f = document.btnForm;
	var url = "/wmn.common.main.CommonMainShowCreateInit.moge";
	//var param = "type="+type+"&bbsSeq="+f.bbsSeq.value+"&ntcSeq="+f.ntcSeq.value+"&ntcPath="+f.ntcPath.value;
	//url = url+"?"+param;
	window.open('', 'mainShowArticle', 'width=300, height=300, scrollbars=no');
	f.target = "mainShowArticle";
	f.action = url;
	f.submit();
}

// url copy
function fncLinkCopy(str){   
   	if (window.clipboardData){
     		window.clipboardData.setData("Text",str);
   	}
   	alert("ũ Ǿϴ.\n\nCtrl + V ٿֱ⸦ Ͻø ˴ϴ.");
}

// contents copy
function fncContentsCopy(url,title){	
	var clipDiv = document.getElementById('clip_contents');	
	var originHTML = clipDiv.innerHTML;
	var linkStr = 	"<div style=\"font-size:12px; color:#555555; width:630px; margin-bottom:20px;\">ó<a href=\"http://www.women.go.kr\"><img src=\"/new_women/images/egovframework/rte/women/bbs/contents_copy_logo.gif\" alt=\"'?γ?\" border=\"0\" align=\"absmiddle\" /></a>"
		linkStr += 	"<span style=\"padding-left:10px;\"><a href=\""+url+"\"><img src=\"/new_women/images/egovframework/rte/women/bbs/contents_copy_bt.gif\" alt=\""+title+"\" border=\"0\" align=\"absmiddle\" /></a></span></div>";
	clipDiv.innerHTML = linkStr + clipDiv.innerHTML;
	var txt = document.body.createTextRange();
	txt.moveToElementText(clipDiv);
	txt.select();
	txt.execCommand("copy");
	alert('  Ǿϴ.\n\nCtrl + V ٿֱ⸦ Ͻø ˴ϴ.');
	document.selection.empty();
	clipDiv.innerHTML = originHTML;	
}

function fncClipCopy(){	
	var txt = document.body.createTextRange();
	txt.moveToElementText(document.getElementById.clip_contents);
	txt.select();
	txt.execCommand("copy");
	alert('  Ǿϴ.\n\nCtrl + V ٿֱ⸦ Ͻø ˴ϴ.');
	document.selection.empty();	
}

function maxlengthLimit(input, gubunflag, maxByte) {
  	// 위:38,아래:40,오른쪽:39,왼쪽:37
  	if ( event.keyCode <37 || event.keyCode >40 )  {
	   	var strCount = 0;
	   	var tempStr, tempStr2;
		for(i = 0;i < input.value.length;i++) {
	    	tempStr = input.value.charAt(i);
     		if(escape(tempStr).length > 4) strCount += 2;
     		else strCount += 1 ;
   		}

   	 	if (strCount > maxByte){
     		if ( gubunflag == 2 ) {
      			alert("ִ" + maxByte + "byte̹Ƿ ʰ ڼ ڵ ˴ϴ.");
     			// alert("제목은 한글 500자(영문 1000자) 이상 입력할 수 없습니다.");
    		}

		    strCount = 0;
		    tempStr2 = "";

    		for(i = 0; i < input.value.length; i++) {
		       	tempStr = input.value.charAt(i);		
		       	if(escape(tempStr).length > 4) strCount += 2;		
		       	else strCount += 1 ;
				if (strCount > maxByte) {
					if(escape(tempStr).length > 4) strCount -= 2;
         			else strCount -= 1 ;
         			break;
       			}

       			else tempStr2 += tempStr;
			}
	
			input.value = tempStr2;
    		document.comnNtcReplForm.hiddenFocusObj.focus();
    		input.focus();
    		input.value = tempStr2;
    		return false;
		}
	}
}

// for ie
var nowZoom = 100; // current
var maxZoom = 200; // maximun
var minZoom = 80; // minimum

// screen zoom in
function zoomIn() {
  	if (nowZoom < maxZoom) {
   		nowZoom += 10; // ++25%
  	} else {
   		return;
  	}
  	document.body.style.zoom = nowZoom + "%";
}


// screen zoom out
function zoomOut() {
  	if (nowZoom > minZoom) {
   		nowZoom -= 10; // --25%
  	} else {
   		return;
  	}
  	document.body.style.zoom = nowZoom + "%";
}

// screen zoom default
function zoomReset() {
	document.body.style.zoom = 100 + "%";
}

// news notice scrolling
var bannerPlayFleg = false;
function bannerSet(){
	if(bannerPlayFleg){
		myRolling.Run(); 
		bannerPlayFleg = false;
	}else{
		window.clearTimeout(myRolling.setTimeOut);
		bannerPlayFleg = true;
	}
}
// news notice scrolling
function bannerMove(str){
		bannerPlayFleg = false;
	if(str=="down"){
		myRolling.direction = 3;
		myRolling.moveDown(); 
	}else{
		myRolling.direction = 2;
		myRolling.moveUp(); 
	}
}

// news notice scrolling
var cocahingPlayFleg = false;
function cocahingStop(){
	if(cocahingPlayFleg){
		cocahingPlayFleg.Run(); 
		cocahingPlayFleg = false;
	}else{
		window.clearTimeout(cocahingRolling.setTimeOut);
		cocahingPlayFleg = true;
	}
}

// news notice scrolling
function cocahingMove(str){
	cocahingPlayFleg = false;
	if(str=="down" && coachingRollingCnt > 1 ){
		cocahingRolling.direction = 3;
		cocahingRolling.moveDown(); 
	}else if (str=="up" && coachingRollingCnt > 1 ){
		cocahingRolling.direction = 2;
		cocahingRolling.moveUp(); 
	}
}

// news notice scrolling
var eduEventPlayFleg = false;
function eduEventStop(){
	if(eduEventPlayFleg){
		eduEventPlayFleg.Run(); 
		eduEventPlayFleg = false;
	}else{
		window.clearTimeout(eduEventRolling.setTimeOut);
		eduEventPlayFleg = true;
	}
}

// news notice scrolling
function eduEventMove(str){
	eduEventPlayFleg = false;
	if(str=="down"){
		eduEventRolling.direction = 3;
		eduEventRolling.moveDown(); 
	}else{
		eduEventRolling.direction = 2;
		eduEventRolling.moveUp(); 
	}
}

function openWindow(url){
	window.open(url,'connect','scrollbars=no,toolbar=no,left=300,top=300,width=535,height=300');
}

function openAppointWindow(url){
	window.open(url,'Apoint','scrollbars=no,toolbar=no,left=300,top=300,width=535,height=300');
}

function openAppointChatWindow(url){
	window.open(url,'ApointChat','scrollbars=no,toolbar=no,left=300,top=300,width=535,height=300');
}

var GLB_CALENDAR = new Object();

function fncShowCalendar(oItem, ymFlag, oDayItem) { //, month, year) {
    var dateFormat 		= O_DATE_FORMAT; 
    var ymdateFormat 	= O_YMDATE_FORMAT; 
    var sToday = "";
    var sYear = "";
    var sMonth = "";
    var sDay = ""; 
    var month ="";
    var year = "";

	var vDate = new Date();
	var toMon = vDate.getMonth()+1;
	
	if ( toMon < 10  ) {
		toMon = "0"+toMon;
	}
	var toYear = vDate.getYear();
	var toDay = vDate.getDate();
	var toDate = toYear + toMon + toDay;
//	alert(toDate);	

    if(opener != null ) {
        sToday = opener.top.hidden.hInfoFrm.today.value;
        sYear = opener.top.hidden.hInfoFrm.todayYear.value;
        sMonth = opener.top.hidden.hInfoFrm.todayMonth.value;
        sDay = opener.top.hidden.hInfoFrm.todayDay.value;
    } else if(parent.hidden != null) {
        sToday = parent.hidden.hInfoFrm.today.value;
        sYear = parent.hidden.hInfoFrm.todayYear.value;
        sMonth = parent.hidden.hInfoFrm.todayMonth.value;
        sDay = parent.hidden.hInfoFrm.todayDay.value;
    }
    else {
//        sToday = top.hidden.hInfoFrm.today.value;
        sToday = toDate;
//        sYear = top.hidden.hInfoFrm.todayYear.value;
        sYear = toYear;
//        sMonth = top.hidden.hInfoFrm.todayMonth.value;
        sMonth = toMon;
//        sDay = top.hidden.hInfoFrm.todayDay.value;
        sDay = toDay;
    }

    var inputDate = oItem.value;
    if(cfIsNull(inputDate) == false) {
      inputDate = cfGetUnmaskDate(inputDate);
      if( ymFlag == true ) {
        var yearIndex = ymdateFormat.indexOf("YYYY");
        var monthIndex = ymdateFormat.indexOf("MM");
        month = inputDate.substr(monthIndex,2);
        year = inputDate.substr(yearIndex,4);        
      }
      else {
        var yearIndex = dateFormat.indexOf("YYYY");
        var monthIndex = dateFormat.indexOf("MM");
        month = inputDate.substr(monthIndex,2);
        year = inputDate.substr(yearIndex,4);    
      }
      
      if( year > 2043 || year < 1881) {
            year = sYear;
            month = sMonth;
        }
        if( month > 12 || month < 1 )  {
             year = sYear;
             month = sMonth;
        }

    }
    else {
        if (cfIsNull(month)) {
              month = sMonth;
        }
        else {
            if( month >12 || month < 1)
                month = sMonth;
            }
  
        if (cfIsNull(year)) {
              year = sYear;
        }
        else {
          if( year > 2043 || year < 1881)
              year = sYear;
        }
    }

    GLB_CALENDAR.eventSrc = event.srcElement;
    GLB_CALENDAR.oItem = oItem.id;
    GLB_CALENDAR.month = month;
    GLB_CALENDAR.year = year;
    GLB_CALENDAR.dateFormat = dateFormat;
    GLB_CALENDAR.ymdateFormat = ymdateFormat;
    GLB_CALENDAR.ymFlag = ymFlag;
    GLB_CALENDAR.sToday = sToday;

    var dwn = document.createElement("DOWNLOAD");
    dwn.style.behavior="url(#default#download)";
    dwn.startDownload("/html/common/calendar.html", fncOnDoneDownLoadCalendar);
}

function fncOnDoneDownLoadCalendar(src) {

    GLB_CALENDAR.popup = window.createPopup();
    GLB_CALENDAR.popup.document.write(src);

    GLB_CALENDAR.popup.document.all("oItem").value = GLB_CALENDAR.oItem;
    GLB_CALENDAR.popup.document.all("oDayItem").value = GLB_CALENDAR.oDayItem;
    
    GLB_CALENDAR.popup.document.all("oMonth").value = GLB_CALENDAR.month - 1;
    GLB_CALENDAR.popup.document.all("oYear").value = GLB_CALENDAR.year;
    GLB_CALENDAR.popup.document.all("oDateFormat").value = GLB_CALENDAR.dateFormat;
    GLB_CALENDAR.popup.document.all("oYmdateFormat").value = GLB_CALENDAR.ymdateFormat;
    GLB_CALENDAR.popup.document.all("oYmFlag").value = GLB_CALENDAR.ymFlag;
    GLB_CALENDAR.popup.document.all("oSToday").value = GLB_CALENDAR.sToday;
    GLB_CALENDAR.popup.document.all("oRefreshBtn").fireEvent("onclick");
    GLB_CALENDAR.popup.show(0, 0, 200, 200, GLB_CALENDAR.eventSrc);
}

function cfGetUnmaskDate(str) {
    if(str == "" )
        return "";  
    var dateStr = str.replace(/[\/.-]/g, "");    
    return dateStr;    
}

function cfIsNull(value) {
	if (value == null ||(typeof(value) == "string" ) ) {
    	return true;
  	}
  	return false;
}

function trim(pstr) {
    var search = 0
    while (pstr.charAt(search) == " ") {
        search = search + 1
    }
    pstr = pstr.substring(search, (pstr.length))
    search = pstr.length - 1
    while (pstr.charAt(search) ==" ")
    {
        search = search - 1
    }
    return pstr.substring(0, search + 1)         
}

// image replacement
function fncErrorImg(obj) {
	obj.src='/new_women/images/egovframework/rte/women/noimage.gif';
}

// image replacement
function fncErrorImgMovie(obj) {
	obj.src='/new_women/images/egovframework/rte/women/noimage.gif';
}

// image replacement
function fncErrorImgPhoto(obj) {
    //alert("no img");
	obj.src='/new_women/images/egovframework/rte/women/noimage.gif';
}

// image replacement
function fncNoneImg(obj) {
	obj.style.display='none';
}

function fncLowerCase(obj) {
	obj.value = obj.value.toLowerCase();   
}

function fncOnlyNumEng(obj) {
   var NumEng = /^[A-Za-z0-9]+$/;
   if(NumEng.test(obj.value) || obj.value == ""){}
   else{
     alert("숫자와 영문자만 입력하세요.");
     obj.value = "";
     obj.focus();
   }
}

function containsCharsOnly(input,chars) {
    for (var inx = 0; inx < input.value.length; inx++) {
       if (chars.indexOf(input.value.charAt(inx)) == -1)
           return false;
    }
    return true;
}

//

// String.trim() method 

//

String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}

//

// String.ltrim() method 

//

String.prototype.ltrim = function() {
	return this.replace(/(^\s*)/g, "");
}

//

// String.rtrim() method 

//

String.prototype.rtrim = function() {
	return this.replace(/(\s*$)/g, "");
}

function fncMapSearch() {
	window.open('http://116.67.109.36/map/search_map.jsp', 'mapPopup','fullscreen=yes,menubar=no,resizable=yes,status=yes,toolbar=yes,titlebar=yes,location=yes,scrollbar=yes');
}

function fncGoLink(link, goTarget){	
	var hf = document.hiddenForm;
	hf.target = goTarget;
	hf.action = link;
	hf.submit();	
}

function fncCoorpSite(obj) {
window.open(obj.value, 'CoorpSitePopup','fullscreen=yes,menubar=no,resizable=yes,status=yes,toolbar=yes,titlebar=yes,location=yes,scrollbar=yes');
}

function SetHomeBox() {
	var hm=document.getElementById('sethome');
	if (hm) {
		hm.style.behavior='url(#default#homepage)';
		hm.setHomePage('http://www.women.go.kr');
	}
}

// my mentoring
function fncMyMentoring(gbmento) {
	location.href = "/new_women/women/cyber/join/viewMember.do?menuId=M00352";	
	window.open('/new_women/women/cyber/mymento/index.do','mymentoring','width=765,height=707,scrollbars=no,menubar=no'); return false;
}

// cyber mentoring notice
function fncMentoNotice() {
	//alert("???? ???????? ??????? ???? ????? ????????? ?y????? ???d?? ?? ??4??.\n\n7?? 17?????? ?y????? d????? ??d????.\n\n?? ????: ??뿡 ??????o?? ??????? ???? ???????4??.");
	location.href = "/womennet/cyber/new_mentoring/jsp/index.jsp";
}

// newsletter
function fncNewsLatter(){
	var targetForm = document.newsForm;
	targetForm.action = "/wmn.common.email.NewsLatterEmailSend.moge";
	targetForm.submit();
}

// upper case
function fncUpperCase(obj) {
	obj.value = obj.value.toUpperCase();
}

// image toggle
function layer_toggle(obj) {
	var objt = document.getElementById(obj);
	objt.style.visibility = objt.style.visibility == "hidden" ? "visible" : "hidden";
} 

function sites() {
	var vsites = document.getElementById("sites"); 
	vsites.style.visibility = "hidden";
} 

// onload
function addLoadEvent(func) {
	var oldonload = window.onload;
	if(typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		oldonload();
		func();
		}
	}
}

// default - sites
addLoadEvent(sites);
