﻿/*
 * Browser type
 */
 
//document.domain = "hanbiton.com";

var isOpera = navigator.userAgent.indexOf("Opera") > -1; 
var isIE = navigator.userAgent.indexOf("MSIE") > 1 && !isOpera; 
var isMoz = navigator.userAgent.indexOf("Mozilla/5.") == 0 && !isOpera; 

// ajax
// XMLHTTP object
var objHttp;

/*
	Title 및 상태바 링크 숨기기
*/
document.title = "T3 Entertainment";

if (document.layers) {
	document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
}

document.onmouseover = hidestatus;
document.onmouseout = hidestatus;

function hidestatus(){
	window.status = 'T3 Entertainmnet';
	return true;
}
/*
 * document event
 */
//document.oncontextmenu = new Function("return false");
document.onclick = MouseDown;
document.onkeydown = processKey;
/*
 * String object prototype functions
 */
// length
String.prototype.getAsciiLength = function() {
	var len = 0;
	for (i = 0; i < this.length; i++) {
		if (this.charCodeAt(i) < 255) {
			len++;
		} else {
			len+=2;
		}
	}
	return len;
}

// trim
String.prototype.trim = function() {
	var retValue = this;

	var ch = retValue.substring(0, 1);
	while (ch == " ") {
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}

	ch = retValue.substring(retValue.length - 1, retValue.length);
	while (ch == " ") {
		retValue = retValue.substring(0, retValue.length - 1);
		ch = retValue.substring(retValue.length - 1, retValue.length);
	}

	return retValue;
}

/*
 * utility functions
 */
// trim
function trim(input) {
	if (typeof input != "string") return input;
	
	var retValue = input;

	var ch = retValue.substring(0, 1);
	while (ch == " ") {
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	
	ch = retValue.substring(retValue.length - 1, retValue.length);
	while (ch == " ") {
		retValue = retValue.substring(0, retValue.length - 1);
		ch = retValue.substring(retValue.length - 1, retValue.length);
	}
	
	return retValue;
}




/*
 * utility functions
 */
//아스키코드값 173 입력 불가 처리 
function CheckNullChar(input)
{
  for (i=0; i<input.length; i++)
  {
    if(input.charCodeAt(i) == 173)
      return false;
  }
  return true;
} 
function CheckSpecialChar(input)
{
  var ret = false;
  ret = CheckNullChar(input);
  if(ret)
  {
    for (i=0; i<input.length; i++)
    {
      if(input.charCodeAt(i) == 8 || input.charCodeAt(i) == 92)
      {
        ret = false;
        break;
      }
    }
    ret = true;
  }
  return ret;
}

// replace string
function replace(str, source, copy) {
	while (str.indexOf(source) != -1) {
		str = str.substring(0, str.indexOf(source)) + copy + str.substring(str.indexOf(source) + source.length);
	}
	return str;
}

// IsNumeric
function IsNumeric(str) {
	var r = new RegExp("^[0-9]*$");
	if (document.all) {
		return r.exec(str) != null;
	} else {
		return r(str) != null;
	}
}

// ASCII only
function URLEncode(plaintext) {
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "%20";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				// encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
}

function URLDecode(encoded) {
	// Replace + with ' '
	// Replace %xx with equivalent character
	// Put [ERROR] in output if %xx is invalid.
	var HEXCHARS = "0123456789ABCDEFabcdef"; 
	var plaintext = "";
	var i = 0;
	
	while (i < encoded.length) {
		var ch = encoded.charAt(i);
		if (ch == "+") {
			plaintext += " ";
			i++;
		} else if (ch == "%") {
			if (i < (encoded.length-2) 
				&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
				&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
			plaintext += ch;
			i++;
		}
	} // while
	return plaintext;
}

// 이미지 미리 로딩
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];}}
}

// windowsopen
function openWindow(loc, name, opt) {
	var win = window.open(loc, name, opt);
	if (win == null) {
		alert("한빛온을 원활하게 이용하시려면 먼저 팝업차단설정을 꺼주세요");
	}
	return win;
}

