function SceneListMainPlusList(options) {

	this.options = options;

	//Object
	this.PlusList = null;
	this.PlusListView = null;
	this.PlusListPopupView = null;
	this.PlusListDim = null;
	this.MenuText = null;
	this.MenuItemArray	= new Array(7);

	//	this.HelpBar = null;

	//flag
	this.IsUnblock = false;
	this.SubSceneType = null;

	//data info
	this.Identity = null;
	this.Display = null;
	this.Index = null;
	this.PrevIndex = -1;
	this.Availability = null;
	this.IsBuddy = null;
	this.IsBlockedUser = null;
	this.IS_PSTN = null;

	//timer
	this.CloseTimer = false;

	//index
	this.BGStyleIndex = 0;
	this.AssignedLabel = null;
	this.AssignedNumber = null;
	this.PhoneNumCnt = 0;
	this.SetMenuCount = 0;
}

var PlusListPopupBGStyle = ["ListMainPlusListBg", "ListMainPlusListBg_7_Items", "ListMainPlusListBg_6_Items", "ListMainPlusListBg_5_Items", "ListMainPlusListBg_4_Items", "ListMainPlusListBg_3_Items", "ListMainPlusListBg_2_Items"];
var PlusListBGStyle = ["ListMainPlusList", "ListMainPlusList_7_Items", "ListMainPlusList_6_Items", "ListMainPlusList_5_Items", "ListMainPlusList_4_Items", "ListMainPlusList_3_Items", "ListMainPlusList_2_Items"];

SceneListMainPlusList.prototype.initialize = function() {
	alert("SceneListMainPlusList.initialize()");
	this.create();
}

SceneListMainPlusList.prototype.handleShow = function() {
	alert("SceneListMainPlusList.handleShow()");
	// this.ListMainPlusListDim.show();
	this.PlusListDim.show();
	this.PhoneNumCnt = PluginAPIMgr.GetPhoneNumberCnt(this.Identity, false);
	this.SetMenu();
	this.SetBGstyle();
	this.PlusList.Show();

	this.startTimer();

}

SceneListMainPlusList.prototype.handleHide = function() {
	alert("SceneListMainPlusList.handleHide()");
	// this.ListMainPlusListDim.hide();
	this.ResetBGstyle();
	if(this.CloseTimer == true) {
		this.stopTimer();
	}

}

SceneListMainPlusList.prototype.handleFocus = function() {
	alert("SceneListMainPlusList.handleFocus()");

	this.PlusList.highlight();
	//	this.PlusListHelpBar.visibleObj();

}

SceneListMainPlusList.prototype.handleBlur = function() {
	alert("SceneListMainPlusList.handleBlur()");

	this.PlusList.blur();
	//	this.PlusListHelpBar.hiddenObj();
}

SceneListMainPlusList.prototype.handleKeyDown = function(keyCode) {

	alert("SceneListMainPlusList.handleKeyDown(" + keyCode + ")");

	PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}

	if(keyCode == sf.key.RETURN) {
		this.processReturnKey();
		//2013 modify by minseok
		sf.key.preventDefault();
	} else if(keyCode == sf.key.EXIT) {
		this.processReturnKey();
		//2013 modify by minseok
		sf.key.preventDefault();
	} else if(keyCode == 147 || keyCode == 261 || keyCode == 115)//infolink ,contents,wiselink
	{
		ProcMgr.processInfolinkKey();
	} else {

		if(keyCode == sf.key.DOWN || keyCode == sf.key.UP) {
			this.resetTimer();
		}

		this.PlusList.KeyProcess(keyCode);
	}

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////

