/**
 * XMLHttpRequest °´Ã¼»ý¼º
 *
 * @return XMLHttpRequest Object
 */
function getXMLHttpRequest()
{
    if(window.ActiveXObject)
    {
        try
        {
            return new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e1)
        {
            try
            {
                return new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e2)
            {
                return null;
            }
        }
    }
    else if(window.XMLHttpRequest)
    {
        return new XMLHttpRequest();
    }
    else
    {
        return null;
    }
}

/**
 * ÆÄ¶ó¹ÌÅÍ °ªÀ» Encode ÇÑ´Ù.
 *
 * @param strValue ¹®ÀÚ¿­
 * @return String
 */
function urlEncoder(strValue)
{
    if(strValue != null && strValue != '')
    {
        return escape(encodeURIComponent(strValue));
    }
    else
    {
        return "";
    }
}

/**
 * ajax POST ¹æ½ÄÀÏ¶§ ÀÌ¸§=°ª Á¶ÇÕ
 *
 * @param frmObj FORM °´Ã¼
 * @return String
 */
function getPostData(frmObj)
{
    var elm;
    var endName ='';
    var i, k, x, z, idx=-1;
    var params = new Array();

    for(i=0, k=frmObj.length; i<k; i++)
    {
        elm = frmObj[i];

        if(elm.type == 'text' || elm.type == 'hidden' || elm.type == 'password' || elm.type == 'textarea')
        {
            if(elm.disabled == false)
            {
                idx++;
                params[idx]= elm.name + '=' + urlEncoder(elm.value);
            }
        }
        else if(elm.type == 'select-one')
        {
            if(elm.disabled == false)
            {
                if(elm.selectedIndex >= 0)
                {
                    idx++;
                    if(elm.options[elm.selectedIndex].value == '')
                    {
                        params[idx]= elm.name + '=' + urlEncoder(elm.options[elm.selectedIndex].text);
                    }
                    else
                    {
                        params[idx]= elm.name + '=' + urlEncoder(elm.options[elm.selectedIndex].value);
                    }
                }
			}
        }
        else if(elm.type == 'select-multiple')
        {
        	if(elm.disabled == false)
            {
                idx++;
                sElm = elm.options;
                params[idx]= elm.name + '=';
                var multiValues = new Array();

                for(x=0, z=sElm.length; x<z; x++)
                {
                    if(sElm[x].selected)
                    {
                        if(sElm[x].value=='')
                        {
                            multiValues[x] = urlEncoder(sElm[x].text);
                        }
                        else
                        {
                            multiValues[x] = urlEncoder(sElm[x].value);
                        }
                    }

                    params[idx] += multiValues.join(',');
                }
            }
        }
        else if(elm.type == 'radio')
        {
        	if(elm.disabled == false)
            {
                if(elm.checked)
                {
                	idx++;
                    params[idx] = elm.name + '=' + urlEncoder(elm.value);
                }
            }
		}
	}

    for(i=0, k=frmObj.length; i<k; i++)
    {
    	elm = frmObj[i];

        if(elm.type == 'checkbox')
        {
        	if(elm.disabled)
            {
                break;
            }

            if(elm.checked)
            {
            	if(elm.name == endName)
            	{
                	params[idx] += ',' + urlEncoder(elm.value);
                }
                else
                {
                    idx++;
                    params[idx] = elm.name + '=' + urlEncoder(elm.value);
                }

                endName = elm.name;
            }
            else
            {
                // unchecked and uncheck value setting
                if(elm.getAttribute('uvalue'))
                {
                    if(elm.name == endName)
                    {
                        params[idx] += ',' + urlEncoder(elm.uvalue);
                    }
                    else
                    {
                        idx++;
                        params[idx] = elm.name + '=' + urlEncoder(elm.uvalue);
                    }

                    endName = elm.name;
                }
            }
       	}
    }

    return params.join("&");
}

/**
 * HTTP ¿¡·¯¸¦ º¸¿©ÁØ´Ù.
 *
 * @param url °æ·Î
 * @param status ¿¡·¯ÄÚµå
 */
