document.domain ="k-1kr.com";

// Browse Type
// IE Script
var NS4;
var IE4;
if (document.all)
{
    IE4 = true;
    NS4 = false;
}
else
{
    IE4 = false;
    NS4 = true;
}
isWin = (navigator.appVersion.indexOf("Win") != -1)

/* ÆË¾÷ °ü·Ã ÇÔ¼ö */
function open_window2(url, name, width, height, feature)
{
    var oWnd;

    if (IE4 && width < window.screen.width && height < window.screen.height) 
    {
        var windowX = Math.ceil( (window.screen.width  - width) / 100 );
        var windowY = Math.ceil( (window.screen.height - height) / 100 );

        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height+",left="+windowX+",top="+windowY + ",resizable=yes");
    }
    else 
    {
        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height + ",resizable=yes");
    }

    return oWnd;
}

/* ÆË¾÷ °ü·Ã ÇÔ¼ö */
function open_window(url, name, width, height, feature)
{
    var oWnd;

    if (IE4 && width < window.screen.width && height < window.screen.height) 
    {
        var windowX = Math.ceil( (window.screen.width  - width) / 2 );
        var windowY = Math.ceil( (window.screen.height - height) / 2 );

        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height+",left="+windowX+",top="+windowY + ",resizable=yes");
    }
    else 
    {
        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height + ",resizable=no");
    }

    return oWnd;
}

function open_wnd(url, name, width, height)
{
    var oWnd = open_window(url, name, width, height, "toolbar=0,menubar=0,resizable=yes,scrollbars=no");
    return oWnd;
}

function pop(url,width,height,flag)
{
    if (flag == 1 )
        var oPop = open_window(url, "", width, height, "toolbar=0,menubar=0,scrollbars=yes,resizable=yes");    
    else
        var oPop = open_window(url, "", width, height, "toolbar=0,menubar=0,scrollbars=no,resizable=yes");    
    return oPop;        
}

function pop2(url,width,height,flag)
{
    if (flag == 1)
		var oPop = open_window(url, "", width, height, "toolbar=0,menubar=0,scrollbars=no,resizable=yes");    
    else
		var oPop = open_window(url, "", width, height, "toolbar=0,menubar=0,scrollbars=no,resizable=no");
	
	return oPop;
}

///* ÆäÀÌÁö ÀÌµ¿ °ü·Ã ÇÔ¼ö */
function toLoginPage(paramURL)
{
    if (paramURL == null || paramURL == '')
        paramURL = document.location.href;
        
    var url = "http://id.naver.com/nidlogin.login?mode=form&url=" + paramURL;
    top.location.href = url;
}
function toLogoutPage()
{
    var url = "/common/LogOut.jsp";
    top.location.href = url;
}

// change admin menu's class
function admin_menu_select(menu_num)
{
    for (i=1; i<=27; i++) 
    {
		var objMenu = parent.document.getElementById("menu" + i);
        if (objMenu != null && typeof(objMenu) == 'object') 
        {
            if (i == menu_num) 
				objMenu.className = "b u";
            else 
				objMenu.className = "";
        }
    }
}
// change cafemain menu's table
function cafemain_menu_select(menu_num)
{
    if (parent != null)
    {
        for (i=1; i<=6; i++)
        {
			var objTopMenuTab = parent.document.getElementById("CafeTopMenuTab" + i);
			if (objTopMenuTab != null && typeof(objTopMenuTab) == 'object')
			{
	            if (i == menu_num)
	                objTopMenuTab.style.display = "block";
		        else
					objTopMenuTab.style.display = "none";
			}
        }
    }
}

function resizepopup()     
{
// var winW = 356, winH = 200;
    winW = document.body.scrollWidth;
    winH = document.body.scrollHeight;
/*
    if(winH > 550)
        winH = 550;
*/
    window.resizeTo(winW + 25,winH + 40);
}

function resizepopup2(wid)     
{
    var winW = wid, winH = 200;
    winH = document.body.scrollHeight;

    if(winH > 550)
        winH = 550;

    window.resizeTo(winW,winH+40);
}

/* onLoad Handler */
LOAD_LIST = new Array();
function LH_create()
{
    this.LIST = LOAD_LIST;
    this.add = LH_add;
    this.exec = LH_exec;

}

function LH_add(strExec)
{
		//document.write("ASDFSADF"+strExec);
    LOAD_LIST[LOAD_LIST.length] = strExec;
}

function LH_exec()
{
    var list_len = LOAD_LIST.length;
	//	document.write ("A"+list_len);

    for (var i = 0; i < list_len; i++)
    {
        eval(LOAD_LIST[i]);
    }
}

/* ÇÑ±Û ½ºÆ®¸µ Ã³¸® ÇÔ¼ö */
// string String::cut(int len, string tail)
String.prototype.cut = function(len, tail) 
{
    var str = this;
    var l = 0;
    for (var i=0; i<str.length; i++) 
    {
        l += (str.charCodeAt(i) > 128) ? 2 : 1;
        if (l > len) return str.substring(0,i) + tail;
    }
    return str;
}

// bool String::bytes(void)
String.prototype.bytes = function() 
{
    var str = this;
    var l = 0;
    for (var i=0; i<str.length; i++) 
        l += (str.charCodeAt(i) > 128) ? 2 : 1;

    return l;
}

