/*
------------------------------------------------------------
website : http://www.scienceall.com/
File Name : script.js
Maker : UI Factory / IdeuMotion (ideumotion@gmail.com)
Date : 2010 / April
explanation : ±âº»ÀûÀÎ java script¼Ó¼º Á¤ÀÇ
------------------------------------------------------------
*/

document.title="Áñ°Å¿î °úÇÐ¼¼»ó »çÀÌ¾ð½º¿Ã"; // title

function pop(url,name,w,h) { window.open(url,name,'width='+w+',height='+h+',scrollbars=auto') } // Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h) { window.open(url,name,'width='+w+',height='+h+',scrollbars=yes') } // Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)

function flashAM(URL,width,height,vars,bgColor,winmode) { //ÇÃ·¡½Ã Ãâ·Â

	var id=URL.split("/")[URL.split("/").length-1].split(".")[0];
	if(vars==null) vars='';
	if(bgColor==null) bgColor='#FFFFFF';
	if(winmode==null) winmode='opaque';

	document.write("	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' "); 
	document.write("		width='"+width+"' height='"+height+"' id='"+id+"' align='middle'> ");
	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie'	value='"+URL+"' /> ");
	document.write("	<param name='FlashVars'		alue='"+vars+"' /> ");
	document.write("	<param name='wmode'	value='"+winmode+"' /> ");
	document.write("	<param name='menu'			value='false' /> ");
	document.write("	<param name='quality'		value='high' /> ");
	document.write("	<param name='bgcolor'	value='"+bgColor+"' /> ");
	document.write("	<embed src='"+URL+"' flashVars='"+vars+"' wmode='"+winmode+"' menu='false' quality='high' ");
	document.write("		bgcolor='"+bgColor+"' width='"+width+"' height='"+height+"' name='"+id+"' align='middle' ");
	document.write("		allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /> ");
	document.write("	</object> ");
}


function setPng24(obj) { //ie6Àü¿ë pngÀÌ¹ÌÁö Åõ¸íÃ³¸®
	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 ''; 
}



/* ie 6.0 background »ç¿ë½Ã flicker Çö»ó ¹æÁö */
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


/* ¸µÅ©½Ã Á¡¼± Á¦°Å */
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring;


/* ÅëÇÕ°Ë»ö ¼¿·ºÆ®¹Ú½º */
function commonSearchSelect(){
	if (document.getElementById('commonSearchSelect').style.display == "block"){
		document.getElementById('commonSearchSelect').style.display = "none";
		document.getElementById('commonSearchArrow').src = "/images10/search/btn_searchform_arrow_01_off.gif";
		document.getElementById('commonSearchArrow').alt = "¿­±â";
	}else{
		document.getElementById('commonSearchSelect').style.display = "block";
		document.getElementById('commonSearchArrow').src = "/images10/search/btn_searchform_arrow_01_on.gif";
		document.getElementById('commonSearchArrow').alt = "´Ý±â";
	}
}


// Å×ÀÌºí tr »ö»óº¯°æ
function tableOverSet(obj, color){
        obj.style.backgroundColor=color;
        obj.onmouseout = function(){
                obj.style.backgroundColor='#ffffff'; //mouseOut
        }
}



//Å¬¸¯½Ã ¼û±ä¸Þ´º º¸ÀÌ±â
function testlMenu(obj,e){
	if(!e) e=window.event;
	util.$("hidMenu").style.display = "block";
	util.$("hidMenu").style.top = util.getDoffset(obj)[1];
	util.$("hidMenu").style.left = util.getDoffset(util.$("body"))[0]-util.getDoffset(obj)[0]+obj.offsetWidth+50;
}



// º¸ÀÌ±â
function showEl(id){
	try{
		document.getElementById(id).style.display = '';
	}catch(e){
	}
}

// ¼û±â±â
function hideEl(id){
	try{
		document.getElementById(id).style.display = 'none';
	}catch(e){
	}
}