function ajaxError(url, status)
{
    var msg = '';

    msg = '¿¡·¯ÄÚµå : ' + status + '\n';
    msg += '°æ·Î : ' + url;

    if(status == 400)
    {
         msg += '\n¿äÃ»ÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.';
    }
    else if(status == 403)
    {
        msg += '\nÁ¢±Ù ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.';
    }
    else if(status == 404)
    {
        msg += '\nÆäÀÌÁö¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.';
    }
    else if(status == 408)
    {
        msg += '\n¿äÃ» ½Ã°£ÀÌ ÃÊ°úÇÏ¿´½À´Ï´Ù.';
    }
    else if(status == 500)
    {
        msg += '\nInternal Server Error.';
    }
    else if(status == 503)
    {
        msg += '\n¼­¹ö Æ®·¡ÇÈ ÃÊ°ú.';
    }

    alert(msg);
}


// lim ÆÐÅ°Áö ¼±¾ð
var lim = new Object();

////////////////////////////////////////////////////////////////////////////////
// lim ajax ¸ðµâ ½ÃÀÛ
////////////////////////////////////////////////////////////////////////////////
lim.ajax = {};

/**
 * XMLHttpRequest °´Ã¼ÀÇ send ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.
 *
 * @param url °æ·Î
 * @param params ÆÄ¶ó¹ÌÅÍ
 * @param method Àü¼Û¹æ½Ä
 * @param resType Response Å¸ÀÔ(XML, TEXT)
 * @param callbackFunc ÄÝ¹éÇÔ¼ö
 * @param readyStatusFunc »óÅÂº¯°æ½Ã È£ÃâÇÔ¼ö
 */
lim.ajax.send = function(url, params, method, resType, callbackFunc, readyStatusFunc)
{

    var req = getXMLHttpRequest();
    if(req == null)
    {
        alert('XMLHttpRequest »ý¼º½ÇÆÐ!');
        return;
    }

    var httpUrl = url;
    var httpParams = (params == null || params == '') ? null : params;
    var httpMethod = method ? method : 'GET';
    if(httpMethod != 'GET' && httpMethod != 'POST')
    {
        httpMethod = 'GET';
    }

    var httpResType = resType ? resType : 'TEXT'
    if(httpResType != 'TEXT' && httpResType != 'XML')
    {
        httpResType = 'TEXT';
    }

    if(httpMethod == 'GET' && httpParams != null)
    {
        httpUrl += '?' + httpParams;
    }

    req.open(httpMethod, httpUrl, true);
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    if(httpMethod == 'POST')
    {
        if(httpParams != null && httpParams != '')
        {
            req.setRequestHeader('Content-Length', httpParams.length);
        }
        else
        {
            req.setRequestHeader('Content-Length', 0);
        }

        req.setRequestHeader('Connection', 'close');
    }

    req.onreadystatechange = function() {
        ////////////////////////////////////////////////////////////////////
        // readyState °ª
        // 0 : UNINITIALIZED °´Ã¼¸¸ »ý¼ºµÇ°í ¾ÆÁ÷ ÃÊ±âÈ­µÇÁö ¾ÊÀº »ýÅÂ(open ¸Þ¼Òµå°¡ È£ÃâµÇÁö ¾ÊÀ½).
        // 1 : LOADING       open ¸Þ¼Òµå°¡ È£ÃâµÇ°í ¾ÆÁö send ¸Þ¼Òµå°¡ È£ÃâµÇÁö ¾ÊÀ½.
        // 2 : LOADED        send ¸Þ¼Òµå°¡ ºÒ·ÈÁö¸¸ status¿Í Çì´õ°¡ µµÂøÇÏÁö ¾ÊÀº »óÅÂ.
        // 3 : INTERACTIVE   µ¥ÀÌÅÍÀÇ ÀÏºÎ¸¦ ¹ÞÀº »óÅÂ.
        // 4 : COMPLETED     µ¥ÀÌÅÍ¸¦ ÀüºÎ ¹ÞÀº »óÅÂ(µ¥ÀÌÅÍ ÀÌ¿ë°¡´É)
        ////////////////////////////////////////////////////////////////////
        if(req.readyState == 4)
        {
            if(req.status == 200)
            {
                if(callbackFunc)
                {
                    callbackFunc(req);
                }

                if(readyStatusFunc)
	            {
	                readyStatusFunc(req.readyState);
	            }
            }
            else
            {
                ajaxError(httpUrl, req.status);
            }
        }
        else
        {
            if(readyStatusFunc)
            {
                readyStatusFunc(req.readyState);
            }
        }
    }

    req.send((httpMethod == 'POST') ? httpParams : null);
}

