var menu_disable = false;
var avmenu_PersonalMenuTargetNickName = "";
var pub_Guild_List = "HHH601,HHH701";

function setMenuDistabled(){
	menu_disable = true;
}
// avatar_show.jsÀÇ ÇÔ¼ö¸¦ override ÇÔ
function avguildpersonalmenu_showMenu(showMemberId, selfMemberId, guildCategory, showNickName, nPos)
{
	if(pub_Guild_List.indexOf(guildCategory)>-1){
		avpersonalmenu_showMenu_guild(showMemberId, selfMemberId, guildCategory, showNickName, nPos);
	}else{
		avpersonalmenu_showMenu(showMemberId, selfMemberId, nPos);
	}
	
}

function avpersonalmenu_showMenu_guild(showMemberId, selfMemberId, guildCategory, showNickName, nPos)
{
	// do not show in case of self 
	//if ( selfMemberId != null && showMemberId == selfMemberId )
	//	return;
	
	if(menu_disable){ return;}
	
	var nMenuPosition = 9; //9=right down, 7=left down
	if ( typeof(nPos)=="number" )
		nMenuPosition = nPos;
		
	// check menu object
	if ( typeof(avPersonalMenu) != "object" )
		 avPersonalMenu = new menu_FloatMenu(menu_createActions_PersonalMenu_Guild(guildCategory),nMenuPosition,null,null,"menu_createHTML_PersonalMenu");
		 
	event.cancelBubble = true;
	var x,y;

	//¹ÙµÏ ¶§¹®¿¡... event.y »ç¿ë ¾ÈÇÔ. 060117 ¿µ³²
	x = event.screenX - self.screenLeft + document.body.scrollLeft;
	y = event.screenY - self.screenTop + document.body.scrollTop;
	//x = event.x + document.body.scrollLeft;
	//y = event.y + document.body.scrollTop;
	
	avmenu_PersonalMenuTargetId = showMemberId;
	avmenu_PersonalMenuSelfId = selfMemberId;
	//±æµå Ãß°¡
	avmenu_PersonalMenuTargetNickName = showNickName;
	
	// safe show
	//avPersonalMenu.showMenu(x,y);
	menu_safeShow(avPersonalMenu.gIndex,x,y)
	
}

function menu_createActions_PersonalMenu_Guild(categoryId){
	var arrActions = menu_createActions_PersonalMenu();
	switch(categoryId){
		case 'HHH601' :
			arrActions.unshift(new menu_Action("bar"));
			arrActions.unshift(new menu_Action("menu","¸¶ÀÌÆäÀÌÁö","avpersonalmenu_skidrush_mypage();"));
			break;
		case 'HHH701' :
			arrActions.unshift(new menu_Action("bar"));
			arrActions.unshift(new menu_Action("menu","¸¶ÀÌÆäÀÌÁö","avpersonalmenu_wolfteam_mypage();"));
			break;
	}
	
	return (arrActions);
}

// menu-implementations
function avpersonalmenu_skidrush_mypage()
{
	var svrSkid= "";
	if ( location.host.search(/alpha|fkiller|dev/g) >= 0 )
		svrSkid = "http://alpha-skidrush.hangame.com";
	else if (location.host.search(/beta/g) >= 0 )
		svrSkid = "http://beta-skidrush.hangame.com";
	else 
		svrSkid = "http://skidrush.hangame.com";
		
	var s = svrSkid + "/mypage/mypage.nhn?m=userGameRecord&charac=" + avmenu_PersonalMenuTargetNickName;
	
	openWin(s,"pop",550,470);
} 	

// menu-implementations
function avpersonalmenu_wolfteam_mypage()
{
	var svrGuild= "";
	if (location.host.search(/dev/g) >= 0 )
		svrGuild = "http://dev-guild.hangame.com";
	else if ( location.host.search(/alpha|fkiller/g) >= 0 )
		svrGuild = "http://alpha-guild.hangame.com";
	else if (location.host.search(/beta/g) >= 0 )
		svrGuild = "http://beta-guild.hangame.com";
	else 
		svrGuild = "http://guild.hangame.com";
		
	var s = svrGuild + "/redirect.nhn?m=pubgameredirect&gameid=WOLFTEAM&memberid=" + avmenu_PersonalMenuTargetId;
	
	openWin(s,"pop",504,609);
	
}

function goSkidTeam(teamId)
{
	var svrSkid= "";
	if ( location.host.search(/alpha|fkiller|dev/g) >= 0 )
		svrSkid = "http://alpha-skidrush.hangame.com";
	else if (location.host.search(/beta/g) >= 0 )
		svrSkid = "http://beta-skidrush.hangame.com";
	else 
		svrSkid = "http://skidrush.hangame.com";
		
	var s = svrSkid + "/teampage.nhn?m=teamDetail&teamid="+teamId;
	
	openWin(s,"_teampop",550,544);
} 	

function goWolfTeam(teamId)
{
	var svrWolf= "";
	if ( location.host.search(/alpha|fkiller|dev/g) >= 0 )
		svrWolf = "http://alpha-wolfteam.hangame.com";
	else if (location.host.search(/beta/g) >= 0 )
		svrWolf = "http://beta-wolfteam.hangame.com";
	else 
		svrWolf = "http://wolfteam.hangame.com";
		
	var s = svrWolf + "/pride/pride.nhn?m=prideDetail&dwprideid="+teamId;
	
	openWin(s,"_teampop",500,605);
} 	