// 팝업창 중앙에 정렬 시키는 함수.
function set_center(width,height,type)
{
	nWidth = width;
	nHeight = height;
	nLeft = (window.screen.width - nWidth ) / 2;
	nTop  = (window.screen.height- nHeight) / 2;
	sF = "";

	if(type=="1") sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=no,scrollbars=no";
	else sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=no,scrollbars=yes";

	sF += ",left=" + nLeft;
	sF += ",top=" + nTop;
	sF += ",width=" +  nWidth;
	sF += ",height=" + nHeight;

	return sF;
}

function set_center1(width,height,type)
{
	nWidth = width;
	nHeight = height;
	nLeft = (window.screen.width - nWidth ) / 2;
	nTop  = (window.screen.height- nHeight) / 2;
	sF = "";

	if(type=="1") sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=yes,scrollbars=no";
	else sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=yes,scrollbars=yes";

	sF += ",left=" + nLeft;
	sF += ",top=" + nTop;
	sF += ",width=" +  nWidth;
	sF += ",height=" + nHeight;

	return sF;
}

	function set_centerALL(width,height,left,top,type)
	{
		nWidth = width;
		nHeight = height;
		nLeft = ((window.screen.width - nWidth ) / 2)+left;
		nTop  = ((window.screen.height- nHeight) / 2)+top;
		sF = "";

		if(type=="1") sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=no,scrollbars=no";
		else sF += "toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=yes,scrollbars=yes";

		sF += ",left=" + nLeft;
		sF += ",top=" + nTop;
		sF += ",width=" +  nWidth;
		sF += ",height=" + nHeight;

		return sF;
	}

	function ReadCookie(name)
	{
		var label = name + "=" ;
		var labelLen = label.length ;
		var cLen = document.cookie.length
		var i = 0
		while (i < cLen){
			var j = i + labelLen
			if (document.cookie.substring(i,j) == label) {
				var cEnd = document.cookie.indexOf(";",j)
				if (cEnd == -1){
					cEnd = document.cookie.length
						}
				return unescape(document.cookie.substring(j,cEnd))
				}
			i++
		}
		return ""
	}



  /// 아이디 체크
  function check_ID(value){
    
    var comp="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
    var len=value.length;
    for(i=0;i<len;i++) {
      if(comp.indexOf(value.substring(i,i+1))<0) {
        return false;
    	}
    }
  }

  /// 이름체크
  function check_Name(value){
    
    var comp="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var len=value.length;
    for(i=0;i<len;i++) {
      if(comp.indexOf(value.substring(i,i+1))<0) {
        return false;
    	}
    }
  }

  function check_Tel(value){
    
    var comp="0123456789+-";
    var len=value.length;
    for(i=0;i<len;i++) {
      if(comp.indexOf(value.substring(i,i+1))<0) {
        return false;
    	}
    }
  }



<!--

//숫자만 입력되도록하는 함수.
function CheckNumeric(Data) {
	var nochk='01234567890'
	for (i=0; i<Data.length; i++){
		if(nochk.indexOf(Data.substring(i,i+1)) < 0) 		
		{
			return false;
		}
	}//for 종료
	return true;
}

// 숫자만 입력하기.
function NumNock(){
	if ((event.keyCode<48)||(event.keyCode>57)){ 
		event.returnValue = false;
	}
	return true;
}

// 숫자에 콤마찍기.
function WonAmount(NumV)
{
	Num = NumV.toString();

	var count     = 0;
	var temp      = "";
	var resultWon = "";
	var oneChar   = "";

	for (var ch = Num.length-1; ch >= 0; ch--)
	{ 
		oneChar = Num.charAt(ch);

		if (count == 3) 
		{
			temp += ",";
			temp +=
			oneChar;
			count = 1;
			continue;
		} 
		else 
		{
			temp +=
			oneChar;
			count ++;
		}
	}

	for (var ch = temp.length-1; ch >= 0; ch--)
	{ 
		oneChar =temp.charAt(ch);
		resultWon += oneChar;
	}
	return resultWon;
}



//공백체크
function isEmpty( data ){
	for ( var i = 0 ; i < data.length ; i++ ){
		if ( data.substring( i, i+1 ) != " " ){
			return true;
		}
	}
	return false;
}