/**
 * XMLHttpRequest °´Ã¼ÀÇ sendÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.
 * responseText
 *
 * @param url °æ·Î
 * @param params ÆÄ¶ó¹ÌÅÍ
 * @param method Àü¼Û¹æ½Ä
 * @param callbackFunc ÄÝ¹éÇÔ¼ö
 * @param readyStatusFunc »óÅÂº¯°æ½Ã È£ÃâÇÔ¼ö
 */
lim.ajax.sendText = function(url, params, method, callbackFunc, readyStatusFunc)
{
    lim.ajax.send(url, params, method, 'TEXT', callbackFunc, readyStatusFunc);
}

/**
 * XMLHttpRequest °´Ã¼ÀÇ sendÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.
 * responseXML
 *
 * @param url °æ·Î
 * @param params ÆÄ¶ó¹ÌÅÍ
 * @param method Àü¼Û¹æ½Ä
 * @param callbackFunc ÄÝ¹éÇÔ¼ö
 * @param readyStatusFunc »óÅÂº¯°æ½Ã È£ÃâÇÔ¼ö
 */
lim.ajax.sendXml = function(url, params, method, callbackFunc, readyStatusFunc)
{
    lim.ajax.send(url, params, method, 'XML', callbackFunc, readyStatusFunc);
}
////////////////////////////////////////////////////////////////////////////////
// lim ajax ¸ðµâ ³¡
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// lim Event ½ÃÀÛ
////////////////////////////////////////////////////////////////////////////////
lim.Event = {};

/**
 * ÀÌº¥Æ® µî·Ï
 *
 * @param element    ÄÁµå·Ñ(¿ä¼Ò)
 * @param name       ÀÌº¥Æ®¸í
 * @param observer   ÀÌº¥Æ®¸¦ ¹ÞÀ»ÇÔ¼ö
 * @param useCapture Ä¸ÃÄ
 */
lim.Event.addListener = function(element, name, observer, useCapture)
{
    useCapture = useCapture || false;

    if(element.addEventListener)
    {
        element.addEventListener(name, observer, useCapture);
    }
    else if(element.attachEvent)
    {
        element.attachEvent('on' + name, observer);
    }
}

/**
 * ÀÌº¥Æ® »èÁ¦
 *
 * @param obj    ÄÁµå·Ñ(¿ä¼Ò)
 * @param name       ÀÌº¥Æ®¸í
 * @param observer   ÀÌº¥Æ®¸¦ ¹ÞÀ»ÇÔ¼ö
 * @param useCapture Ä¸ÃÄ
 */
lim.Event.removeListener = function(obj, name, observer, useCapture)
{
    useCapture = useCapture || false;

    if(obj.removeEventListener)
    {
        obj.removeEventListener(name, observer, useCapture);
    }
    else if(obj.detachEvent)
    {
        obj.detachEvent('on' + name, observer);
    }
}

/**
 * ÀÌº¥Æ® ÇÚµé·¯ÀÇ this ¹®Á¦ ÇØ°á
 *
 * @param obj element
 * @param func ÀÌº¥Æ® ÇÔ¼ö
 */
lim.Event.bindAsListener = function(func, obj)
{
    return function() {

        return func.apply(obj, arguments);

    }
}

