
<!--

function SetCookie(sName, sValue, expireDate){
	if(expireDate)
		document.cookie = sName + "=" +sValue+ "; path=/; expires=" + expireDate.toUTCString() + ";";
	else
		document.cookie = sName + "=" +sValue+ "; path=/;";
}

function DelCookie(sName){
	document.cookie = sName + "='temp'; path=/; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}

function ReadCookie(CookieName){
	var name = CookieName;
	var Found = false;
	var start, end;
	var i = 0
	while(i < document.cookie.length){
		start = i
		end	= start + name.length;
		if(document.cookie.substring(start,end) == name){
			Found = true;
			break;
		}
		i++;
	}
	if(Found == true){
		start = end + 1;
		end	= document.cookie.indexOf(";",start);
		if(end < start){
			end	= document.cookie.length;
		}
		return document.cookie.substring(start, end);
	}
	else
	{
		return null;
	}
}

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.0
  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 && document.getElementById) x=document.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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Change_WMplayer(file_name){

 document.WMPlayer.Filename = file_name;  
 document.WMPlayer.Play();
}

function TabControl(parent)
{
	var menus = new Array;
	this.addMenus = function()
	{
		for(var i = 0; i < arguments.length; i++)
			menus.push(arguments[i]);
	}
	this.removeMenu = function(menuIndex)
	{
		var temp = new Array;
		for(var i = 0; i < menus.length; i++)
			if(i != menuIndex)
				temp.push(menus[i]);
		menus = temp;
	}
	this.onchange = null;
	function onChange(obj, cell)
	{
		if(obj.selectedIndex != cell.cellIndex)
		{
			obj.selectedIndex = cell.cellIndex;
			if(obj.onchange)
				obj.onchange(cell.cellIndex);
		}
	}
	this.selectedIndex = 0;
	this.select = function(menuIndex)
	{
		this.selectedIndex = menuIndex;
		this.paint();
	}
	var currentTab = null;
	this.paint = function()
	{
		parent.innerHTML = "";
		var table = document.createElement("table");
		table.cellSpacing = table.cellPadding = 0;
		table.height = 19;
		var row = table.insertRow();
		row.align = "center";
		var obj = this;
		for(var i = 0; i < menus.length; i++)
		{
			var cell = row.insertCell(i);
			cell.innerHTML = menus[i];
			cell.className = "tab_out";
			cell.width = 100;
			cell.onclick = function()
			{
				if(currentTab != null)
					currentTab.className = "tab_out";
				currentTab = this;
				currentTab.className = "tab_click";
				onChange(obj, this);
			}
			cell.onmouseover = function()
			{
				if(currentTab != this)
				{
					this.className = "tab_over";
				}
			}
			cell.onmouseout = function()
			{
				if(currentTab != this)
				{
					this.className = "tab_out";
				}
			}
			if(i == this.selectedIndex)
			{
				currentTab = cell;
				cell.className = "tab_click";
			}
		}
		parent.appendChild(table);
	}
}

function na_restore_img_src(name, nsdoc)
{
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name == '')
		return;
	if (img && img.altsrc) {
		img.src		= img.altsrc;
		img.altsrc = null;
	} 
}

function na_preload_img()
{ 
	var img_list = na_preload_img.arguments;
	if (document.preloadlist == null) 
		document.preloadlist = new Array();
	var top = document.preloadlist.length;
	for (var i=0; i < img_list.length; i++) {
		document.preloadlist[top+i]		 = new Image;
		document.preloadlist[top+i].src = img_list[i+1];
	} 
}

function na_change_img_src(name, nsdoc, rpath, preload)
{ 
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name == '')
		return;
	if (img) {
		img.altsrc = img.src;
		img.src		= rpath;
	} 
}

function resizeImage(img, maxwidth)
{
	if(img.width > maxwidth)
	{
		img.width = maxwidth;
		img.style.cursor = "pointer";
		img.onclick = function()
		{
			window.open(img.src, "imgwin", "");
		}
		img.alt = "¿ø·¡ Å©±â·Î º¸±â";
	}
}

//Á¤±Ô½Ä ÆÐÅÏ¿¡ ºÎÇÕµÇ´ÂÁö ¿©ºÎ ¹ÝÈ¯
//ex) "abc123".validate(/[a-z0-9]+/gm), true ¹ÝÈ¯
String.prototype.validate = function(regEx)
{
	return (this.replace(regEx, "") == "");
}

