
//document.domain = "uway.com";
document.domain = "knou.ac.kr";
document.title="ÇÑ±¹¹æ¼ÛÅë½Å´ëÇÐ±³";	// Å¸ÀÌÆ²
document.write("<script type='text/javascript' src='/js/ui.js'></script>");
document.write("<script type='text/javascript' src='/js/menu.js'></script>");

var IE = (navigator.appName.indexOf("Microsoft")>-1);
var IE6 = (navigator.appName.indexOf("Microsoft")>-1)&&(navigator.userAgent.indexOf("MSIE 6")>-1);
var IE7 = (navigator.appName.indexOf("Microsoft")>-1)&&(navigator.userAgent.indexOf("MSIE 7")>-1);

var depth1="",depth2="",depth3="";	// °¢ ÆäÀÌÁö¿¡ ¸Â°Ô Å¾¸Þ´º,ÁÂÃø¸Þ´º°¡ ÀÚµ¿À¸·Î È°¼ºÈ­µÇ°Ô ÇÏ±âÀ§ÇÑ ¸Þ´ºÀÇ depth ÀÇ °ªÀúÀå
var topMenuCount = 4;	// Å¾¸Þ´º°¹¼ö (´ëÇÐ¼Ò°³, ´ëÇÐ/´ëÇÐ¿ø, ÀÔÇÐ¾È³», ´ëÇÐ»ýÈ°) ÃÑ 4°³
var global_topFocusId = "";	// Å¾¸Þ´º¿¡¼­ ÇöÀç Æ÷Ä¿½º°¡ µÈ °´Ã¼ ID ÀÓ½ÃÀúÀåº¯¼ö
var global_leftFocusId = "";	// ÁÂÃø¸Þ´º¿¡¼­ ÇöÀç Æ÷Ä¿½º°¡ µÈ °´Ã¼ ID ÀÓ½ÃÀúÀåº¯¼ö
var tmpDepth1 = "";	// ÁÂÃø¸Þ´º¿¡¼­ ÇöÀçÆäÀÌÁöÀÇ depth¹øÈ£¿Í ¸Þ´º¹øÈ£¸¦ ºñ°íÇØ¼­ Æ÷Ä¿½º°¡ ÀÖ´Ù¸é Å¬·¡½º¸í ³¡¿¡ _on ¸¦ ºÙÀÓ

// ÇÃ¸®Ä¿Çö»ó((flicker prevent) Á¦°Å¼Ò½º
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


// ¸ðµç ÆäÀÌÁö¿¡¼­ ÇöÀç ÆäÀÌÁöÀÇ Ä«Å×°í¸®¹øÈ£¸¦ ¼³Á¤ //
function mNavi(hNum,mNum,sNum) {
	if(hNum) {
		depth1 = hNum;
		tmpDepth1 = hNum.toString();
	}
	if(mNum) {
		depth2 = mNum;
		tmpDepth1 += "-" + mNum.toString();

	}
	if(sNum) {
		depth3 = sNum;
		tmpDepth1 += "-" + sNum.toString();
	}
}

function visual(){
	if(depth1 != ""){
		document.write('<div id="visual">');
		flashWrite('/comimg/visual'+depth1+'.swf',700,138,'','#ffffff','transparent')
		document.write('</div>');
		
	}
}


// ----------------------------------------------------
// ·Î±×ÀÎ Ã¼Å©
// ----------------------------------------------------
function homepageLoginCheck() {

    var result = false;
	var name = getCookie("knoucommon1");

	if(name != null && name != "") {
        result = true;
	}

	return result;
}

function getCookie(name)
{
	var blank='';
	var cname = name + '=';
	var dc = (document.cookie+';');
	if(dc.length > 0) {
		begin = dc.lastIndexOf(cname);
		if(begin==-1)
			begin=dc.lastIndexOf(name);
		if(dc.charAt(begin+name.length)==';')
			return '';

		if(begin != -1) {
			begin += cname.length;
			end = dc.indexOf(';', begin);
			if(end == -1)
				end = dc.length;
			if(begin==end)
				return blank;
			return unescape(dc.substring(begin, end));
		}
	}
	return null;
}

function ClearCookie(){
	//window.open('http://ep.knou.ac.kr/EP/web/login/login_chk.jsp?logout=Y&unload=Y','','left=3000,top=3000');
	var now = new Date();
	now.setDate(now.getDate() - 1);
	document.cookie = "knouCookie=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knouName=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knouMail=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();

	document.cookie = "knoucommon1=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knoucommon2=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knoustudent=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knouemployee=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knouemployeedn=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();

	document.cookie = "knouIDGB=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knouIDDGB=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "knouUid=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();
	document.cookie = "Knou_NewWorld_Info=; path=/; domain=knou.ac.kr; expires=" + now.toGMTString();

	location.reload();
	return;
}

// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, À©µµ¿ì¸ðµå)
function flashWrite(url,w,h,id,bg,win){

	// ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);

}

/***************************************
* top button
***************************************/
ScroolTop = function(className, id) {
  this.IE = document.all ? 1 : 0;
  this.NN = document.layer ? 1 : 0;
  this.N6 = document.getElementById ? 1 : 0;
  if(this.IE) this.layer = document.all(id);
  else if(this.NN) this.layer = document.layer[id];
  else if(this.N6) this.layer = document.getElementById(id);
  else return;
  this.className = className;
  this.top = this.oldY = parseInt(this.layer.style.top,10);
  setInterval(this.className + ".move()", 10);
}
ScroolTop.prototype.move = function() {
//    var diffY = (this.IE) ? document.body.scrollTop+this.top : self.pageYOffset+this.top; // Ç¥ÁØ¿¡´Â document.documentElement.scrollTop
    var diffY = (this.IE) ? document.documentElement.scrollTop+this.top : self.pageYOffset+this.top; // Ç¥ÁØ¿¡´Â document.documentElement.scrollTop
    if(diffY != this.oldY) {
        var percentY = .1 * (diffY - this.oldY);
        percentY = (percentY > 0) ? Math.ceil(percentY) : Math.floor(percentY);

        this.oldY += percentY;
        this.layer.style.top = this.oldY + "px";
    }
}

/* ÀÌ¹ÌÁö ·Ñ¿À¹ö */
function over(obj,type){
	if(type) obj.src = obj.src.replace(".gif","_.gif");
	else  obj.src = obj.src.replace("_.gif",".gif");
}

/* »õÃ¢¶ç¿ì±â */
function newOpen(url,name,mwidth,mheight,top,left,resizable,scrollbars,status,position,msg) {
	// Ã¢ È­¸é°¡¿îµ¥·Î ¶ç¿ì±â //
	if(position=="C") {
		top = (window.screen.availHeight - mheight) / 2;
		left = (window.screen.availWidth - mwidth) / 2;
		if (top < 0) Top = 0;
		if (left < 0) Left = 0;
	}
		
	if(msg.length > 0) {
		if(confirm(msg)) {
			eval('window.open(url,name,"top='+top+'px,left='+left+'px,width='+mwidth+'px,height='+mheight+'px,resizable='+resizable+',scrollbars='+scrollbars+',status='+status+'")');
		} else { 
			return false; 
		}
	} else {
		eval('window.open(url,name,"top='+top+'px,left='+left+'px,width='+mwidth+'px,height='+mheight+'px,resizable='+resizable+',scrollbars='+scrollbars+',status='+status+'")');
	}
}

/* ³»¿ë¹Ù·Î°¡±â */
function contentAcessibility() {
	document.write('<div id="skipnavi"><a href="#contents">³»¿ëÀ¸·Î ¹Ù·Î°¡±â</a></div>');
}

/* ÁÂÃøÃÖ»ó´Ü¿¡ ¹æ¼ÛÅë½Å´ëÇÐ ·Î°í */
function knouLogo() {
	document.write('<div id="topleft"><a class="logolink" id="topLogo" href="/" title="ÇÑ±¹¹æ¼ÛÅë½Å´ëÇÐ±³ ¹Ù·Î°¡±â" tabindex="1">ÇÑ±¹¹æ¼ÛÅë½Å´ëÇÐ±³ ·Î°í</a></div>');
}

/* ÁÂÃø »ó´Ü Å©°Ô,ÀÛ°Ô º¸±â */
function textZoomControl() {
	document.write('<div id="zoom_util">');
	document.write('<ul>');
	document.write('<li id="zoom_plus"><a title="±ÛÀÚÈ®´ë" onkeypress="zoomUtil(\'plus\',event)" onclick="zoomUtil(\'plus\',event)" href="#">È®´ë</a></li>');
	document.write('<li id="zoom_default"><a title="±ÛÀÚ ±âº»»çÀÌÁî" onkeypress="zoomUtil(\'default\',event)" onclick="zoomUtil(\'default\',event)" href="#">±âº»</a></li>');
	document.write('<li id="zoom_minus"><a title="±ÛÀÚÃà¼Ò" onkeypress="zoomUtil(\'minus\',event)" onclick="zoomUtil(\'minus\',event)" href="#">Ãà¼Ò</a></li>');
	document.write('</ul>');
	document.write('</div>');
}

