function SceneSettingsPrivacy(options) {
	this.options = options;

	this.sceneId = "SettingsPrivacy";
	this.SettingsPrivacyView = null;
	this.SettingsPrivacyDim = null;
	this.SettingsPrivacyBG = null;

	this.AllowCallLabel = null;

	this.AllowCallBtn = null;

	this.SaveBtn = null;
	this.CancelBtn = null;


	this.InitFlag == true;
	
	this.ShownSubList = false;
	this.InitAllowCall =null;
	this.IsChangeAllowCall = false;
	this.IsEnableSaveBtn = true;
	
	this.waitingCommit = false;
}

SceneSettingsPrivacy.prototype.initialize = function() {
	alert("SceneSettingsPrivacy.initialize()");
	// this function will be called only once when the scene manager show this scene first time
	// initialize the scene controls and styles, and initialize your variables here
	// scene HTML and CSS will be loaded before this function is called
	this.create();
}

SceneSettingsPrivacy.prototype.handleShow = function() {
	alert("SceneSettingsPrivacy.handleShow()");
	// this function will be called when the scene manager show this scene

	WndMgr.startPopupHideTimer(60000);
	this.InitSettingsPrivacy();
	this.setSaveBtnEnable(false);
}

SceneSettingsPrivacy.prototype.handleHide = function() {
	alert("SceneSettingsPrivacy.handleHide()");
	// this function will be called when the scene manager hide this scene
	this.SettingsPrivacyDim.hide();
	
	if(this.ShownSubList==true){
		WndMgr.HideSettingsSubList();
	}
	WndMgr.stopPopupHideTimer();
	this.highlight(null);
}

SceneSettingsPrivacy.prototype.handleFocus = function() {
	alert("SceneSettingsPrivacy.handleFocus()");
	// this function will be called when the scene manager focus this scene
	this.SettingsPrivacyDim.show();
	var  obj = this.SettingsPrivacyView.getCurrentHighlight();
	if(obj != null)
	{
		this.highlight(obj);
	}else{
		this.highlight(this.AllowCallBtn);
	}
	this.ShownSubList=false;
}

SceneSettingsPrivacy.prototype.handleBlur = function() {
	alert("SceneSettingsPrivacy.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
	var  obj = this.SettingsPrivacyView.getCurrentHighlight();
	if(obj != null)
	{
		obj.blur();	
	}
	/*
	if(this.ShownSubList)
			this.SaveBtn.SetFlagDim(true);*/
	
}

SceneSettingsPrivacy.prototype.handleKeyDown = function(keyCode) {
	alert("SceneSettingsPrivacy.handleKeyDown(" + keyCode + ")");
	// TODO : write an key event handler when this scene get focued
	PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	switch (keyCode) {
		case sf.key.LEFT:
			WndMgr.resetPopupHideTimer();
			this.processLeftKey();
			break;
		case sf.key.RIGHT:
			WndMgr.resetPopupHideTimer();
			this.processRightKey();
			break;
		case sf.key.UP:
			WndMgr.resetPopupHideTimer();
			this.processUpKey();
			break;
		case sf.key.DOWN:
			WndMgr.resetPopupHideTimer();
			this.processDownKey();
			break;

		case sf.key.ENTER:
			this.processEnterKey();
			break;

		case sf.key.RETURN:
		case sf.key.EXIT:
			this.processReturnKey();
			sf.key.preventDefault();
			break;

		case 147:
		//infolink
		case 261:
		//contents
		case 115:
			//wiselink
			ProcMgr.processInfolinkKey();
			break;
	}
}

SceneSettingsPrivacy.prototype.processReturnKey = function() {
	alert("SceneSettingsPrivacy.processReturnKey() ");
	StateMgr.Stop_SettingsPrivacy_State(true);
}

SceneSettingsPrivacy.prototype.processMouseOver = function(obj) {
	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}
	WndMgr.resetPopupHideTimer();
}