//¾ÕµÚ °ø¹éÀ» »èÁ¦ ÈÄ ¹ÝÈ¯
//ex) " 123 123 ".trim(), "123 123" ¹ÝÈ¯
String.prototype.trim = function()
{
	return this.replace(/^\s+|\s+$/, "");
}

//¹®ÀÚ¿­ÀÇ byte ±æÀÌ¸¦ ¹ÝÈ¯
//ex) "abc°¡³ª´Ù¶ó".bytelength(), 11 ¹ÝÈ¯
String.prototype.bytelength = function()
{
	var c = 0, i = 0, len = 0;
	while(!isNaN(c = this.charCodeAt(i++)))
		len += (c > 0xFF?2:1);
	return len;
}

//Æ÷¸Ë¿¡ ¸ÂÃç º¯È¯µÈ ¹®ÀÚ¿­ ¹ÝÈ¯
//ex) "{0} is less than {1} {2}".format(0, 1), "0 is less than 1 {2}" ¹ÝÈ¯
String.prototype.format = function()
{
	var args = arguments;
	return this.replace(/\{(\d+)\}/g, function(whole, match){
			var n = Number(match);
			if(n < args.length)
				return args[n].toString();
			else
				return whole;
		}
	);
}

//¿À¸¥ÂÊ¿¡ ÇØ´ç ¹®ÀÚ¸¦ ±æÀÌ¿¡ ¸Â°Ô µ¡ºÙÀÎ ÈÄ ¹ÝÈ¯
//ex) "a".padRight("b", 3), "abb" ¹ÝÈ¯
String.prototype.padRight = function(ch, len)
{
	return this + new Array(len - this.length + 1).join(ch);
}


//¿ÞÂÊ¿¡ ÇØ´ç ¹®ÀÚ¸¦ ±æÀÌ¿¡ ¸Â°Ô µ¡ºÙÀÎ ÈÄ ¹ÝÈ¯
//ex) "12".padLeft("0", 4), "0012" ¹ÝÈ¯
String.prototype.padLeft = function(ch, len)
{
	return new Array(len - this.length + 1).join(ch) + this;
}

//SELECT ELEMENT ÀÇ ÇØ´ç value¸¦ °®´Â OPTION ELEMENT ¸¦ ¹ÝÈ¯
//ex) findOption(document.forms[0].select1, "1")
function findOption(select, value)
{
	for(var i = 0; i < select.options.length; i++)
		if(select.options[i].value == value)
			return select.options[i];
	return new Object;
}

//ÇØ´ç ³âµµ¿Í ¿ùÀÇ ¸¶Áö¸· ÀÏÀ» ¹ÝÈ¯
//ex) getDaysInMonth(2001, 2), 28 ¹ÝÈ¯
function getDaysInMonth(year, month)
{
	return (new Date(year, month, 0)).getDate();
}

//»ç¿ëÀÚÁ¤ÀÇ ¼Ó¼º°ªÀ» Åä´ë·Î FORM ÀÇ À¯È¿¼º °Ë»ç
function checkFormValidation(form)
{
	for(var i = 0; i < form.elements.length; i++)
	{
		var elem = form.elements[i];
		if(elem.getAttribute("required") != null)
		{
			if(elem.value.trim() == "")
			{
				alert("ÇÊ¼öÀÔ·Â»çÇ×ÀÔ´Ï´Ù");
				if(elem.focus)
					elem.focus();
				return false;
			}
		}
		if(elem.getAttribute("maxbyte"))
		{
			var bytelen = elem.value.bytelength();
			if(bytelen > Number(elem.getAttribute("maxbyte")))
			{
				var over = bytelen - Number(elem.getAttribute("maxbyte"));
				alert("Çã¿ë±æÀÌ¸¦ ÃÊ°úÇß½À´Ï´Ù\n\nÃÊ°ú±æÀÌ{0}(ÇÑ±Û±âÁØ ¾à{1}±ÛÀÚ, ¿µ¹®±âÁØ ¾à{0}±ÛÀÚ)".format(over, parseInt(over / 2)));
				if(elem.focus)
					elem.focus();
				return false;
			}
		}
		if(elem.getAttribute("numberonly") != null)
		{
			if(elem.value.replace(/\d+/, "") != "")
			{
				alert("¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù");
				if(elem.focus)
					elem.focus();
				return false;
			}
		}
		if(elem.getAttribute("valid") != null)
		{
			if(!elem.value.validate(eval("/" + elem.getAttribute("valid") + "/gm")))
			{
				alert("¿Ã¹Ù¸¥ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù");
				if(elem.focus)
					elem.focus();
				return false;
			}
		}
	}
	return true;
}