/**
 * ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»óÀ» ¾ò´Â´Ù.
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 */
lim.Event.targetControl = function(event)
{
    if(event == null)
    {
        return null;
    }

    if(event.target)
    {
        return event.target;
    }
    else if(event.srcElement)
    {
        return event.srcElement;
    }
    else
    {
        return null;
    }
}

/**
 * ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»óÀÇ ÁÂÇ¥¸¦ ¾ò´Â´Ù.
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 * @return x, y ÁÂÇ¥
 */
lim.Event.getMouseXY = function(event)
{
	var mx = event.clientX;
    var my = event.clientY;
    
    if(document.documentElement)
    {
    	mx += document.documentElement.scrollLeft;
        my += document.documentElement.scrollTop;
    }
    else if(document.body)
    {
    	mx += document.body.scrollLeft;
        my += document.body.scrollTop;
    }
	    
    return {x: mx, y: my};
}

/**
 * ¸¶¿ì½ºÀÇ ÁÂÃø¹öÆ° Å¬¸¯¿©ºÎ
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 * @return boolean
 */
lim.Event.isMouseLeftButton = function(event)
{
    return (event.which) ? event.which == 1 && event.button == 0 : (event.type == 'click') ? event.button == 0 : event.button == 1;
}

/**
 * ¸¶¿ì½ºÀÇ ¿ìÃø¹öÆ° Å¬¸¯¿©ºÎ
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 * @return boolean
 */
lim.Event.isMouseRightButton = function(event)
{
    return event.button == 2;
}

/**
 * »óÀ§·Î ÀÌº¥Æ® ÀüÆÄ ¹æÁö
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 */
lim.Event.stopPropagation = function(event)
{
    if(event.stopPropagation)
    {
        event.stopPropagation();
    }
    else
    {
        event.cancelBubble = true;
    }
}

/**
 * ÀÌº¥Æ®¸¦ ÁßÁö
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 */
lim.Event.preventDefault = function(event)
{
    if(event.preventDefault)
    {
        event.preventDefault();
    }
    else
    {
        event.returnValue = false;
    }
}

/**
 * ÀÌº¥Æ® ÀüÆÄ¹æÁö¹× ÁßÁö.
 *
 * @param event ÀÌº¥Æ®¸¦ ¹ß»ý½ÃÅ² ´ë»ó.
 */
lim.Event.stopEvent = function(event)
{
    lim.Event.stopPropagation(event);
    lim.Event.preventDefault(event);
}
////////////////////////////////////////////////////////////////////////////////
// lim Event Á¾·á
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// lim GUI ½ÃÀÛ
////////////////////////////////////////////////////////////////////////////////
lim.GUI = {};

/**
 * Åõ¸íµµ¸¦ Á¶ÀýÇÑ´Ù.
 *
 * @param el ¿ä¼Ò
 * @param opacity °ª
 */
lim.GUI.setOpacity = function(el, opacity)
{
    if(el.filters)
    {
        el.style.filter = 'alpha(opacity='+(opacity * 100)+')';
    }
    else
    {
        el.style.opacity = opacity;
    }
}

/**
 * style ¼Ó¼º °ªÀ» ¾ò´Â´Ù
 *
 * @param el ¿ä¼Ò
 * @param property ¼Ó¼º
 */
lim.GUI.getStyle = function(el, property)
{
    var value = null;
    var dv = document.defaultView;

    if(property == 'opacity' && el.filters) // IE
    {
        value = 1;
        try
        {
            value = el.filters.item('alpha').opacity / 100;
        }
        catch(e) {}
    }
    else if(el.style[property])
    {
        value = el.style[property];
    }
    else if(el.currentStyle && el.currentStyle[property])
    {
        value = el.currentStyle[property];
    }
    else if(dv && dv.getComputedStyle)
    {
        var converted = '';
        var i =0;
        var len = 0;
        for(i=0, len=property.length; i<len; ++i)
        {
            if(property.charAt(i) == property.charAt(i).toUpperCase())
            {
                converted = converted + '-' + property.chatAt(i).toLowCase();
            }
            else
            {
                converted = converted + property.charAt(i);
            }
        }

        if(dv.getComputedStyle(el, '').getPropertyValue(converted))
        {
            value = dv.getComputedStyle(el, '').getPropertyValue(converted);
        }
    }

    return value;
}

