var str_area = "";
var int_mh_id = 0;
var int_login_id = 0;
var str_mh_name = "";
var str_return_path = "";
var ui_parent_x = 0;
var ui_parent_y = 0;
var ui_parent_client_x = 0;
var ui_parent_client_y = 0;
var ui_child1_x = 0;
var ui_child1_y = 0;
var ui_child2_x = 0;
var ui_child2_y = 0;
var ui_child3_x = 0;
var ui_child3_y = 0;

//var rtn_chat_status = "";
//alert('dang test');

var is_ie_browser= (navigator.appName.indexOf("Microsoft")!=-1)? true: false;
 
if(is_ie_browser == true){
	window.document.onclick = MouseClick;
}
else{
	window.onclick = MouseClick;
}

// check between login_id and mh_id before pop up window
function inviteWindow(mh_id, login_id, strGetData){
	if(mh_id == login_id) {
		alert(str_msg_buddy_self);
		return false;
	}
	
	OpenNameUIPublic('WinBuddyMake', strGetData);
}


//Check poke ability
function checkPoke(cyid, login_id) 
{		
	if(typeof(cyid) == "undefined" || typeof(login_id) == "undefined" || cyid == login_id)
		return;
	
	
	var str_data= 'poked_cyid='+cyid+'&login_id='+login_id;
	
	$.ajax(
	{
	    url: '/common/poke_check.php',
	    type: 'GET',
//		    dataType: 'script',
	    //timeout: 1000,
	    processData: true,
	    data: str_data,
	    cache: false,
	    error: function()
	    {
	        alert('Vui lòng thực hiện lại');
	    },
	    success: function( data, textStatus)
	    {
	    	if(trim(data) == "OK")
	    	{
	    		$("#nameui_poke").html('<div class="nameuilinkoff" onmouseover="this.className=\'nameuilinkover\';clearNameUI(\'child\');" onmouseout="this.className=\'nameuilinkoff\'" onclick="linkNameUI(\'poke\', event);"><a href="javascript:notop();">Pốc</a></div>');
	    	}
	    }
	});	
}


function viewNameUINoImage(e, mh_id, login_id, mh_name, rtn_url){
	viewNameUI(e, mh_id, login_id, mh_name, rtn_url, 1);
}

