function XMLtoAraay(fileName, depth1)
{	
	var depth3 = null;

	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
	xmlDoc.async = false;
	xmlDoc.load(fileName);

	var menuList = new Array();

	if (xmlDoc.readyState == 4)
	{
		var root = xmlDoc.documentElement;
		var titleMenu = new Array();
		
		menuList[0] = root.attributes[0].value;

		for(var i=0; i<root.childNodes.length; i++)
		{
			var tmp = new Array();
			tmp[0] = root.childNodes[i].attributes[0].value;
			tmp[1] = root.childNodes[i].attributes[1].value;
			tmp[2] = root.childNodes[i].attributes[2].value;
			
			titleMenu[i] = tmp;
		}
		
		menuList[1] = titleMenu;
		
		if(depth1 != null)
		{
			menuList[2] = depth1;
			var arrDepth1 = new Array();
			
			for(var i=0; i<root.childNodes[depth1].childNodes.length; i++)
			{
				var tmp = new Array();
				tmp[0] = root.childNodes[depth1].childNodes[i].attributes[0].value;
				tmp[1] = root.childNodes[depth1].childNodes[i].attributes[1].value;
				tmp[2] = root.childNodes[depth1].childNodes[i].attributes[2].value;
				
				arrDepth1[i] = tmp;
			}
			
			menuList[3] = arrDepth1;
		}
	}
	else
	{
		alert("XML 파일을 찾을 수 없습니다.");
	}
	
	if(menuList.length > 0)
	{
		return menuList;
	}
	else
	{
		return null;
	}
}

function StyleXMLtoAraay(fileName, styleType)
{
	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
	xmlDoc.async = false;
	xmlDoc.load(fileName);

	var StyleList = new Array();

	if (xmlDoc.readyState == 4)
	{
		var root = xmlDoc.documentElement;
		
		StyleList[0] = root.attributes[0].value;

		for(var i=0; i<root.childNodes.length; i++)
		{
			if(styleType == i+1)
			{
				StyleList[1] = root.childNodes[i].childNodes[0].childNodes[0].nodeValue;
				StyleList[2] = root.childNodes[i].childNodes[1].childNodes[0].nodeValue;
				StyleList[3] = root.childNodes[i].childNodes[2].childNodes[0].nodeValue;
				StyleList[4] = root.childNodes[i].childNodes[3].childNodes[0].nodeValue;
				StyleList[5] = root.childNodes[i].childNodes[4].childNodes[0].nodeValue;
			}
		}
	}
	else
	{
		alert("XML 파일을 찾을 수 없습니다.");
	}

	if(StyleList.length > 0)
	{
		return StyleList;
	}
	else
	{
		return null;
	}
} 