/**
 * ÇöÀç Ã¢ÀÇ ¼¾ÅÍ ÁÂÇ¥¸¦ ¾ò´Â´Ù.
 *
 * @param width Æø
 * @param height ³ôÀÌ
 */
lim.GUI.getCenter = function(width, height)
{
	var x1 = 0;
	var y2 = 0;
	
	if(width > 0)
	{
		x1 = (screen.availWidth - parseInt(width)) / 2;
	}
	else
	{
		x1 = screen.availWidth / 2;
	}
	
	if(height > 0)
	{
    	y2 = (screen.availHeight - parseInt(height)) / 2;
    }
    else
    {
    	y2 = screen.availHeight / 2;
    }
    
	return {x: x1, y: y2};
}

/**
 * ¿ä¼ÒÀÇ xÁÂÇ¥¿Í yÁÂÇ¥¸¦ ¾ò´Â´Ù.
 *
 * @param el ¿ä¼Ò
 */
lim.GUI.getXY = function(el)
{
    if(el.parentNode == null || el.style.display == 'none')
    {
        return false;
    }

    var parent = null;
    var pos = [];
    var box;

    if(document.getBoxObjectFor)
    {
        box = document.getBoxObjectFor(el);
        pos = [box.x, box.y];        
    }
    else
    {
        pos = [el.offsetLeft, el.offsetTop];
        parent = el.offsetParent;

        if(parent != el)
        {
            while(parent)
            {
                pos[0] += parent.offsetLeft;
                pos[1] += parent.offsetTop;

                parent = parent.offsetParent;
            }
        }

        var ua = navigator.userAgent.toLowerCase();

        if(ua.indexOf('opera') != -1 || (ua.indexOf('safari') != -1 && lim.GUI.getStyle(el, 'position') == 'absolute'))
        {
            pos[1] -= document.body.offsetTop;
        }
    }

    if(el.parentNode)
    {
        parent = el.parentNode;
    }
    else
    {
        parent = null;
    }

    while(parent && parent.tagName != 'BODY' && parent.tagName != 'HTML')
    {
        pos[0] -= parent.scrollLeft;
        pos[1] -= parent.scrollTop;

        if(parent.parentNode)
        {
            parent = parent.parentNode;
        }
        else
        {
            parent = null;
        }
    }
  
    return {x: pos[0], y: pos[1]};
}

/**
 * ¿ä¼ÒÀÇ xÁÂÇ¥¸¦ ¾ò´Â´Ù.
 *
 * @param el ¿ä¼Ò
 */
lim.GUI.getX = function(el)
{
    return lim.GUI.getXY(el).x;
}

/**
 * ¿ä¼ÒÀÇ yÁÂÇ¥¸¦ ¾ò´Â´Ù.
 *
 * @param el ¿ä¼Ò
 */
lim.GUI.getY = function(el)
{
    return lim.GUI.getXY(el).y;
}

/**
 * ¿ä¼ÒÀÇ x, y ÁÂÇ¥¿Í ³ÐÀÌ¿Í ³ôÀÌ¸¦ ¾ò´Â´Ù.
 *
 * @param el ¿ä¼Ò
 */
lim.GUI.getBounds = function(el)
{
    var xy = lim.GUI.getXY(el);

    return {

        x: xy.x,
        y: xy.y,
        width: el.offsetWidth,
        height: el.offsetHeight

    };
}