SceneSettingsPrivacy.prototype.highlight = function(obj) {
	this.SettingsPrivacyView.setCurrenHighlight(obj);
}

SceneSettingsPrivacy.prototype.processClickEvent = function(obj) {
	alert("SceneSettingsPrivacy.processClickEvent() ");

	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}
	this.processEnterKey();
}
SceneSettingsPrivacy.prototype.processUpKey = function() {
	alert("SceneSettingsPrivacy.processUpKey()");
	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.CancelBtn:
			if(this.IsEnableSaveBtn==true)
				this.highlight(this.SaveBtn);
			break;
	}
}
SceneSettingsPrivacy.prototype.processDownKey = function() {
	alert("SceneSettingsPrivacy.processDownKey()");
	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.SaveBtn:
			this.highlight(this.CancelBtn);
			break;
		case this.CancelBtn:
			break;
	}
}
SceneSettingsPrivacy.prototype.processLeftKey = function() {
	alert("SceneSettingsPrivacy.processLeftKey()");
	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.SaveBtn:
			this.highlight(this.AllowCallBtn);
			break;
		case this.CancelBtn:
			this.highlight(this.AllowCallBtn);
			break;
	}
}

SceneSettingsPrivacy.prototype.processRightKey = function() {
	alert("SceneSettingsPrivacy.processRightKey()");
	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.AllowCallBtn:
			if(this.IsEnableSaveBtn ==true)
				this.highlight(this.SaveBtn);
			else
				this.highlight(this.CancelBtn);
			break;
	}
}
SceneSettingsPrivacy.prototype.processEnterKey = function() {
	alert("SceneSettingsPrivacy.processEnterKey()");

	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.AllowCallBtn:
			this.ShownSubList=true;
			
			WndMgr.StartSettingsSubList(this.AllowCallBtn, this.sceneId,this.SettingsPrivacyView, this.SublistCallBack/*callback*/, this.AllowCallBtn.GetText());
			break;
		case this.SaveBtn:
			this.SavePrivacySetting();
			break;
		case this.CancelBtn:
			this.processReturnKey();
			break;
	}
}
SceneSettingsPrivacy.prototype.SaveSuccess = function() {
	alert("SceneSettingsPrivacy.SaveSuccess()");
	this.InitAllowCall = this.AllowCallBtn.GetText();
	if(this.waitingCommit==false){
		StateMgr.Stop_SettingsPrivacy_State(true);
	}
}
SceneSettingsPrivacy.prototype.SavePrivacySetting = function() {
	alert("SceneSettingsPrivacy.SavePrivacySetting()");
	if(this.IsChangeAllowCall == true) {
		WndMgr.StartLoading(LoadingTypeIndex.WAIT);
		PluginAPIMgr.SetCallAllowPolicy(this.AllowCallBtn.GetText());
		this.waitingCommit = true;
		WndMgr.SetCurrentPopupSceneId(this.sceneId);
		WndMgr.HideSettingsPrivacy();
		
	}
}
SceneSettingsPrivacy.prototype.setSaveBtnEnable = function(flag_enable) {
	alert("SceneSettingsPrivacy.setSaveBtnEnable() : ");

	if(flag_enable == true) {
		this.SaveBtn.SetFlagDim(false);
		this.IsEnableSaveBtn = true;
	} else if(flag_enable == false) {
		this.SaveBtn.SetFlagDim(true);
		this.IsEnableSaveBtn = false;
	}
}
SceneSettingsPrivacy.prototype.IsChange = function(caller) {
	alert("SceneSettingsPrivacy.IsChange()");
	switch(caller) {
		case "ALLOW":
			if(this.IsChangeAllowCall==true)
				this.setSaveBtnEnable(true);
			else
				this.setSaveBtnEnable(false);
			break;
	}
}
SceneSettingsPrivacy.prototype.InitSettingsPrivacy = function() {
	alert("SceneSettingsPrivacy.InitSettingsPrivacy()");
	var currentHighlight = this.SettingsPrivacyView.getCurrentHighlight();
	
	this.InitAllowCall = PluginAPIMgr.GetCallAllowPolicy();
	
	this.AllowCallBtn.SetText(this.InitAllowCall);
	
	this.IsChangeDisplayNotify = false;
	this.IsChangeAutoStart = false;

}