function viewNameUI(e, mh_id, login_id, mh_name, rtn_url, noimage, area){
	//alert("mh_id:"+mh_id+",login_id:"+",mh_name:"+mh_name+",rtn_url:"+rtn_url+",noimage:"+noimage);
	
	var mousex = 0;
	var mousey = 0;
	var flipX = 0;
	var smushX = 0;
	var flipY = 0;

	var winwidth;
	var winheight;

	var scrolltop = 0;
	var scrollleft = 0;

	var popMenu = document.getElementById('ui_parent');
	var menuHeight = 200;

	clearNameUI('parent');
	if (mh_id == ""){
		alert("Chưa phải là thành viên Cyworld.");
		return; 
	}

	if (mh_id < "1200001")//previously 12000010000
	{
		return; 
	}

	if (!noimage)
	{
		menuHeight = 200;
		getProfileStart(mh_id);
		var divs = popMenu.getElementsByTagName('div');
		for (var i=0; i<divs.length; i++) {
			
			if (divs[i].className == 'nameuiimg') {
				divs[i].style.display = 'block';
			}
		}
	}
	else
	{
		menuHeight = 110;
		var divs = popMenu.getElementsByTagName('div');
		for (var i=0; i<divs.length; i++) {
			if (divs[i].className == 'nameuiimg') {
				divs[i].style.display = 'none';
			}
		}
	}
	
	var tds = popMenu.getElementsByTagName('td');
	for (var i=0; i<tds.length; i++) {
		switch (tds[i].className) {
			case 'nameuisidelh':
			case 'nameuisiderh':
			case 'nameuisiderh3':
				tds[i].style.height = menuHeight;
				if (tds[i].height) tds[i].height = menuHeight; // just in case
				break;
		}
	}
	
	//init value
	int_mh_id = mh_id;
	int_login_id = login_id;
	str_mh_name = mh_name;
	str_return_path = rtn_url;
	str_area = area;
	
	if (document.documentElement && document.documentElement.scrollTop)
		scrolltop = document.documentElement.scrollTop;
	else if (document.body)
		scrolltop = document.body.scrollTop;
	
	if (document.documentElement && document.documentElement.scrollLeft)
		scrollleft = document.documentElement.scrollLeft;
	else if (document.body)
		scrollleft = document.body.scrollLeft;
	
	if (e.clientX || e.clientY)
	{
		ui_parent_x = e.clientX + scrollleft;
		ui_parent_client_x = ui_parent_x;
		ui_parent_y = e.clientY + scrolltop; // Toa do thuc su cua vi tri press chuot
		ui_parent_client_y = ui_parent_y;
	}	
	
	if (window.innerWidth) {
		winwidth = window.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		winwidth = document.documentElement.clientWidth;
	} else if (document.body) {
		winwidth = document.body.clientWidth;
	}
	
	if (window.innerHeight) {
		winheight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		winheight = document.documentElement.clientHeight;
	} else if (document.body) {
		winheight = document.body.clientHeight;
	}
	
	// don't change any of the numbers below unless you really know what you're doing
		
	var arrowOffset = Math.round(0.2 * menuHeight);	
	
	ui_parent_x += 5;
	ui_parent_y -= arrowOffset;
	
	if ((ui_parent_x + 217) > (winwidth + scrollleft)) {
		flipX = 1;
	}
	
	if ((ui_parent_x + 130) > (winwidth + scrollleft)) {
		smushX = 1;
	}
	
	if ((ui_parent_y + menuHeight) > (winheight + scrolltop)) {
		flipY = 1;
	}
		
	if (flipX) {
		ui_parent_x -= 130;
		
		document.getElementById('name_ui_arrow_left').style.visibility = 'hidden';
		document.getElementById('name_ui_arrow_right').style.display = 'block';
	} else {
		document.getElementById('name_ui_arrow_left').style.visibility = 'visible';
		document.getElementById('name_ui_arrow_right').style.display = 'none';
	}
	
	var arrowPos = Math.round(0.165 * menuHeight);
	
	if (flipY) {
		ui_parent_y -= (menuHeight-2*(arrowOffset)+12);
		document.getElementById('name_ui_arrow_left').style.marginTop = (menuHeight-arrowPos)+'px';
		document.getElementById('name_ui_arrow_right').style.marginTop = (menuHeight-arrowPos)+'px';		
	} else {
		document.getElementById('name_ui_arrow_left').style.marginTop = arrowPos+'px';
		document.getElementById('name_ui_arrow_right').style.marginTop = arrowPos+'px';
	}
		
	popMenu.style.display = 'block';
	popMenu.style.left = ui_parent_x + "px";
	popMenu.style.top = ui_parent_y + "px";

	if (smushX) {
		ui_child1_x = ui_parent_x + 59;
		ui_child2_x = ui_parent_x + 59;
		ui_child3_x = ui_parent_x + 59;
	} else {
		ui_child1_x = ui_parent_x + 89;
		ui_child2_x = ui_parent_x + 89;
		ui_child3_x = ui_parent_x + 89;
	}
	
	ui_child1_y = ui_parent_y + menuHeight - 77;
	ui_child2_y = ui_parent_y + menuHeight - 59;
	ui_child3_y = ui_parent_y + menuHeight - 25;

	 // ???? ?? ??? ??? ?? ??
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
		hideControl("IFRAME",ui_parent);
		hideControl("SELECT",ui_parent);
	 }
	
	// prevent browser from following links or jumping around the page
	if (e.preventDefault) {
		e.preventDefault();
		e.stopPropagation();
	} else {
		e.returnValue = false;
		e.cancelBubble = true;	
	}
	
	// 2007. 3.17 Rock<rockk@nate.com>
	// for chatting
	checkPoke(mh_id, login_id);
	checkBuddy(mh_id, login_id, 'name_chat');
}


function getProfileStart(mh_id)
{
	$.ajax({
		url: Config.actionURL,
		data: 'mod=avatar&ctrl=avatar&mh_id='+mh_id,
		success: function( src){			
			document.getElementById("ui_profile").innerHTML = src;
		}
	})
}