function CreateMenu(menuList, styleList, depth, locationInfo)
{
	var menu = '';
	var styleURL = styleList[0];

	var LinkStyle01Def = 'font-family:\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; font-size:12px; color:#6D6E71; text-decoration:none; cursor:hand; height:25px; padding-top:4px; font-weight:bold; padding-left:9px; width:100%';
	var LinkStyle01Def2 = 'font-family:\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; font-size:12px; color:#98068F; text-decoration:none; cursor:hand; height:25px; padding-top:4px; font-weight:bold; padding-left:9px; width:100%';
	var LinkStyle01Out = 'this.style.fontFamily=\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; this.style.fontSize=\"12px\"; this.style.color=\"#6D6E71\"; this.style.textDecoration=\"none\"; this.style.cursor=\"hand\"; this.style.height=\"25px\"; this.style.paddingTop=\"4px\"; this.style.fontWeight=\"bold\"; this.style.paddingLeft=\"9px\"; this.style.width=\"100%\"; ';
	var LinkStyle01Ove = 'this.style.fontFamily=\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; this.style.fontSize=\"12px\"; this.style.color=\"#98068F\"; this.style.textDecoration=\"none\"; this.style.cursor=\"hand\"; this.style.height=\"25px\"; this.style.paddingTop=\"4px\"; this.style.fontWeight=\"bold\"; this.style.paddingLeft=\"9px\"; this.style.width=\"100%\"; ';
	
	var LinkStyle02Def = 'font-family:\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; font-size:12px; color:#58595B; text-decoration:none; cursor:hand; height:25px; padding-top:4px; width:100%; padding-left:15px;';
	var LinkStyle02Def2 = 'font-family:\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; font-size:12px; color:#98068F; text-decoration:none; cursor:hand; height:25px; padding-top:4px; width:100%; padding-left:15px;';
	var LinkStyle02Out = 'this.style.fontFamily=\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; this.style.fontSize=\"12px\"; this.style.color=\"#58595B\"; this.style.textDecoration=\"none\"; this.style.cursor=\"hand\"; this.style.height=\"25px\"; this.style.paddingTop=\"4px\"; this.style.width=\"100%\"; this.style.paddingLeft=\"15px\";';
	var LinkStyle02Ove = 'this.style.fontFamily=\"돋움\", \"돋움체\", \"굴림\", \"굴림체\", \"Arial\", \"Verdana\"; this.style.fontSize=\"12px\"; this.style.color=\"#98068F\"; this.style.textDecoration=\"none\"; this.style.cursor=\"hand\"; this.style.height=\"25px\"; this.style.paddingTop=\"4px\"; this.style.width=\"100%\"; this.style.paddingLeft=\"15px\";';
                           
	menu += "<table width='200' border='0' cellspacing='0' cellpadding='0'>";
	menu += "	<tr><td height='650' valign='top'>";

	menu += "<table width='200' border='0' cellspacing='0' cellpadding='0'>";
	menu += "	<tr>";
	menu += "		<td width='13'>&nbsp;</td>";
	menu += "		<td><img src='" + styleURL + styleList[5] + "' width='187' height='83'></td>";
	menu += "	</tr>";
	menu += "	<tr>";
	menu += "		<td>&nbsp;</td>";
	menu += "	</tr>";
	menu += "	<tr>";
	menu += "		<td>&nbsp;</td>";
	menu += "		<td>";
	menu += "			<div id='leftmenu'>"
	menu += "			<table width='100%' border='0' cellspacing='0' cellpadding='0'> ";
	for (var i=0; i<menuList[1].length; i++)
	{
		var LinkType = '';
		if(menuList[1][i][1] == '1')
		{
			LinkType = "#' onClick=\"window.open('" + menuList[1][i][2] + "', '', ''); return false;\" ";
		}else{
			LinkType = menuList[0] + menuList[1][i][2] + "'";
		}

		menu += "			<tr>";
		if(depth == i)
		{
			menu += "			<td style=\"background-image:url(" + styleURL + styleList[2] + ");\" onMouseOver=\"this.style.backgroundImage='url(" + styleURL + styleList[2] + ")'\" onmouseout=\"this.style.backgroundImage='url(" + styleURL + styleList[2] + ")'\">";
			menu += "				<a href='" + LinkType + " style='" + LinkStyle01Def2 + "' >" + menuList[1][i][0] + "</a>";
		}else{
			menu += "			<td style=\"background-image:url(" + styleURL + styleList[1] + ");\" onMouseOver=\"this.style.backgroundImage='url(" + styleURL + styleList[2] + ")'\" onmouseout=\"this.style.backgroundImage='url(" + styleURL + styleList[1] + ")'\">";
			menu += "				<a href='" + LinkType + " style='" + LinkStyle01Def + "' onMouseOver='" + LinkStyle01Ove + "' onMouseOut='" + LinkStyle01Out + "' >" + menuList[1][i][0] + "</a>";
		}
		
		menu += "				</td>";
		menu += "			</tr>";
		menu += "			<tr>";
		menu += "				<td height='1' bgcolor='#DADCDD'></td>";
		menu += "			</tr>";
		if(menuList[3].length > 0 && menuList[2] == i)
		{
			for(var j=0; j<menuList[3].length; j++)
			{
				var LinkType2 = '';
				if(menuList[3][j][1] == '1')
				{
					LinkType2 = "#' onClick=\"window.open('" + menuList[3][j][2] + "', '', ''); return false;\" ";
				}else{
					LinkType2 = menuList[0] + menuList[3][j][2] + "'";
				}

				menu += "	<tr>";
				menu += "		<td style='padding-left:9px; background-image:url(" + styleURL + styleList[3] + ")'>";
				if(locationInfo == j)
				{
					menu += "		<a href='" + LinkType2 + " style='" + LinkStyle02Def2 + "'>" + menuList[3][j][0] + "</a>";
				}else{
					menu += "		<a href='" + LinkType2 + " style='" + LinkStyle02Def + "' onMouseOver='" + LinkStyle02Ove + "' onMouseOut='" + LinkStyle02Out + "'>" + menuList[3][j][0] + "</a>";
				}

				menu += "		</td>";
				menu += "	</tr>";
			}
			menu += "		<tr><td style='height:7px;'></td></tr>";
		}
	}
	menu += "			</table>";
	menu += "			</div>";
	menu += "		</td>";
	menu += "	</tr>";
	menu += "</table>";


	menu += "	</td></tr>";
	menu += "	</table>";
	
	return menu;
}