//이미지체크
function CheckImg(Data)
{
	if ( Data.indexOf(".JPG") != -1 || Data.indexOf(".GIF") != -1 || Data.indexOf(".gif") != -1 || Data.indexOf(".jpg") != -1 ){
		return true;
	}
	return false;
}

function copyUrl(url) {
    window.clipboardData.setData('Text', url);
    alert("현재 URL이 복사되었습니다.\n\n게시판이나 메신저에서 Ctrl+v로 붙여넣을 수 있습니다.");
}

// 공란체크
function Check(keyword) 
{
	var st_num, key_len;
	st_num = keyword.indexOf(" ");	
	while (st_num != -1)
	{
		keyword = keyword.replace(" ", "");
		st_num  = keyword.indexOf(" ");
	}
	key_len=keyword.length;
	return key_len;
}

// 이메일 체크
function email_chk()
{
	var t = document.fn.bbs_email.value
	var ValidFlag = false
	var atCount = 0
	var SpecialFlag
	var atLoop
	var atChr
	var BadFlag
	var tAry1
	var UserName
	var DomainName

	if ( t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0 ) {
		atCount = 0
		SpecialFlag = false

		for( atLoop=1; atLoop<=t.length; atLoop++ ) {
			atChr = t.substring( atLoop, atLoop+1 )
			if ( atChr == "@" ) atCount = atCount + 1

			if ( (atChr >= 32) && (atChr <= 44) ) SpecialFlag = true 
			if ( (atChr == 47) || (atChr == 96) || (atChr >= 123) ) SpecialFlag = true 
			if ( (atChr >= 58) && (atChr <= 63) ) SpecialFlag = true 
			if ( (atChr >= 91) && (atChr <= 94) ) SpecialFlag = true 
		}

		if ( ( atCount == 1 ) && (SpecialFlag == false ) ) {
			BadFlag = false
			tAry1 = t.split("@")
			UserName = tAry1[0]
			DomainName = tAry1[1]
			if ( (UserName.length <= 0 ) || (DomainName.length <= 0 ) ) BadFlag = true
			if ( DomainName.substring( 1, 2 ) == "." ) BadFlag = true
			if ( DomainName.substring( DomainName.length-1, DomainName.length) == "." ) BadFlag = true
			ValidFlag = true
		}
	}
	if ( BadFlag == true ) ValidFlag = false
	return ValidFlag
}

// 이메일 체크
function email_chk2(tempf)
{
	var t = tempf
	var ValidFlag = false
	var atCount = 0
	var SpecialFlag
	var atLoop
	var atChr
	var BadFlag
	var tAry1
	var UserName
	var DomainName

	if ( t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0 ) {
		atCount = 0
		SpecialFlag = false

		for( atLoop=1; atLoop<=t.length; atLoop++ ) {
			atChr = t.substring( atLoop, atLoop+1 )
			if ( atChr == "@" ) atCount = atCount + 1

			if ( (atChr >= 32) && (atChr <= 44) ) SpecialFlag = true 
			if ( (atChr == 47) || (atChr == 96) || (atChr >= 123) ) SpecialFlag = true 
			if ( (atChr >= 58) && (atChr <= 63) ) SpecialFlag = true 
			if ( (atChr >= 91) && (atChr <= 94) ) SpecialFlag = true 
		}

		if ( ( atCount == 1 ) && (SpecialFlag == false ) ) {
			BadFlag = false
			tAry1 = t.split("@")
			UserName = tAry1[0]
			DomainName = tAry1[1]
			if ( (UserName.length <= 0 ) || (DomainName.length <= 0 ) ) BadFlag = true
			if ( DomainName.substring( 1, 2 ) == "." ) BadFlag = true
			if ( DomainName.substring( DomainName.length-1, DomainName.length) == "." ) BadFlag = true
			ValidFlag = true
		}
	}
	if ( BadFlag == true ) ValidFlag = false
	return ValidFlag
}


// 주민번호 체크
function Jumin_chk(it) {
	IDtot = 0;
	IDAdd = "234567892345";

	for(i=0; i<12; i++) IDtot = IDtot + parseInt(it.substring(i, i+1)) * parseInt(IDAdd.substring(i, i+1));
	IDtot = 11 - (IDtot%11);
	if (IDtot == 10) IDtot = 0;
	else if (IDtot == 11) IDtot = 1;
	if(parseInt(it.substring(12, 13)) != IDtot) return true;
	else return false
}