function hideControl (tagName, popupObj) 
{ 
    if (document.all) { 

        var x = cmGetX (popupObj); 
        var y = cmGetY (popupObj); 
        var w = popupObj.offsetWidth; 
        var h = popupObj.offsetHeight; 

        var i; 
        for (i = 0; i < document.all.tags(tagName).length; ++i) { 
            var obj = document.all.tags(tagName)[i]; 
            if (!obj || !obj.offsetParent) continue; 

            var ox = cmGetX (obj); 
            var oy = cmGetY (obj); 
            var ow = obj.offsetWidth; 
            var oh = obj.offsetHeight; 

            if (ox > (x + w) || (ox + ow) < x) continue; 
            if (oy > (y + h) || (oy + oh) < y) continue; 
             
            if(obj.style.visibility == "hidden") continue; 

            if(!popupObj.overFlag) 
                popupObj.overFlag = new Array (); 

            popupObj.overFlag[popupObj.overFlag.length] = obj; 
			if(tagName == "IFRAME"){
				if(obj.name == "mh_buddy" || obj.name == "actionFrame" || obj.name == "my_buddy"){
					obj.style.visibility = "hidden";
				}
			}
			else{
				obj.style.visibility = "hidden"; 
			}
        } 
    } 

} 



function showControl(popupObj) 
{ 
    if (popupObj.overFlag) { 
        var i; 
        for (i = 0; i < popupObj.overFlag.length; ++i) 
            popupObj.overFlag[i].style.visibility = ""; 
    } 
    popupObj.overFlag = null; 
} 

function cmGetX (obj) 
{ 
    var x = 0; 
    do 
    { 
        x += obj.offsetLeft; 
        obj = obj.offsetParent; 
    } 
    while (obj); 
    return x; 
} 

function cmGetY (obj) 
{ 
    var y = 0; 
    do 
    { 
        y += obj.offsetTop; 
        obj = obj.offsetParent; 
    } 
    while (obj); 
    return y; 
} 


function viewChildNameUI(ui_id){
	clearNameUI('child');
	if(ui_id=='ui_child1'){
		document.getElementById('ui_child1').style.display = 'inline';
		document.getElementById('ui_child1').style.left = ui_child1_x + "px";
		document.getElementById('ui_child1').style.top = ui_child1_y + "px";
		chk_obj = document.getElementById('ui_child1');
		
		
	}else if(ui_id=='ui_child2'){
		document.getElementById('ui_child2').style.display = 'inline';
		document.getElementById('ui_child2').style.left = ui_child2_x + "px";
		document.getElementById('ui_child2').style.top = ui_child2_y + "px";
		chk_obj = document.getElementById('ui_child2');
	}else if(ui_id=='ui_child3'){
		document.getElementById('ui_child3').style.display = 'inline';
		document.getElementById('ui_child3').style.left = ui_child3_x + "px";
		document.getElementById('ui_child3').style.top = ui_child3_y + "px";
		chk_obj = document.getElementById('ui_child3');
	}
	 // ???? ?? ??? ??? ?? ??
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
		hideControl("IFRAME",chk_obj);
		hideControl("SELECT",ui_parent);
	 }
	 // ???? ????? ??? ?? ?
}
function clearNameUI(option){
	if(option=='parent'){
		document.getElementById('ui_parent').style.display = 'none';
		document.getElementById('ui_child1').style.display = 'none';
		document.getElementById('ui_child2').style.display = 'none';
		document.getElementById('ui_child3').style.display = 'none';		
		document.getElementById('poke_input_form_div').style.display = 'none';		
		 // ???? ?? ??? ??? ?? ??
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			showControl(ui_parent);
			showControl(ui_child1);
			showControl(ui_child2);
			showControl(ui_child3);			
		 }
		 // ???? ????? ??? ?? ?
		 
		// 2007. 3.17 Rock<rockk@nate.com>
		// for chatting
		//delete contents
		 document.getElementById('nameui_poke').innerHTML ="";
		 document.getElementById('name_chat').innerHTML ="";
		 
	}else if(option=='child'){
		document.getElementById('ui_child1').style.display = 'none';
		document.getElementById('ui_child2').style.display = 'none';
		document.getElementById('ui_child3').style.display = 'none';
		document.getElementById('poke_input_form_div').style.display = 'none';
	}
	
}