//Çì´õ ¸Þ´º Á¶Á¤
function headNaviResize(type){
if(type==1) document.getElementById("gnbMenu").className = "headNaviOpen";
else document.getElementById("gnbMenu").className = "headNaviClose";
}


/* quick ¸Þ´º*/
var quickMenu_limit_top = 0; // ÀüÃ¼ ÆäÀÌÁö ±âÁØ À§ÂÊ ÇÑ°è ÇÈ¼¿ 
var quickMenu_margin_top = 445; // ÇöÀç º¸°í ÀÖ´Â È­¸é ±âÁØ À§ÂÊ ÇÑ°è ÇÈ¼¿
var quickMenu_margin_bottom = 380; // ¾Æ·¡ÂÊ ÇÑ°è ÇÈ¼¿
var quickMenu_speed = 8; // ÇÑ¹ø¿¡ ¿òÁ÷ÀÌ´Â ÇÈ¼¿ °£°Ý
var quickMenu_interval = 10; // ¿òÁ÷ÀÌ´Â ½Ã°£ °£°Ý



setInterval ("quickscroll()", quickMenu_interval);

function quickscroll() {

if(document.documentElement.offsetHeight < 600)	quickMenu_margin_top = 360;

quickmenu = document.getElementById ("pageTop");

 if (quickmenu) {

  quickmenu_move_y = document.documentElement.scrollTop + quickMenu_margin_top;
  if (quickmenu_move_y < quickMenu_limit_top ) quickmenu_move_y = quickMenu_limit_top;

  nowTop = parseInt(quickmenu.style.top);

  minus = nowTop - quickmenu_move_y;
  if (Math.abs(minus) >= quickMenu_speed ) minus = 0;

  if ( nowTop != quickmenu_move_y) moving = ( nowTop > quickmenu_move_y) ? (quickMenu_speed * -1) : quickMenu_speed;
  else moving = 0;

  nextPos = nowTop + (moving - minus);

 // if (nextPos + quickMenu_margin_bottom > document.body.scrollHeight ) nextPos = document.body.scrollHeight - quickMenu_margin_bottom;
  if (nextPos + quickmenu.offsetHeight + quickMenu_margin_bottom  > document.documentElement.scrollHeight   ) nextPos = document.documentElement.scrollHeight - quickmenu.offsetHeight - quickMenu_margin_bottom  ;

  quickmenu.style.top = parseInt(nextPos);

 }

}



/*¿¡µà¸ÞÀÎ ÅÇ½ºÅ©¸³Æ®*/

//Àç¹Õ´Â ½ÇÇè ±³½Ç
function eduSchchange(p) {
		try{
			eduScichangeAll() //°úÇÐ±³°ú¼­´Ý°í
			eduMathchangeAll()  //¼öÇÐ±³°ú¼­ ´Ý°í
		}catch(e){
			alert(e);
		}
		var screen = new Array();
        screen[0] = document.getElementById('schLevel_01');
        screen[1] = document.getElementById('schLevel_02');
        screen[2] = document.getElementById('schLevel_03');
        screen[3] = document.getElementById('schLevel_04');
        screen[4] = document.getElementById('schLevel_05');
        screen[5] = document.getElementById('schLevel_06');
        screen[6] = document.getElementById('schLevel_07');
        screen[7] = document.getElementById('schLevel_08');

        for(var i=0 ; i<screen.length ; i++)
        {
                if(i == p)
                        screen[i].style.display = '';
                else
                        screen[i].style.display = 'none';
        }
        ctn1 = p+1;
        act1=false;
}

function eduSchchangeAll() {
	var screen = new Array();
    screen[0] = document.getElementById('danwonList01');
    screen[1] = document.getElementById('danwonList02');
    screen[2] = document.getElementById('danwonList03');
    screen[3] = document.getElementById('danwonList04');
    screen[4] = document.getElementById('danwonList05');
    screen[5] = document.getElementById('danwonList06');
    screen[6] = document.getElementById('danwonList07');
    screen[7] = document.getElementById('danwonList08');

    for(var i=0 ; i<screen.length ; i++)
    {
    	screen[i].style.display = 'none';
    }
}

