////////////////////////////////////////////////////////////////////////////////////////////////////////

//                                     [200812 hobread's js]

////////////////////////////////////////////////////////////////////////////////////////////////////////

/*******************************************************************************************************

	배경 이미지 깜박거림(Background Image Flicker) 및 배경이미지의 반복적인 다운로드 문제
	Internet Explorer 6 서비스 팩 1(Windows XP SP1) 이후 브라우저를 위한 해결.
	
********************************************************************************************************/
try {
    doument.execCommand("BackgroundImageCache", false, true);
} catch(ignored) {}

function MM_swapImgRestore() { //v3.0
	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]; }
}

/********************************************************************************************************
		//toggle
/********************************************************************************************************/
  function toggle(lay) {
  			document.getElementById(lay).style.display = document.getElementById(lay).style.display == "none" ? "" : "none";
  		};
	
/********************************************************************************************************

				ie6의 PNG 이미지 표현 함수

********************************************************************************************************/
function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    obj.src='';  
    return ''; 
} 

/*********************************************************************************************************/

//메세지 출력후 이동
function moveAfterAlert(msg, link) {
	alert(msg);
	location.href = link;
}

//강의시간표와 종합반 소개 레이어 조정
var display_kyshigh = 0;
function display_layer(idname)
{
	
	var intro = document.getElementById('intro');
	var sch = document.getElementById('sch');
	var aintro = document.getElementById('aintro');	
	var asch = document.getElementById('asch');
	var viewobj = document.getElementById('viewname');

	
	
	if(idname == 'intro')
	{		
		
		intro.style.display='block';
		aintro.className="select";	
		viewobj.val='';
		if(display_kyshigh == 1)
		{
			sch.style.display='none';	
			asch.className="";
		}
		

	}
	else if(idname == 'sch')
	{	
		
		if(display_kyshigh == 0)
		{
			alert('준비중입니다.');
			
		}
		else
		{
			aintro.className="";		
			asch.className="select";		
			sch.style.display='block';
			intro.style.display='none';
		}
		
		
	}
	

}
function setdisplay_kyshigh(bdisplay)
{
	display_kyshigh=bdisplay;
}

/*******************************************************************************************************
  
  Quick Menu
  
********************************************************************************************************/

function zoomDefault() 
{ 
    nowZoom = 100; 
    document.body.style.zoom = nowZoom + "%"; 
} 
// Quick Menu
var stmnLEFT = 996; // 왼쪽 여백 (메뉴가 오른쪽에서 지정된 음수값 픽셀만큼 떨어진 곳에 보여집니다)
var stmnGAP1 = 198; // 위쪽 여백 (메뉴가 위에서 10픽셀 떨어진 곳에 보여집니다)
var stmnGAP2 = 10; // 스크롤시 브라우저 위쪽과 떨어지는 거리
var stmnBASE = 100; // 스크롤 시작위치
var stmnActivateSpeed = 10;
var stmnScrollSpeed = 100;
var stmnTimer;

//기존 사용하던 오른쪽 퀵배너
function RefreshStaticMenu() {
	var stmnStartPoint, stmnEndPoint;

	stmnStartPoint = parseInt(document.getElementById('quick_menu').style.top, 10);
	stmnEndPoint = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + stmnGAP2;
	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

	if (stmnStartPoint != stmnEndPoint) {
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		document.getElementById('quick_menu').style.top = parseInt(document.getElementById('quick_menu').style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount ) + 'px';
		stmnRefreshTimer = stmnScrollSpeed;
	}

	stmnTimer = setTimeout("RefreshStaticMenu();", stmnActivateSpeed);
}
function InitializeStaticMenu() {
	document.getElementById('quick_menu').style.marginLeft = stmnLEFT + 'px';
	document.getElementById('quick_menu').style.top = document.body.scrollTop + stmnBASE + 'px';
	RefreshStaticMenu();
}
//

//D-Day 포함 오른쪽 퀵배너
function RefreshStaticMenu_1() {
	var stmnStartPoint, stmnEndPoint;

	stmnStartPoint = parseInt(document.getElementById('quick_menu').style.top, 10) + 5;
	stmnEndPoint = Math.max(document.documentElement.scrollTop, document.body.scrollTop);

	if (stmnEndPoint < stmnGAP1) stmnEndPoint = 0;

	if (stmnStartPoint != stmnEndPoint) {
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		document.getElementById('quick_menu').style.top = parseInt(document.getElementById('quick_menu').style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount ) + 'px';
		stmnRefreshTimer = stmnScrollSpeed;
	}

	stmnTimer = setTimeout("RefreshStaticMenu_1();", stmnActivateSpeed);
}