// get cookie expire day
function getexpirydate(mins){
	var Today = new Date();
	var nomilli = Date.parse(Today);
	Today.setTime(nomilli + mins * 60 * 1000);
	return Today.toUTCString();
}

// get cookie value
function getcookie(cookiename) {
	var cookiestring = "" + document.cookie;

	// cookie first
	var index1 = cookiestring.indexOf(cookiename);
	if (index1 == -1 || cookiename == "") {
		return "";
	}

	// cookie end
	var index2 = cookiestring.indexOf(';',index1);
	if (index2 == -1) {
		index2 = cookiestring.length; 
	}

	return unescape(cookiestring.substring(index1+cookiename.length+1, index2));
}

// set cookie
function setcookie(name, value, mins){
	// make cookie string
	cookiestring = name + "=" + escape(value) + ";expires=" + getexpirydate(mins) + ";domain=hanbiton.com;path=/;";

	// write!
	document.cookie = cookiestring;
	if (!getcookie(name)){
		return false;
	} else {
		return true;
	}
}

/*
 * usage
 *
 * var cookie = new MCookie();
 * for (i = 0; i < 10; i++) {
 *   AppendMCookie(cookie, "name_" + i, "value_" + i);
 * }
 * SetMCookie(cookie, "sample_cookie", 10); // 10 minutes
 *
 *
 * var cookie = GetMCookie("sample_cookie");
 */

// multi name-value cookie container
function MCookie() {
	this.names = new Array();
	this.values = new Array();
	this.count = 0;

	return this;
}

// append multi name-value cookie
function AppendMCookie(cookie, name, value) {

	var index = cookie.count;
	// if exists cookie, update that
	for (i = 0; i < cookie.count; i++) {
		if (cookie.names[i] == name) {
			index = i;
			break;
		}
	}

	cookie.names[index] = name;
	cookie.values[index] = value;
	cookie.count++;
}

// delete one cookie in multi name-value cookie
function DeleteMCookie(cookie, index) {
	for (i = index + 1; i < cookie.count; i++) {
		cookie.names[i - 1] = cookie.names[i];
		cookie.values[i - 1] = cookie.values[i];
	}

	cookie.count--;
}

// multi name-value cookie seperator
var s1 = "||";
var s2 = "|||";

// set multi name-value cookie
function SetMCookie(cookie, name, mins) {

	var value = "";
	for (i = 0; i < cookie.count; i++) {
		value += escape(cookie.names[i]) + s1 + escape(cookie.values[i]);
		if (i + 1 < cookie.count) {
			value += s2;
		}
	}
	setcookie(name, value, mins);
}

// get multi name-value cookie
function GetMCookie(name) {
	var str = getcookie(name);
	var cookie = new MCookie();

	if (str != "") {
		var array = str.split(s2);

		for (i = 0; i < array.length; i++) {
			tmp = array[i].split(s1);
			AppendMCookie(cookie, tmp[0], tmp[1]);
		}

		cookie.count = array.length;
		return cookie;
		
	} else {
		return new MCookie();
	}
}

// add get variable
function AddGetVariable(url, name, value) {
	url = url + "";

	var index0 = url.indexOf("?" + name + "=");

	if (index0 == -1) {
		var index1 = url.indexOf("&" + name + "=");

		if (index1 == -1) {
			if (url.indexOf("?") == -1) {
				url = url + "?" + name + "=" + value;
			} else {
				url = url + "&" + name + "=" + value;
			}
		} else {
			var index2 = url.substr(index1 + 1).indexOf("&");
			if (index2 == -1) {
				url = url.substr(0, index1) + "&" + name + "=" + value;
			} else {
				url = url.substr(0, index1) + url.substr(index1 + index2 + 1, url.length) + "&" + name + "=" + value;
			}
		}
	} else {
		var index3 = url.substr(index0 + 1).indexOf("&");
		if (index3 == -1) {
			url = url.substr(0, index0) + "?" + name + "=" + value;
		} else {
			url = url.substr(0, index0) + "?" + name + "=" + value + url.substr(index0 + index3 + 1, url.length);
		}
	}	

	return url;
}