//Date°³Ã¼¸¦ ÁöÁ¤µÈ Æ÷¸Ë¹®ÀÚ¿­·Î º¯È¯ ÈÄ ¹ÝÈ¯
//ex) new Date().format("yyyy-MM-dd")
Date.prototype.format = function(strFormat)
{
	var d = this;
	return strFormat.replace(
		/[a-z]+/ig,
		function(pattern){
			switch(pattern){
				case "yyyy":
					return d.getFullYear();
				case "yy":
					return d.getYear();
				case "MM":
					return (d.getMonth() + 1).toString().padLeft("0", 2);
				case "M":
					return d.getMonth() + 1;
				case "dd":
					return d.getDate().toString().padLeft("0", 2);
				case "d":
					return d.getDate();
				case "hh":
					return d.getHours().toString().padLeft("0", 2);
				case "h":
					return d.getHours();
				case "mm":
					return d.getMiniutes().toString().padLeft("0", 2);
				case "m":
					return d.getMinutes();
				case "ss":
					return d.getSeconds().toString().padLeft("0", 2);
				case "s":
					return d.getSeconds();
				case "ms":
					return d.getMilliSeconds();
				default:
					return pattern;
				}
			}
		);
}

function JSCalendar(parent, width, height, align, backColor)
{
	/*
	STYLESHEET GUIDE
	<style type="text/css">
	td.calendar_hover {cursor:pointer;text-decoration:underline;}
	table.calendar {color:black;margin:0 0 5 0;border:solid 1px silver;font-size:9pt;}
	</style>
	*/
	var visibleDate;
	var year, month, date;
	var weeks = "ÀÏ¿ùÈ­¼ö¸ñ±ÝÅä";
	var enableChangeMonth = true;
	var weekVisible = true;
	
	this.setWeekVisible = function(value){weekVisible = value;}
	this.getWeekVisible = function(){return weekVisible;}
	this.setVisibleDate = function()
	{
		if(arguments[0] instanceof Date)
		{
			visibleDate = arguments[0];
		}
		else if(arguments.length == 3)
		{
			visibleDate.setFullYear(arguments[0]);
			visibleDate.setMonth(arguments[1] - 1);
			visibleDate.setDate(arguments[2]);
		}
		year = visibleDate.getFullYear();
		month = visibleDate.getMonth() + 1;
		date = visibleDate.getDate();
	}
	
	this.setEnableChangeMonth = function(value){enableChangeMonth = value;}
	this.getEnableChangeMonth = function(){return enableChangeMonth;}
	
	this.getYear = function(){return year;}
	this.getMonth = function(){return month;}
	this.getDay = function(){return date;}
	
	this.getVisibleDate = function()
	{
		return visibleDate;
	}

	function ondayrender(sender, tableCell, dt)
	{
		if(sender.ondayrender)
			sender.ondayrender(sender, tableCell, dt);
	}
	
	function onmonthchange(sender, add)
	{
		var dt = sender.getVisibleDate();
		dt.setMonth(dt.getMonth() + add);
		sender.setVisibleDate(dt);
		if(sender.onmonthchange)
			sender.onmonthchange(sender, dt);
		//sender.paint();
	}
	
	function onchange(sender, dt)
	{
		sender.setVisibleDate(dt);
		if(sender.onchange)
			sender.onchange(sender, dt);
		//sender.paint();
	}

	function onlabelclick(sender)
	{
		if(sender.onlabelclick)
			sender.onlabelclick(sender, sender.getVisibleDate());
	}
	
	function hoverOn(cell, idx)
	{
		for(var i = -2; i < 3; i++)
			if(cells[i + idx])
				cells[i + idx].style.fontSize = (12 - Math.abs(i) * 2) + "pt";
		cell.className = "calendar_hover";
	}
	
	function hoverOff(cell, idx)
	{
		for(var i = -2; i < 3; i++)
			if(cells[i + idx])
				cells[i + idx].style.fontSize = "8pt";
		cell.className = "";
	}
	
	var cells;
	
	this.paint = function()
	{
		parent.innerHTML = "";
		var tempDate = new Date(visibleDate.getTime());
		tempDate.setDate(1);
		var startColumn = tempDate.getDay();
		var table = document.createElement("table");
		table.className = "calendar";
		if(align)
			table.setAttribute("align", align);
		if(backColor)
			table.bgColor = backColor;
		table.border = 0;
		table.cellSpacing = table.cellPadding = 0;
		var row = table.insertRow(table.rows.length);
		var prev = row.insertCell(0);
		if(enableChangeMonth)
			prev.innerHTML = "¢¸";
		var label = row.insertCell(1);
		label.style.cssText = "font-size:9pt;font-family:verdana, µ¸¿ò;text-align:center;";
		label.height = 20;
		label.colSpan = 5;
		var current = document.createElement("span");
		current.innerHTML = visibleDate.format("yyyy - MM");
		label.appendChild(current);
		var next = row.insertCell(2);
		if(enableChangeMonth)
			next.innerHTML = "¢º";
		prev.style.cssText = next.style.cssText = "font-size:8pt;font-family:µ¸¿ò;text-align:center;cursor:pointer;";
		prev.onmouseover = next.onmouseover = function(){this.className = "calendar_hover";}
		prev.onmouseout = next.onmouseout = function(){this.className = "";}
		var sender = this;
		prev.onclick = new fwrapper(onmonthchange, [sender, -1]).invoke;
		next.onclick = new fwrapper(onmonthchange, [sender, 1]).invoke;
		current.onclick = new fwrapper(onlabelclick, [sender]).invoke;
		current.onmouseover = function(){this.style.textDecoration = "underline";}
		current.onmouseout = function(){this.style.textDecoration = "none";}
		current.style.cssText = "cursor:pointer;";
		if(weekVisible)
		{
			var row = table.insertRow(table.rows.length);
			for(var i = 0; i < 7; i++)
			{
				var cell = row.insertCell(i);
				cell.style.cssText = "font-size:8pt;font-family:verdana, µ¸¿ò;text-align:center;width:"+width+";height:"+height+";";
				cell.innerHTML = weeks.charAt(i);
			}
		}
		row = table.insertRow(table.rows.length);
		var col = 0;
		for(; col < startColumn; col++)
		{
			var cell = row.insertCell(col);
		}
		cells = new Array;
		for(var i = 1;tempDate.getMonth() == visibleDate.getMonth(); tempDate.setDate(++i), col++)
		{
			if(col > 0 && col % 7 == 0)
			{
				row = table.insertRow(table.rows.length);
			}
			var cell = row.insertCell(col % 7);
			cells.push(cell);
			cell.style.cssText = "font-size:8pt;font-family:verdana;text-align:center;cursor:pointer;width:"+width+";height:"+height+";overflow:hidden;";
			if(col % 7 == 0)
				cell.style.color = "red";
			//if(tempDate.toDateString() == visibleDate.toDateString())
			//	cell.style.color = "black";
			cell.onclick = new fwrapper(onchange, [this, new Date(tempDate)]).invoke;
			cell.innerHTML = tempDate.getDate();
			cell.onmouseover = new fwrapper(hoverOn, [cell, i - 1]).invoke;
			cell.onmouseout = new fwrapper(hoverOff, [cell, i - 1]).invoke;
			ondayrender(this, cell, tempDate);
		}
		parent.appendChild(table);
	}
	
	this.setVisibleDate(new Date());
}