//Àç¹Õ´Â ¼öÇÐ±³°ú¼­
function eduMathchange(p) {
		try{
			eduScichangeAll();	//°úÇÐ´Ý°í
			eduSchchangeAll();  //½ÇÇè½Ç´Ý°í
		}catch(e){
			alert(e)
		}
		var screen = new Array();
        screen[0] = document.getElementById('mathLevel_01');
        screen[1] = document.getElementById('mathLevel_02');
        screen[2] = document.getElementById('mathLevel_03');
        screen[3] = document.getElementById('mathLevel_04');

        for(var i=0 ; i<screen.length ; i++)
        {
                if(i == p)
                        screen[i].style.display = '';
                else
                        screen[i].style.display = 'none';
        }
        ctn2 = p+1
        act2=false;
}

function eduMathchangeAll() {
	var screen = new Array();
    screen[0] = document.getElementById('mathList01');
    screen[1] = document.getElementById('mathList02');
    screen[2] = document.getElementById('mathList03');
    screen[3] = document.getElementById('mathList04');

    for(var i=0 ; i<screen.length ; i++)
    {
            screen[i].style.display = 'none';
    }
}

//½Å³ª´Â °úÇÐ±³°ú¼­
function eduScichange(p) {
		try{
			eduSchchangeAll()
			eduMathchangeAll()
		}catch(e){
			alert(e)
		}
		var screen = new Array();
        screen[0] = document.getElementById('sciLevel_01');
        screen[1] = document.getElementById('sciLevel_02');
        screen[2] = document.getElementById('sciLevel_03');

        for(var i=0 ; i<screen.length ; i++)
        {
                if(i == p)
                        screen[i].style.display = '';
                else
                        screen[i].style.display = 'none';
        }
        ctn3=p+1
        act3=false;
}

function eduScichangeAll() {
	var screen = new Array();
    screen[0] = document.getElementById('sciList01');
    screen[1] = document.getElementById('sciList02');
    screen[2] = document.getElementById('sciList03');

    for(var i=0 ; i<screen.length ; i++)
    {
        screen[i].style.display = 'none';
    }
}



function eduRight(p) {
	var screen = new Array();
    screen[0] = document.getElementById('eduQuickmenu_01');
    screen[1] = document.getElementById('eduQuickmenu_02');
    screen[2] = document.getElementById('eduQuickmenu_03');
    screen[3] = document.getElementById('eduQuickmenu_04');
    screen[4] = document.getElementById('eduQuickmenu_05');
    screen[5] = document.getElementById('eduQuickmenu_06');
    screen[6] = document.getElementById('eduQuickmenu_07');
    screen[7] = document.getElementById('eduQuickmenu_08');
    screen[8] = document.getElementById('eduQuickmenu_09');
    screen[9] = document.getElementById('eduQuickmenu_10');
    screen[10] = document.getElementById('eduQuickmenu_11');
    screen[11] = document.getElementById('eduQuickmenu_12');
    
    var img = new Array();
    img[0] = document.getElementById('rbanner1');
    img[1] = document.getElementById('rbanner2');
    img[2] = document.getElementById('rbanner3');
    img[3] = document.getElementById('rbanner4');
    img[4] = document.getElementById('rbanner5');
    img[5] = document.getElementById('rbanner6');
    img[6] = document.getElementById('rbanner7');//Áß1
    img[7] = document.getElementById('rbanner8');
    img[8] = document.getElementById('rbanner9');
    img[9] = document.getElementById('rbanner10');//°í1
    img[10] = document.getElementById('rbanner11');
    img[11] = document.getElementById('rbanner12');

    for(var i=0 ; i<img.length ; i++)
    {
    	var num = i+1;
        if(i==6 || i==9)
        	num =1;
        if(i==7 || i==10)
        	num =2;
        if(i==8 || i==11)
        	num =3;
        
            if(i == p){
                    screen[i].style.display = '';
                    img[i].src = CONST_IMAGE_URL+ "/images10/sitemap/rbanner_"+num+"_on.gif";
            }
            else{
                    screen[i].style.display = 'none';
                    img[i].src = CONST_IMAGE_URL+ "/images10/sitemap/rbanner_"+num+".gif";
            }
    }
}