// 2007. 3.17 Rock<rockk@nate.com>
// for chatting
function checkChatStatus(login_id, cyid, buddy_name)
{
	
	// popup
	strUrl = "/common/chat/pop_chat_status.php?fcyid=" + cyid + "&fname=" +encodeURIComponent(buddy_name);
	strName = "chat_"+cyid+"_"+login_id;
	WinWidth = 438;
	WinHeight = 467;
	//WinHeight = 667; // debug
	ScrollBar = "no";
	Resize = "no";
	WinGubun = "Center";
	strProperty = "status=yes,toolbar=no,menubar=no,location=no";
	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
	
}

function linkNameUI(key, e)
{
	document.getElementById('ui_parent').style.display='none';
	
	if(str_return_path == "") 
	{ 
//		str_return_path = Config.mainService+"/main/index.php"; 
		str_return_path = Config.mainService; 
	}
	switch(key) {
		case "p_1":
			if(int_login_id == '0') int_login_id = "";
			open_myhome("" + int_mh_id + "", "" + int_login_id + "");
			break;
		case "p_2":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_mh_id == null || int_mh_id == "") { alert("" + str_msg_buddy_friend_id_none + ""); return; }
			
			strUrl = Config.mainService+"/mall/gift_send_for_one.php?recive_id=" + int_mh_id + "&recive_name=" +str_mh_name;
			strName = "GiftWinForOne";
			WinWidth = 1024;
			WinHeight = 600;
			ScrollBar = "yes";
			Resize = "yes";
			WinGubun = "Center";
			strProperty = "";
			
			WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);	
			
			//window.top.location= strUrl;	 					
			//window.top.location.href= strUrl;	 					
			
			break;
			
		case "poke":
			if(int_login_id == "0" || int_login_id == "" ) { alert("" + str_login_msg + ""); return; }
			if(int_mh_id == null || int_mh_id == "") { alert("" + str_msg_buddy_friend_id_none + ""); return; }
			
			viewPoke(e, int_login_id, int_mh_id, str_mh_name, str_area, "", ui_parent_client_x, ui_parent_client_y);
			
			break;
			
		//Xem video
		case "p_3":
			strUrl = "http://kine.cyworld.vn/personal/" + int_mh_id ;
			window.open(strUrl,'_blank');	
			
			//window.top.location= strUrl;	 					
			//window.top.location.href= strUrl;	 					
			
			break;	
			
		case "c1_1":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_buddy_self + ""); return; }
			if(int_mh_id == null || int_mh_id == "") { alert("" + str_msg_buddy_friend_id_none + ""); return; }			
			OpenNameUIPublic2('WinBuddyInvite','?buddy=invite&login_id=' + int_login_id + '&mh_id=' + int_mh_id + '&mh_name=' + str_mh_name + '');
			break;
		case "c1_2":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_buddy_self + ""); return; }
			if(int_mh_id == null || int_mh_id == "") { alert("" + str_msg_buddy_friend_id_none + ""); return; }
			OpenNameUIPublic2('WinBuddyInvite','?buddy=modify&login_id=' + int_login_id + '&mh_id=' + int_mh_id + '&mh_name=' + str_mh_name + '');
			break;
		case "c1_3":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_buddy_end_self + ""); return; }
			//vinhbq comment Jan.,24,2007
			//OpenNameUIPublic('WinBuddyInvite','?buddy=remove&login_id=' + int_login_id + '&mh_name=' + str_mh_name + '&mh_id=' + int_mh_id + '&hidReturnURL=' + str_return_path + '');
			//vinhbq add Jan.,24,2007
			OpenNameUIPublic2('WinBuddyInvite','?buddy=remove&login_id=' + int_login_id + '&mh_id=' + int_mh_id + '&mh_name=' + str_mh_name +'');
			break;
			
		case "c2_1":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_memo_send_self + ""); return; }
			OpenNameUIPublic2('WinMemoSend','?login_id=' + int_login_id + '&send_cyid=' + int_mh_id + '&hidSendName=' + str_mh_name + '');
			//@Thang Tran: edited to accomodate VN version
			/*
			var strUrlTmp = "about:blank";
			var WinWidth = "870";
			var WinHeight = "580";
			var ScrollBar = "yes";
			var Resize = "no";
			var WinGubun = "";
			var strProperty = "";
			var strUrl = "/communication/memo_received_list.php";
			var strName = "CommBox";
			myCommBox = WinOpen(strUrlTmp,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
			myCommBox.focus(); 
			myCommBox.location.replace(strUrl);	
			*/
			break;
		case "c2_2":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_memo_send_self + ""); return; }
			OpenNameUIPublic2('WinMemoSend','?login_id=' + int_login_id + '&send_cyid=' + int_mh_id + '&hidSendName=' + str_mh_name + '&hidMode=Invite');
			break;
		case "c2_3":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_memo_end_self + ""); return; }
			if(int_mh_id == "12000000001") { alert("Bạn không thể chặn tin nhắn từ Admin."); return; }
			if(confirm('Bạn có chắc là bạn muốn chặn tin nhắn từ thành viên này?')) {
				//alert(str_return_path + '|' + int_mh_id +'|' + str_mh_name + '|' + int_login_id );
//			go_url('', Config.mainService+"/main/memo_setup_proc.php?hidMode=Reject&hidReturnURL=" + str_return_path + "&ChkValues=" + int_mh_id + "&hidFriendName=" + str_mh_name);
			go_url('', Config.mainService+"/main/memo_setup_proc.php?hidMode=Reject&hidReturnURL=&ChkValues=" + int_mh_id + "&hidFriendName=" + str_mh_name);
			}
			break;
		case "c3_1":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			if(int_login_id == int_mh_id) { alert("" + str_msg_invte_send_self + ""); return; }
			
			OpenNameUIPublic2('WinClubInvite','?login_id=' + int_login_id + '&invited_cyid=' + int_mh_id + '&hidSendName=' + str_mh_name);
			break;	
		case "chat":
			if(int_login_id == "0" || int_login_id == "" || int_login_id == "null" ) { alert("" + str_login_msg + ""); return; }
			
			// popup
			checkChatStatus(int_login_id, int_mh_id, str_mh_name);
			
			break;	
			
		default:
			break;
	}
}