SceneListMainPlusList.prototype.Init = function(type) {
	alert("SceneListMainPlusList.Init() ");
	var isPSTN = null;
 	var Scene = sf.scene.get(WndMgr.GetMainSubSceneID());
 	
	this.options = type;
	this.Identity	= Scene.list.GetCurIdentityName();
	this.Display	= Scene.list.GetCurDisplayName();
	this.Index		= Scene.list.GetCurIndex();
	this.Availability	= parseInt(PluginAPIMgr.GetContactAvailabilityWithName(this.Identity));
	this.IsBuddy 		= PluginAPIMgr.IsMyBuddy(this.Identity);
	this.IsBlockedUser	= PluginAPIMgr.IsBlocked(this.Identity);
	if(this.options == "Contact_In" || this.options == "Contact_Out") {
		isPSTN = PluginAPIMgr.GetContactPropWithName(this.Identity,ENUM_CONTACT_PROPERTY.P_PSTNNUMBER);
		if(isPSTN == ""||isPSTN==null) 
			this.IS_PSTN = "0";
	else
			this.IS_PSTN = "1";
	}
	else {
		isPSTN = PluginAPIMgr.GetHistoryPropWithIndex(this.Index, ENUM_HISTORY_PROPERTY.P_IS_PSTN);
		if(isPSTN == '1') 
		this.IS_PSTN = "1";
	else
		this.IS_PSTN = "0";
}

}

SceneListMainPlusList.prototype.create = function() {
	alert("SceneListMainPlusList.create() ");

	this.PlusListView = new View("ListMainPlusList");
	this.PlusListDim = new DimBg("ListMainPlusListDim", "ListMainPlusList");
	this.PlusListPopupView = new View("ListMainPlusListBg");

	this.PlusList = new MenuList();
	this.PlusList.CreateBG("plusList", "divide");
	this.PlusList.SetNumOfVisibleItem(7);
	this.PlusList.SetStartDataIndex(0);
	this.PlusList.SetItemClass(MenuListItem);
	this.PlusList.SetItemBgImage(ITEM_STATE.NORMAL," ");
	this.PlusList.SetItemBgImage(ITEM_STATE.NORMAL_UP,null);
	this.PlusList.SetItemBgImage(ITEM_STATE.NORMAL_DOWN,null);
	this.PlusList.SetItemBgImage(ITEM_STATE.HIGHLIGHT,g_Image.IMAGE_LIST_SELECTION_HIGH);

	this.PlusList.SetItemDefualtTextStyle(ITEM_STATE.NORMAL, "cPlusList_Text_Normal");
	this.PlusList.SetItemDefualtTextStyle(ITEM_STATE.HIGHLIGHT, "cPlusList_Text_Highlight");
	this.PlusList.SetItemDisableTextStyle("cPlusList_Text_Disable");
	this.PlusList.SetDataType(ITEM_DATA_TYPE.TEXT_ONLY);

	var scene = sf.scene.get("ListMainPlusList");
	this.PlusList.SetItemPressedEventCallback(scene.ProcessKeyEnter);

	//Text, Image, Diable
	var tempdata1 = ["1", null];
	var tempdata2 = ["2", null];
	var tempdata3 = ["3", null];
	var tempdata4 = ["4", null];
	var tempdata5 = ["5", null];
	var tempdata6 = ["6", null];
	var tempdata7 = ["7", null];

	this.PlusList.AddData(tempdata1);
	this.PlusList.AddData(tempdata2);
	this.PlusList.AddData(tempdata3);
	this.PlusList.AddData(tempdata4);
	this.PlusList.AddData(tempdata5);
	this.PlusList.AddData(tempdata6);
	this.PlusList.AddData(tempdata7);

	this.PlusList.SetOnClickCallbackFunc(0, this.onClickEventFunc1);
	this.PlusList.SetOnClickCallbackFunc(1, this.onClickEventFunc2);
	this.PlusList.SetOnClickCallbackFunc(2, this.onClickEventFunc3);
	this.PlusList.SetOnClickCallbackFunc(3, this.onClickEventFunc4);
	this.PlusList.SetOnClickCallbackFunc(4, this.onClickEventFunc5);
	this.PlusList.SetOnClickCallbackFunc(5, this.onClickEventFunc6);
	this.PlusList.SetOnClickCallbackFunc(6, this.onClickEventFunc7);

	this.PlusList.SetOnMouseOverCallbackFunc(0, function(){scene.processMouseOver(0);});
	this.PlusList.SetOnMouseOverCallbackFunc(1, function(){scene.processMouseOver(1);});
	this.PlusList.SetOnMouseOverCallbackFunc(2, function(){scene.processMouseOver(2);});
	this.PlusList.SetOnMouseOverCallbackFunc(3, function(){scene.processMouseOver(3);});
	this.PlusList.SetOnMouseOverCallbackFunc(4, function(){scene.processMouseOver(4);});
	this.PlusList.SetOnMouseOverCallbackFunc(5, function(){scene.processMouseOver(5);});
	this.PlusList.SetOnMouseOverCallbackFunc(6, function(){scene.processMouseOver(6);});

	this.PlusList.SetClickEventAvailable(WndMgr.MouseClickEnable);

	this.PlusList.ShowItem();

}