function mainTopchange(p) {
	var screen = new Array();
    screen[0] = document.getElementById('contTab01_01');
    screen[1] = document.getElementById('contTab01_02');
    screen[2] = document.getElementById('contTab01_03');
    screen[3] = document.getElementById('contTab01_04');
    screen[4] = document.getElementById('contTab01_05');
    screen[5] = document.getElementById('contTab01_06');

    for(var i=0 ; i<screen.length ; i++)
    {
            if(i == p)
                    screen[i].style.display = '';
            else
                    screen[i].style.display = 'none';
    }
}



/*¿¡µàÄü¸Þ´ºÇÐ³âº°´Ü¿øÆîÄ§*/
function eduQuickMenu(tabContainerID, change) {
	change = (typeof(change) != 'undefined') ? change : 'none';
	//document.location.hash
	var default_open = '';
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (change == 'image') {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else if(change == 'parent') {
					currentmenu.parentNode.className = currentmenu.className.replace(" on", "");
				} else if(change == 'a') {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (change == 'image') {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else if(change == 'parent') {
				this.parentNode.className += " on";
			} else if(change == 'a') {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		//if (!thismenu.container.first)
			//thismenu.container.first = thismenu;

		if(change == 'image'){
			if(thismenu.imgEl.src.lastIndexOf('_on.gif') != -1){
				thismenu.imgEl.src = thismenu.imgEl.src.replace("_on.gif", ".gif");
				default_open = thismenu;
			}
		}else if(change == 'parent'){
			if(thismenu.parentNode.className.lastIndexOf(' on') != -1){
				thismenu.parentNode.className = thismenu.parentNode.className.replace(" on", "");
				default_open = thismenu;
			}
		}else if(change == 'a'){
			if(thismenu.className.lastIndexOf(' on') != -1){
				thismenu.className = thismenu.className.replace(" on", "");
				default_open = thismenu;
			}
		}

		/*
		if(document.location.hash.split('#')[1] && document.location.hash.split('#')[1] == thismenu.href.split('#')[1]){
			default_open = thismenu;
		}
		*/
	}

	if(default_open){
		default_open.onclick();
	}else{
		if(tabContainer.first) tabContainer.first.onclick();
	}

}



// Tab Content
function initTabMenu(tabContainerID, change) {
	change = (typeof(change) != 'undefined') ? change : 'none';
	//document.location.hash
	var default_open = '';
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (change == 'image') {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else if(change == 'parent') {
					currentmenu.parentNode.className = currentmenu.className.replace(" on", "");
				} else if(change == 'a') {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (change == 'image') {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else if(change == 'parent') {
				this.parentNode.className += " on";
			} else if(change == 'a') {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;

		if(change == 'image'){
			if(thismenu.imgEl.src.lastIndexOf('_on.gif') != -1){
				thismenu.imgEl.src = thismenu.imgEl.src.replace("_on.gif", ".gif");
				default_open = thismenu;
			}
		}else if(change == 'parent'){
			if(thismenu.parentNode.className.lastIndexOf(' on') != -1){
				thismenu.parentNode.className = thismenu.parentNode.className.replace(" on", "");
				default_open = thismenu;
			}
		}else if(change == 'a'){
			if(thismenu.className.lastIndexOf(' on') != -1){
				thismenu.className = thismenu.className.replace(" on", "");
				default_open = thismenu;
			}
		}

		/*
		if(document.location.hash.split('#')[1] && document.location.hash.split('#')[1] == thismenu.href.split('#')[1]){
			default_open = thismenu;
		}
		*/
	}

	if(default_open){
		default_open.onclick();
	}else{
		if(tabContainer.first) tabContainer.first.onclick();
	}

}