// 영문 숫자만 입력가능

function checkEN(str){ 
	var check = 'abcdefghijklmnopqrstuvwxyz0123456789_-';
	var temp; 
	for (var i=0; i<str.length; i++) { 
		temp = '' + str.substring(i, i+1); 
		if (check.indexOf(temp) == '-1'){ 
			return false;
		}
	} 
	return true;
}

// 우편번호 찾기
function zipcode(){
	window.open('/shopArea/member/zipcode/Newwindow.asp','', 'width=420, height=200,left=400,top=400, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=yes, copyhistory=no');
}

// 미디어 플레이어 
function fPlayer_Activate(argWIDTH, argHEIGHT, argBASE_WORK_URL, argATT_PLAYER_NAME) {

	var contents = "<OBJECT id='mediaPlayer' type='application/x-oleobject' standby='Loading Microsoft?Windows?Media Player components...'"
		contents += " width= " + argWIDTH + " height= " + argHEIGHT + " classid='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95'>" 
		contents += " <PARAM NAME='FileName' VALUE=" + argBASE_WORK_URL + "/" + argATT_PLAYER_NAME + "> "
		contents += " <PARAM NAME='AnimationAtStart' VALUE='false'> "
		contents += " <PARAM NAME='TransparentAtStart' VALUE='true'> "
		contents += " <PARAM NAME='AutoStart' VALUE='true'> "
		contents += " <PARAM NAME='Autosize' VALUE='false'> "
		contents += " <PARAM NAME='AutoRewind' VALUE='true'> "
		contents += " <PARAM NAME='ShowDisplay' VALUE='false'> "
		contents += " <PARAM NAME='ShowStatusBar' VALUE='false'> "
		contents += " <PARAM NAME='ShowControls' VALUE='false'> "
		contents += " <PARAM NAME='ShowAudioControls' VALUE='false'> "
		contents += " <PARAM NAME='ShowTracker' VALUE='false'> "
		contents += " <PARAM NAME='ShowPositionControls' VALUE='0'> "
		contents += " <PARAM NAME='EnableContextMenu' VALUE='false'> "
		contents += " </object> ";
		document.write(contents);
}
function fFlash_Activate(argSRC, argWIDTH, argHEIGHT, argID, argWMODE) {

	var contents = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + argID  + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + argWIDTH + '" height="' +argHEIGHT +'">';
	contents += '<param name="menu" value="false">';
	if (typeof(argWMODE) == "undefined") {
		contents += '<param name="wmode" value="transparent">';
	} else {
		contents += '<param name="wmode" value="' + argWMODE + '">';
	}
	contents += '<param name="movie" value="' + argSRC + '">';
    contents += '<param name="quality" value="high">';
    contents += '<embed src="' + argSRC + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	if (typeof(argWMODE) == "undefined") {
		contents += ' wmode="transparent" ';
	} else {
		contents += ' wmode="' + argWMODE + '" ';
	}
	contents += ' type="application/x-shockwave-flash" width="' + argWIDTH + '" height="' + argHEIGHT +'"></embed></object>';
	document.write(contents);
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/*
*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function goSearch(){
	if (document.searchForm.sk.value == "")
	{
		alert("검색어를 입력해 주세요.");
	}
	else{
		document.searchForm.submit();
	}
	
}

function goCategory(){
	document.searchForm.submit();
}

function goPageSize(){
	document.searchForm.submit();	
}

	// 로그인 체크 함수 --------------------------
    function goLogSubmit(){
      var f
      f =  document.check;
      
      
      if ( f.strID.value.length < 4 ){
        alert("아이디는 4자리 이상 16자리 이내로 입력해 주세요..");
        f.strID.focus();
        return;
      }
      if ( f.strID.value.length > 16 ){
        alert("아이디는 4자리 이상 16자리 이내로 입력해 주세요.");
        f.strID.focus();
        return;
      }
      if ( check_ID(f.strID.value) == false ){
        alert("아이디는 특수문자 없이 입력해 주세요..");
        f.strID.focus();
        return;
      }
      
      if ( f.strPWD.value.length < 4 ){
        alert("비밀번호는 4자리 이상 16자리 이내로 입력해 주세요.");
        f.strPWD.focus();
        return;
      }
      if ( f.strPWD.value.length > 16 ){
        alert("비밀번호는 4자리 이상 16자리 이내로 입력해 주세요.");
        f.strPWD.focus();
        return;
      }
      
      f.submit();
      
    }

	function getChkCnt(f)
	{
		var chkcnt=0;
		
		for( var i=0; i<f.length; i++ )
		{
			var ele = f[i];

			if ( ele.checked==true )
				chkcnt++;
		}

		return chkcnt;
	}

	function getChkCnt1(f)
	{
		var chkcnt=0;
		var objcnt=0;

		if ((typeof(f)=="object") && (typeof(f.length)=="undefined")){
			if ( f.checked==true )
				chkcnt++;

		}else{
			for( var i=0; i<f.length; i++ )
			{
				var ele = f[i];

				if ( ele.checked==true )
					chkcnt++;
			}

		}

		return chkcnt;
	}

	function goComment()
	{
		var f
		f = document.commForm;
		if (f.txtComment.value == ""){
			alert("댓글을 입력해 주세요.");
		}
		else{
			f.action = "../_inc/inc_Comment_ok.asp";
			f.submit();
		}
	}

	function goCommentDel(value)
	{
		var f
		f = document.commForm;

		if ( confirm("댓글을 정말 삭제하시겠습니까?") )
		{
			f.idxBoardComment.value=value;
			f.action = "../_inc/inc_Comment_Del.asp";
			f.submit();
		}
		
	}

	function hpWriteF(){
		var f 
		f = document.HpWriteForm;

		var chkcnt = getChkCnt(f.nLevel);

		if ( chkcnt==0 )
		{
			alert("평가를 선택해 주세요..");
			return;
		}
		else{
			f.action="../_inc/inc_HP_write_ok.asp";
			f.submit();

		}
	}

	function kwWriteF(){
		var fa
		fa = document.kwWriteForm;
		
		var chkcnt = getChkCnt1(fa.nKeyWord);
		
		if ( chkcnt == 0 )
		{
			alert("주제어를 선택하세요.");
			return;
		}
		else{
			fa.action="../_inc/inc_keyword_ok.asp";
			fa.submit();
		}
	}


	function scrap_ok(value1,value2){

		document.ifrm_mainRead.location.href="../../scrap_ok.asp?bid="+value1+"&idx="+value2;
		
	}

	function goScrapSubmit()
	{
		var f
		f = document.scrapForm;
		f.action = "../_inc/inc_scrap_ok.asp";
		f.submit();

	}

	function downURLClick(value1,value2,value3,value4,value5,value6,value7){		// 파일명 , idxBoard , idxBoardInfo , idxFile , 경로 , 아이디 , 홈페이지 root 디렉토리
//		window.location.href=value5+value3+"/"+value1;
//		alert(value5.indexOf("http://"));
		window.open(value5+value3+"/"+value1);
		window.open('/_inc/inc_download.asp?idx='+value2+'&bid='+value3+'&idxFile='+value4+'&strFileName='+encodeURI(value1)+'&id='+value6,"none","width=10,height=10,toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=yes,scrollbars=no");
	}
	

	function downURLClick_forum(value1,value2,value3,value4,value5,value6,value7){		// 파일명 , idxBoard , idxBoardInfo , idxFile , 경로 , 아이디 , 홈페이지 root 디렉토리
//		window.location.href=value5+value3+"/"+value1;
//		alert(value5.indexOf("http://"));
		window.open(value5+value3+"/"+value1);
		window.open('/_inc/inc_download_forum.asp?idx='+value2+'&bid='+value3+'&idxFile='+value4+'&strFileName='+encodeURI(value1)+'&id='+value6,"none","width=10,height=10,toolbar=no,location=no,menubar=no,status=no,directories=no,resizable=yes,scrollbars=no");
	}

// 검색 함수 부분  ----------------------------------------------------
	function F_Txtdelete(){
		var f
		f = document.TotsearchForm;

		f.strTSearch_Txt.value = "";
		f.strTSearch_Txt.value = "";
	}
	
	function F_TxtdeleteSub(){
		var f
		f = document.searchForm;

		f.sk.value = "";
	}
	
	function F_TotSearch(){
		var f
		f = document.TotsearchForm;
		if (f.strTSearch_Txt.value == ""){
			
			alert("검색어를 입력해 주세요.");

		}
		else{
			
//			f.action="/search/search.asp";
			f.submit();

		}
	}

	function F_TotSearch_CN(){
		var f
		f = document.TotsearchForm;
		if (f.strTSearch_Txt.value == ""){
			
			alert("Please enter the search keyword.");		/// 검색어를 입력하세요.

		}
		else{
			
			if (f.SearchCode.value == "baidu"){
				window.open("/support/search/TotalURL.asp?keyword="+ escape(f.strTSearch_Txt.value) + "&strURL=baidu");
				return false;
//				window.open("http://www.baidu.com/s?wd=" + (f.strTSearch_Txt.value));
			}
			else if (f.SearchCode.value == "google"){
				window.open("/support/search/TotalURL.asp?keyword="+ escape(f.strTSearch_Txt.value) + "&strURL=google");
				return false;
//				window.open("http://www.google.com/search?complete=1&q=" + escape(f.strTSearch_Txt.value) + "&strURL=google");
			}
			else{
				f.action="/support/search/search.asp";
				f.submit();

			}
		}
	}

	function F_TotSearch_S(){
		var f
		f = document.TotsearchForm_S;
		if (f.strTSearch_Txt.value == ""){
			
			alert("Please enter the search keyword.");

		}
		else{
			
//			f.action="/search/search.asp";
			f.submit();

		}
	}

	function F_SearchResult(valueBoard){
		var f
		f = document.TotsearchForm;
		
		f.bid.value = valueBoard;
		f.action="./search.asp";
		f.submit();
		
	}

	function F_TotSearchDetail(value){
		var f
		f = document.TotsearchForm;
		
		f.bid.value=value;
		f.action="./search_result.asp";
		f.submit();


	}
// 검색 함수 부분  ----------------------------------------------------
// 파일 다운로드 팝업 ------------------------------------
	function OpenDownPOPUP(value1,value2){
		
		window.open('../_inc/file_download.asp?idx='+value1+'&bid='+value2,'filepopUP','width=450,height=300');
		
	}
// 파일 다운로드 팝업 ------------------------------------

// 온라인 교육 팝업 
	function Open_OnLineEdu(value1,value2){
//		window.open('./online_viewer.asp?idx='+value2+"&bid="+value1,'EduViewer','width=990,height=1005');
		window.open('/civil/edu_center/online_viewer.asp?idx='+value2+"&bid="+value1);

	}


// 태그 크라우드 함수 ------------------------------------
	function F_TagSearch(str) {
	  top.location.href="/search/search.asp?strTSearch_Txt="+encodeURI(str)+"&bTagC=1";
	}
	
// 링크 폼으로 이동하는 함수 ---------------------------------
	function goView(strForm,strAction,strFieldName,nIdxField)
	{
		strForm.action = strAction+"?"+strFieldName+"="+nIdxField;
		strForm.submit();
	}

// Comment txt 클릭시 글자 지우기  -------------------------
	function AddCommenttxtDEl(value){
		var txtComm
		txtComm = document.commForm;

		if (txtComm.txtComment.value == value){
			txtComm.txtComment.value = "";
		}

	}

	function openpop(strUrl,nWidth,nHeight,nType)
	{
		var strAddon = set_center(nWidth,nHeight,nType);

		window.open(strUrl,"popup"+nWidth,strAddon);
	}

	function checkEmail(email) {
		if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
			return true;
		}
		else {
			return false;
		}
	}
	// 하단 패밀리 사이트 가는 함수
	function f_popLocation(value){
		window.open(value);
	}

	function featurePrint(){
		
		top.iframe01.focus();
		window.print();

	}

	function EmailCheck(StrVal) {
		if( (StrVal.match(/[\w\-\~]+\@[\w\-\~]+(\.[\w\-\~]+)+/g) != StrVal.split(" ").join("")) || (StrVal.length < 7) ) {
			return true;
		}
	}

	function onEnter(e, exec) {
		var e = window.event || e;
		var keyCode = (window.event) ? e.keyCode : e.which;
		if (keyCode == 13) eval(exec);
	}

	function comsoon(){
		alert("준비중입니다.");
	}