SceneListMainPlusList.prototype.ProcessKeyEnter = function() {

	alert("SceneListMainPlusList.ProcessKeyEnter() ");

	var scene = sf.scene.get("ListMainPlusList");
	var Index = scene.PlusList.GetCurrentItem();

	var tempData = scene.PlusList.GetData(Index);
	alert("data is : " + tempData[0]);

	if(tempData[0] == IDWS_MOIP_SKYPE_VIEW_PROFILE) {//view profile
		scene.ShowVeiwProfile();
	} else if(tempData[0] == IDWS_MOIP_SEND_VOICEMAIL) {//send voicemail
		scene.SendVoicemail();
	} else if(tempData[0] == SID_RENAME) {//rename
		scene.ShowRenamePopup();
	} else if(tempData[0] == IDWS_MOIP_SKYPE_REMOVE || tempData[0] == IDWS_MOIP_SKYPE_DELETE_THIS_ENTRY) {//remove
		if(scene.SubSceneType == 0) {//listmaincontact
			scene.ShowRemoveContactPopup();
		} else {//listmainhistory
			scene.ShowRemovePopup();
		}
	} else if(tempData[0] == IDWS_MOIP_SKYPE_BLOCK || tempData[0] == IDWS_MOIP_UNBLOCKED) {//block
		scene.ShowBlockPopup();
	}else if(tempData[0]==IDWS_MOIP_SKYPE_ADD_A_PHONE_NUMBER){	//add phone contact
			scene.ShowAddContactPopup();
	}else if(tempData[0]==IDWS_MOIP_ADD_TO_CONTACTS){//add to contact
		scene.ShowAddPopup();
	}else if(tempData[0]==TV_CHANGE_PHONE_NUMBER){//change phone number //  && this.PhoneNumCnt > 0
		scene.ShowChangePopup();
	}	 
}

SceneListMainPlusList.prototype.SetBGstyle = function() {
	var Scene = sf.scene.get(WndMgr.GetMainSubSceneID());
	$("#" + this.PlusListView.GetObjId()).addClass(PlusListBGStyle[this.BGStyleIndex]);

	this.PlusListPopupView.CreatePopupBG(0, PlusListPopupBGStyle[this.BGStyleIndex]);
	if(this.options == "History_In" || this.options == "History_Out")
		this.PlusListPopupView.SetTitleTextofPopupBG(PluginAPIMgr.GetHistoryNameWithIndex(Scene.list.GetCurIndex())); 
	else
	this.PlusListPopupView.SetTitleTextofPopupBG(PluginAPIMgr.GetContactNameWithIndex(Scene.list.GetCurIndex()));
}

SceneListMainPlusList.prototype.ResetBGstyle = function() {
	$("#" + this.PlusListView.GetObjId()).removeClass();

	this.PlusListPopupView.RemovePopupBG();
	this.PhoneNumCnt = 0;
}

