/**
 * Copyright (c) 2002 by (ÁÖ)¾ÆÀÌºñÄÄ
 * All rights reserved.
 *
 * ÀÚ¹Ù½ºÅ©¸³Æ® °øÅëÇÔ¼ö
 *
 * ÁÖÀÇ: ¾Æ·¡ÀÇ ¸ðµç ¸Þ¼Òµå´Â ÀÔ·ÂÆûÀÇ ÇÊµå°´Ã¼ÀÌ¸§À»
 *       ÆÄ¶ó¹ÌÅÍ·Î ¹Þ´Â´Ù. ÇÊµå°´Ã¼ÀÇ °ªÀÌ ¾Æ´Ô
 *
 * @version 1.1, 2002/10/18
 * @author °­¿øÈ£, whkang@ibcom.co.kr
 */

function enter_to_tab(){
//event.srcElement.tagName
    //alert(event.srcElement.tagName);
    if (event.srcElement.tagName != "TEXTAREA") {
     if(event.keyCode == 13){
  		  event.keyCode=9;
     }
   }
}
document.onkeydown=enter_to_tab;
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 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];}}
}

/**
 * ¼Ò¼öÁ¡ ÀÌÇÏ Æ¯Á¤ °¹¼ö±îÁö round ÇÏ±â
 */
function myRound(num, pos) {
		var posV = Math.pow(10, (pos ? pos : 2));
		return Math.round(num*posV)/posV
}
/**
 * ÀÔ·Â°ªÀÌ ¸ðµÎ ¼ýÀÚ·Î¸¸ µÇ¾îÀÖ´ÂÁö Ã¼Å©
 */
function isNum(obj) {
 	for(i = 0; i < obj.value.length; i++)  	{
 		ch = obj.value.charAt(i);
 		if(ch < "0" || ch > "9")
 			return false;
 	}
 	return true;
}
/**
 * ÀÔ·Â°ªÀÌ NULLÀÎÁö Ã¼Å©

 */
function isNull(input) {
    if (input.value == null || input.value == "") {
        return true;
    }
    return false;
}

/**
 * ÀÔ·Â°ª¿¡ ½ºÆäÀÌ½º ÀÌ¿ÜÀÇ ÀÇ¹ÌÀÖ´Â °ªÀÌ ÀÖ´ÂÁö Ã¼Å©

 * ex) if (isEmpty(form.keyword)) {
 *         alert("°Ë»öÁ¶°ÇÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
 *     }
 */
function isEmpty(input) {
    if (input.value == null || input.value.replace(/ /gi,"") == "") {
        return true;
    }
    return false;
}

/**
 * ÀÔ·Â°ª¿¡ Æ¯Á¤ ¹®ÀÚ(chars)°¡ ÀÖ´ÂÁö Ã¼Å©
 * Æ¯Á¤ ¹®ÀÚ¸¦ Çã¿ëÇÏÁö ¾ÊÀ¸·Á ÇÒ ¶§ »ç¿ë
 * ex) if (containsChars(form.name,"!,*&^%$#@~;")) {
 *         alert("ÀÌ¸§ ÇÊµå¿¡´Â Æ¯¼ö ¹®ÀÚ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
 *     }
 */
function containsChars(input,chars) {
    for (var inx = 0; inx < input.value.length; inx++) {
       if (chars.indexOf(input.value.charAt(inx)) != -1)
           return true;
    }
    return false;
}

/**
 * ÀÔ·Â°ªÀÌ Æ¯Á¤ ¹®ÀÚ(chars)¸¸À¸·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©

 * Æ¯Á¤ ¹®ÀÚ¸¸ Çã¿ëÇÏ·Á ÇÒ ¶§ »ç¿ë
 * ex) if (!containsCharsOnly(form.blood,"ABO")) {
 *         alert("Ç÷¾×Çü ÇÊµå¿¡´Â A,B,O ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
 *     }
 */
function containsCharsOnly(input,chars) {
    for (var inx = 0; inx < input.value.length; inx++) {
       if (chars.indexOf(input.value.charAt(inx)) == -1)
           return false;
    }
    return true;
}

/**
 * ÀÔ·Â°ªÀÌ ¾ËÆÄºªÀÎÁö Ã¼Å©

 * ¾Æ·¡ isAlphabet() ºÎÅÍ isNumComma()±îÁöÀÇ ¸Þ¼Òµå°¡
 * ÀÚÁÖ ¾²ÀÌ´Â °æ¿ì¿¡´Â var chars º¯¼ö¸¦
 * global º¯¼ö·Î ¼±¾ðÇÏ°í »ç¿ëÇÏµµ·Ï ÇÑ´Ù.
 * ex) var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 *     var lowercase = "abcdefghijklmnopqrstuvwxyz";
 *     var number    = "0123456789";
 *     function isAlphaNum(input) {
 *         var chars = uppercase + lowercase + number;
 *         return containsCharsOnly(input,chars);
 *     }
 */