lim.GUI.setXY = function(el, x, y)
{
    var pageXY = lim.GUI.getXY(el);

    if(pageXY == false)
    {
        return false;
    }

    var position = lim.GUI.getStyle(el, 'position');

    if(!position || position == 'static')
    {
        el.style.position = 'relative';
    }

    var delta = {
        x: parseInt(lim.GUI.getStyle(el, 'left'), 10),
        y: parseInt(lim.GUI.getStyle(el, 'top'), 10)
    }

    if(isNaN(delta.x)) { delta.x = 0; }
    if(isNaN(delta.y)) { delta.y = 0; }

    if(x != null)
    {
        el.style.left = (x - pageXY.x + delta.x) + 'px';
    }

    if(y != null)
    {
        el.style.top = (y - pageXY.y + delta.y) + 'px';
    }

    return true;
}
////////////////////////////////////////////////////////////////////////////////
// lim GUI Á¾·á
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// ·Î±× °ü·Ã ½ÃÀÛ
////////////////////////////////////////////////////////////////////////////////
var _logToBottom = 'b';
/**
 * ·Î±×Ãâ·Â ½ºÅ©¸³Æ®
 */
function _logView()
{
    var _logToBottomText = '¡ã »ó´Ü';
    if(_logToBottom != 'b')
    {
        _logToBottomText = '¡å ÇÏ´Ü'
    }

    document.write('<div id="_logConsolMain" align="center" style="position:absolute; display:none; width:100%; height:220px; left:0px; top:0px; border-bottom:1px solid #cccccc;"><input type="button" id="_logMoveBtn" value="'+_logToBottomText+'" onfocus="blur()" onclick="javascript:if(_logMove) { _logMove(); }" style="padding-top:2; font-family:±¼¸²; font-size:9pt; width:10%; height:20px; padding-bottom:5px; background-color:#cccccc;"><input type="button" id="_logRemoveBtn" value="·Î±× Áö¿ì±â" onfocus="blur()" onclick="javascript:if(_logClear) { _logClear(); }" style="padding-top:2; font-family:±¼¸²; font-size:9pt; width:90%; height:20px; padding-bottom:5px; background-color:#cccccc;"><div id="_debugConsol" style="position:relative; display:none; width:99.7%%; height:200px; background-color:#ffffff; border-bottom:1px solid #cccccc;padding:5px; font-family:±¼¸²; font-size:10pt; text-align:left; overflow-y:auto; line-height:14pt;" align="center"></div></div>');
}

/**
 * ·Î±×¸¦ ±â·ÏÇÑ´Ù.
 *
 * @paranm logStr ·Î±×¹®ÀÚ¿­
 */