function GetGetVariable(url, name) {
	url = url + "";

	var index0 = url.indexOf("?" + name + "=");

	if (index0 == -1) {
		var index1 = url.indexOf("&" + name + "=");

		if (index1 == -1) {
			return "";
		} else {
			var index2 = url.substr(index1 + name.length + 2).indexOf("&");
			if (index2 == -1) {
				return url.substr(index1 + name.length + 2);
			} else {
				return url.substr(index1 + name.length + 2, index2);
			}
		}
	} else {
		var index3 = url.substr(index0 + name.length + 2).indexOf("&");
		if (index3 == -1) {
			return url.substr(index0 + name.length + 2);
		} else {
			return url.substr(index0 + name.length + 2, index3);
		}
	}
}

function DeleteGetVariable(url, name) {
	url = url + "";

	var index0 = url.indexOf("?" + name + "=");

	if (index0 == -1) {
		var index1 = url.indexOf("&" + name + "=");

		if (index1 != -1) {
			var index2 = url.substr(index1 + 1).indexOf("&");
			if (index2 == -1) {
				url = url.substr(0, index1);
			} else {
				url = url.substr(0, index1) + url.substr(index1 + index2 + 1, url.length);
			}
		}
	} else {
		var index3 = url.substr(index0 + 1).indexOf("&");
		if (index3 == -1) {
			url = url.substr(0, index0);
		} else {
			url = url.substr(0, index0) + "?" + url.substr(index0 + index3 + 2, url.length);
		}
	}	

	return url;
}

// is xp sp2?
function IsNaviXp2() {
	var strMatch = window.navigator.appVersion;

	if( strMatch.match("SV1") == "SV1" && strMatch.match("Windows NT 5.1") == "Windows NT 5.1" )
		return true;
	else
		return false;
}

// form submit with disabled viewstate
function FormSubmit(form, action) {
	for (i = 0; (e = document.getElementsByTagName("input")[i]); i++) {
		if (e.getAttribute("type").indexOf("hidden") != -1) {
			if (e.getAttribute("name") == "__VIEWSTATE") {
				e.disabled = true;
				break;
			}
		}
	}

	form.action = action;
	form.submit();
}