function NewsTicker(s, delay)
{
	var t;
	this.initiated = false;
	this.init = function()
	{
		var d = (delay == null?1000:delay);
		var mouseFlag = false;
		var i = 0;
		function adScroll()
		{
			if(mouseFlag)
				return;
			if(--i <= 0)
			{
				window.clearInterval(t);
				s.appendChild(s.childNodes[0]);
				s.scrollTop = 0;
				window.setTimeout(startScroll, d);
				return;
			}
			s.scrollTop++;
		}
		
		function startScroll()
		{
		  i = s.childNodes[0].offsetHeight;
			t = window.setInterval(adScroll, 50);
		}
		
		if(s.childNodes.length > 0 && s.offsetHeight < s.scrollHeight)
		{
			s.onmouseover = function(){mouseFlag = true;}
			s.onmouseout = function(){mouseFlag = false;}
			window.setTimeout(startScroll, d);
		}
		this.initiated = true;
	}
	
	this.dispose = function()
	{
		window.clearInterval(t);
	}
}

function NewsTicker(s, delay)
{
	var t;
	this.initiated = false;
	this.init = function()
	{
		var d = (delay == null?1000:delay);
		var mouseFlag = false;
		var i = 0;
		function adScroll()
		{
			if(mouseFlag)
				return;
			if(--i <= 0)
			{
				window.clearInterval(t);
				s.appendChild(s.childNodes[0]);
				s.scrollTop = 0;
				window.setTimeout(startScroll, d);
				return;
			}
			s.scrollTop++;
		}
		
		function startScroll()
		{
		  i = s.childNodes[0].offsetHeight;
			t = window.setInterval(adScroll, 50);
		}
		
		if(s.childNodes.length > 0 && s.offsetHeight < s.scrollHeight)
		{
			s.onmouseover = function(){mouseFlag = true;}
			s.onmouseout = function(){mouseFlag = false;}
			window.setTimeout(startScroll, d);
		}
		this.initiated = true;
	}
	
	this.dispose = function()
	{
		window.clearInterval(t);
	}
}

