var mainpart = "/website4eng";

/*------------------------------------------------------------------------------------------------*/
/* User Define -----------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------*/

// Sub Page ÀÇ BorderLine Àç¼³Á¤
function _DivHeightReset() {
	var bodyheight = document.body.scrollHeight;
	document.all['Sub_BorderLine'].style.height = bodyheight - 382;
}

// ±³Á÷¿ø/¼º½ÅÀÎ/¿¹ºñ¼º½ÅÀÎ ºÒ·¯³»´Â ÇÔ¼ö (¸ÞÀÎÇÃ·¹½¬¾È¿¡¼­ È£ÃâµÊ)
function _DivLink1Showing() {
  document.all['Main_Link1'].style.display='block';	
}

// °Ö·¯¸®¿¡ »çÁø ÆË¾÷½Ã±â´Â ÇÔ¼ö
function _img_view(img) {
	window.open(mainpart+"/common/popup_imgview.html?img="+img,"imgview","scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no,width=100,height=100");
}

/*------------------------------------------------------------------------------------------------*/
/* Global Define ---------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------*/

/**¸µÅ© Á¡¼±¾ø¾Ö´Â ¼Ò½º**/
function bluring(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring; 

// Ã¹À§Ä¡·Î ½ºÅ©·Ñ (onclick="_back_top();")
function _back_top()
{
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
        step = 10;

        while ((x != 0) || (y != 0)) {
                scroll (x, y);
                step += (step * step / 300);
                x -= step;
                y -= step;
                if (x < 0) x = 0;
                if (y < 0) y = 0;
        } 
        scroll (0, 0);
}

// flash, movie Å×µÎ¸® ¾ø´Â ½ÇÇàÀ» À§ÇÑ object launch
function objectlaunch(obcode)
{
    document.write(obcode);
}

// ÁÂÃø¸Þ´ºÀÇ mouseover event 
function _mouseover(fol,val) {
    document.all[val].src=mainpart+'/images/'+fol+'/'+val+'_ov.gif';
}
function _mouseout(fol,val) {
    document.all[val].src=mainpart+'/images/'+fol+'/'+val+'.gif';
}

function getCookie( name )
{
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return "";
}

function setCookie( name, value, expiredays ) {
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}





// sub page tab
function Khc_Tab(m_id){
	bg_class = "k1"
	var cName = document.getElementById(m_id).className + " " + bg_class
	document.getElementById(m_id).className = cName
	var tList = document.getElementById(m_id).getElementsByTagName("a");

	var noticeSave = 0;

	// ¼ö¾÷ÆäÀÌÁö ¿¹¿ÜÃ³¸®
	if(m_id == "tabLesson"){
		var noticeSave = 1;
	}

	// ¿¬Çõ ¿¹¿ÜÃ³¸®
	if(m_id == "tabHistory"){
		var noticeSave = 4;
	}

	for (i=0;i<tList.length;i++) {
		TabPlay = function() {
			for (y=0;y<tList.length;y++) {
			tList[y].className = "";
			document.getElementById(m_id + "_sub" + (y+1)).style.display = "none";
			if(this==tList[y]){x=y+1}
			}
			this.className = this.className + "on";
			document.getElementById(m_id + "_sub" + x).style.display = "block";
			document.getElementById(m_id).className = cName.replace(bg_class,"k" + x);

			var $jj = j$;
			var obj = $jj("#"+m_id);
			var objC =obj.find(">li");
			var cnt = objC.find("a").index($jj(this));
			var oldTab = objC.eq(noticeSave).find(">a");
			var oldTabImg = oldTab.find(">img").get(0);
			oldTabImg.src = oldTabImg.src.replace("_ov.gif",".gif");
			var newTab = objC.eq(cnt).find(">a");
			var newTabImg = newTab.find(">img").get(0);
			newTabImg.src = newTabImg.src.replace(".gif","_ov.gif");

			noticeSave = cnt;
		}
		tList[i].onclick = TabPlay;
		if(arguments[1]=="Mover"){tList[i].onmouseover = TabPlay;}
	}
}
