/* 오른쪽 마우스 막기, 드래그 막기 
//새로고침, 뒤로가기 막기
document.onkeydown = function(e){
	key = (e) ? e.keyCode : event.keyCode;
	if(key==116){
		if(e){
			e.preventDefault();
		}else{
			event.keyCode = 0;
			event.returnValue = false;
		}
	}
} 

//오른쪽마우스 막기
document.oncontextmenu = function(e){
	if(e){
		e.preventDefault();
	}else{
		event.keyCode = 0;
		event.returnValue = false;
	}
}

//드래그 막기
document.ondragstart = function(e){
	if(e){
		e.preventDefault();
	}else{
		event.keyCode = 0;
		event.returnValue = false;
	}
}

document.onselectstart = function(e){
	if(e){
		e.preventDefault();
	}else{
		event.keyCode = 0;
		event.returnValue = false;
	}
}
/**/



/* HOME */
function home(){location.href='/index.html';}	//HOME



/* 센터소개 */
function center00(){location.href='/Center/Center01.html';}			//센터소개 - 메인
function center01(){location.href='/Center/Center01.html';}			//센터소개 - 인사말
function center02(){location.href='/Center/Center02.html';}			//센터소개 - 회사소개
function center03(){location.href='/Center/Center03.html';}			//센터소개 - 회사연혁
function center04(){location.href='/Center/Center04.html';}			//센터소개 - 교육의 특징
function center05(){location.href='/Center/Center05.html';}			//센터소개 - 회원사리스트
function center06(){location.href='/Center/Center06.html';}			//센터소개 - 찾아오시는 길



/*과정안내 */
function course002(){location.href='/Course/Course00.html';}	
function course00(){location.href='/Course/Course000.html';}				//메인
function course01(){location.href='/Course/sub06.html';}				//샘플강좌
function course02(){location.href='/Course/Course02.html';}			//강사소개



/* 수강신청 */
function enterclass00(){location.href='/EnterClass/EnterClass01.html';}				// 메인
function enterclass01(){location.href='/EnterClass/EnterClass01.html';}				// 수강신청



/* 교재구입 */
function book00(){location.href='/Book/Book01.html';}			// 메인
function book01(){location.href='/Book/Book01.html';}			// 교재구입
function book02(){location.href='/Book/Book02.html';}			// 교재정오표



/* 고객지원 */
function customer00(){location.href='/Customer/Customer01.html';}								 	// 메인
function customer01(){location.href='/Customer/Customer00.html?BoardID=B_Notice';}				 	// 공지사항
function customer02(){location.href='/Customer/Customer01.html?BoardID=B_News';}					// 교육뉴스
function customer03(){location.href='/Customer/Customer02.html';}									// 학습도우미
function customer04(){location.href='/Customer/Customer03.html?BoardID=B_OnlineQ';}				// 1:1 온라인상담
function customer05(){location.href='/Customer/Customer04.html?BoardID=B_CQNA';}					// 개인회원상담실
function customer06(){location.href='/Customer/Customer06.html?BoardID=B_RemoteService';}		 	// 원격상담예약
function customer07(){location.href='/Customer/Customer07.html?BoardID=B_Data';}					// 원격상담예약



/* 기업교육안내 */
function company00(){location.href='/Company/Company01.html';}					// 메인
function company01(){location.href='/Company/Company01.html';}					// 일반과정
function company02(){location.href='/Company/Company02.html';}					// 기업교육안내
function company03(){location.href='/Company/Company03.html';}					// 고용보험환급과정
function company04(){location.href='/Company/Company04.html';}					// 개인수강지원금과
function company05(){location.href='/Company/Company05.html';}					// 능력
function company06(){location.href='/Company/Company06.html';}					// 기업학습.



/* 마이페이지 */
function classroom00(){location.href='/ClassRoom/index.html';}					// 마이페이지



/* 팝업 - 아이디 중복확인 */
function pop_idcheck(frm, frmName){														
	var url = "/member/pop_idcheck.html?id=" + frm.UserID.value + "&frmName=" + frmName ;
	window.open(url,'id_check','width=436,height=436');
}



/* 팝업 - 우편번호 검색 */

//팝업 - 우편번호 검색2
function pop_zipcode(frmName, frmNav){														
	var url = "/member/pop_zipcode.html?frmName=" + frmName + "&frmNav=" + frmNav ;
	window.open(url,'zipcode','scrollbars=yes,no-resize,width=436,height=250');
}

//팝업 - 우편번호 검색2
function pop_zipcode2(){														
	window.open('/member/pop_zipcode2.html','zipcode','scrollbars=yes,no-resize,width=436,height=250');
}



/* 로그인 */
function login01(){location.href='/member/login.html';}						//LOGIN
function logout01(){location.href='';}										//LOGOUT



/* 사이트맵 */
function sitemap01(){location.href='';}			//Sitemap



/* 플래시 삽입 flash(경로,가로,세로,투명여부) */
function flash(src,width,height,tr){
    object = '';
    object += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="param" width="'+width+'" height="'+height+'">';
    object += '<param name="movie" value="'+src+'">';
    if(tr=='1'){
         object += '<param name="wmode" Value="Transparent">';
    }
    object += '<embed src="'+src+'" quality="high" ';    
    if(tr=='1'){
        object += ' wmode="transparent" ';
    }
    object += ' bgcolor="#ffffff" menu="false" width="'+width+'" height="'+height+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
    object += '</object>';
    document.write(object);
}



