function validateLogin() {
	var f = document.loginForm;

	if (f.userid.value.search(/\S/) < 0 || f.userid.value == '아이디') {
		alert("아이디를 입력하세요");
		f.userid.focus();
		return false;
	}

	if (f.passwd.style.display == 'none') {
		f.passwd_1.style.display = 'none';
		f.passwd.style.display = 'block';

		alert("비밀번호를 입력하세요");
		f.passwd.focus();
		return false;
	}

	if (f.passwd.value.search(/\S/) < 0) {
		alert("비밀번호를 입력하세요");
		f.passwd.focus();
		return false;
	}

	var day = new Date();
	day.setMonth( day.getMonth()+ ( f.saveId.checked ? 1 : -1 ) )
	document.cookie = "login_saved=" + f.userid.value + "; path=/; expires=" + day.toGMTString() + ";"

	if( f.ret_url && !f.ret_url.value ) {
		f.ret_url.value = escape(location.pathname + "?" +  location.search.substring(1));
	}

	f.action = "/ebs/fhz.AilSSOLoginSubmit.laf";
	f.submit();
}

function clear_logintext(type) {
	if (type == 'id') {
		document.getElementById("idLabel").style.display = "none";
	} else {
		document.getElementById("pwLabel").style.display = "none";
	}
}

function clearKeyword(obj) {
	if (srch != '' && obj.value == srch && !clear_flag) {
		obj.value = '';
		clear_flag = true;
		
		var f = document.srchForm;
		f.target = "_self";
		f.action = "/ebs/bsz.BscMainSrch.laf";
	}
}

function attendHistView(o) {
	var value = o.value;

	if (value != '') {
		var arr = value.split("|");
		location.href = "/ebs/flz.AlcLessonList.laf?courseId="+arr[0]+"&mid="+arr[1];
	}
}

function goFamilySite(o) {
	if (o.value != '') {
	    window.open(o.value, '_blank', 'fullscreen=no,resizable=yes,menubar=yes,status=yes,toolbar=yes,titlebar=yes,location=yes,scrollbars=yes');
	}
}

function getSavedId(){
	var cookieValue = document.cookie+';';
	index1 = cookieValue.indexOf('login_saved', 0);

	if(index1 != -1){
		cookieValue = cookieValue.substring(index1, cookieValue.length);
		var index2 = cookieValue.indexOf('=', 0) + 1;
		var index3 = cookieValue.indexOf(';', index2);

		var userId = unescape(cookieValue.substring(index2, index3));

		if(userId != ''){
			if (document.loginForm) {
				document.loginForm.userid.value = userId;
				document.loginForm.saveId.checked = true;
			}
		}
	}
}

//플래쉬 테두리 없애기
function setObjectTag(Target, TagID){
	var objObject = document.getElementById(TagID);
	var objTarget = document.getElementById(Target);
	var txtObject = objObject.value;	

	objTarget.innerHTML = txtObject;	
}

function setPViewCookie( name, value, expiredays ) {
	var todayDate = new Date();

	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/;"
}

function comnForumLogin() {
	if ( parent ) {
		var ret_url = escape(parent.document.location.pathname + "?" +  parent.document.location.search.substring(1));

		parent.document.location.href = "/ebs/fhz.AilSSOLoginForm.laf?ret_url=" + ret_url;
	}
	else if ( opener ) {
		if ( !opener.closed ) {
			var ret_url = escape(opener.document.location.pathname + "?" +  opener.document.location.search.substring(1));

			opener.document.location.href = "/ebs/fhz.AilSSOLoginForm.laf?ret_url=" + ret_url;
		}

		self.close();
	}
	else {
		history.back(-1);
	}
}