function MouseClick(e){
	if(is_ie_browser == true){
		current_x = event.x + document.documentElement.scrollLeft;
		current_y = event.y + document.documentElement.scrollTop;
	}
	else{
		current_x = e.clientX + document.documentElement.scrollLeft;
		current_y = e.clientY + document.documentElement.scrollTop; 
	}
	
	if(document.getElementById('ui_parent').style.display != 'none'){
		if(! (((ui_parent_x - 30) < current_x && current_x < (ui_parent_x + 140)) && ((ui_parent_y-20) < current_y && current_y < (ui_parent_y + 100))) ){
			clearNameUI('parent');
		}
	}
	
	//added 8-10-06: used to close song menu
	if (document.getElementById('song_ui_parent'))
	{
	if(document.getElementById('song_ui_parent').style.display != 'none'){
		if(! (((ui_parent_x - 30) < current_x && current_x < (ui_parent_x + 140)) && ((ui_parent_y-20) < current_y && current_y < (ui_parent_y + 100))) ){
			song_clearNameUI('parent');
		}
	}
	}
		
	
	// close Today i'm menu if it is open
	try
	{
	hideTodayim();
	resetFlagTodayim();
	}
	catch (e){}
	
	
	//check persona div (emoticon pallete in comment) and close if it doesn't have focus.
	try{
	max_div_cnt =5;
	
	for (i=0; i<max_div_cnt; i++)
	{
		if (document.getElementById("persona" + i))
		{
			 
			if (document.getElementById("persona" + i).style.display != "none" && eval("g_persona_div_"+ i +"_over == false"))
				document.getElementById("persona" + i).style.display = "none";
		}
	}
	}catch(e){}
	
	
	
	
	
}


function setDivInnerClicked(divId){
	
	eval('g_'+divId+'_div_inner_clicked = true');
	
}

function hookWindow_click()
{
	if(is_ie_browser == true){
		window.document.onclick = MouseClick;
	}
	else{
		window.onclick = MouseClick;
	} 
}
function unhookWindow_click()
{
	if(is_ie_browser == true){
		window.document.onclick = function (){};
	}
	else{
		window.onclick = function (){};
	} 
}