SceneSettingsPrivacy.prototype.SublistCallBack = function(text) {
	alert("SceneSettingsPrivacy.SublistCallBack()");
	var this_ = sf.scene.get("SettingsPrivacy");
	
	if(this_.InitAllowCall != text) {
		this_.IsChangeAllowCall = true;
	}else{
		this_.IsChangeAllowCall = false;
	}
	this_.IsChange("ALLOW");
}
SceneSettingsPrivacy.prototype.create = function() {
	alert("SceneSettingsPrivacy.create()");
	this.SettingsPrivacyView = new View("SettingsPrivacy");
	this.SettingsPrivacyBG = new View("SettingsPrivacyBG");
	this.SettingsPrivacyBG.CreatePopupBG(0, "SettingsPrivacy_popup_BG");
	this.SettingsPrivacyBG.CreateInnerBox("SettingsPrivacy_popup_innerbox");
	this.SettingsPrivacyBG.SetTitleTextofPopupBG(IDWS_MOIP_SKYPE_SETTING_PRIVACY_SETTINGS);
	this.SettingsPrivacyDim = new DimBg("SettingsPrivacyDim", "SettingsPrivacyBG");

	var this_ = sf.scene.get("SettingsPrivacy");
	var clickCF = function(obj) {
		this_.processClickEvent(obj);
	};
	this.AllowCallLabel = new TextLayer("settingsprivacy_allow_call_label");
	this.AllowCallLabel.SetTextStyle("settingsprivacy_label_style");
	this.AllowCallLabel.SetText(IDWS_MOIP_SETUP_CALL_OPTIONS+" : ");
	
	
	this.AllowCallBtn = new Button();
	this.AllowCallBtn.SetImageObjId("settingsprivacy_allow_call_btn", 29);
	this.AllowCallBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_TEXT_INPUT_NORMAL);
	this.AllowCallBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_TEXT_INPUT_FOCUS);

	this.AllowCallBtn.SetTextObjId("settingsprivacy_allow_call_btn_text");

	this.AllowCallBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "image_text_box_normal_style");
	this.AllowCallBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "image_text_box_focus_style");
	this.AllowCallBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "image_text_box_dim_style");
	this.AllowCallBtn.SetIconObjId("settingsprivacy_allow_call_btn_arrow");
	this.AllowCallBtn.SetBgIcon(0, g_Image.IMAGE_TEXT_INPUT_ARROW);
	this.AllowCallBtn.SetOnClickCallbackFunc(clickCF);
	
	this.SaveBtn = new Button();
	this.SaveBtn.SetImageObjId("settingsprivacy_save_btn", 20);
	this.SaveBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
	this.SaveBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);
	this.SaveBtn.SetTextObjId("settingsprivacy_save_btn_text");
	this.SaveBtn.SetText(SID_SAVE);
	this.SaveBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "popup_btn_text_normal_style");
	this.SaveBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "popup_btn_text_focus_style");
	this.SaveBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "popup_btn_text_dimmed_style");
	this.SaveBtn.SetOnClickCallbackFunc(clickCF);

	this.CancelBtn = new Button();
	this.CancelBtn.SetImageObjId("settingsprivacy_cancel_btn", 20);
	this.CancelBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
	this.CancelBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);
	this.CancelBtn.SetTextObjId("settingsprivacy_cancel_btn_text");
	this.CancelBtn.SetText(SID_CANCEL);
	this.CancelBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "popup_btn_text_normal_style");
	this.CancelBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "popup_btn_text_focus_style");
	this.CancelBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "popup_btn_text_dimmed_style");
	this.CancelBtn.SetOnClickCallbackFunc(clickCF);
	
	this.AllowCallBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});

	this.SaveBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
	this.CancelBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
}