function _log(logStr)
{
    var by = 0;
    var bx = 0;

    if(_logToBottom == 'b')
    {
        if(typeof(window.innerHeight) == 'number')
        {
            by = window.innerHeight;
            bx = window.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
            by = document.documentElement.clientHeight;
            bx = document.documentElement.clientWidth;
        }
        else if (document.body && document.body.clientHeight)
        {
            by = document.body.clientHeight;
            bx = document.body.clientWidth;
        }

        if (typeof(window.pageYOffset) == 'number')
        {
            by = by + window.pageYOffset;
            bx = bx + window.pageXOffset;
        }
        else if (document.body && document.body.scrollTop)
        {
            by = by + document.body.scrollTop;
            bx = bx + document.body.scrollLeft;
        }
        else if (document.documentElement && document.documentElement.scrollTop)
        {
            by = by + document.documentElement.scrollTop;
            by = by + document.documentElement.scrollLeft;
        }
    }
    else
    {
        if(typeof(window.pageYOffset) == 'number')
        {
            by = by + window.pageYOffset;
            bx = by + window.pageXOffset;
        }
        else if (document.body && document.body.scrollTop)
        {
            by = by + document.body.scrollTop;
            bx = bx + document.body.scrollLeft;
        }
        else if (document.documentElement && document.documentElement.scrollTop)
        {
            by = by + document.documentElement.scrollTop;
            bx = bx + document.documentElement.scrollLeft;
        }

        by += 5;
    }

    if(document.getElementById("_logConsolMain") && document.getElementById("_debugConsol"))
    {
        if(logStr != null && logStr != '')
        {
            logStr = '<font color="red"><b>'+getDate('/') + ' ' + getHour() + ':' + getMinute() + ':' + getSecond() + ' ' + getMillisecond() + '</b></font>&nbsp;&nbsp;&nbsp;&nbsp;==>&nbsp;&nbsp;&nbsp;&nbsp;' + logStr;

            if(_logToBottom == 'b')
            {
                lim.GUI.setXY(document.getElementById("_logConsolMain"), 0, by - 240);
            }
            else
            {
                lim.GUI.setXY(document.getElementById("_logConsolMain"), 0, by);
            }

            if(lim.GUI.getStyle(document.getElementById('_logConsolMain'), 'opacity') != 1)
            {
                lim.GUI.setOpacity(document.getElementById('_logConsolMain'), 1);
            }
            if(lim.GUI.getStyle(document.getElementById('_debugConsol'), 'opacity') != 1)
            {
                lim.GUI.setOpacity(document.getElementById('_debugConsol'), 1);
            }
            if(lim.GUI.getStyle(document.getElementById('_logMoveBtn'), 'opacity') != 1)
            {
                lim.GUI.setOpacity(document.getElementById('_logMoveBtn'), 1);
            }
            if(lim.GUI.getStyle(document.getElementById('_logRemoveBtn'), 'opacity') != 1)
            {
                lim.GUI.setOpacity(document.getElementById('_logRemoveBtn'), 1);
            }

            if(document.getElementById("_logConsolMain").style.display != '' || document.getElementById("_debugConsol").style.display != '')
            {
                document.getElementById("_logConsolMain").style.display = '';
                document.getElementById("_debugConsol").style.display = '';
            }

            if(document.getElementById("_debugConsol").innerHTML != '')
            {
                document.getElementById("_debugConsol").innerHTML = logStr + "<br>" + getElementById("_debugConsol").innerHTML;
            }
            else
            {
                document.getElementById("_debugConsol").innerHTML = logStr;

                lim.Event.addListener(window, 'resize', _logResize, false);
                lim.Event.addListener(window, 'scroll', _logResize, false);
            }
        }
    }
}

/**
 * ÀúÀåµÈ ·Î±×¸¦ »èÁ¦ ÇÑ´Ù.
 */
function _logClear()
{
    if(document.getElementById("_debugConsol") && document.getElementById("_logConsolMain") && document.getElementById("_debugConsol").style.display == '' && document.getElementById("_logConsolMain").style.display == '')
    {
        setTimeout("_logTimerClear(parseFloat(1.0))", 50);

        lim.Event.removeListener(window, 'resize', _logResize, false);
        lim.Event.removeListener(window, 'scroll', _logResize, false);
    }
}

function _logTimerClear(opacity)
{
    if(opacity >= 0)
    {
        opacity = opacity - 0.1;

        lim.GUI.setOpacity(document.getElementById('_logConsolMain'), opacity);
        lim.GUI.setOpacity(document.getElementById('_debugConsol'), opacity);
        lim.GUI.setOpacity(document.getElementById('_logMoveBtn'), opacity);
        lim.GUI.setOpacity(document.getElementById('_logRemoveBtn'), opacity);

        setTimeout("_logTimerClear("+opacity+")", 50);
    }
    else
    {
        document.getElementById("_debugConsol").innerHTML = '';
        document.getElementById("_debugConsol").style.display = 'none';
        document.getElementById("_logConsolMain").style.display = 'none';
    }
}