SceneListMainPlusList.prototype.SetMenu = function() {

	alert("SceneListMainPlusList.SetMenu() ");

 	this.SetMenuCount = 0;
	this.SetVeiwProfileMenu(this.SetMenuCount);
	this.SubSceneType = WndMgr.GetMainSubIndex();
	
	if(this.options != "Contact_In" && this.options != "Contact_Out" && this.options != "History_In" && this.options != "History_Out") {

		alert("!!                  SceneListMainPlusList : SetMenu --> 2st Checking                        !! ");
	    var skype_name = PluginAPIMgr.GetContactPropWithIndex(this.Index,this.Identity); 

		if(this.SubSceneType == 0)
		{
		    if(skype_name.length >0)	//skype in
				this.options = "Contact_In";
			else						//skype out
				this.options = "Contact_Out";
		}
		else if(this.SubSceneType == 1)
		{
			if(skype_name.length >0)	//skype in
				this.options = "History_In";
			else						//skype out
				this.options = "History_Out";
		}
		else
		{
			alert("========================================================================================= ");
			alert("==                                                                                     == ");
			alert("==                                                                                     == ");
			alert("==                  SceneListMainPlusList : SetMenu --> Fail...                        == ");
			alert("==                                                                                     == ");
			alert("==                                                                                     == ");
			alert("========================================================================================= ");
		}
	}

	alert("Identity = " + this.Identity);
	alert("Display = " + this.Display);
	alert("Index = " + this.Index);
	alert("Availability = " + this.Availability);
	alert("IsBuddy = " + this.IsBuddy);
	alert("IsBlockedUser = " + this.IsBlockedUser);
	alert("SubSceneType = " + this.SubSceneType);
	alert("options = " + this.options);
	alert("IS_PSTN = " + this.IS_PSTN);

	switch(this.options) {
		case "Contact_In":
			if(this.Identity == 'echo123') {
				this.SetRenameMenu(this.SetMenuCount);
//				this.SetBlockMenu(this.SetMenuCount);
			} else {
				this.SetSendVoicemailMenu(this.SetMenuCount);
				this.SetRenameMenu(this.SetMenuCount);
				this.SetRemoveMenu(this.SetMenuCount);
				this.SetBlockMenu(this.SetMenuCount);
				this.SetAddPhoneNumberMenu(this.SetMenuCount);
				this.SetChangePhoneNumberMenu(this.SetMenuCount);
			}
			break;

		case "Contact_Out":
			this.SetRenameMenu(this.SetMenuCount);
			this.SetRemoveMenu(this.SetMenuCount);
			this.SetBlockMenu(this.SetMenuCount);
			break;

		case "History_In":
			this.SetSendVoicemailMenu(this.SetMenuCount);
			if(this.IsBuddy != true)
				this.SetAddToContaxctMenu(this.SetMenuCount);
			this.SetBlockMenu(this.SetMenuCount);
			this.SetRemoveMenu(this.SetMenuCount);
			break;

		case "History_Out":
			if(this.IsBuddy != true)
				this.SetAddToContaxctMenu(this.SetMenuCount);
			this.SetBlockMenu(this.SetMenuCount);
			this.SetRemoveMenu(this.SetMenuCount);
			break;
	}
	
	this.BGStyleIndex = 7-(this.SetMenuCount-1);
	for( ; this.SetMenuCount < 7; this.SetMenuCount++)
		this.SetBlankMenu(this.SetMenuCount);
}

SceneListMainPlusList.prototype.EnableSendVoicemail = function() {
	alert("SceneListMainPlusList.prototype.EnableSendVoicemail()");
	var MyCapability = parseInt(PluginAPIMgr.GetAccountCapability(ENUM_CONTACT_CAPABILITY.CAPABILITY_VOICEMAIL));
	var YourCapability = PluginAPIMgr.HasVoiceMailCapability(this.Identity);
	//Set Disable if Blocked user & added user & pstn number & no capablility of voicemail
	if(this.IsBuddy == false || this.Availability == ENUM_CONTACT_AVAILABILITY.BLOCKED
		|| this.Availability == ENUM_CONTACT_AVAILABILITY.BLOCKED_SKYPEOUT || this.Availability == ENUM_CONTACT_AVAILABILITY.UNKNOWN
		|| this.Availability == ENUM_CONTACT_AVAILABILITY.SKYPEOUT || (MyCapability == ENUM_CAPABILITY_STATUS.NO_CAPABILITY && YourCapability == false)) {

		alert("DisableVoicemail");
		return false;
	} else {
		alert("EnableVoicemail");
		return true;
	}
}

