//·Ñ¿À¹ö ¹öÆ°]
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.01
  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 && d.getElementById) x=d.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 popupPage(popCnt)
{
	if(popCnt > 0)	openPop();
}

function openPop()
{
	for(i = 0 ; i < popObj.length ; i++)
	{
		if(!getCookie(popObj[i][3]))
		{
			window.open(popObj[i][0],popObj[i][1],popObj[i][2]);
		}
	}
}
/* //ÆË¾÷ °ü·Ã */

// ½Ã°£Àº ºÐ´ÜÀ§
function setCookieVal (name, value, time) {
	pathname = location.pathname;
	var ExpDate = new Date();
  var myDomain = pathname.substring(0, pathname.lastIndexOf('/')) +'/';

	// ÀÌ·¸°Ô ¾µ¼öµµ ÀÖ´Ù.
  var myDomain = '/';

  ExpDate.setTime(ExpDate.getTime() + 1000*60* time);
  setCookie(name, value, ExpDate, myDomain);
}

function setCookie (name, value) {
	var argv = setCookie.arguments;
	var argc = setCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
		((expires == null) ? "" :
			 ("; expires=" + expires.toGMTString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1) endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {	//while open
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			 return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}	//while close
	return null;
}

function mouseOverColor(obj,bgColor,fontColor,cursor)
{
	obj.style.backgroundColor	= bgColor;
	obj.style.color				= fontColor;
	obj.style.cursor			= cursor;
}

function mouseOutColor(obj,bgColor,fontColor)
{
	obj.style.backgroundColor	= bgColor;
	obj.style.color				= fontColor;
}

function textCounter(field, countfield, maxlimit) {
    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
}

function TabChange(obj,no,len)
{
	for(i = 1 ; i <=len ; i++)
	{
		tabImg		= eval("document.images['"+obj+"Tab" + i + "']") ;
		tabLayer	= eval("document.all."+obj+"List" + i) ;

		if( i == no)
		{
			tabImg.src = "./images/main/"+obj+"Tab_on_0" + i + ".gif" ;
			tabLayer.style.display = '';
		}
		else
		{
			tabImg.src = "./images/main/"+obj+"Tab_off_0" + i + ".gif" ;
			tabLayer.style.display = 'none';
		}
	}
}

function TabLink(dest,mcode)
{
	location.href=dest+"?mnucode="+mcode;
}

function viewContents(dest,no,page_var){
	location.href = dest + "?no="+ no + page_var;
}

function setCookie2 (name, value, expires) {
  document.cookie = name + "=" + escape (value) +
    "; path=/; expires=" + expires.toGMTString();
}

function getCookie2(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
      if (end == -1)
        end = document.cookie.length
      return unescape(document.cookie.substring(offset, end))
    }
  }
  return "";
}

function saveid(form) {
	if(!form.uid.value){
		alert('¾ÆÀÌµð¸¦ ¸ÕÀú ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		form.checksaveid.checked = false;
		form.uid.focus();
		return;
	}
	var expdate = new Date();
	// ±âº»ÀûÀ¸·Î 30ÀÏµ¿¾È ±â¾ïÇÏ°Ô ÇÔ. ÀÏ¼ö¸¦ Á¶ÀýÇÏ·Á¸é * 30¿¡¼­ ¼ýÀÚ¸¦ Á¶ÀýÇÏ¸é µÊ
	if (form.checksaveid.checked)
		expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
	else
		expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
	setCookie2("saveid", form.uid.value, expdate);
}

function getid(form) {
	form.checksaveid.checked = ((form.uid.value = getCookie2("saveid")) != "");
}

function popupPage(popCnt)
{
	if(popCnt > 0)	openPop();
}

function openPop()
{
	for(i = 0 ; i < popObj.length ; i++)
	{
		if(!getCookie(popObj[i][3]))
		{
			window.open(popObj[i][0],popObj[i][1],popObj[i][2]);
		}
	}
}