function _logResize()
{
    var by = 0;
    var bx = 0;
    var flag = false;

    if(_logToBottom == 'b')
    {
        if (typeof(window.innerHeight) == 'number')
        {
            by = window.innerHeight;
            bx = window.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
            by = document.documentElement.clientHeight;
            bx = document.documentElement.clientWidth;
        }
        else if (document.body && document.body.clientHeight)
        {
            by = document.body.clientHeight;
            bx = document.body.clientWidth;
        }

        if (typeof(window.pageYOffset) == 'number')
        {
            by = by + window.pageYOffset;
            bx = bx + window.pageXOffset;
        }
        else if (document.body && document.body.scrollTop)
        {
            by = by + document.body.scrollTop;
            bx = bx + document.body.scrollLeft;
        }
        else if (document.documentElement && document.documentElement.scrollTop)
        {
            by = by + document.documentElement.scrollTop;
            by = by + document.documentElement.scrollLeft;
        }
    }
    else
    {
        if (typeof(window.pageYOffset) == 'number')
        {
            by = by + window.pageYOffset;
            bx = by + window.pageXOffset;
        }
        else if (document.body && document.body.scrollTop)
        {
            by = by + document.body.scrollTop;
            bx = bx + document.body.scrollLeft;
        }
        else if (document.documentElement && document.documentElement.scrollTop)
        {
            by = by + document.documentElement.scrollTop;
            bx = bx + document.documentElement.scrollLeft;
        }

        by += 5;
    }

    if(document.getElementById("_logConsolMain").style.display == '' && document.getElementById("_debugConsol").style.display == '')
    {
        if(_logToBottom == 'b')
        {
            lim.GUI.setXY(document.getElementById("_logConsolMain"), 0, by - 245);
        }
        else
        {
            lim.GUI.setXY(document.getElementById("_logConsolMain"), 0, by);
        }
    }
}

function _logMove()
{
    var _logToBottomText = '';

    if(document.getElementById("_logConsolMain").style.display == '' && document.getElementById("_debugConsol").style.display == '')
    {
        if(_logToBottom == 'b')
        {
            _logToBottom = 't';
            _logToBottomText = '¡å ÇÏ´Ü';
        }
        else
        {
            _logToBottom = 'b';
            _logToBottomText = '¡ã »ó´Ü';
        }

        document.getElementById("_logMoveBtn").value = _logToBottomText;
        _logResize();
    }
}
////////////////////////////////////////////////////////////////////////////////
// ·Î±× °ü·Ã Á¾·á
////////////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////////
// xml2json °ü·Ã
////////////////////////////////////////////////////////////////////////////////
//Create DOM
function parseXml(xml) {
	var dom = null;
	if(window.DOMParser) {
		try { 
			dom = (new DOMParser()).parseFromString(xml, "text/xml"); 
		} 
		catch (e) { dom = null; }
	}
	else if (window.ActiveXObject) {
		try {
			dom = new ActiveXObject('Microsoft.XMLDOM');
			dom.async = false;
			if (!dom.loadXML(xml)) // parse error ..

				window.alert(dom.parseError.reason + dom.parseError.srcText);
		} 
		catch (e) { dom = null; }
	}
	else
		alert("cannot parse xml string!");

	return dom;
}

//JSON »ý¼º		
function MakeJSONObject(xmlResponse)
{
	var DOM = parseXml(xmlResponse.responseText);
	return eval("(" + xml2json(DOM, "") + ")");
}

//JSON ·çÆ® ¿¤¸®¸ÕÆ® ÀÌ¸§ ¹ÝÈ¯
function GetRootElementName(JSON)
{	
	var sRootEN;
	for(x in JSON)
		sRootEN = x;
	return sRootEN;
}

//JSON ·¹ÄÚµå ¿¤¸®¸ÕÆ® ÀÌ¸§ ¹ÝÈ¯
function GetRowName(JSON)
{
	var sRootName = GetRootElementName(JSON);
	var sRow;
	for(x in JSON[sRootName])
		sRow = x;
		
	return sRow;
}

//JSON ÄÃ·³ ¿¤¸®¸ÕÆ® ÀÌ¸§ ¹è¿­ ¹ÝÈ¯
//¾øÀ¸¸é null ¹ÝÈ¯
function GetColumnNames(JSON)
{
	var arrReturn = new Array();
	var idx = 0;
	var sRootName = GetRootElementName(JSON);
	var sRowName = GetRowName(JSON);
	
	for(x in JSON[sRootName][sRowName])
	{
		arrReturn[idx] = x;
		idx++;
	}
	return arrReturn;
}

//null => "" ¹ÝÈ¯
function NullCheck(value)
{
	return value == null? "" : value;
}