﻿function SiteLinkJump(id){
 if(id=='1') var Value = document.oiForm.select_id1.value;
 if(id=='2') var Value = document.oiForm.select_id2.value;
 if(id=='3') var Value = document.oiForm.select_id3.value;
 if(Value=='') return false;
 else {
 if(id=='1' && Value.substring(0, 1) == '/') location.href = Value;
 else window.open(Value,'','');
 }
}


/*********************************************************************
*	오픈 윈도우
*********************************************************************/
function openWindow(theURL,theName,theWidth,theHeight,theScroll) { 
	window.open(theURL, theName,'width='+theWidth+',height='+theHeight+',marginwidth=0,marginheight=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+theScroll+',resizable=no');
}

/* zoom-in, zoom-out */

function zoom_body(contentid, how) {
    if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != "" && GetCookie("zoomVal") != "undefined"){
        //document.all[contentid].style.zoom = GetCookie("zoomVal");
		document.body.style.zoom = GetCookie("zoomVal");
        currZoom=GetCookie("zoomVal");
    }
    else{
        //document.all[contentid].style.zoom = '100%'; 
		document.body.style.zoom = '100%'; 
        currZoom = '100%';
    }
    if (((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
        return; 
    }
    if (how == "in") {
		//alert(document.body.style.zoom);
        //document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)+zoomRate+'%'
		document.body.style.zoom = parseInt(document.body.style.zoom)+zoomRate+'%';
    }
    else {
        //document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)-zoomRate+'%'
		document.body.style.zoom = parseInt(document.body.style.zoom)-zoomRate+'%';
    }
    SetCookie("zoomVal",document.body.style.zoom);
}

// 삭제 검사 확인
function del(href) 
{
	if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")){ 
		document.location.href = href;
	}
}

//이미지 새창띄우기
function image_window(img)
    {
        var w = img.tmp_width; 
        var h = img.tmp_height; 
        var winl = (screen.width-w)/2; 
        var wint = (screen.height-h)/3; 

        if (w >= screen.width) { 
            winl = 0; 
            h = (parseInt)(w * (h / w)); 
        } 

        if (h >= screen.height) { 
            wint = 0; 
            w = (parseInt)(h * (w / h)); 
        } 

        var js_url = "<script language='JavaScript1.2'> \n"; 
            js_url += "<!-- \n"; 
            js_url += "var ie=document.all; \n"; 
            js_url += "var nn6=document.getElementById&&!document.all; \n"; 
            js_url += "var isdrag=false; \n"; 
            js_url += "var x,y; \n"; 
            js_url += "var dobj; \n"; 
            js_url += "function movemouse(e) \n"; 
            js_url += "{ \n"; 
            js_url += "  if (isdrag) \n"; 
            js_url += "  { \n"; 
            js_url += "    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n"; 
            js_url += "    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n"; 
            js_url += "    return false; \n"; 
            js_url += "  } \n"; 
            js_url += "} \n"; 
            js_url += "function selectmouse(e) \n"; 
            js_url += "{ \n"; 
            js_url += "  var fobj      = nn6 ? e.target : event.srcElement; \n"; 
            js_url += "  var topelement = nn6 ? 'HTML' : 'BODY'; \n"; 
            js_url += "  while (fobj.tagName != topelement && fobj.className != 'dragme') \n"; 
            js_url += "  { \n"; 
            js_url += "    fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n"; 
            js_url += "  } \n"; 
            js_url += "  if (fobj.className=='dragme') \n"; 
            js_url += "  { \n"; 
            js_url += "    isdrag = true; \n"; 
            js_url += "    dobj = fobj; \n"; 
            js_url += "    tx = parseInt(dobj.style.left+0); \n"; 
            js_url += "    ty = parseInt(dobj.style.top+0); \n"; 
            js_url += "    x = nn6 ? e.clientX : event.clientX; \n"; 
            js_url += "    y = nn6 ? e.clientY : event.clientY; \n"; 
            js_url += "    document.onmousemove=movemouse; \n"; 
            js_url += "    return false; \n"; 
            js_url += "  } \n"; 
            js_url += "} \n"; 
            js_url += "document.onmousedown=selectmouse; \n"; 
            js_url += "document.onmouseup=new Function('isdrag=false'); \n"; 
            js_url += "//--> \n"; 
            js_url += "</"+"script> \n"; 

        var settings;

       // if (g4_is_gecko) {
            settings  ='width='+(w+10)+','; 
            settings +='height='+(h+10)+','; 
        /*} else {
            settings  ='width='+w+','; 
            settings +='height='+h+','; 
        }*/
        settings +='top='+wint+','; 
        settings +='left='+winl+','; 
        settings +='scrollbars=no,'; 
        settings +='resizable=yes,'; 
        settings +='status=no'; 


        win=window.open("","image_window",settings); 
        win.document.open(); 
        win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n"); 
        var size = "이미지 사이즈 : "+w+" x "+h;
        win.document.write ("<title>"+size+"</title> \n"); 
        if(w >= screen.width || h >= screen.height) { 
            win.document.write (js_url); 
            var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '"; 
        } 
        else 
            var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '"; 
        win.document.write ("<style>.dragme{position:relative;}</style> \n"); 
        win.document.write ("</head> \n\n"); 
        win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n"); 
        win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
        win.document.write ("</body></html>"); 
        win.document.close(); 

        if(parseInt(navigator.appVersion) >= 4){win.window.focus();} 
    }

// 아이디체크
function check_id(frm_name, frm_id)
{
	var mb_id = document.frmReg.mb_id.value;
	url = "/member/information_pop.htm?frm_name="+frm_name+"&mb_id="+mb_id;
	window.open(url, "id", "left=50,top=50,width=450,height=215,scrollbars=1");
}

// 주민등록번호 체크

function check_jumin(){
	var chk =0;
	var theform = document.frmReg;
	var yy = theform.mb_jumin1.value.substring(0,2);
	var mm = theform.mb_jumin1.value.substring(2,4);
	var dd = theform.mb_jumin1.value.substring(4,6);
	var sex = theform.mb_jumin2.value.substring(0,1);

	 if (theform.mb_name.value==""){
		 alert ("이름을 입력해주세요.");
		 theform.mb_name.focus();
		 return false;
	   }

	 if ((theform.mb_jumin1.value.length!=6)||(yy <20||mm <1||mm>12||dd<1)){
		 alert ("주민등록번호가 올바르지 않습니다.");
		 theform.mb_jumin1.focus();
		 return false;
	   }

	   if ((sex != 1 && sex !=2 )||(theform.mb_jumin2.value.length != 7 )){
		 alert ("주민등록번호가 올바르지 않습니다.");
		 theform.mb_jumin2.focus();
		 return false;
	   }   

	// 주민등록번호 체크 

	for (var i = 0; i <=5 ; i++){ 
	chk = chk + ((i%8+2) * parseInt(theform.mb_jumin1.value.substring(i,i+1)))
	}

	   for (var i = 6; i <=11 ; i++){ 
			 chk = chk + ((i%8+2) * parseInt(theform.mb_jumin2.value.substring(i-6,i-5)))
	}

	   chk = 11 - (chk %11)
	   chk = chk % 10

	   if (chk != theform.mb_jumin2.value.substring(6,7))
	   {
		 alert ("유효하지 않은 주민등록번호입니다.");
		 theform.mb_jumin1.focus();
		 return;
	   } 
	  
	  alert('실명인증이 정상적으로 완료되었습니다');
	  theform.r_name.value="ok";
}


// 우편번호 창
function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2)
{

	url = "/member/zipcode.php?frm_name="+frm_name+"&frm_zip1="+frm_zip1+"&frm_zip2="+frm_zip2+"&frm_addr1="+frm_addr1+"&frm_addr2="+frm_addr2;
	window.open(url, "winZip", "left=50,top=50,width=347,height=500,scrollbars=1");
}