function CreateQuickBanner(left)
{
	var menu = '';
	menu += "<div id='divQuickLink' style='position:absolute; left:" + left + "px; top:800;'>";
	menu += "	<table width='99' border='0' cellpadding='0' cellspacing='0'>";
	menu += "		<tr>";
	menu += "        <td>";

	menu += "			<table width='148' border='0' cellspacing='0' cellpadding='0'>";
	menu += "				<tr>";
	menu += "					<td width='20'><img src='../img/M_f_quickimage01.gif' width='20' height='46'></td>";
	menu += "					<td width='103'><img src='../img/M_f_quickimage02.gif' width='103' height='46'></td>";
	menu += "					<td width='25'><img src='../img/M_f_quickimage03.gif' width='25' height='46'></td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td background='../img/M_f_quickleft.gif'>&nbsp;</td>";
	menu += "					<td background='../img/M_f_quickdotline.gif' class='qu_Con01'><a href='/EntranceEx/HelfDesk/EntrDate.jsp' class='quick' onFocus='blur();'><img src='../img/M_f_quickdot.gif' width='3' height='6' border='0' align='absmiddle'> 입시일정</a></td>";
	menu += "					<td background='../img/M_f_quickright.gif'>&nbsp;</td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td background='../img/M_f_quickleft.gif'>&nbsp;</td>";
	menu += "					<td background='../img/M_f_quickdotline.gif' class='qu_Con01'><a href='/EntranceEx/HelfDesk/Counsel.jsp' class='quick' onFocus='blur();'><img src='../img/M_f_quickdot.gif' width='3' height='6' border='0' align='absmiddle'> 입학상담</a></td>";
	menu += "					<td background='../img/M_f_quickright.gif'>&nbsp;</td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td background='../img/M_f_quickleft.gif'>&nbsp;</td>";
	menu += "					<td background='../img/M_f_quickdotline.gif' class='qu_Con01'><a href='/EntranceEx/HelfDesk/LastResult01.jsp' class='quick' onFocus='blur();'><img src='../img/M_f_quickdot.gif' width='3' height='6' border='0' align='absmiddle'> 전년도입시결과</a></td>";
	menu += "					<td background='../img/M_f_quickright.gif'>&nbsp;</td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td background='../img/M_f_quickleft.gif'>&nbsp;</td>";
	menu += "					<td background='../img/M_f_quickdotline.gif' class='qu_Con01'><a href='/EntranceEx/etc/AppReceipt.jsp' class='quick' onFocus='blur();'><img src='../img/M_f_quickdot.gif' width='3' height='6' border='0' align='absmiddle'> 원서접수</a></td>";
	menu += "					<td background='../img/M_f_quickright.gif'>&nbsp;</td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td background='../img/M_f_quickleft.gif'>&nbsp;</td>";
	menu += "					<td background='../img/M_f_quickdotline.gif' class='qu_Con01'><a href='/EntranceEx/etc/SuccCandidate.jsp' class='quick' onFocus='blur();'><img src='../img/M_f_quickdot.gif' width='3' height='6' border='0' align='absmiddle'> 합격자조회</a></td>";
	menu += "					<td background='../img/M_f_quickright.gif'>&nbsp;</td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td colspan='3'><img src='../img/M_f_quickimage04.gif' width='148' height='13'></td>";
	menu += "				</tr>";
	menu += "				<tr>";
	menu += "					<td colspan='3' align='center'><a href='#' onfocus='blur();'><img src='../img/quick_top.png' width='103' height='18' onclick='document.body.scrollTop;'></a></td>";
	menu += "				</tr>";
	menu += "			</table>";

	menu += "		</td>";
	menu += "	   </tr>";
	menu += "	</table>";
	menu += "</div>";

	return menu;
}