// string String::trim();
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
}

// µû¿ÈÇ¥¿Í ¿ª½½·¡½¬ Ã³¸®
function replaceBackslash(paramStr) 
{
    var str = paramStr;
    if (str.indexOf("\\") >= 0) str = str.replace(/\\/g, "\\\\");
    if (str.indexOf("\"") >= 0) str = str.replace(/\"/g, "\\\"");
    return str;
}

// == Iframe Handling ==
// iframe resize½Ã ÃÖ¼Ò width, height
var frmMinWidth;
var frmMinHeight;
var applyMinSize = false;
// iframe resize½Ã ÃÖ´ë width, height
var frmMaxWidth;
var frmMaxHeight;
var applyMaxSize = false;
function setMinSize(width, height)
{
    frmMinWidth = width;
    frmMinHeight = height
    applyMinSize = true;
}
function setMaxSize(width, height)
{
    frmMaxWidth = width;
    frmMaxHeight = height
    applyMaxSize = true;
}

function resizeIframe(name)
{
    if (name == null || name == "")
    {
        name = "cafe_main";
    }
        
    try
    {
        if (IE4)
            var oBody   = document.frames(name).document.body;
        else
            var oBody = document.getElementById(name).contentDocument.body;
        var oIFrame = document.getElementById(name);

        var frmWidth  = oBody.scrollWidth;
        var frmHeight = oBody.scrollHeight;

        if (applyMinSize)
        {
            frmWidth  = Math.max(frmWidth, frmMinWidth);
            frmHeight = Math.max(frmHeight, frmMinHeight);
        }
        if (applyMaxSize)
        {
            frmWidth  = Math.min(frmWidth, frmMaxWidth);
            frmHeight = Math.min(frmHeight, frmMaxHeight);
        }

        oIFrame.style.height = frmHeight;
        oIFrame.style.width = frmWidth;
    }
    catch (e) {}
}

function parentResizeIframe(name)
{
    if (parent && parent != this && parent.resizeIframe != null)
    {
        parent.resizeIframe(name);
    }
}

// F5¸¦ ´­·¶À»¶§ iframe ³»ºÎ¸¸ refresh µÇµµ·Ï Ã³¸® start
if (NS4) 
{
    document.captureEvents(Event.KEYDOWN)
    document.onkeydown = trapRefreshNS;
} 
else if (IE4) 
{
    document.onkeydown = trapRefreshIE;
}

function trapRefreshNS(e)
{
    if (e.keyCode == 116)
    {
        e.cancelBubble = true; 
        e.returnValue = false;
        document.location.reload();
    }
}

function trapRefreshIE()
{
    if (event.keyCode == 116)
    {
        event.keyCode = 0; 
        event.cancelBubble = true; 
        event.returnValue = false;
        document.location.reload();
    }
}
// F5¸¦ ´­·¶À»¶§ iframe ³»ºÎ¸¸ refresh µÇµµ·Ï Ã³¸® end

function parentPlusIframe(name, height)
{
    if (parent && parent != this && parent.plusIframe != null)
    {
        parent.plusIframe(name, height);
    }
}

function plusIframe(name, height)     
{
    if (name == null || name == "")
    {
        name = "cafemain";
    }
    
    try
    {
        if (IE4)
            var oBody   = document.frames(name).document.body;
        else
            var oBody = document.getElementById(name).contentDocument.body;
        var oIFrame = document.getElementById(name);

        var frmWidth  = oBody.scrollWidth;
        var frmHeight  = oBody.scrollHeight;

        if (applyMinSize)
        {
            frmHeight = Math.max(frmHeight, frmMinHeight);
        }
        if (applyMaxSize)
        {
            frmHeight = Math.min(frmHeight, frmMaxHeight);
        }
        oIFrame.style.height = frmHeight + height;
    }
    catch (e)
    {
        window.status = "IFrame Size Plus Error";
    }
}



function showEmoticonBox(top,left)
{
    var pos = document.body.clientHeight;

    if (document.getElementById("emoticon").style.display == "none")
    {
        document.getElementById("emoticon").style.top = event.y+document.body.scrollTop-event.offsetY+top;
        document.getElementById("emoticon").style.left = event.x+document.body.scrollLeft-event.offsetX+left;
        document.getElementById("emoticon").style.display = "";
    }
    else
    {
        document.getElementById("emoticon").style.display = "none";
    }
}


function setpersonaconemot(emot, emoturl)
{
    document.getElementById("myemoticon").width = 19;
    document.getElementById("myemoticon").height = 19;
    document.getElementById("myemoticon").src = "/mobileschool/web/images/" + emoturl + emot + ".gif";
    document.WriteFrm.personacon.value = emot;
    document.getElementById("emoticon").style.display = "none";
}

function next(str,order,size){     // ÁÖ¹Î¹øÈ£ valid check , ÀÚµ¿ ´ÙÀ½ Æû ÀÌµ¿
	
	num=str.value;
	siz=num.length;
	if (siz==size){
		if (order==1)
		{
			document.WriteFrm.phone3.focus();
		}
		else
		{
			document.WriteFrm.name.focus();
		}
	}
}