function isAlphabet(input) {
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¾ËÆÄºª ´ë¹®ÀÚÀÎÁö Ã¼Å©

 */
function isUpperCase(input) {
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¾ËÆÄºª ¼Ò¹®ÀÚÀÎÁö Ã¼Å©
 */
function isLowerCase(input) {
    var chars = "abcdefghijklmnopqrstuvwxyz";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ª¿¡ ¼ýÀÚ¸¸ ÀÖ´ÂÁö Ã¼Å©

 */
function isNumber(input) {
    var chars = "0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¾ËÆÄºª,¼ýÀÚ·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©

 */
function isAlphaNum(input) {
    var chars
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¼ýÀÚ,´ë½Ã(-)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
 */
function isNumDash(input) {
    var chars = "-0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ ¼ýÀÚ,ÄÞ¸¶(,)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©

 */
function isNumComma(input) {
    var chars = ",0123456789";
    return containsCharsOnly(input,chars);
}

/**
 * ÀÔ·Â°ªÀÌ »ç¿ëÀÚ°¡ Á¤ÀÇÇÑ Æ÷¸Ë Çü½ÄÀÎÁö Ã¼Å©

 * ÀÚ¼¼ÇÑ format Çü½ÄÀº ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ 'regular expression'À» ÂüÁ¶
 */
function isValidFormat(input,format) {
    if (input.value.search(format) != -1) {
        return true; //¿Ã¹Ù¸¥ Æ÷¸Ë Çü½Ä
    }
    return false;
}

/**
 * ÀÔ·Â°ªÀÌ ÀÌ¸ÞÀÏ Çü½ÄÀÎÁö Ã¼Å©
 * ex) if (!isValidEmail(form.email)) {
 *         alert("¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏ ÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù.");
 *     }
 */
function isValidEmail(input) {
//    var format = /^(\S+)@(\S+)\.([A-Za-z]+)$/;
    var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
    return isValidFormat(input,format);
}

/**
 * ÀÔ·Â°ªÀÌ ÀüÈ­¹øÈ£ Çü½Ä(¼ýÀÚ-¼ýÀÚ-¼ýÀÚ)ÀÎÁö Ã¼Å©
 */
function isValidPhone(input) {
    var format = /^(\d+)-(\d+)-(\d+)$/;
    return isValidFormat(input,format);
}

/**
 * ÀÔ·Â°ªÀÇ ¹ÙÀÌÆ® ±æÀÌ¸¦ ¸®ÅÏ

 * ex) if (getByteLength(form.title) > 100) {
 *         alert("Á¦¸ñÀº ÇÑ±Û 50ÀÚ(¿µ¹® 100ÀÚ) ÀÌ»ó ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
 *     }
 * Author : Wonyoung Lee
 */
function getByteLength(input) {
    var byteLength = 0;
    for (var inx = 0; inx < input.value.length; inx++) {
        var oneChar = escape(input.value.charAt(inx));
        if ( oneChar.length == 1 ) {
            byteLength ++;
        } else if (oneChar.indexOf("%u") != -1) {
            byteLength += 2;
        } else if (oneChar.indexOf("%") != -1) {
            byteLength += oneChar.length/3;
        }
    }
    return byteLength;
}

/**
 * ÀÔ·Â°ª¿¡¼­ ÄÞ¸¶¸¦ ¾ø¾Ø´Ù.

 */
function removeComma(input) {
    return input.value.replace(/,/gi,"");
}

/**
 * ¼±ÅÃµÈ ¶óµð¿À¹öÆ°ÀÌ ÀÖ´ÂÁö Ã¼Å©

 */
function hasCheckedRadio(input) {
    if (input.length > 1) {
        for (var inx = 0; inx < input.length; inx++) {
            if (input[inx].checked) return true;
        }
    } else {
        if (input.checked) return true;
    }
    return false;
}
/**
 * ¼±ÅÃµÈ ¶óµð¿À¹öÆ°ÀÇ °ªÀ» ±¸ÇÏ±â
 */
function getRadioValue(obj) {
	var ret = "";
     for(var i = 0; i < obj.length; i++) {
     	if (obj[i].checked == true) {
			ret = obj[i].value;
     	}
     }
	 return ret;
}

/**
 * ¼±ÅÃµÈ Ã¼Å©¹Ú½º°¡ ÀÖ´ÂÁö Ã¼Å©

 */
function hasCheckedBox(input) {
    return hasCheckedRadio(input);
}
/**
 * ¸®½ºÆ® °ªÀ¸·Î ÁöÁ¤ÇÏ±â
 */
function setListValue(obj, val) {
    //alert(val);
     for(var i = 0; i < obj.length; i++) {
     	if (obj[i].value == val) {
			obj[i].selected = true;
     	}
     }
}
/**
 * ¶óµð¿À¹öÆ° °ªÀ¸·Î ÁöÁ¤ÇÏ±â
 */
function setRadioValue(obj, val) {
     for(var i = 0; i < obj.length; i++) {
     	if (obj[i].value == val) {
  			obj[i].checked = true
     	}else {
  			obj[i].checked = false
     	}
     }
}
	function openHiddenTextArea(title, size, array2) {
		var html = "<html>\n";
		html += "<head>\n<title>" + title + "</title>\n";
		html += "<link rel='stylesheet' href='../style.css' type='text/css'>\n";
		html += "\<script language='javascript'\>\n";
		html += "<!--\n";
		html += "  function closewin() {\n";
		html += "   if (document.eng.text.value.length > " + size + ") document.eng.text.value = document.eng.text.value.substring(0, " + size + ");\n";
		html += "   opener.document.form1." + array2[0].name + ".value = document.eng.text.value;\n";
		html += "	self.close();\n";
		html += "  }\n";
		html += "//-->\n";
		html += "\<\/script\>\n";
		html += "</head>\n";
		html += "<body>\n";
		html += "<form name='eng'>\n";
		html += "<textarea name='text' cols='50' rows='4' maxlength='" + size + "'>";
		html += array2[0].value;
		html += "</textarea><br>\n";
		html += "</form>\n";
		html += "<a href='javascript:closewin();'>´Ý±â</a>";
		html += "</body>\n";
		html += "</html>\n";
		var win = window.open("",null, "height=200,width=500,status=yes,toolbar=no,menubar=no,location=no");
		win.document.write(html);
	}
	function openHidden(title, array1, array2) {
  	array = new Array();
		for (i = 0; i < array1.length; i++) {
	  	array[i] = array1[i].maxLength;
  	}
  	openHidden1(title, array1, array2, array);
	}
	function openHidden1(title, array1, array2, maxLength_array) {
		var html = "<html>\n";
		html += "<head>\n<title>" + title + "</title>\n";
		html += "<link rel='stylesheet' href='../style.css' type='text/css'>\n";
		html += "\<script language='javascript'\>\n";
		html += "<!--\n";
		html += "  function closewin() {\n";
		for (i = 0; i < array1.length; i++) {
		html += "   opener.document.form1." + array2[i].name + ".value = document.eng." + array2[i].name + ".value;\n";
		}
		html += "	self.close();\n";
		html += "  }\n";
		html += "//-->\n";
		html += "\<\/script\>\n";
		html += "</head>\n";
//		html += "alert(opener.document.form1." + array1[0].name + ".value);
		html += "<body>\n";
		for (i = 0; i < array1.length; i++) {
		html += array1[i].value + "<br>";
		}
		html += "<form name='eng'>\n";
		for (i = 0; i < array1.length; i++) {
//			alert(array1[i].name);
		html += "<input type='text' name='" + array2[i].name + "' "
				+ "maxlength='" + maxLength_array[i] + "' size='" + array1[i].size
				+ "' class='inputA' value='" + array2[i].value + "'><br>\n";
		}
		html += "</form>\n";
		html += "<a href='javascript:closewin();'>´Ý±â</a>";
		html += "</body>\n";
		html += "</html>\n";
		var win = window.open("",null, "height=200,width=400,scrollbars=yes status=yes,toolbar=no,menubar=no,location=no");
		win.document.write(html);
/*
		var win = new Window("", "openWin");

		win.document.writeln("abcd");
		win.open();
*/
	}
/**
 * cookie°ªÀ» ¸®ÅÏ
 * if ( getCookie( "Notice" ) != "done" ){
 *        noticeWindow  =  window.open('./event/2002_10/popup_0930.jsp','notice','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,width=336,height=650');
 *        noticeWindow.opener = self;
 * }
 */
function getCookie( name )
{
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                        break;
        }
        return "";
}
/**
 * cookie°ªÀ» ÁöÁ¤
 * name : cookie ½Äº°¸í
 * value : cookie °ª
 * expiremins : À¯È¿±â°£(ºÐ´ÜÀ§, 1½Ã°£:60, 12½Ã°£:720, 24½Ã°£ 1440)
 * function closeWin() {
 *        if ( document.forms[0].Notice.checked ) setCookie( "Notice", "done" , 1);
 *              //¸¸¾à »õÃ¢¿¡¼­ ¿©·¯°³ÀÇ form À» »ç¿ëÇÏ°í ÀÖÀ¸¸é forms[0] ¿¡¼­ °øÁöÃ¢ ¾È¶ç¿ì±â formÀÇ ¼ø¼­(0ºÎÅÍ ½ÃÀÛ)·Î °íÃÄÁÝ´Ï´Ù. ¿¹: forms[4]
 *      self.close();
 * }
 */
function setCookie( name, value, expiremins ) {
  var todayDate = new Date();
  todayDate.setMinutes( todayDate.getMinutes() + expiremins );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
}

function deleteCookie( name) {
  var todayDate = new Date();
  todayDate.setMinutes( todayDate.getMinutes() - 1);
  document.cookie = name + "=" + getCookie(name) + "; path=/; expires=" + todayDate.toGMTString() + ";";
}

/*
 * Å« ¼ýÀÚÀÇ ¼ö¸¦ 1000 ´ÜÀ§·Î ½°Ç¥·Î ±¸ºÐ
 */
function commaNum(num) {

	if (num < 0) { num *= -1; var minus = true}
	else var minus = false

	var dotPos = (num+"").split(".")
	var dotU = dotPos[0]
	var dotD = dotPos[1]
	var commaFlag = dotU.length%3

	if(commaFlag) {
		var out = dotU.substring(0, commaFlag)
		if (dotU.length > 3) out += ","
	}
	else var out = ""

	for (var i=commaFlag; i < dotU.length; i+=3) {
		out += dotU.substring(i, i+3)
		if( i < dotU.length-3) out += ","
	}

	if(minus) out = "-" + out
	if(dotD) return out + "." + dotD
	else return out
}

function validateForm() { //v4.0
	var bReturn = false;
  var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) {
  	test=args[i+2];
  	val=findObj(args[i]);
    if (val) {
    	if (args[i+1] != "") {
	    	nm = args[i+1];
    	} else {
	    	nm = val.name;
    	}
//  	alert(nm);
    	if ((val=val.value)!="") {
      	if (test.indexOf('isEmail')!=-1) {
      		p=val.indexOf('@');
        	if (p<1 || p==(val.length-1)) {
        		//errors+='- '+nm+' must contain an e-mail address.\n';
        		errors+='- '+nm+' E-mail ÁÖ¼Ò.\n';
        	}
      	} else if (test!='R') {
        	if (isNaN(val)) {
        		//errors+='- '+nm+' must contain a number.\n';
        		errors+='- '+nm+' ¼öÀÚ.\n';
        	}
        	if (test.indexOf('inRange') != -1) {
        		p=test.indexOf(':');
          	min=test.substring(8,p);
          	max=test.substring(p+1);
          	if (val<min || max<val) {
          		//errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
          		errors+='- '+nm+' '+min+' ¿Í '+max+'»çÀÌÀÇ ¼öÀÚ.\n';
          	}
    			}
    		}
     } else if (test.charAt(0) == 'R') {
//     		errors += '- '+nm+' is required.\n';
     		errors += '- '+nm+' ´©¶ô.\n';
     }
    }
  }
  if (errors) {
//	  alert('The following error(s) occurred:\n'+errors);
	  alert('ÇÊ¼ö Ç×¸ñ ÀÔ·Â ´©¶ô/ÀÚ·á À¯Çü ¿À·ù:\n'+errors);
 	}
  bReturn = (errors == '');
  return bReturn;
}
function 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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function displayTop(top_banner) {
	var log;
	if (getCookie("e_mail") == "") {
		log = "<a href=\"/member/login.jsp\">·Î±×ÀÎ</a> | <a href=\"/member/register.jsp\">È¸¿ø°¡ÀÔ</a> <br>";
	} else {
		log = "<a href=\"/member/logout.jsp\">·Î±×¾Æ¿ô</a> | <a href=\"/member/user_info_change1.jsp\">Á¤º¸¼öÁ¤</a><br> ";
	}
	if (getCookie("e_mail") != "" && getCookie("corp_id") != "") {
		log = "<a href=\"/member/corp_user_list.jsp\">intranet</a> | " + log;
	}
	var top;
	top = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
			+ "  <tr>"
			+ "    <td width='120'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='120' height='100'>"
			+ "        <param name=movie value='/ibbanner.swf'>"
			+ "        <param name=quality value=high>"
			+ "        <embed src='/ibbanner.swf' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='120' height='100'>"
			+ "        </embed> "
			+ "      </object></td>"
			+ "    <td width='660'>"
			+ "      <table width='100%' border='0' cellspacing='0' cellpadding='0'>"
			+ "        <tr>"
			+ "          <td height='60' width='660'>"
			+ "            <table width='100%' border='0' cellspacing='0' cellpadding='0'>"
			+ "              <tr>"
			+ "                <td width='468'><img src='" + top_banner + "' width='468' height='60'></td>"
			+ "                <td><div align='right'>"
			+ log
			+ "                   ÀÌ¿ë¾È³» | »çÀÌÆ®¸Ê<br>"
			+ "                   <a style=\"cursor:hand\" HREF onClick=\"this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.ibbanner.co.kr');\">½ÃÀÛÆäÀÌÁö·Î</a> | <a href=\"#\" onclick=\"{window.external.AddFavorite('http://www.ibbanner.co.kr', 'B2B, B2C ibBanner')}\">ºÏ¸¶Å©ÇØµÎ±â</a></div></td>"
			+ "              </tr>"
			+ "            </table>"
			+ "          </td>"
			+ "        </tr>"
			+ "        <tr>"
			+ "          <td width='660' height='40'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='660' height='40'>"
			+ "              <param name=movie value='/ibbanner_menu.swf'>"
			+ "              <param name=quality value=high>"
			+ "              <embed src='/ibbanner_menu.swf' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='660' height='40'>"
			+ "              </embed> "
			+ "            </object></td>"
			+ "        </tr>"
			+ "      </table>"
			+ "    </td>"
			+ "    <td></td>"
			+ "  </tr>"
			+ "</table>";
	document.write(top);
}
function displayBottom() {
	var bottom;
	bottom = "      <center>"
				+ "        È¸»ç¼Ò°³ | ¼­ºñ½º¾à°ü | °³ÀÎÁ¤º¸º¸È£Á¤Ã¥ | »ç¾÷Á¦ÈÞ | ±¤°í¹®ÀÇ | »çÀÌÆ®¸Ê<br>"
				+ "        Copyright &copy; ibizBaner.com"
				+ "      </center>";
	document.write(bottom);
}


//-----------------------------------------------------------------------------
// sortTable(id, col, rev)
//
//  id  - ID of the TABLE, TBODY, THEAD or TFOOT element to be sorted.
//  col - Index of the column to sort, 0 = first column, 1 = second column,
//        etc.
//  rev - If true, the column is sorted in reverse (descending) order
//        initially.
//
// Note: the team name column (index 1) is used as a secondary sort column and
// always sorted in ascending order.
//-----------------------------------------------------------------------------

function sortTable(id, col, rev) {

  // Get the table or table section to sort.
  var tblEl = document.getElementById(id);

  // The first time this function is called for a given table, set up an
  // array of reverse sort flags.
  if (tblEl.reverseSort == null) {
    tblEl.reverseSort = new Array();
    // Also, assume the team name column is initially sorted.
    tblEl.lastColumn = 1;
  }

  // If this column has not been sorted before, set the initial sort direction.
  if (tblEl.reverseSort[col] == null)
    tblEl.reverseSort[col] = rev;

  // If this column was the last one sorted, reverse its sort direction.
  if (col == tblEl.lastColumn)
    tblEl.reverseSort[col] = !tblEl.reverseSort[col];

  // Remember this column as the last one sorted.
  tblEl.lastColumn = col;

  // Set the table display style to "none" - necessary for Netscape 6 
  // browsers.
  var oldDsply = tblEl.style.display;
  tblEl.style.display = "none";

  // Sort the rows based on the content of the specified column using a
  // selection sort.

  var tmpEl;
  var i, j;
  var minVal, minIdx;
  var testVal;
  var cmp;

  for (i = 0; i < tblEl.rows.length - 1; i++) {

    // Assume the current row has the minimum value.
    minIdx = i;
    minVal = getTextValue(tblEl.rows[i].cells[col]);

    // Search the rows that follow the current one for a smaller value.
    for (j = i + 1; j < tblEl.rows.length; j++) {
      testVal = getTextValue(tblEl.rows[j].cells[col]);
      cmp = compareValues(minVal, testVal);
      // Negate the comparison result if the reverse sort flag is set.
      if (tblEl.reverseSort[col])
        cmp = -cmp;
      // Sort by the second column (team name) if those values are equal.
      if (cmp == 0 && col != 1)
        cmp = compareValues(getTextValue(tblEl.rows[minIdx].cells[1]),
                            getTextValue(tblEl.rows[j].cells[1]));
      // If this row has a smaller value than the current minimum, remember its
      // position and update the current minimum value.
      if (cmp > 0) {
        minIdx = j;
        minVal = testVal;
      }
    }

    // By now, we have the row with the smallest value. Remove it from the
    // table and insert it before the current row.
    if (minIdx > i) {
      tmpEl = tblEl.removeChild(tblEl.rows[minIdx]);
      tblEl.insertBefore(tmpEl, tblEl.rows[i]);
    }
  }

  // Make it look pretty.
  makePretty(tblEl, col);

  // Set team rankings.
  //¸µÅ©¸¦ °¡Áö°í ÀÖ´Â °æ¿ì´Â ·©Å© Á¶Á¤ÇÏÁö ¸»°Í
  //setRanks(tblEl, col, rev);

  // Restore the table's display style.
  tblEl.style.display = oldDsply;

  return false;
}

//-----------------------------------------------------------------------------
// Functions to get and compare values during a sort.
//-----------------------------------------------------------------------------

// This code is necessary for browsers that don't reflect the DOM constants
// (like IE).
if (document.ELEMENT_NODE == null) {
  document.ELEMENT_NODE = 1;
  document.TEXT_NODE = 3;
}

function getTextValue(el) {

  var i;
  var s;

  // Find and concatenate the values of all text nodes contained within the
  // element.
  s = "";
  for (i = 0; i < el.childNodes.length; i++)
    if (el.childNodes[i].nodeType == document.TEXT_NODE)
      s += el.childNodes[i].nodeValue;
    else if (el.childNodes[i].nodeType == document.ELEMENT_NODE &&
             el.childNodes[i].tagName == "BR")
      s += " ";
    else
      // Use recursion to get text within sub-elements.
      s += getTextValue(el.childNodes[i]);

  return normalizeString(s);
}

function compareValues(v1, v2) {

  var f1, f2;

  // If the values are numeric, convert them to floats.

  f1 = parseFloat(v1);
  f2 = parseFloat(v2);
  if (!isNaN(f1) && !isNaN(f2)) {
    v1 = f1;
    v2 = f2;
  }

  // Compare the two values.
  if (v1 == v2)
    return 0;
  if (v1 > v2)
    return 1
  return -1;
}

// Regular expressions for normalizing white space.
var whtSpEnds = new RegExp("^\\s*|\\s*$", "g");
var whtSpMult = new RegExp("\\s\\s+", "g");

function normalizeString(s) {

  s = s.replace(whtSpMult, " ");  // Collapse any multiple whites space.
  s = s.replace(whtSpEnds, "");   // Remove leading or trailing white space.

  return s;
}

//-----------------------------------------------------------------------------
// Functions to update the table appearance after a sort.
//-----------------------------------------------------------------------------

// Style class names.
var rowClsNm = "alternateRow";
var colClsNm = "sortedColumn";

// Regular expressions for setting class names.
var rowTest = new RegExp(rowClsNm, "gi");
var colTest = new RegExp(colClsNm, "gi");

function makePretty(tblEl, col) {

  var i, j;
  var rowEl, cellEl;

  // Set style classes on each row to alternate their appearance.
  for (i = 0; i < tblEl.rows.length; i++) {
   rowEl = tblEl.rows[i];
   rowEl.className = rowEl.className.replace(rowTest, "");
    if (i % 2 != 0)
      rowEl.className += " " + rowClsNm;
    rowEl.className = normalizeString(rowEl.className);
    // Set style classes on each column (other than the name column) to
    // highlight the one that was sorted.
    for (j = 2; j < tblEl.rows[i].cells.length; j++) {
      cellEl = rowEl.cells[j];
      cellEl.className = cellEl.className.replace(colTest, "");
      if (j == col)
        cellEl.className += " " + colClsNm;
      cellEl.className = normalizeString(cellEl.className);
    }
  }

  // Find the table header and highlight the column that was sorted.
  var el = tblEl.parentNode.tHead;
  rowEl = el.rows[el.rows.length - 1];
  // Set style classes for each column as above.
  for (i = 2; i < rowEl.cells.length; i++) {
    cellEl = rowEl.cells[i];
    cellEl.className = cellEl.className.replace(colTest, "");
    // Highlight the header of the sorted column.
    if (i == col)
      cellEl.className += " " + colClsNm;
      cellEl.className = normalizeString(cellEl.className);
  }
}

function setRanks(tblEl, col, rev) {

  // Determine whether to start at the top row of the table and go down or
  // at the bottom row and work up. This is based on the current sort
  // direction of the column and its reversed flag.

  var i    = 0;
  var incr = 1;
  if (tblEl.reverseSort[col])
    rev = !rev;
  if (rev) {
    incr = -1;
    i = tblEl.rows.length - 1;
  }

  // Now go through each row in that direction and assign it a rank by
  // counting 1, 2, 3...

  var count   = 1;
  var rank    = count;
  var curVal;
  var lastVal = null;

  // Note that this loop is skipped if the table was sorted on the name
  // column.
  while (col > 1 && i >= 0 && i < tblEl.rows.length) {

    // Get the value of the sort column in this row.
    curVal = getTextValue(tblEl.rows[i].cells[col]);

    // On rows after the first, compare the sort value of this row to the
    // previous one. If they differ, update the rank to match the current row
    // count. (If they are the same, this row will get the same rank as the
    // previous one.)
    if (lastVal != null && compareValues(curVal, lastVal) != 0)
        rank = count;
    // Set the rank for this row.
    tblEl.rows[i].rank = rank;

    // Save the sort value of the current row for the next time around and bump
    // the row counter and index.
    lastVal = curVal;
    count++;
    i += incr;
  }

  // Now go through each row (from top to bottom) and display its rank. Note
  // that when two or more rows are tied, the rank is shown on the first of
  // those rows only.

  var rowEl, cellEl;
  var lastRank = 0;

  // Go through the rows from top to bottom.
  for (i = 0; i < tblEl.rows.length; i++) {
    rowEl = tblEl.rows[i];
    cellEl = rowEl.cells[0];
    // Delete anything currently in the rank column.
    while (cellEl.lastChild != null)
      cellEl.removeChild(cellEl.lastChild);
    // If this row's rank is different from the previous one, Insert a new text
    // node with that rank.
    if (col > 1 && rowEl.rank != lastRank) {
      cellEl.appendChild(document.createTextNode(rowEl.rank));
      lastRank = rowEl.rank;
    }
  }
}

//Sort¸Þ½ÃÁö ´Ý±â
function hide_sort_message() { 
/*
    if (document.layers && document.layers["sort_message"] != null) {
        document.layers["sort_message"].visibility = 'hidden'; 
    } else if (document.all) {
        document.all["sort_message"].style.visibility = 'hidden'; 
    }
*/
    //document.all["sort_message"].style.display = "none";
    //alert(document.all["sort_message"].style.display);
		document.getElementById("sortMessageLayer").style.display="none";
} 

//Sort ¸Þ½ÃÁö Ãâ·Â
function init_sort_message() {
/*
    if (document.all["sort_message"] ==null) {
      init_sort_message_pos(0, 0);
    } else {
      show_message();
    }
*/
//      show_message();
}

function init_sort_message_pos(left_pos, top_pos) {
    
    document.write("<!--Sort¸Þ½ÃÁö½ÃÀÛ-->");
    document.write("<div id='sort_message' style='width:118px; height:77px; position:absolute; left:"+left_pos+"px; top:"+top_pos+"px; z-index:1;' class='invisible'>");
    document.write("    <table border=0 cellspacing='0' bgcolor='#E7FFD8'>");
    document.write("    <tr>");
    document.write("    <td>´ë±âÇØÁÖ¼¼¿ä</td>");
    document.write("    </tr>");
    document.write("    </table>");
    document.write("</div>");
    document.write("<!--Sort¸Þ½ÃÁö³¡-->");
    show_message();
}
var openingLayer=0;
var t_height,t_width;
function show_message() { 
    //alert(document.all["sort_message"].style.display);
/*
    if (document.layers && document.layers["sort_message"] != null) {
      document.layers["sort_message"].visibility = 'visible'; 
    } else if (document.all) {
      document.all["sort_message"].style.visibility = 'visible'; 
    }
*/
    //document.all["sort_message"].style.display = 'block'; 
    //alert(document.all["sort_message"].style.display);
    var html = '<html><head>';
    html += '</head><body>';
    html += '    <table border=0 cellspacing="0" bgcolor="#E7FFD8">';
    html += '    <tr>';
    html += '    <td>Sorting</td>';
    html += '    </tr>';
    html += '    <tr>';
    html += '    <td><img src="/img/progress.gif"></td>';
    html += '    </tr>';
    html += '    </table>';
    html += '</body></html>';
    //alert(html);
		//	sortMessageFrame.document.write(html);
			document.write(html);
	if (!openingLayer){
		closeLayers();
		sv = document.getElementById("sortMessageLayer").style;
		t_height = parseInt(sv.height);
		t_width = parseInt(sv.width);
		//alert(t_height);
		sv.height=10;
		sv.width=10;
		openingLayer=1;
		sv.display = 'inline';
  	movingLayer("sortMessageLayer");
	}
} 
function movingLayer(layerName){
	var steps=2.5;
	sv = document.getElementById(layerName).style;
	tmpx = parseInt(sv.height);
	tmpy = parseInt(sv.width);
	if (t_height - tmpx > 1){
		sv.height = tmpx+(t_height-tmpx)/steps+1;
		sv.width = tmpy+(t_width-tmpy)/steps+1;
		window.setTimeout("movingLayer('"+layerName+"')",10);
	} else {
		sv.height = t_height;
		sv.width = t_width;
		openingLayer=0;
	}
}
function closeLayers(){
	var layerNames = new Array('sortMessageLayer'); //,'fontsizeLayer','fontcolorLayer','fontbackLayer','bgcolorLayer','emoticonLayer','linkLayer');
	for (i in layerNames){
		document.getElementById(layerNames[i]).style.display="none";
	}
}
    /****************************************************
        tbl      : º´ÇÕÇÒ ´ë»ó table object
        startRow : º´ÇÕ ½ÃÀÛ row, title ÇÑ ÁÙÀÏ °æ¿ì 1
        cNum     : º´ÇÕ ½Ç½ÃÇÒ ÄÃ·³¹øÈ£, 0ºÎÅÍ ½ÃÀÛ
        length   : º´ÇÕÇÒ rowÀÇ ±æÀÌ, º¸Åë 1
        add      : ºñ±³ÇÒ ±âÁØ¿¡ Ãß°¡ÇÒ ÄÃ·³¹øÈ£
                  A | 1
                  B | 1
                 À» ¼­·Î ±¸ºÐÇÏ°í ½Í´Ù¸é, add¿¡ 0¹øÂ°
                 ÄÃ·³À» Ãß°¡
    *****************************************************/
//mergeCell(document.getElementById('tbl0'), '1', '0', '1');
//mergeCell(document.getElementById('tbl0'), '1', '1', '4');
//mergeCell(document.getElementById('tbl0'), '1', '1', '6');
    function mergeCell(tbl, startRow, cNum, length, add)
    {
        var isAdd = false;
        if(tbl == null) return;
        if(startRow == null || startRow.length == 0) startRow = 1;
        if(cNum == null || cNum.length == 0) return ;
        if(add  == null || add.length == 0) {
            isAdd = false;
        }else {
            isAdd = true;
            add   = parseInt(add);
        }
        cNum   = parseInt(cNum);
        length = parseInt(length);

        rows   = tbl.rows;
        rowNum = rows.length;

        tempVal  = '';
        cnt      = 0;
        startRow = parseInt(startRow);

        for( i = startRow; i < rowNum; i++ ) { 
            curVal = rows[i].cells[cNum].innerHTML;
            if(isAdd) curVal += rows[i].cells[add].innerHTML;
            if( curVal == tempVal ) {
                if(cnt == 0) {
                    cnt++;
                    startRow = i - 1;
                }
                cnt++;
            }else if(cnt > 0) {
                merge(tbl, startRow, cnt, cNum, length);
                startRow = endRow = 0;
                cnt = 0;
            }else {
            }
            tempVal = curVal;
        }

        if(cnt > 0) {
            merge(tbl, startRow, cnt, cNum, length);
        }
    }

    /*******************************************
        mergeCell¿¡¼­ »ç¿ëÇÏ´Â ÇÔ¼ö
    ********************************************/
    function merge(tbl, startRow, cnt, cellNum, length)
    {
        rows = tbl.rows;
        row  = rows[startRow];

        for( i = startRow + 1; i < startRow + cnt; i++ ) {
            for( j = 0; j < length; j++) {
                rows[i].deleteCell(cellNum);
            }
        }
        for( j = 0; j < length; j++) {
            row.cells[cellNum + j].rowSpan = cnt;
        }
    }

/*******************************************
    table RowSpan Á¤¸®
    rowNum : Çà¼ö
    rows[idx] : Çà °´Ã¼ idx´Â 0ºÎÅÍ ½ÃÀÛ
    rows[i].cells[0].innerHTML : i Çà 0 ¿­ ³»ºÎ ÅÂ±×
    rows[i].cells[0].innerText : i Çà 0 ¿­ °ª
********************************************/
function emptySameRowCell(tbl, startCol, endCol, compareCol) {
  rows   = tbl.rows;
  rowNum = rows.length;
  //alert(rowNum);
  startRow = 0;
  var tmp = "";
  cnt = 0;
  for( i = startRow + 1; i < rowNum; i++ ) {
    if (compareCol == null) {
      if (tmp == rows[i].cells[startCol].innerText) {
        for (j = startCol; j <= endCol; j++) {
          rows[i].cells[j].innerText = "";
        }
      } else {
        tmp = rows[i].cells[startCol].innerText;
      }
    } else {
      for( i = startRow + 1; i < rowNum; i++ ) {
        if (rows[i].cells[compareCol].innerText == "" && tmp == rows[i].cells[startCol].innerText) {
          for (j = startCol; j <= endCol; j++) {
            rows[i].cells[j].innerText = "";
          }
        } else {
          tmp = rows[i].cells[startCol].innerText;
        }
      }
    }
  }
}
function setRowSpan(tbl, startCol, endCol) {
  rows   = tbl.rows;
  rowNum = rows.length;
  //alert(rowNum);
  startRow = 0;
  cnt = 0;
  for( i = rowNum - 1; i > startRow; i-- ) {
    if (rows[i].cells[endCol].innerText == "") {
      cnt++;
      for (j = startCol; j <= endCol; j++) {
        rows[i].deleteCell(startCol);  //¾Õ¿¡¼­ »èÁ¦ÇÏ´Ï 5°¡ 4·Î ´ç°¼Áø´Ù
      }
    } else {
      for (j = startCol; j <= endCol; j++) {
        rows[i].cells[j].rowSpan = cnt + 1;
      }
      cnt = 0;
    }
  }
}