SceneListMainPlusList.prototype.SetVeiwProfileMenu = function(Index) {

	//TEMPCODE: check previous status. do not try in same status.
	this.MenuItemArray[Index] = [IDWS_MOIP_SKYPE_VIEW_PROFILE, null];
	this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
	this.PlusList.SetEnableItem(Index);
	this.SetMenuCount++;
}

SceneListMainPlusList.prototype.SetSendVoicemailMenu = function(Index) {

	if(this.EnableSendVoicemail()) {
		this.MenuItemArray[Index] = [IDWS_MOIP_SEND_VOICEMAIL, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;
	}
}

SceneListMainPlusList.prototype.SetRenameMenu = function(Index) {

	this.MenuItemArray[Index] = [SID_RENAME, null];
	this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
	this.PlusList.SetEnableItem(Index);
	this.SetMenuCount++;

}

SceneListMainPlusList.prototype.SetRemoveMenu = function(Index) {

	//TEMPCODE:
	if(this.SubSceneType == 0) {

		this.MenuItemArray[Index]= [IDWS_MOIP_SKYPE_REMOVE, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);

		if(this.Availability == ENUM_CONTACT_AVAILABILITY.UNKNOWN || this.Identity == 'echo123') {

//			this.PlusList.SetDisableItem(Index);
		} else {
			this.PlusList.SetEnableItem(Index);
			this.SetMenuCount++;
		}

	} else if(this.SubSceneType == 1) {

		this.MenuItemArray[Index] = [IDWS_MOIP_SKYPE_DELETE_THIS_ENTRY, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;

	}

}

SceneListMainPlusList.prototype.SetBlockMenu = function(Index) {

	//TEMPCODE: no relationship with buddy
	if(this.IsBlockedUser == 1) {

		this.MenuItemArray[Index] = [IDWS_MOIP_UNBLOCKED, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);

		this.IsUnblock = true;
		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;
	} else if(this.Availability == ENUM_CONTACT_AVAILABILITY.UNKNOWN || this.Identity == 'echo123') {

//		this.MenuItemArray[Index] = [IDWS_MOIP_SKYPE_BLOCK, null];
//		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
//		this.IsUnblock = false;
//		this.PlusList.SetDisableItem(Index);
	} else {

		this.MenuItemArray[Index] = [IDWS_MOIP_SKYPE_BLOCK, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);

		this.IsUnblock = false;
		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;
	}

}

SceneListMainPlusList.prototype.SetAddToContaxctMenu = function(Index) {

	this.MenuItemArray[Index] = [IDWS_MOIP_ADD_TO_CONTACTS, null];
	this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);

	if(this.IsBuddy == true || this.IsBlockedUser == 1 || this.Identity == 'echo123') {

//		this.PlusList.SetDisableItem(Index);
	} else {

		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;
	}
}

SceneListMainPlusList.prototype.SetLogoutMenu = function(Index) {

	this.MenuItemArray[Index] = [IDWS_MOIP_POPUP_EXIT_SIGN_OUT, null];
	this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
	this.PlusList.SetEnableItem(Index);
	this.SetMenuCount++;

}

SceneListMainPlusList.prototype.SetAddPhoneNumberMenu = function(Index) {

	if(this.PhoneNumCnt < 3 && this.IS_PSTN == "0") {
		this.MenuItemArray[Index] = [IDWS_MOIP_SKYPE_ADD_A_PHONE_NUMBER, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;
	}
}

SceneListMainPlusList.prototype.SetChangePhoneNumberMenu = function(Index) {

	if(this.PhoneNumCnt > 0 && this.IS_PSTN == "0") {
		this.MenuItemArray[Index] = [TV_CHANGE_PHONE_NUMBER, null];
		this.PlusList.ChangeData(Index, this.MenuItemArray[Index]);
		this.PlusList.SetEnableItem(Index);
		this.SetMenuCount++;
	}
}

SceneListMainPlusList.prototype.SetBlankMenu = function(Index) {

	alert("SceneListMainPlusList.SetBlankMenu -- " + Index);
	var tempdata = [" ", null];
	this.PlusList.ChangeData(Index, tempdata);
	this.PlusList.SetDisableItem(Index);

}

SceneListMainPlusList.prototype.ShowVeiwProfile = function() {

	//StateMgr.Stop_List_Tools_State(false);
	StateMgr.Start_View_Profile_State(this.Identity);

}

SceneListMainPlusList.prototype.ShowBlockPopup = function() {

	//StateMgr.Stop_List_Tools_State(false);

	var type;

	if(this.IsUnblock) {

		if(this.SubSceneType == 0) {
			type = MAIN_LIST_POPUP_FUNCTION_TYPE.CONTACT_UNBLOCK;
		} else if(this.SubSceneType == 1) {
			type = MAIN_LIST_POPUP_FUNCTION_TYPE.HISTORY_UNBLOCK;
		} else if(this.SubSceneType == 2) {
			type = MAIN_LIST_POPUP_FUNCTION_TYPE.CHAT_UNBLOCK;
		}
	} else {

		if(this.SubSceneType == 0) {
			type = MAIN_LIST_POPUP_FUNCTION_TYPE.CONTACT_BLOCK;
		} else if(this.SubSceneType == 1) {
			type = MAIN_LIST_POPUP_FUNCTION_TYPE.HISTORY_BLOCK;
		} else if(this.SubSceneType == 2) {
			type = MAIN_LIST_POPUP_FUNCTION_TYPE.CHAT_UNBLOCK;
		}

	}

	StateMgr.Start_Block_State(type, this.Identity, this.Display);

}

SceneListMainPlusList.prototype.ShowRenamePopup = function() {

	//StateMgr.Stop_List_Tools_State(false);
	StateMgr.Start_Rename_State(this.Identity);

}

SceneListMainPlusList.prototype.ShowRemovePopup = function() {

	//StateMgr.Stop_List_Tools_State(false);
//	StateMgr.Start_Remove_State(this.SubSceneType, this.Identity, this.Display, this.Index);
	StateMgr.Start_Remove_State(this.Index);

}

SceneListMainPlusList.prototype.ShowRemoveContactPopup = function() {

	//StateMgr.Stop_List_Tools_State(false);
	StateMgr.Start_Remove_Contact_State(this.Identity, this.Display);

}

SceneListMainPlusList.prototype.SendVoicemail = function() {

	//Check!!!!
	/*
	var Scene = sf.scene.get(WndMgr.GetMainSubSceneID());
		Scene.Activation();*/
	

	StateMgr.Stop_List_Plus_State(false);
	ProcMgr.LeaveVoicemail(this.Identity);

}

SceneListMainPlusList.prototype.ShowAddPopup = function() {

	if(this.IS_PSTN == "1") {
		alert("AddSkypeOutContact(" + this.Identity + ")");
		PluginAPIMgr.AddSkypeOutContact(this.Identity, "");
	} else {
		alert("AddContact(" + this.Identity + ")");
		PluginAPIMgr.AddContact(this.Identity, "");
	}

	StateMgr.Stop_List_Plus_State(false);

	WndMgr.StartOneBottonPopup(OneBtnPopupIndex.ADD_REMOVED_CONTACT);

}

SceneListMainPlusList.prototype.ChangePopupcheck = function()
{
	alert("SceneListMainPlusList.ChangePopupcheck");

	var AssignedLabel = null;
	var AssignedNumber = null;

	for(var i=1; i<7; i++) {

		AssignedNumber = PluginAPIMgr.GetAssignedPhoneNumberWithName(this.Identity,i);
		AssignedLabel = PluginAPIMgr.GetAssignedPhoneNumberWithName(this.Identity,++i);

		if(AssignedLabel != null && AssignedLabel != "none" && AssignedLabel != 0) {
			this.PhoneNumCnt++;
			
			if(this.PhoneNumCnt == 1) {
				this.AssignedLabel = AssignedLabel;
				this.AssignedNumber = AssignedNumber;
			}
			AssignedNumber = null;
			AssignedLabel = null;
		}
	}
		alert("==================== ChangePopupcheck  == this.PhoneNumCnt = " + this.PhoneNumCnt);
}

SceneListMainPlusList.prototype.ShowChangePopup = function(){

	/*
	var Scene = sf.scene.get(WndMgr.GetMainSubSceneID());	
		Scene.Activation();*/
	

	if(this.PhoneNumCnt > 1) {

		StateMgr.Start_Change_Phone_Number_Select_State('ListMainContact', this.Identity);

	} else if(this.PhoneNumCnt == 1) {
		
		var AssignedLabel = null;
		var AssignedNumber = null;

		for(var i=1; i<7; i++) {

			AssignedNumber = PluginAPIMgr.GetAssignedPhoneNumberWithName(this.Identity,i);
			AssignedLabel = PluginAPIMgr.GetAssignedPhoneNumberWithName(this.Identity,++i);

			if(AssignedLabel != null && AssignedLabel != "none" && AssignedLabel != 0) {
				break;
			}
		}
		StateMgr.Start_Change_Phone_Number_State(this.Identity, i/2, AssignedLabel, AssignedNumber);
		
	}else {
		alert("==================== ShowChangePopup Error == this.PhoneNumCnt = " + this.PhoneNumCnt);
	}
}

SceneListMainPlusList.prototype.processReturnKey = function() {

	//check
	/*
	var Scene = sf.scene.get(WndMgr.GetMainSubSceneID());
		Scene.Activation();*/
	

	StateMgr.Stop_List_Plus_State(true);
}

SceneListMainPlusList.prototype.startTimer = function() {
	alert("SceneListMainPlusList.startTimer() ");

	this.CloseTimer = true;
	PluginAPIMgr.StartOSDTimer("60000", function() {
		sf.scene.get('ListMainPlusList').popupTimerCallback();
	}, ENUM_TIMER_TYPE.POPUP_WND);
}

SceneListMainPlusList.prototype.resetTimer = function() {
	alert("SceneListMainPlusList.resetTimer() ");

	if(this.CloseTimer == true) {
		PluginAPIMgr.RestartOSDTimer("60000", ENUM_TIMER_TYPE.POPUP_WND);
	}
}

SceneListMainPlusList.prototype.stopTimer = function() {
	alert("SceneListMainPlusList.stopTimer() ");

	this.CloseTimer = false;
	PluginAPIMgr.StopOSDTimer(ENUM_TIMER_TYPE.POPUP_WND);
}

SceneListMainPlusList.prototype.popupTimerCallback = function() {
	alert("SceneListMainPlusList.popupTimerCallback() ");
	if(this.CloseTimer == false) {
		return
	}
	this.CloseTimer = false;

	this.processReturnKey();
}

SceneListMainPlusList.prototype.ShowLogoutPopup = function() {

	alert("SceneListMainPlusList.prototype.ShowLogoutPopup");

	StateMgr.Start_Signout_State();
}

SceneListMainPlusList.prototype.ShowAddContactPopup = function() {

	alert("SceneListMainPlusList.prototype.ShowAddContactPopup");

	StateMgr.Start_Add_Phone_Number_State(this.Identity);
}

SceneListMainPlusList.prototype.processMouseOver = function(ItemIndex)
{
	alert("SceneListMainPlusList.processMouseOver --" + ItemIndex);

	if(ItemIndex < 0 || ItemIndex > 6 || this.PrevIndex == ItemIndex)
	{
		alert("ItemIndex only 0~6, and PrevIndex == ItemIndex"); 
		return;
	}

	this.PrevIndex = ItemIndex;
	this.PlusList.SetCurrentItem(ItemIndex);
}

SceneListMainPlusList.prototype.onClickEventFunc = function(Index) {

	var scene = sf.scene.get("ListMainPlusList");
	var tempData = this.MenuItemArray[Index];
	alert("SceneListMainPlusList.onClickEventFunc() : tempData = " + tempData);

	if(tempData[0] == IDWS_MOIP_SKYPE_VIEW_PROFILE) {//view profile
		scene.ShowVeiwProfile();
	} else if(tempData[0] == IDWS_MOIP_SEND_VOICEMAIL) {//send voicemail
		scene.SendVoicemail();
	} else if(tempData[0] == SID_RENAME) {//rename
		scene.ShowRenamePopup();
	} else if(tempData[0] == IDWS_MOIP_SKYPE_REMOVE || tempData[0] == IDWS_MOIP_SKYPE_DELETE_THIS_ENTRY) {//remove
		if(scene.SubSceneType == 0) {//listmaincontact
			scene.ShowRemoveContactPopup();
		} else {//listmainhistory
			scene.ShowRemovePopup();
		}
	} else if(tempData[0] == IDWS_MOIP_SKYPE_BLOCK || tempData[0] == IDWS_MOIP_UNBLOCKED) {//block
		scene.ShowBlockPopup();
	}else if(tempData[0]==IDWS_MOIP_SKYPE_ADD_A_PHONE_NUMBER){	//add phone contact
			scene.ShowAddContactPopup();
	}else if(tempData[0]==IDWS_MOIP_ADD_TO_CONTACTS){//add contact
		scene.ShowAddPopup();
	}else if(tempData[0]==TV_CHANGE_PHONE_NUMBER){//change phone number //  && this.PhoneNumCnt > 0
		scene.ShowChangePopup();
	}	 
}

SceneListMainPlusList.prototype.onClickEventFunc1 = function() {

	alert("SceneListMainPlusList.onClickEventFunc1() ");

	var This_ = sf.scene.get("ListMainPlusList");
	This_.onClickEventFunc(0);
}

SceneListMainPlusList.prototype.onClickEventFunc2 = function() {

	alert("SceneListMainPlusList.onClickEventFunc2() ");

	var This_ = sf.scene.get("ListMainPlusList");
	This_.onClickEventFunc(1);
}

SceneListMainPlusList.prototype.onClickEventFunc3 = function() {

	alert("SceneListMainPlusList.onClickEventFunc3() ");

	var This_ = sf.scene.get("ListMainPlusList");
	This_.onClickEventFunc(2);
}

SceneListMainPlusList.prototype.onClickEventFunc4 = function() {

	alert("SceneListMainPlusList.onClickEventFunc4() ");

	var This_ = sf.scene.get("ListMainPlusList");
	This_.onClickEventFunc(3);
}

SceneListMainPlusList.prototype.onClickEventFunc5 = function() {

	alert("SceneListMainPlusList.onClickEventFunc5() ");

	var This_ = sf.scene.get("ListMainPlusList");
	This_.onClickEventFunc(4);
}

SceneListMainPlusList.prototype.onClickEventFunc6 = function() {

	alert("SceneListMainPlusList.onClickEventFunc6() ");

	var This_ = sf.scene.get("ListMainPlusList");
	This_.onClickEventFunc(5);
}

SceneListMainPlusList.prototype.onClickEventFunc7 = function() {

	alert("SceneListMainPlusList.onClickEventFunc7() ");

	var This_ = sf.scene.get("ListMainPlusList");
		This_.onClickEventFunc(6);
}