/* 온에어 관련 스크립트 */
//	var strOnAirServiceDomain = "www.ebslang.co.kr";
	var strOnAirServiceDomain = "www.ebsi.co.kr";
	var boolOnairIsServiceOn = true;
	var strOnairServiceMsg = "원할한 서비스 제공을 위하여 현재 시스템 점검 중 입니다.\n빠른 시간내에 서비스를 재개 하도록 하겠습니다.";

	// 큰사이즈 온에어 재생창 - EBSe
	function	QuickLink041(){
		if ( boolOnairIsServiceOn ) {
			var width = 570;
			var height = 540;
			
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;

			document.Quick.chnnel.value = "300";
			document.Quick.action = "/ebs/jsp/fhz/onAir/onAir_Player.jsp";
			
			window.open("", "Quick", "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
			
			document.Quick.target = "Quick";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}

	// 작은사이즈 온에어 재생창 - EBSe
	function	QuickLink041_2(){
		if ( boolOnairIsServiceOn ) {
			var width = 349;
			var height = 375;
			
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;

			document.Quick.chnnel.value = "300";
			document.Quick.action = "/ebs/jsp/fhz/onAir/onAir_Player2.jsp";
			
			window.open("", "Quick", "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
			
			document.Quick.target = "Quick";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}

	// 온에어 바뀐 창(091014)
	function	onairNewPlayPop(){
		if ( boolOnairIsServiceOn ) {
			var width = 575;
			var height = 580;
			
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;

			document.Quick.chnnel.value = "300";
			document.Quick.action = "/ebs/fhz.AbpOnairPlayerPop.laf";
			
			window.open("", "Quick", "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
			
			document.Quick.target = "Quick";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}

	// EBS TV
	function	renewalQuickLink012()
	{ 
		if ( boolOnairIsServiceOn ) {
			var width = 580;
			var height = 580;
	
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;
	
			document.Quick.brodgb.value = "L-TV";
			document.Quick.action = "http://" + strOnAirServiceDomain + "/ebs/jsp/apz/etc/etcOnAirPlayer.jsp?onair_ch=TV";
	
			window.open('',"OnPopup", "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
	
			document.Quick.target = "OnPopup";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}

	// EBS Radio
	function	renewalQuickLink013()
	{
		if ( boolOnairIsServiceOn ) {
			var width = 580;
			var height = 580;
			
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;
	
			document.Quick.speed.value = "H";
			document.Quick.action = "http://" + strOnAirServiceDomain + "/ebs/jsp/apz/etc/etcOnAirPlayer.jsp?onair_ch=RADIO";
	
			window.open("", 'OnPopup', "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
	
			document.Quick.target = "OnPopup";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}

	// EBS Plus1
	function	renewalQuickLink014()
	{
		if ( boolOnairIsServiceOn ) {
			var width = 580;
			var height = 580;
			
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;
	
			document.Quick.brodgb.value = "PLUS1";
			document.Quick.action = "http://" + strOnAirServiceDomain + "/ebs/jsp/apz/etc/etcOnAirPlayer.jsp?onair_ch=PLUS1";
			window.open("", "Quick", "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
			
			document.Quick.target = "Quick";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}

	// EBS Plus2
	function	renewalQuickLink015()
	{ 
		if ( boolOnairIsServiceOn ) {
			var width = 580;
			var height = 580;
	
			var x = (screen.width - width) / 2 - 4;
			var y = (screen.height - height) / 2 - 16;
	
			document.Quick.brodgb.value = "PLUS2";
			document.Quick.action = "http://" + strOnAirServiceDomain + "/ebs/jsp/apz/etc/etcOnAirPlayer.jsp?onair_ch=PLUS2";
	
			window.open("", 'OnPopup', "width="+width+",height="+height+",top="+y+",left="+x+",scrollbars=no");
	
			document.Quick.target = "OnPopup";
			document.Quick.submit();
		}
		else {
			alert(strOnairServiceMsg);
		}
	}
/* 온에어 관련 스크립트 */

//add Bookmark
function bookmarksite(url,title){
	if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} else if(document.all) {// ie
		window.external.addfavorite(url, title);
	} else if (window.sidebar) { // firefox
		window.sidebar.addPanel(title, url, "");
	}
}