
function SceneSettingsVoicemailUnable(options) {
	this.options = options;
	this.sceneId = "SettingsVoicemailUnable";
	this.SettingsVoicemailUnableDim = null;
	this.SettingsVoicemailUnableView = null;
	this.SettingsVoicemailUnableBG = null;
	this.AboutLabel = null;
	this.HowToLabel = null;
	this.CloseBtn = null;	
}

SceneSettingsVoicemailUnable.prototype.initialize = function() {
	alert("SceneSettingsVoicemailUnable.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();
}

SceneSettingsVoicemailUnable.prototype.handleShow = function() {
	alert("SceneSettingsVoicemailUnable.handleShow()");
	// this function will be called when the scene manager show this scene
	
	WndMgr.startPopupHideTimer(60000);
	this.SettingsVoicemailUnableDim.show();
}

SceneSettingsVoicemailUnable.prototype.handleFocus = function() {
	alert("SceneSettingsVoicemailUnable.handleFocus()");
	// this function will be called when the scene manager focus this scene
	var currentHighlight = this.SettingsVoicemailUnableView.getCurrentHighlight();
	if(currentHighlight!=null)
		this.highlight(currentHighlight);
	else
		this.highlight(this.CloseBtn);
}

SceneSettingsVoicemailUnable.prototype.handleHide = function() {
	alert("SceneSettingsVoicemailUnable.handleHide()");
	// this function will be called when the scene manager hide this scene
	this.SettingsVoicemailUnableDim.hide();
	WndMgr.stopPopupHideTimer();
	this.highlight(null);
}
SceneSettingsVoicemailUnable.prototype.handleBlur = function() {
	alert("SceneSettingsVoicemailUnable.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
	var currentHighlight =  this.SettingsVoicemailUnableView.getCurrentHighlight();
	if(currentHighlight != null)
	{
		currentHighlight.blur();
	}
}

SceneSettingsVoicemailUnable.prototype.handleKeyDown = function(keyCode) {
	alert("SceneSettingsVoicemailUnable.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:
		case sf.key.RIGHT:
		case sf.key.UP:
		case sf.key.DOWN:
			WndMgr.resetPopupHideTimer();
			this.highlight(this.CloseBtn);
			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;
	}
}

SceneSettingsVoicemailUnable.prototype.processReturnKey = function() {
	alert("SceneSettingsVoicemailUnable.processReturnKey() ");
	StateMgr.Stop_SettingsVoicemailUnable_State(true);
}
SceneSettingsVoicemailUnable.prototype.highlight = function(obj) {
	this.SettingsVoicemailUnableView.setCurrenHighlight(obj);
}

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

	var currentHighlight = this.SettingsVoicemailUnableView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}
	this.processEnterKey();
}
SceneSettingsVoicemailUnable.prototype.processEnterKey = function() {
	alert("SceneSettingsVoicemailUnable.processEnterKey()");

	var currentHighlight = this.SettingsVoicemailUnableView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.CloseBtn:
			this.processReturnKey();
			break;
	}
}

SceneSettingsVoicemailUnable.prototype.createPopupUI = function() {
	var oriHeight = 306;
	var multiLine = 0;
	var lineHeight = 32;
	
	var data = this.AboutLabel.GetTextMinHeight();
	if(data > lineHeight*2)
		multiLine++;
	
	var oriTop2 = parseInt($("#settings_voicemail_unable_howto_label").css('top').replace(/[^-\d\.]/g, ''));
	$("#settings_voicemail_unable_howto_label").css('top',oriTop2+multiLine*lineHeight+'px');
	var data = this.HowToLabel.GetTextMinHeight();
	if(data > lineHeight)
		multiLine++;
		
	var oriTop = parseInt($("#settings_voicemail_unable_close_btn").css('top').replace(/[^-\d\.]/g, ''));
	$("#settings_voicemail_unable_close_btn").css('top',oriTop+multiLine*lineHeight+'px');
	
	
	this.SettingsVoicemailUnableBG.ChangePopupBGSize(null,306,207,698,oriHeight+multiLine*lineHeight);
	$("#SettingsVoicemailUnable").css('height',oriHeight-55+multiLine*lineHeight+'px');
}
SceneSettingsVoicemailUnable.prototype.create = function() {
	alert("SceneSettingsVoicemailUnable.create()");
	this.SettingsVoicemailUnableView = new View(this.sceneId);
	this.SettingsVoicemailUnableBG = new View("SettingsVoicemailUnableBG");
	this.SettingsVoicemailUnableBG.CreatePopupBG(0, "SettingsVoicemailUnable_popup_BG");
	this.SettingsVoicemailUnableBG.SetTitleTextofPopupBG(TV_SID_NEVER_MISS_ANOTHER_CALL_WITH_VOICEMAIL);
	this.SettingsVoicemailUnableDim = new DimBg("SettingsVoicemailUnableDim","SettingsVoicemailUnableBG");
	

	var this_ = sf.scene.get(this.sceneId);
	var clickCF = function(obj){
		this_.processClickEvent(obj);
	}
	
	this.AboutLabel = new TextLayer("settings_voicemail_unable_about_label");
	this.AboutLabel.SetText(TV_SID_SKYPE_TAKE_MESSAGE_OFFLINE_MSG);
	this.AboutLabel.SetTextStyle("settings_voicemail_unable_label_style");
	
	this.HowToLabel = new TextLayer("settings_voicemail_unable_howto_label");
	this.HowToLabel.SetTextStyle("settings_voicemail_unable_label_style");
	this.HowToLabel.SetText(TV_SID_GET_VOICEMAIL_AT_WWW_SKYPE_COM);
	
	
	this.CloseBtn = new Button();
	this.CloseBtn.SetImageObjId("settings_voicemail_unable_close_btn", 20);
	this.CloseBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
	this.CloseBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);

	this.CloseBtn.SetTextObjId("settings_voicemail_unable_close_btn_text");
	this.CloseBtn.SetText(SID_CLOSE);
	this.CloseBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "popup_btn_text_normal_style");
	this.CloseBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "popup_btn_text_focus_style");
	this.CloseBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "popup_btn_text_dimmed_style");
	this.CloseBtn.SetOnClickCallbackFunc(clickCF);
	this.CloseBtn.SetOnMouseOverCallbackFunc(function(obj) {
		WndMgr.resetPopupHideTimer();
		this_.highlight(obj);
	});
	this.createPopupUI();
}