function totalsearch() {
	var searchName = document.all.myhome.usersearch.value;
	//alert(searchName);

	
	if( searchName.indexOf("%") != -1 || searchName.indexOf("#") != -1 ||
		searchName.indexOf("@") != -1 || searchName.indexOf("&") != -1 )
	{
		alert("Æ¯¼ö¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."); //  Æ¯¼ö¹®ÀÚ °ü·Ã MessageÀÔ´Ï´Ù. 
 		return;
	}

	var returl = "http://ep.knou.ac.kr/EP/web/search/jsp/SR_DiquestSearchCheck.jsp?query=" + searchName ;
	window.open(returl, "userSearch", "scrollbars=yes, resizable=no,scroll=auto, width=800,height=650,status=1,left=0,top=0");	
}

/* ÁÂÃø ÅëÇÕ°Ë»ö */
function unitSearch() {
	document.write(' <div id="search">');
	document.write(' <fieldset class="search_field">');
	document.write('<form name="myhome">');
	document.write('<input name="usersearch" type="text" class="chang" onKeyPress="if(event.keyCode==13) {totalsearch();return false;}" value="ÅëÇÕ°Ë»ö" size="18" maxlength="50" alt="°Ë»öÅØ½ºÆ®¹Ú½º" onclick="this.value = \'\';">');
	document.write('&nbsp;<input  type="image" src="../comimg/btn_go.gif" width="42" height="19" alt="°Ë»ö½ÃÀÛ" onClick="javascript:totalsearch();" class="search_btn">');				   
	document.write('</form>');
	document.write('</fieldset>');
	document.write('</div>');
}
/* ÁÂÃø ÅëÇÕ°Ë»ö */

/* ÇÏ´Ü Ä«ÇÇ¶óÀÌÆ® */
function copyRightIncldue() {
	document.write('<div id="footer">');
	document.write('<div id="footerlogo">');
document.write('<h4>ÇÏ´Ü·Î°í - ÇÑ±¹¹æ¼ÛÅë½Å´ëÇÐ±³</h4>');
	document.write('</div>');
	document.write('<div id="wrapper_footer">');
	document.write('<div id="footer_menu">');
	document.write('<h4>»çÀÌÆ® ¾È³» ¹× Á¤Ã¥</h4>');
	document.write('<ul id="fmgroup">');
	document.write('<li class="fm_01"><a class="fm_01" href="http://www.knou.ac.kr/guide/HK_5_3.html" title="ÀÌ¿ë¾È³» º¸±â" >ÀÌ¿ë¾È³»</a></li>');
	document.write('<li class="fm_02"><a class="fm_02" href="/introduction/HK_1_9_2_1.html" title="ÀüÈ­¹øÈ£¾È³» º¸±â">ÀüÈ­¹øÈ£¾È³»</a></li>');
	document.write('<li class="fm_03"><a class="fm_03" href="javascript:openPop02(\'/guide/HKPrivacy.html\',\'pop\',622,550,\'\');" title="°³ÀÎÁ¤º¸º¸È£Á¤Ã¥ »õÃ¢¶ç¿ì±â">°³ÀÎÁ¤º¸º¸È£Á¤Ã¥</a></li>');
	document.write('<li class="fm_04"><a class="fm_04" href="javascript:openPop02(\'/guide//HKOpen.html\',\'pop\',622,550,\'\');" title="ÇàÁ¤Á¤º¸°ø°³Á¦µµ »õÃ¢¶ç¿ì±â">ÇàÁ¤Á¤º¸°ø°³Á¦µµ</a></li>');
	document.write('<li class="fm_05"><a class="fm_04" href="javascript:openPop02(\'/common/HKCenter.do\',\'pop\',622,550,\'\');" title="ºñ¸®½Å°í¼¾ÅÍ »õÃ¢¶ç¿ì±â">ºñ¸®½Å°í¼¾ÅÍ</a></li>');
	document.write('<li class="fm_06"><a class="fm_05" href="http://www.knou.ac.kr/main/popup/th001.hwp" title="°ø¹«¿øÇàµ¿°­·É">°ø¹«¿øÇàµ¿°­·É</a></li>');
	document.write('<li class="fm_07"><a class="fm_06" href="#" onclick="window.open(\'http://www.aaou.net\');" title="AAOUÈ¨ÆäÀÌÁö »õÃ¢¶ç¿ì±â">AAOU</a></li>');
	document.write('<li class="fm_08"><a class="fm_07" href="javascript:openPop02(\'/main/HKtender.html\',\'pop\',650,600,\'\');" title="ÀÔÂûÁ¤º¸ »õÃ¢¶ç¿ì±â">ÀÔÂûÁ¤º¸</a></li>');
	document.write('<li class="fm_09"><a class="fm_04" href="javascript:openPop02(\'/main/HKadoption.html\',\'pop\',650,600,\'\');" title="Ã¤¿ë¾È³» ¹Ù·Î°¡±â">Ã¤¿ë¾È³»</a></li>');
//	document.write('<li class="fm_10"><a class="fm_10" href="http://www.academyinfo.go.kr/schoolAction.do?process=schoolDisclose00&schoolCd=61300000&orgcode=1&sry_yy=2008&univ_gubun=U&estb=1" title="´ëÇÐÁ¤º¸°ø½Ã">´ëÇÐÁ¤º¸°ø½Ã</a></li>');
	document.write('</ul>');
	document.write('</div>');
	document.write('<hr />');
	document.write('<div id="footer_address">');
	document.write('<h4>ÇÑ±¹¹æ¼ÛÅë½Å´ëÇÐ±³ ¿¬¶ôÃ³</h4>');
	document.write('<address>¿ìÆí¹øÈ£:110-791 ÁÖ¼Ò: ¼­¿ïÆ¯º°½Ã Á¾·Î±¸  µ¿¼þµ¿ 169¹øÁöÇÑ±¹¹æ¼ÛÅë½Å´ëÇÐ±³</address>');
	document.write('<dl>');
	document.write('<dt>´ëÇ¥ÀüÈ­</dt>');
	document.write('<dd>02-3668-4114</dd>');
	document.write('<dt>&nbsp;</dt>');
	document.write('<dt>Copyright &copy; 2007 Korea national Open University. All rights reserved.</dt>');
	document.write('</dl>');
	document.write('</div>');
	
	document.write('</div>');
	
	
	document.write('</div>');
	
}