// WebService
function CallHanbitONWebService(methodName, paramNames, paramValues, func) {
	//alert(methodName);
	if (window.XMLHttpRequest) {// native XMLHttpRequest object  
	
		objHttp = new XMLHttpRequest();
	}	
	else if (window.ActiveXObject) { // IE/Window ActiveX version
	
		objHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else { // sorry
		
		return;
	}
	
	var strEnvelope = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
	" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
	" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
	"<soap:Body>" +
	"  <" + methodName + " xmlns=\"http://audition.hanbiton.com/service\">";

	// parameters	      
	for (i = 0; i < paramNames.length; i++) {
		strEnvelope += "<" + paramNames[i] + ">" + paramValues[i] + "</" + paramNames[i] + ">";
	}

	strEnvelope = strEnvelope + "  </" + methodName + ">" +
	"</soap:Body>" +
	"</soap:Envelope>";

	// add event handler
	objHttp.onreadystatechange = func;

	var szUrl = "/Service/HanbitOnAuditionService.asmx";

	// send the POST to the Web service	
	
	objHttp.open("POST", szUrl, false);
	objHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
	objHttp.setRequestHeader("SOAPAction", "http://audition.hanbiton.com/service/" + methodName);
	objHttp.send(strEnvelope);
}

function ActionWindow(flag) {
	flag = flag + "";
	if (flag.length == 4) {
		actionWindow(opener, flag.substr(0, 1));
		actionWindow(top, flag.substr(1, 1));
		actionWindow(parent, flag.substr(2, 1));
		actionWindow(self, flag.substr(3, 1));
	}
}

function actionWindow(o, action) {
	if (o != null) {
		switch (action) {
			case "1": 
			    var ret = GetGetVariable(window.location, "ReturnUrl");
				if (ret != null && ret != "") {
					ret = unescape(ret);
					o.location = ret;
				} else {
					o.location.reload(); 
				}
				break;
			case "2": 
				o.close(); 
				break;
			case "3":
				var ret = GetGetVariable(window.location, "ReturnUrl");
				if (ret != null && ret != "") {
					ret = unescape(ret);
					o.location = ret;
				} else {
					o.location = "/home/Home.aspx";
				}
				break;
		}
	}
}

// select color pallete
function SelectColorInPallete(szFunction) {
	window.open("/popup/selectcolor.html?o=" + szFunction, "HanbitON_Pallete", "width=300,height=190,status=no,scrollbars=no");
}


/*
 * gogogo functions
 */


var UserMiniblType;
var UserMiniblUserID;

// 미니블 가기
function goMinibl(id) {
	openWindow("http://www.hanbiton.com/miniblblog/default.aspx?id="+ id +"&FirstView=true", "blogwindow", "");

}

// 길드/파티 바로가기
function goshortcut(loc) {
  setcookie("hanbiton_visit", "", -100);
	if (loc) location.href = loc;
}

// 창닫기
function closeWindow() {
	if (top != self) {
		top.closeWindow();
	} else {
		self.opener = self;
		self.close();
	}
}


// 인사말 수정
function GreetingPopup(id) {
	window.open("http://www.hanbiton.com/popup/minibl/EditGreeting.aspx?id=" + id, "HanbitOn_EditGreeting", "width=350,height=300,status=no,scrollbars=no");
}

// 스크랩
function ScrapPost(from, id, no) {
	window.open("http://www.hanbiton.com/popup/scrappost.aspx?from=" + from + "&id=" + id + "&no=" + no, "HanbitOn_Scrap", "width=400,height=300,status=no,scrollbars=no");
}
function ScrapPost(from, id, no, ds_photo) {
	window.open("http://www.hanbiton.com/popup/scrappost.aspx?from=" + from + "&id=" + id + "&no=" + no+ "&ds_photo=" + ds_photo, "HanbitOn_Scrap", "width=400,height=300,status=no,scrollbars=no");
}

function ViewScrap(from, id, no) {
	window.open("http://www.hanbiton.com/popup/viewscraplist.aspx?from=" + from + "&id=" + id + "&no=" + no, "HanbitOn_ScrapList", "width=400,height=400,status=no,scrollbars=yes");
}
 
 
//약관동의 창
/*
function openArticle() {
	window.open("http://www.hanbiton.com/h_article/marketarticle.aspx", "HanbitOn_Article", "width=800,height=550,status=no,scrollbars=no");
}
*/

//약관동의 창
function openArticle(domain) {
	//alert(url);
	//window.open("/h_article/main.aspx", "HanbitOn_Article", "width=800,height=550,status=no,scrollbars=no");
	domain  = "http://" + domain;
	window.open(domain + "/h_article/marketarticle.aspx?gm=takedown", "HanbitOn_Article", "width=800,height=550,status=no,scrollbars=no");
}




/******************************************************************************************************************/
/* 게임 미니블 */
/* 게임 미니블 테스트 종료 후 삭제할 것
function Game_goMyMinibl(id, mode) 
{
	if (mode == null) {location.href = "/minibl/default.aspx?id=" + id ;} 
	else {location.href = "/GameMiniblWeb/default.aspx?id=" + id + "&mode=" + mode;}
}

function Game_goMinibl(id, mode) 
{
	if (mode == null) {location.href = "/minibl/default.aspx?id=" + id ;} 
	else {location.href = "/GameMiniblWeb/default.aspx?id=" + id + "&mode=" + mode;}
}

// 미니블 포스트 가기
function Game_goMiniblPost(id, no) {
	location.href="/GameMiniblWeb/blog/main.aspx?id=" + id + "&postid=" + no ;
}
*/
/******************************************************************************************************************/

// Membership Site

// 회원가입
function GoJoinMember() {
	window.open("http://member.hanbiton.com/h_member/h_hms/ms_article.aspx?regsite=audition", "HanbitMemberShip", "left=10,top=10,width=997,height=600,status=no,scrollbars=yes");
}

// 회원수정
function GoEditMember() {
	window.open("http://member.hanbiton.com/h_member/h_hms/ms_bypass.aspx?regsite=audition", "HanbitMemberShip", "left=10,top=10,width=997,height=600,status=no,scrollbars=yes");
}

// 회원탈퇴
function GoOutMember() {
	window.open("http://member.hanbiton.com/h_member/h_hms/ms_out.aspx?regsite=audition", "HanbitMemberShip", "left=10,top=10,width=997,height=600,status=no,scrollbars=yes");
}

// 아이디/패스워드 찾기
function GoSearchIdPass() {
	window.open("http://member.hanbiton.com/h_member/h_hms/ms_search.aspx?regsite=audition", "HanbitMemberShip", "left=10,top=10,width=997,height=600,status=no,scrollbars=yes");
}

// 멤버쉽 페이지로
function GoMembership() {
	window.open("http://member.hanbiton.com/h_member/ms_main.aspx", "HanbitMemberShip", "left=10,top=10,width=997,height=600,status=no,scrollbars=yes");
}


/* 
 * Layer Function
 */
// 소망상자 보기
function GoWishList(id) {
	openWindow("http://www.hanbiton.com/minibl/style/main.aspx?id=" + id + "&menu=hope", "MiniblWindow", "width=940,height=670,status=no,scrollbars=no");
}

function GoGiftList(id) {
	openWindow("http://www.hanbiton.com/minibl/style/main.aspx?id=" + id + "&menu=gift", "MiniblWindow", "width=940,height=670,status=no,scrollbars=no");
}




/* 
 * popup functions
 */

// 이미지 팝업
function popview(url) {
    
	openWindow("/popup/ViewImage.aspx?url=" + encodeURI(url), "HanbitOnpopview", "width=100,height=100,status=no,scrollbars=yes");
}

// 로그인 창 열기
function openLogin() {
	openWindow("/popup/login.aspx", "HanbitOnLogin", "width=350,height=300,status=no,scrollbars=no");
}

// 로그인이 필요합니다
function NeedLogin() {
	alert("먼저 로그인해주세요");
	openWindow("/popup/login.aspx", "HanbitOnLogin", "width=350,height=300,status=no,scrollbars=no");
}

// 프레임으로 쌓여있는 곳에서의 로그인
function NeedLoginFrame() {
	alert("먼저 로그인해주세요");
}

// 바로가기
function goUrl(url) {
	if (url != "") {
		if (url.substring(0, 7) == 'http://') {
			openWindow(url, "", "");
		} else {
			location.href = url;
		}
	}
}

// 로그인
function Login() {
	
	var preurl = escape(window.location.href);
	
	while(preurl.search(/%3A/i) > 0)
	{
		preurl = preurl.replace(/%3A/i,":");
	}
	
	while(preurl.search(/%3F/i) > 0)
	{
		preurl = preurl.replace(/%3F/i,"?");
	}
	
	while(preurl.search(/%3D/i) > 0)
	{
		preurl = preurl.replace(/%3D/i,"=");
	}
	
	while(preurl.search(/%23/i) > 0)
	{
		preurl = preurl.replace(/%23/i,"#");
	}
	alert(preurl);
	
	top.location.href = "/h_help/h_space/member05.aspx?ReturnUrl="+preurl;
	
}

/*
 * frame resize functions
 */
// ifrmae 리사이즈
function resizeIframe(name) {
	if (name == null || name == "") {
		return;
	}
	
	try {
	  // iframe object
	  var oIFrame = document.getElementById(name);

	  // resize
		oIFrame.style.height = oIFrame.contentWindow.document.body.scrollHeight;
	} catch (e) {
	}
}

// 부모쪽 리사이즈 함수 호출
function parentResizeIframe(name) {
	if (parent && parent != this && parent.resizeIframe != null) {
		parent.resizeIframe(name);
	}
}

/*
 * navi table
 */
var navi = new Array();
navi[0] = "/home/default.aspx";
navi[1] = "/h_guild/h_space/guild_main.aspx";
navi[2] = "/h_parti/h_space/main.aspx";
navi[3] = "/h_minibl/h_space/main.aspx";
navi[4] = "/h_ongisik/knowMain.aspx";
navi[5] = "/h_news/main.aspx";
navi[6] = "/shop/main.aspx";

/*
 * hanbiton key shortcut
 */
function processKey(event) {
	var e;

	if (isIE) {
		e = window.event;
	} else {
		e = event;
	}

	// alt + number
	if (e.altKey && e.keyCode > 47 && e.keyCode < 54) {
		if (window == top && opener == null) {
			window.location = navi[e.keyCode - 48];
		}
	}
}

function setFocusing(obj)
{
	if(obj != null)
	{
		try {
			obj.focus();
			obj.style.imeMode ="active";
			obj.select();
		}
		catch (ex)
		{
			// not text box
		}
	}
}

function setSearchTxtBoxFocus()
{
	var objTxt = document.getElementById("mainquery");

	setFocusing(objTxt);
}

function setLoginTxtBoxFocus()
{
	var objTxt = document.getElementById("UserID");

	setFocusing(objTxt);
}

/*
 * hanbiton ui functions
 * 
 */
var status_over = false;
var menu_name = "ui_menu";

var minibl_id = "";

var menuover_bgcolor = "#eeeeee";
var default_menuover_bgcolor = "#ffffff";

// admin id array
var adminIdList = ["hanbiton", "hanbitonshop", "hanbiton_stars", "hanbit_game", "hanbiton_ge"];


// mouse down event
function MouseDown(e) {
	if (event.button == 2 || event.button == 3) {
		return false;
	}
	event_check = false;
	event_target = event.srcElement;

	// 이미지에 링크가 걸리는 경우
	if (event_target.tagName.toString().toLowerCase() == "img") {
		if (event_target.parentElement.tagName.toString().toLowerCase() == "a") {
			event_target = event_target.parentElement.toString();
			event_check = event_target.indexOf("javascript:HOPopup(");
		} else {
			return;
		}
	} else {
		event_target = event_target.toString();
		event_check = event_target.indexOf("javascript:HOPopup(");
	}
	
	if (!status_over) hideMenu();
	if (!event_check) {
		viewMenu(event, menu_name);
	} else {
		if (!status_over) hideMenu();
		return;
	}
}

function viewMenu(e, name) {
	if (name == "none") return;

	b = window.document.body;
	x_pos = b.scrollLeft + event.clientX;
	y_pos = event.clientY + b.scrollTop;

	eval(name + ".style.pixelTop = " + y_pos);
	eval(name + ".style.pixelLeft = " + x_pos);
	eval(name + ".style.display = \"\"");
}

function hideMenu() {
	eval(menu_name + ".style.display = \"none\"");
}

function menuOut(ar_obj) {
	status_over = false;
	changeColor(ar_obj);
}

function menuOver(ar_obj, ar_id) {
	status_over = true;
	changeColor(ar_obj);
}

function changeColor(ar_obj) {
	if (ar_obj.style.background == menuover_bgcolor) {
		ar_obj.style.background = default_menuover_bgcolor;
	} else {
		ar_obj.style.background = menuover_bgcolor;
	}
}

function exec_menuitem(key) {
	switch(key) {
		case "HOEVENT1":
			goMinibl(minibl_id);
			break;
		case "HOEVENT2":		
		  ho_SendNote(minibl_id);
		  break;
		case "HOEVENT3":
		  GoWishList(minibl_id);
		  break;
		case "HOEVENT4":
		  ho_AddNeighbor(minibl_id);
		  break;
	}
}

//
// 실제 호출할 때 사용
//
function HOPopup(m_nick) {
	minibl_id = m_nick;

	var chk = false;
	for (i = 0; i < adminIdList.length; i++) {
		if (minibl_id == adminIdList[i]) {
			chk = true;
			break;
		}
	}

	if (chk) {
		document.getElementById("ui_menu").innerHTML = half_ui_menu;
	} else {
		document.getElementById("ui_menu").innerHTML = full_ui_menu;
	}
}

var loc = window.location + "";
if (!(loc.indexOf('/guild/') > -1 || loc.indexOf('/parti/') > -1)) {
	setcookie('hanbiton_visit', '', -10);
}

//
// 지식 신뢰지수 레벨 이미지 레이어 보이기
//
function trustDescShow(nLevel)
{
	b = window.document.body;
	x_pos = b.scrollLeft + event.clientX;
	y_pos = event.clientY + b.scrollTop;
	
	x_pos -= event.offsetX;
	y_pos -= event.offsetY;
	
	if(document.all.TrustLevelImage != null)
	{
		document.all.TrustLevelImage.src = "/images/gisik_alt_0"+ nLevel +".gif";
		
		if(document.all.TrustDescription != null)
		{
			document.all.TrustDescription.style.top = y_pos - 4;
			document.all.TrustDescription.style.left = x_pos + 35;
			document.all.TrustDescription.style.display = "";
		}
	}
}

//
// 지식 신뢰지수 레벨 이미지 레이어 감추기
//
function trustDescHide()
{
	if(document.all.TrustDescription != null)
	{
		document.all.TrustDescription.style.display = "none";
	}
}	

// 쪽지 보내기
function takedown_SendNote(id) {
	var LeftPosition = (screen.width) ? (screen.width-335)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-320)/2 : 0;
	openWindow("http://www.hanbiton.com/h_note/ms_bypass_note.aspx?page=w&op=new&rid=" + id, "HanbitOnNote", "width=335,height=320,status=no,scrollbars=no,top=" + TopPosition + ",left=" + LeftPosition);
}