//by: quynhdn
//2009.03.30
//This function seem to not use! It overwrited in js/common.js
function OpenNameUIPublic(strName, strGetData){
	
	//???? ?? ???
	if(strName == "WinBuddyMake"){
		var strUrl = Config.mainService+"/common/include/buddy_invite_makeC_Wview.php" + strGetData;
//		var strUrl = "/common/include/buddy_invite_requestedC_Wview.php" + strGetData;	// ?? ?? ??
		var WinWidth = "400";
		var WinHeight = "500";
	}
	// Remove neighbors
	else if(strName == "WinBuddyRemove") {
		var strUrl = Config.mainService+"/common/include/buddy_remove_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//???? ?? > ??? ?? ?? ???
	else if(strName == "WinBuddyReceiver"){
		var strUrl = Config.mainService+"/common/include/buddy_invite_receiverC_Mview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//?? ???
	else if(strName == "WinMemoSend"){
		//var strUrl = "/main/memo_writeC_Wview.php" + strGetData;
		var strUrl = Config.mainService+"/communication/memo_writeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//?? ??? ???? ???
	else if(strName == "WinBuddyNameChange"){
		//alert(strGetData);
		//var strUrl = "/main/buddy_name_changeC_Wview.php" + strGetData;
		
		var strUrl = Config.mainService+"/common/include/buddy_change_makeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		
	}
	else if(strName == "WinBuddyNameChange_re"){
		var strUrl = Config.mainService+"/common/include/buddy_change_re_makeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	else if(strName == "WinBuddyInvite" ) {
		// it requires to go through the template below to process
		var strUrl = Config.mainService+"/common/include/buddy_invite.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		
	}
	else if(strName == "WinClubInvite" ) {
		// it requires to go through the template below to process
		var strUrl = Config.mainService+"/common/include/buddy_invite_club_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	
	
	var ScrollBar = "no";
	var Resize = "no";
	var WinGubun = "Center";
	var strProperty = "";
	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}


//add: quynhdn
//temp fixed
function OpenNameUIPublic2(strName, strGetData){
	
	//???? ?? ???
	if(strName == "WinBuddyMake"){
		var strUrl = Config.mainService+"/common/include/buddy_invite_makeC_Wview.php" + strGetData;
//		var strUrl = "/common/include/buddy_invite_requestedC_Wview.php" + strGetData;	// ?? ?? ??
		var WinWidth = "400";
		var WinHeight = "500";
	}
	// Remove neighbors
	else if(strName == "WinBuddyRemove") {
		var strUrl = Config.mainService+"/common/include/buddy_remove_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//???? ?? > ??? ?? ?? ???
	else if(strName == "WinBuddyReceiver"){
		var strUrl = Config.mainService+"/common/include/buddy_invite_receiverC_Mview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//?? ???
	else if(strName == "WinMemoSend"){
		//var strUrl = "/main/memo_writeC_Wview.php" + strGetData;
		var strUrl = Config.mainService+"/communication/memo_writeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	//?? ??? ???? ???
	else if(strName == "WinBuddyNameChange"){
		//alert(strGetData);
		//var strUrl = "/main/buddy_name_changeC_Wview.php" + strGetData;
		
		var strUrl = Config.mainService+"/common/include/buddy_change_makeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		
	}
	else if(strName == "WinBuddyNameChange_re"){
		var strUrl = Config.mainService+"/common/include/buddy_change_re_makeC_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	else if(strName == "WinBuddyInvite" ) {
		// it requires to go through the template below to process
		var strUrl = Config.mainService+"/common/include/buddy_invite.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
		
	}
	else if(strName == "WinClubInvite" ) {
		// it requires to go through the template below to process
		var strUrl = Config.mainService+"/common/include/buddy_invite_club_Wview.php" + strGetData;
		var WinWidth = "400";
		var WinHeight = "500";
	}
	
	
	var ScrollBar = "no";
	var Resize = "no";
	var WinGubun = "Center";
	var strProperty = "";
	WinOpen(strUrl,strName,WinWidth,WinHeight,ScrollBar,Resize,WinGubun,strProperty);
}
