

/*
리스트형 탭
감추기/보이기 */
function toggle(ele,bd_idx,def_code){ 
// alert(ele);
	if(typeof ele == "string") ele = document.getElementById(ele);
	// css의 display 값 받아오기
	var value = null;
	if(ele.currentStyle) var value = ele.currentStyle['display'];
	else if(document.defaultView.getComputedStyle) var value = document.defaultView.getComputedStyle(ele,null)['display'];
	// none일때와 아닐때 다르게 먹이기
	if(value != "none") (ele.style.display != 'none') ? ele.style.display = 'none' : ele.style.display = '';
	else (ele.style.display != 'block') ? ele.style.display = 'block' : ele.style.display = ''
	
	/* block  내용 보여줄때 Ajax로 조회수 1증가*/
	if(value == 'none'){
		readCntUp(bd_idx,def_code);
	}
	return false;
}


/*
셀렉트 박스
감추기/보이기 */
function toggleSelect(ele){ 
// alert(ele);
	if(typeof ele == "string") ele = document.getElementById(ele);
	// css의 display 값 받아오기
	var value = null;
	if(ele.currentStyle) var value = ele.currentStyle['display'];
	else if(document.defaultView.getComputedStyle) var value = document.defaultView.getComputedStyle(ele,null)['display'];
	// none일때와 아닐때 다르게 먹이기
	if(value != "none") (ele.style.display != 'none') ? ele.style.display = 'none' : ele.style.display = '';
	else (ele.style.display != 'block') ? ele.style.display = 'block' : ele.style.display = ''	
	return false;
}


/** 글자 자동 넘기기 - 전화 **/
function lengthCheck( checkTag ){
	if ( checkTag.name == "get_tell" ){
		if ( checkTag.value.length >= 3 )	{
			checkTag.blur();
			document.getElementById("get_tell2").focus();
		}
	}
	if ( checkTag.name == "get_tell2" ){
		if ( checkTag.value.length >= 4 )	{
			checkTag.blur();
			document.getElementById("get_tell3").focus();
		}
	}	
}


/* 셀렉트 박스 선택 */
	function sKeyVal(tit,val,name,SelId) {

	document.getElementById(SelId).innerHTML = tit;
	document.PageForm(name).value = val;
	
}

	/* 아이디 찾기 */
	function findId(){
		if(!inputCheck("FormId","mem_name","성명","STR","R","","","Y")){return false;}
		if(!inputCheck("FormId","mem_ssn1","주민번호 앞자리","N","R","","","Y")){return false;}
		if(!inputCheck("FormId","mem_ssn2","주민번호 뒷자리","N","R","","","Y")){return false;}
	}
	/* 주민번호 포커스 이동 */

	function lengthCheck( checkTag ){
		if ( checkTag.name == "mem_ssn1" )
		{
			if ( checkTag.value.length >= 6 )
			{
				checkTag.blur();
				document.all.mem_ssn2.focus();
			}
		}
	}
	/* 비밀번호 찾기 */
	function findPw(){
		if(!inputCheck("FormPw","mem_id","아이디","STR","R","","","Y")){return false;}
		if(!inputCheck("FormPw","mem_name","성명","STR","R","","","Y")){return false;}
		if(!inputCheck("FormPw","jumin1","주민번호 앞자리","N","R","","","Y")){return false;}
		if(!inputCheck("FormPw","jumin2","주민번호 뒷자리","N","R","","","Y")){return false;}
		if(!inputCheck("FormPw","sMethod","비밀번호 받으실 항목을","STR","R","","","Y")){return false;}
	}

	function lengthCheck2( checkTag ){
		if ( checkTag.name == "jumin1" )
		{
			if ( checkTag.value.length >= 6 )
			{
				checkTag.blur();
				document.all.jumin2.focus();
			}
		}
	}

	/* 회원탈퇴 팝업관련 */

	function secCheck(){
		opener.PageForm.submit();
		this.close();
	}
	
/** 탭 공통 **/
function tabList(ele, active){
	var ele = document.getElementById(ele);
	if(active === undefined) active = 0;						
	
	// tabtit를 포함하는 제목 노드들 수집 
	var btn = ele.getElementsByTagName("*");
	for(var i=0; i<btn.length; i++){
		if(btn[i].className.indexOf('tabtit') != -1){
			btn = btn[i].nodeName;
			btn = ele.getElementsByTagName(btn);
			break;
		}
	}
	
	// 타이틀의 타겟 레이어 이름중 숫자만 뺀 영문만 tab1 중 tab만
	var layerName = btn[0].getElementsByTagName("A")[0].href.split("#")[1];
	layerName = layerName.slice(0, layerName.length-1);
	
	for(var i=0; i<btn.length; i++){
		ele["target" + i] = document.getElementById(layerName + (i+1)); // 노드저장 예) tab1, tab2, tab3
		ele["a" + i] = btn[i].getElementsByTagName("A")[0]; // 탭링크
		ele["img" + i] = btn[i].getElementsByTagName("IMG")[0]; // 이미지노드 저장
		btn[i].style.position = "absolute"; // 제목레이어 적용
		//ele.getElementsByTagName("P")[i].style.position = "absolute"; // 더보기 레이어
	}
	
	/* 초기세팅 */
	var oldActive = active;
	for(var i=0; i<btn.length; i++){
		ele["a" + i].cnt = i;
		ele["a" + i].onclick = function menuActive(){
			ele["target" + oldActive].style.display = "none";
			ele["img" + oldActive].src = ele["img" + oldActive].src.replace("_over", "_out");
			
			ele["target" + this.cnt].style.display = "block";
			ele["img" + this.cnt].src = ele["img" + this.cnt].src.replace("_out", "_over");
			oldActive = this.cnt;
			return false;
		}
		
		if(active == i) continue; // 초기 활성화
		ele["target" + i].style.display = "none";
		ele["img" + i].src = ele["img" + i].src.replace("_over", "_out");

	}
}


/* 페이지 로딩후 스크립트 호출 */
function addLoadEvent(func){	
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {	 
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
 
}

//파일 다운로드  subMain 파일 다운로드
function reportFile(adboard,ir,sFile,tFile)
{
	location.href="/library/server/filedown.asp?sDir1="+adboard+"&sDir2="+ir+"&sSFilename="+sFile+"&sTFilename=" + tFile;
}


/* 상단네비게이션 변경 */
function flashChange( st) {
  if( st == "over" ) {
    document.getElementById("top").style.zIndex = 100;
    document.getElementById("top").style.height = "310px";
  } else {
    document.getElementById("top").style.zIndex = 10;
    document.getElementById("top").style.height = "120px";
  }
}


// 플래시 팝업
function popFullFlash(){
//	window.open("/shinan/index.html","pop","left=0,top=0,fullscreen");
		window.open("/newshinan/sd_avi.html","pop","left=0,top=0,width=850,height=698");
}
function popFlash(val){
	window.open("/pr/popfrontier.asp?staVar="+val,"flash","left=0,top=0,fullscreen");
}

function ebDown(){
	$("eDownFile").style.display = "block";
}
function ebClose(){
	$("eDownFile").style.display = "none";
}

// 태그 생성 (채용)
function cEle(tag){
	return document.createElement(tag);
}