//
// 키보드 해킹 방지 Ax Loading
//
/*
var keyClsID = 'clsid:2CDD22B9-FC0F-46B9-A2FA-BCCFFA7F87F3';
var keyCodeBase = 'http://www.wyd2.co.kr/JKeySecret/ActiveJoyP.cab#version=1,0,0,13';
var jkey = '<OBJECT classid="'+ keyClsID +'" codebase="'+ keyCodeBase +'" width=0 height=0></OBJECT>';

document.write(jkey);
*/

var full_ui_menu = "<table width=\"80\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#B6B6B6\"><tr><td> ";
full_ui_menu += "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#FFFFFF\">";
full_ui_menu += "<tr><td style=\"padding-left: 7px;\" height=\"20\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem('HOEVENT1');\" style=\"cursor:hand\"><font color=#404040>미니블보기</font></td></tr>";
full_ui_menu += "<tr><td height=\"1\" background=\"/images/line_dot_02.gif\"></td></tr>";
full_ui_menu += "<tr><td style=\"padding-left: 7px;\" height=\"20\" onmouseout=\"menuOut(this);\" onmouseover=\"menuOver(this, 'none');\" onclick=\"exec_menuitem('HOEVENT2');\" style=\"cursor:hand\"><font color=#404040>쪽지보내기</font></td></tr>";
full_ui_menu += "</table>";
full_ui_menu += "</td></tr></table>";



document.write("<div id=\"ui_menu\" style=\"position:absolute;display:none;top:0;left:0;z-index:9;\">");
document.write("</div>");

//
// 지식 레이어 HTML
//
document.write("<div id=\"TrustDescription\" style=\"RIGHT: expression(document.body.clientWidth/2 - 62);position:absolute; z-index:1;display:none\"><img id=\"TrustLevelImage\"></div>");

