var KR = 82;
var EN = 1;
var g_hWnd = null;
var bBuddyLayer = false;
var oBuddyForm = {};

var MSG = {
	ALREDY_CONNECTION:{
		en:"현재 통신 중입니다.\n\n[확인] 버튼을 누르고, 잠시만 기다리세요.",
		kr:"현재 통신 중입니다.\n\n[확인] 버튼을 누르고, 잠시만 기다리세요."},
	INTERNAL_ERROR:{
		en:"일시적인 서버 장애로 처리되지 못하였습니다.\n\n잠시 후, 다시 시도해보세요.",
		kr:"일시적인 서버 장애로 처리되지 못하였습니다.\n\n잠시 후, 다시 시도해보세요."}
};

function getMsg(s, lang)
{
	if (lang == undefined)
		var lang = EN;

	if (lang == EN)
		return MSG[s].en;
	else
		return MSG[s].kr;
}

function PageMove(pageFormName, pageNo)
{
	var oForm = document.forms["pageForm"];
	if (oForm)
	{
		oForm[pageFormName].value = pageNo;
	}
	else
	{
		alert("페이지 정보를 담을 폼이 없습니다.\n\n페이지 이동을 할 수 없습니다.");
	}
	oForm.submit();
}

function PageMove1(pageFormName, pageNo)
{
	var oForm = document.forms["pageForm1"];
	if (oForm)
	{
		oForm[pageFormName].value = pageNo;
	}
	else
	{
		alert("페이지 정보를 담을 폼이 없습니다.\n\n페이지 이동을 할 수 없습니다.");
	}
	oForm.submit();
}


function PageMove2(pageFormName, pageNo)
{
	var oForm = document.forms["pageForm2"];
	if (oForm)
	{
		oForm[pageFormName].value = pageNo;
	}
	else
	{
		alert("페이지 정보를 담을 폼이 없습니다.\n\n페이지 이동을 할 수 없습니다.");
	}
	oForm.submit();
}

function isValidUserID(userid)
{
	if (userid == "")
	{
		alert("아이디를 입력하세요.");
		return false;
	}

	if (userid.length < 3 ||  userid.length > 16)
	{
		alert("아이디는 3∼16자로 입력하셔야 합니다.");
		return false;
	}

	if (userid.replace(/[a-zA-Z0-9\-]+/g,"") != false)
	{
		alert("아이디는 영문과 숫자, 하이픈(-)으로 입력하셔야 합니다.");
		return false;
	}

	if (userid.substr(0,1) == "-" || userid.substr(userid.length - 1,1) == "-")
	{
		alert("아이디는 하이픈(-)으로 시작하거나 끝날 수 없습니다.");
		return false;
	}

	return true;
}

function goMenu(name)
{
	location.href = gURL_root + "/" + name + ".php";
}

function onRollOver(mode)
{
	$("happybox-left-pane").style.width = "310px"; // 310
	$("happybox-left-pane").style.background = "transparent url(../img/bg_dot.png) repeat-y right top";

	$("divSmallContainer").style.display = "none";
	$("divBigContainer").style.display = "block";
	
	$("happybox-right-pane").style.width = "480px"; // 480

	displayResize();
}

function onRollOut(mode)
{
	$("happybox-left-pane").style.width = "120px"; // 310
	$("happybox-left-pane").style.background = "transparent url(../img/bg_dot.png) repeat-y top 100px";

	$("divSmallContainer").style.display = "block";
//	$("divSmallContainer").style.marginTop = "-250px";

	$("divBigContainer").style.display = "none";

	$("happybox-right-pane").style.width = "670px"; // 480

	displayResize();
}

function displayResize(b)
{
	if (b == undefined)
		b = true;

	var oLeft = $("happybox-left-pane");
	var oRight = $("happybox-right-pane");
	var oMap = $("happybox-map");

	if (oLeft.clientHeight < oRight.clientHeight)
	{
		//oMap.style.height = (oRight.clientHeight - 150) + "px";
		var h = parseInt(oRight.clientHeight);

		if (h < 550)
			h = 650;

		oLeft.style.height = h + "px";
		oLeft.style.backgroundImage = gURL_root + "/img/bg_dot.png";
	}
	else
	{
		var h = parseInt(oLeft.clientHeight);

		if (h < 550)
			h = 650;

		oLeft.style.height = h + "px";
		oLeft.style.backgroundImage = gURL_root + "/img/bg_dot.png";
	}

	if (!b)
	{
		oLeft.style.height = oRight.clientHeight + "px";
	}

}


function isTimeCnt(n)
{
	return /^([0-9]){1,3}(|\.([0-9]){1,2})$/.test(n);
}

function doFind()
{
	var oForm = document.forms['tagForm'];
//	oForm['item'].value = $('__item').value;
	oForm['tag'].value = $('__tag').value;
	oForm.submit();
}