// 아이디/비번찾기
function find_idpw()
{
	window.open("/member/login_idpw.htm", "idpw", "left=10,top=10,width=600,height=363");
}

// 우편번호 창
function open_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2){
	url = "/member/zipcode.php?frm_name="+frm_name+"&frm_zip1="+frm_zip1+"&frm_zip2="+frm_zip2+"&frm_addr1="+frm_addr1+"&frm_addr2="+frm_addr2;
	window.open(url, "winZip", "left=50,top=50,width=347,height=460,scrollbars=1");
}

// 삭제 검사 확인
function del(href) 
{
	if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) 
		document.location.href = href;
}

/*+++++++++팝업창+++++++++*/
function MM_openBrWindow(theURL,winName,features) {
//v2.0
 window.open(theURL,winName,features);
}

//직원정보
function open_staff(sidx,idx){
	window.open('/_modules/org_staff.php?sidx='+sidx+'&idx='+idx,'or','top=10,left=10,width=600,height=500,scrollbars=yes');
}

//시작페이지설정
function set_start() {
startpage.style.behavior='url(#default#homepage)';
startpage.setHomePage('https://www.hampyeong.jeonnam.kr/');
}

/* 페이지 인쇄 기능 (개발 : 김형원 2009.04.13) */
function lf_printIframe() {
	if (document.getElementById("PrintAreaDiv") != null) {
		var sHTML = document.getElementById("PrintAreaDiv").innerHTML;
	} else {
		window.print();
		return;
	}
	var linkCount = document.getElementsByTagName("link").length;
	var styleLink;
	for(i=0;i<linkCount;i++) {
		styleLink = hiddenFrame.document.createElement('link');
		styleLink.type = "text/css";
		styleLink.rel = "stylesheet";
		styleLink.href = document.getElementsByTagName("link")[i].href;
		hiddenFrame.document.appendChild(styleLink);
	}
	hiddenFrame.location.href="/_modules/print/printPage.php";
	var Div = hiddenFrame.document.createElement('div');
	Div.style.width = "750px";
	Div.style.float = "left";
	Div.innerHTML = sHTML;
	if( navigator.appName.indexOf("Microsoft") > -1 ){
		if( navigator.appVersion.indexOf("MSIE 6") > -1){
			hiddenFrame.document.body.style.zoom='85%';
		}else if(navigator.appVersion.indexOf("MSIE 7") > -1){
			Div.style.margin = "0 0 0 20px";
			hiddenFrame.document.body.style.zoom='120%';
		}
	}
	hiddenFrame.document.appendChild(Div);
	hiddenFrame.focus();
	hiddenFrame.print();
}