function NewsTicker2(s, delay)
{
	var t;
	this.initiated = false;
	this.init = function()
	{
		var d = (delay == null?1000:delay);
		var mouseFlag = false;
		var i = 0;
		function adScroll()
		{
			if(mouseFlag)
				return;
			if(--i <= 0)
			{
				window.clearInterval(t);
				s.appendChild(s.childNodes[0]);
				s.scrollLeft = 0;
				window.setTimeout(startScroll, d);
				return;
			}
			s.scrollLeft++;
		}
		
		function startScroll()
		{
			i = s.childNodes[0].offsetWidth;
			t = window.setInterval(adScroll, 50);
		}
		
		if(s.childNodes.length > 0 && s.offsetWidth < s.scrollWidth)
		{
			s.onmouseover = function(){mouseFlag = true;}
			s.onmouseout = function(){mouseFlag = false;}
			window.setTimeout(startScroll, d);
		}
		this.initiated = true;
	}
	
	this.dispose = function()
	{
		window.clearInterval(t);
	}
}

function fwrapper(func, args)
{
	this.invoke = function(){
		func.apply(null, args);
	}
}

function openShowroom(showroom_idx)
{
	var wndShowroom = window.open("/webbase/museum/showroom.aspx?m=" + showroom_idx,'wndShowroom','width=810, height=700, left=50, top=50, status=no, scrollbars=no, resizable=no');
	wndShowroom.focus();
}

function resizeImg(img)
{
	if(img.offsetWidth > 500)
		img.width = 500;
}

window.prompt = function(message, defaultValue)
{
	var dArg = [message, defaultValue];
	return window.showModalDialog("/webbase/prompt.htm", dArg, "dialogWidth:330px;dialogHeight:220px;status=no;help=no;");
}

function openEbook(idx)
{
	var url = "/webbase/museum/ebook{0}/application.htm".format(idx);
	var wndEbook = window.open(url, "wndEbook", "width=1020px,height=710px");
	wndEbook.focus();
}

function openImage(imgSrc)
{
	window.open("/webbase/image.htm?" + imgSrc, "", "status=yes,resizable=yes,width=200px,height=100px").focus();
}

function isNumeric()
{
	for(var i = 0; i < arguments.length; i++)
		if(String(arguments[i]) == "" || String(arguments[i]).replace(/\d+/, "") != "")
			return false;
	return true;
}

/*
document.ondragstart = function(){
	try
	{
		var tag = window.event.srcElement.tagName;
		if(tag == "TEXTAREA" || tag == "INPUT")
		{
			return true;
		}
	}catch(e){}
	return false;
}
document.oncontextmenu = function(){
	try
	{
		var tag = window.event.srcElement.tagName;
		if(tag == "TEXTAREA" || tag == "INPUT")
		{
			return true;
		}
	}catch(e){}
	return false;
}
document.onselectstart = function(){
	try
	{
		var tag = window.event.srcElement.tagName;
		if(tag == "TEXTAREA" || tag == "INPUT")
		{
			return true;
		}
	}catch(e){}
	return false;
}
*/
//-->