function openPop02(url, name, width, height, noOption) {
	if ( ! noOption ) {
		var pop = window.open(url, name, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,top=0,left=0,width="+ width +",height="+ height);
            pop.location.href=url;

	} else {
		var pop = window.open(url, name);
	}
	try { pop.focus(); } catch(e) {}
}

function openPop_noscroll(url, name, width, height, noOption) {
	if ( ! noOption ) {
		var pop = window.open(url, name, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=1,top=0,left=0,width="+ width +",height="+ height);
            pop.location.href=url;

	} else {
		var pop = window.open(url, name);
	}
	try { pop.focus(); } catch(e) {}
}

// ¾ÆÀÌÇÁ·¹ÀÓ ¸®»çÀÌÂ¡ //
function adjustIFrameSize(id) {
	var myIframe = document.getElementById(id);

	if (myIframe) {
        if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {
            // W3C DOM (and Mozilla) syntax
			if(window.opera) {			
				myIframe.height = myIframe.document.body.scrollHeight;    
			} else {
				myIframe.height = myIframe.contentDocument.body.offsetHeight;    
			}
        } else if (myIframe.Document && myIframe.Document.body.scrollHeight) {
            // IE DOM syntax
            myIframe.height = myIframe.Document.body.scrollHeight;
        }

		// bind onload events to iframe
        if (myIframe.addEventListener) {			
            myIframe.addEventListener("load", resizeIframe, false);
        } else {
            myIframe.attachEvent("onload", resizeIframe);
        }
   }
}

function resizeIframe(evt) {
    evt = (evt) ? evt : event;
    var target = (evt.target) ? evt.target : evt.srcElement;

    // take care of W3C event processing from iframe's root document

    if (target.nodeType == 9) {
      if (evt.currentTarget && evt.currentTarget.tagName.toLowerCase() == "iframe") {
            target = evt.currentTarget;    
        }
    }

    if (target) {
        adjustIFrameSize(target.id);
    }
}


// F9Å°·Î ¾ÆÀÌÇÁ·¹ÀÓÀ¸·Î Æ÷Ä¿½º ÀÌµ¿ //
function iframeFocus(e) {
	var IE = "",keyCode = "";
	
	if(navigator.appName != "Microsoft Internet Explorer") 	IE = false;
	else IE = true;

	if(IE) 	keyCode = event.keyCode;	 // IE
	else keyCode = e.which;	// FF/netscape//opera

	// Æã¼ÇÅ° F9
	if(keyCode == 120) window.frames.uwayFrame.focus();	
}