function InitializeStaticMenu_1() {
	document.getElementById('quick_menu').style.marginLeft = stmnLEFT + 'px';
	document.getElementById('quick_menu').style.top = '-5px';
	RefreshStaticMenu_1();
}
/********************************************************************************************************
*
*				User info
*
********************************************************************************************************/
	var agent	= navigator.userAgent.toLowerCase();
	var User	= {
		version	: agent.replace(/.*(?:rv|it|ra|ie|on|ox)[\/: ]([\d.]+).*/, "$1"),
		browser	: agent.replace(/.*(msie|opera|apple|mozilla).*/, "$1"),
		doc		: null,
		referrer: document.referrer
	};

/********************************************************************************************************
*
*				type info
*
********************************************************************************************************/
	function isArray(obj_){
		return typeof obj_ == "object" && obj_.constructor === Array;
	};
	
	function isElement(obj_){
		return typeof obj_ == "object" && /[A-Z]/.test(obj_.tagName);
	};


/********************************************************************************************************
*
*				elements
*
********************************************************************************************************/
	function el(){
		var owner, i = 0;
		if(isElement(arguments[i]))
			owner	= arguments[i ++];
		if(!arguments[i])
			return	owner || document;
		if(arguments.length > i + 1){
			var array	= [];
			for(var len = arguments.length; i < len; i ++)
				array.push(owner ? el(owner, arguments[i]) : el(arguments[i]));
			return array;
		}

		return	/[^A-Z]/.test(arguments[i]) ?
				document.getElementById(arguments[i]) :
				(owner || document).getElementsByTagName(arguments[i]);
	};

	
/********************************************************************************************************
*
*				Flash Embed Write
*
********************************************************************************************************/
	function writeFlash(path_, width_, height_, flashvars_, transparent_){
		width_			= width_ || "100%";
		height_			= height_ || "100%";
		flashvars_		= flashvars_ || "";
		transparent_	= transparent_ ? "window" : "transparent";
		var n			= 0, strFlash;
		while(el("flashMedia_" + n))
			n++;
		if(User.browser == "msie")
			strFlash	= "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"" + width_ + "\" height=\"" + height_ + "\" id=\"flashMedia_" + n + "\">"
						+ "    <param name=\"movie\" value=\"" + path_ + "\">"
						+ "    <param name=\"menu\" value=\"false\">"
						+ "    <param name=\"wmode\" value=\"" + transparent_ + "\">"
						+ "    <param name=\"quality\" value=\"high\">"
						+ "    <param name=\"allowscriptaccess\" value=\"always\">"
						+ "    <param name=\"flashvars\" value=\"" + flashvars_ + "\">"
						+ "</object>";
		else
			strFlash	= "<embed src=\"" + path_ + "\" quality=\"high\" wmode=\"" + transparent_ + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width_ + "\" height=\"" + height_ + "\" allowScriptAccess=\"always\" name=\"" + flashvars_ + "\" flashvars=\"" + flashvars_ + "\"></embed>";

		document.write(strFlash);
	};


		



	
/********************************************************************************************************
*
*				Flash Embed Write 왼쪽메뉴의 경우 높이 조정을 위해서...object id 값을 줌
*
********************************************************************************************************/
	function writeFlashLeft(path_, width_, height_, flashvars_, transparent_){
		width_			= width_ || "100%";
		height_			= height_ || "100%";
		flashvars_		= flashvars_ || "";
		transparent_	= transparent_ ? "window" : "transparent";
		var n			= 0, strFlash;
		while(el("flashMedia_" + n))
			n++;
		if(User.browser == "msie")
			strFlash	= "<object id='lnb' classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"" + width_ + "\" height=\"" + height_ + "\" id=\"flashMedia_" + n + "\">"
						+ "    <param name=\"movie\" value=\"" + path_ + "\">"
						+ "    <param name=\"menu\" value=\"false\">"
						+ "    <param name=\"wmode\" value=\"" + transparent_ + "\">"
						+ "    <param name=\"quality\" value=\"high\">"
						+ "    <param name=\"allowscriptaccess\" value=\"always\">"
						+ "    <param name=\"flashvars\" value=\"" + flashvars_ + "\">"
						+ "</object>";
		else
			strFlash	= "<embed id='lnb2' src=\"" + path_ + "\" quality=\"high\" wmode=\"" + transparent_ + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width_ + "\" height=\"" + height_ + "\" allowScriptAccess=\"always\" name=\"" + flashvars_ + "\" flashvars=\"" + flashvars_ + "\"></embed>";

		document.write(strFlash);
	};