function lf_flashBannerLink(as_code){
	if(as_code=="1") { document.location.href="/2008_hpm/hpm04/hpm0403/hpm040301/shpm040301.php";}
	if(as_code=="2") { 
		theName = "ECOPARK_FROM_MAIN";
		theURL = "http://www.ecopark.or.kr/";
		window.open(theURL, theName,'width=1024,height=730,marginwidth=0,marginheight=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
		}
	if(as_code=="3") { document.location.href="/2008_hpm/hpm03/hpm0301/shpm0301.php";}
	if(as_code=="4") { document.location.href="/2008_hpm/hpm04/hpm0404/hpm040401/shpm040401.php";}
	if(as_code=="5") { 
		theName = "EXPO_FROM_MAIN";
		theURL = "http://www.hampyeongexpo.org/";
		window.open(theURL, theName,'width=1024,height=730,marginwidth=0,marginheight=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	}
}

	function Auth() {
		if (document.getElementById('agree_check_value').value=="y") {
			wWidth = 360;
			wHight = 120;

			wX = (window.screen.width - wWidth) / 2;
			wY = (window.screen.height - wHight) / 2;

			var w = window.open("/member/AuthRequest.php", "gPinLoginWin", "directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
		}
		else {
			alert("약관에 동의하셔야 합니다");
			return;
		}
	}