function CreateBottom()
{
	var menu = "";
	var menu = "";

	menu += "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
	menu += "	<tr>";
	menu += "		<td bgcolor='#dcdedf' width='980' height='1px' ></td>";
	menu += "	<tr>"
	menu += "		<td>";
	menu += "			<table width='980' border='0' cellspacing='0' cellpadding='0'>";
	menu += "			  <tr> ";
	menu += "			    <td>&nbsp;</td>";
	menu += "			  </tr>";
	menu += "			  <tr>";
	menu += "			    <td align='center' class='tbfo_con'><span class='tbfo_con'><a href='http://www.cjnu.ac.kr/Main/Etc/Mobil.jsp' class='fo' onFocus='blur()'>모바일캠퍼스</a>ㅣ<span class='tbfo_con'><a href='http://www.cjnu.ac.kr/Main/Etc/acrc.jsp' class='fo' onFocus='blur()'>공직청렴신문고</a>ㅣ<span class='fo'><a href='http://www.cjnu.ac.kr/Main/Etc/Disclosure.jsp' class='fo' onFocus='blur()'>정보공개</a></span>ㅣ</font><a href='http://secu.cjnu.ac.kr/' target='_blank' class='bot' onFocus='blur()'><font style='font-size:11px;'>정보보안</font></a><font style='font-size:11px;'>ㅣ<a href='http://www.cjnu.ac.kr/Main/Etc/privacy.jsp' class='fo' onFocus='blur()'>개인정보보호정책</a>ㅣ</span><a href='http://www.cjnu.ac.kr/Main/Etc/e-mail.jsp' class='fo' onFocus='blur()'>이메일무단수집거부</a><span class='tbiss_no1'>ㅣ</span><a href='http://www.cjnu.ac.kr/Main/Etc/Fa호ilySites.jsp' class='fo' onFocus='blur()'>학내주요사이트</a>ㅣ<a href='http://www.cjnu.ac.kr/Main/Etc/homepage.jsp' class='fo' onFocus='blur()'>홈페이지개선의견</a></td>";
	menu += "			  </tr>";
	menu += "			  <tr>";
	menu += "			    <td>&nbsp;</td>";
	menu += "			  </tr>";
	menu += "			  <tr> ";
	menu += "			    <td>";
	menu += "					<table width='960' border='0' cellspacing='0' cellpadding='0'>";
	menu += "						<tr> ";
	menu += "							<td width='30%'>&nbsp;</td>";
	menu += "							<td class='tbfo_con'>충주캠퍼스 380-702 충청북도 충주시 대학로 72 입학관리본부 TEL 043)841-5016";
	menu += "								 <br>";
	menu += "							</td>";
	menu += "						</tr>";
	menu += "					</table>";
	menu += "			    </td>";
	menu += "			  </tr>";
	menu += "			  <tr> ";
	menu += "			    <td align='center' class='tbfo_con'> Copyright 2008 ⓒ ChungJu National University. ";
	menu += "			      All rights reserved. <a href='mailto:ipsi@cjnu.ac.kr' class='fo' onFocus='blur()'><font color='058AE7'>ipsiⓒcjnu.ac.kr</font></a></td>";
	menu += "			  </tr>";
	menu += "			</table>";
	menu += "		</td>";
	menu += "	</tr>";
 	menu += "</table>";

	return menu;
}

function onLoadPage(fileName, depth2, styleType, locationInfo)
{
	var xmlUrl = "/EntranceEx/Common/xml/";

	var styleList = StyleXMLtoAraay(xmlUrl + "style.xml", styleType);

	var menuList = XMLtoAraay(xmlUrl + fileName, depth2);
	
	document.all.DivMenu.innerHTML = CreateMenu(menuList, styleList, depth2, locationInfo);

	document.all.bottom.innerHTML = CreateBottom() + CreateQuickBanner(33);

	document.title = "::입학정보:: 꿈을 키우는 사람들 - 충주대학교";

	

	OnLoad();
}


function onLoadBottom()
{
	document.all.bottom.innerHTML = CreateBottom();

	document.title = "::입학정보:: 꿈을 키우는 사람들 - 충주대학교";
}

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements(){
	var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
	
	if ( bNetscape4plus ) {
		yMenuFrom   = document["divQuickLink"].top;
		yMenuTo     = top.pageYOffset + 91;
	}
	else if ( bExplorer4plus ) {
		yMenuFrom   = parseInt (divQuickLink.style.pixelTop, 10);
		yMenuTo     = document.body.scrollTop + document.getElementById("leftmenu").offsetHeight + 280;
	}
	
	timeoutNextCheck = 500;
	
	if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return;
	}
	
	if ( yButtonFrom != yButtonTo ) {
		yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
		if ( yButtonTo < yButtonFrom )
			yOffset = -yOffset;
		
		if ( bNetscape4plus )
		document["divLinkButton"].top += yOffset;
		else if ( bExplorer4plus )
			divLinkButton.style.pixelTop = parseInt (divLinkButton.style.pixelTop, 10) + yOffset;
		
		timeoutNextCheck = 10;
	}
	if ( yMenuFrom != yMenuTo ) {
		yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 50 );
		if ( yMenuTo < yMenuFrom )
			yOffset = -yOffset;
		
		if ( bNetscape4plus )
		document["divQuickLink"].top += yOffset;
		else if ( bExplorer4plus )
			divQuickLink.style.pixelTop = parseInt (divQuickLink.style.pixelTop, 10) + yOffset;
		
		timeoutNextCheck = 10;
	}
	
	setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad() {
	var y;
	if ( top.frames.length )
		if ( bNetscape4plus ) {
			document["divQuickLink"].top = top.pageYOffset + 700;
			document["divQuickLink"].visibility = "visible";
		}
	else if ( bExplorer4plus ) {
		divQuickLink.style.pixelTop = document.body.scrollTop + 700;
		divQuickLink.style.visibility = "visible";
	}
	CheckUIElements();
	return true;
}