/* 미디어 플레이어 스크립트 */
function writePlayer(mmsUrl, w, h) {
	try {
		//CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6는 미디어 플레이어 7.0 이상을 지원한다.(url 사용)
		//CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95는 미디어 플레이어 6.4을 지원한다. (filename 사용)
		document.write('<OBJECT ID="MediaPlayer1" style="WIDTH: ' + w + ' ; HEIGHT: ' + h + '" CLASSID=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 standby="Loading Microsoft Windows Media Player components..." TYPE="application/x-oleobject" VIEWASTEXT">');
		document.write('<param name="AUTOSTART" value="true">');
		document.write('<PARAM NAME="ShowCaptioning" VALUE="false">');
		document.write('<PARAM NAME="ShowControls" VALUE="false">');
		document.write('<PARAM NAME="ShowAudioControls" VALUE="ture">');
		document.write('<PARAM NAME="ShowDisplay" VALUE="false">');
		document.write('<PARAM NAME="ShowPositionControls" VALUE="false">');
		document.write('<PARAM NAME="ShowStatusBar" VALUE="false">');
		document.write('<PARAM NAME="ShowTracker" VALUE="true">');
	    document.write('<param name="filename" value="' + mmsUrl+ '">');
	 	document.write('<param name="PlayCount" value="1">');	
	 	document.write('<param name="enableContextMenu" value="false">');			
		document.write('</OBJECT>');
	} catch(E){}
}



/* 체크박스 처리 */

// 전체 선택
function selectAll(frm) { 
	for (var i=0;i<frm.elements.length;i++) {
		var target = frm.elements[i]; 
		if(target.name == 'list[]' && target.checked==false){ 
			target.click(); 
		} 
	} 
} 

// 전체 해제
function deSelectAll(frm) {
	for (var i=0;i<frm.elements.length;i++) { 
		var target = frm.elements[i]; 
			if(target.name == 'list[]' && target.checked==true){ 
				target.click(); 
			} 
	} 
}

// 선택 반전
function convertAll(frm) {
	for (var i=0;i<frm.elements.length;i++) { 
		var target = frm.elements[i];
		if(target.name == 'list[]'){  
			target.click(); 
		}
	} 
}

// 선택 삭제
function fnListDel(frm, url, p, msg) {
	var f=confirm("정말로 삭제하시겠습니까?") ;
	if(f==true) {
		frm.p.value=p ;
		//---------- 체크리스트 체크 여부 시작 -----------
		var list = document.getElementsByName("list[]");
		var leng=list.length ;					
		var count=0 ;
		for(i=0; i<leng; i++) {
			if(list[i].checked==true) count++ ;
		}
		if(count==0) {
			alert(msg);
			return ;
		}
		//---------- 체크리스트 체크 여부 끝 -----------									
		frm.action=url ;
		frm.submit();
	}else{
		return ;	
	} 
}

// 팝업창 관리
function fnOpenPopup(url, name, width, height, scroll_yn) {
	var url = url ;
	var name = name ;
	var opt = "width=" + width + ", height=" + height + ", scrollbars=" + scroll_yn ; ;
	window.open(url, name, opt) ;
}

/*--------------------------------------------------------------------------------------------
 Spec	  : 숫자입력시 3자리마다 자동으로 콤마 찍기
 Argument : string
 Return   : string
 Example  : onkeyup="comma_value(this)"
---------------------------------------------------------------------------------------------*/
function fnComma(me)
{
    var tmpH = null;	
	if(me.charAt(0)=="-"){//음수가 들어왔을때 '-'를 빼고적용되게..
		tmpH=me.substring(0,1);
		me=me.substring(1,me.length);
	}	//me.indexOf('-')
 	if(me.length > 3){
 		var c=0;
 		var myArray=new Array();
   		for(var i=me.length;i>0;i=i-3){
    			myArray[c++]=me.substring(i-3,i);
  	 	}
   		myArray.reverse();
  	 	me=myArray.join(",");
 	 }
	 if(tmpH){
 	 	me=tmpH+me;
 	 }
	return me;
}

// Ajax 모듈 생성
function getXMLHttpRequest() {
	if (window.ActiveXObject) {
		try {
			return new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e1) { return null; }
		}
	} else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else {
		return null;
	}
}

var httpRequest = null;

function sendRequest(url, params, callback, method) {
	httpRequest = getXMLHttpRequest();
	var httpMethod = method ? method : 'GET';
	if (httpMethod != 'GET' && httpMethod != 'POST') {
		httpMethod = 'GET';
	}
	var httpParams = (params == null || params == '') ? null : params;
	var httpUrl = url;
	if (httpMethod == 'GET' && httpParams != null) {
		httpUrl = httpUrl + "?" + httpParams;
	}
	httpRequest.open(httpMethod, httpUrl, true);
	httpRequest.setRequestHeader(
		'Content-Type', 'application/x-www-form-urlencoded');
	httpRequest.onreadystatechange = callback;
	httpRequest.send(httpMethod == 'POST' ? httpParams : null);
}

function fnCheckSSNToServer() {
	var frm = document.frmSSNCheck ;
	var ssn2 = frm.ssn2.value ;
	var GroupCount = frm.GroupCount.value ;
	if(ssn2=="") {
		alert("주민등록번호 뒷자리를 입력해 주세요.");
		frm.ssn2.focus();
		return ;
	}
	var params = "ssn2=" + escape(ssn2) + "&GroupCount=" + escape(GroupCount) ;
	sendRequest("/include/SsnCheck.inc.xml.php", params, fnCheckSSNFromServer, "POST");
}

function fnCheckSSNFromServer() {
	var frm = document.frmSSNCheck ;
	if(httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var docElement = httpRequest.responseXML;
			var temp = docElement.getElementsByTagName("Tree");
			code = temp(0).childNodes(0).text;
			if(code=="Y") {				
				frm.submit();
			}else{
				alert("주민등록 뒷번호를 정확하게 입력해 주세요.");
				frm.ssn2.value = "" ;
				frm.ssn2.focus();
				return ;
			}
		}
	}
}
