var MAX_NUMBER_OF_TEXT_FOR_TEXTING = 7;

function SceneTestPopupForText(options) {
	this.options = options;
    
	this.MsgNumber	= 1;
		    
    this.PopupView		= null;
	this.PopupDim	= null;
    
	this.Title				= null;
    this.PopupMsg			= null;
//	this.CenterPopupMsg		= null; 
	
	this.OkBtn				= null;
	
	//ICON	
//	this.PopupMsgWithIcon	= null;
//	this.WarningIcon		= null;
	
 
}

SceneTestPopupForText.prototype.initialize = function () {
    
	this.create();
}

SceneTestPopupForText.prototype.handleShow = function () {
	alert("SceneOneButtonPopup.handleShow()");

	this.PopupDim.show();
    this.highlight(this.OkBtn);
    this.initializeMsg();
        
}

SceneTestPopupForText.prototype.handleHide = function () {

	this.PopupDim.hide();  

}

SceneTestPopupForText.prototype.handleFocus = function () {

}

SceneTestPopupForText.prototype.handleBlur = function () {
}

SceneTestPopupForText.prototype.handleKeyDown = function (keyCode) {

	switch (keyCode) {
		case sf.key.LEFT:
			this.PreviousMsg();
			break;
			
		case sf.key.RIGHT:
			this.NextMsg();			
			break;
			
		case sf.key.ENTER:
		case sf.key.RETURN:
		case sf.key.EXIT:
            this.processReturnKey();
            sf.key.block(event);
			break;
            		
        case 147:  //infolink
        case 261:  //contents
        case 115:  //wiselink
            sf.key.block(event);
			break;
	}
}

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

SceneTestPopupForText.prototype.create = function(){
    
    this.PopupView = new View("TestPopupForText");
    this.PopupView.SetBgImage(WndMgr.Bg_Popup.src);    
	
	this.PopupDim = new DimBg("TestPopupForTextDim", "TestPopupForText");
    
    this.Title = new Label(null,"TestPopupForText_Title");
	
    this.PopupMsg = new Label(null,"TestPopupForText_message");
    this.PopupMsg.SetTextStyle("one_button_popup_message_style");
	
//	this.PopupMsgWithIcon = new Label(null,"TestPopupForText_message_with_icon");
//    this.PopupMsgWithIcon.SetTextStyle("one_button_popup_message_with_icon_style");
//	
//	this.CenterPopupMsg = new Label(null,"TestPopupForText_center_message");
//    this.CenterPopupMsg.SetTextStyle("one_button_popup_center_message_style");

    this.OkBtn = new Button();
    this.OkBtn.SetImageObjId("TestPopupForText_btn");
    this.OkBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_LOADING_BTN_NORMAL);
    this.OkBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LOADING_BTN_NORMALFOCUS);	
    this.OkBtn.SetTextObjId("TestPopupForText_btn_text");
    this.OkBtn.SetText(SID_OK_KR_YES);
    this.OkBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"common_btn_text_f19_normal_style");
	this.OkBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE,"common_btn_text_f19_highlight_style");
	
//	this.WarningIcon= new Label("TestPopupForText_warning_icon", null);
//    this.WarningIcon.SetBgImage(g_Image.IMAGE_BUTTON_POPUP_WARNING_ICON);

}

SceneTestPopupForText.prototype.highlight=function(obj)
{
    this.PopupView.setCurrenHighlight(obj);

}


SceneTestPopupForText.prototype.processReturnKey = function(){

	sf.scene.hide('TestPopupForText');
	sf.scene.focus('ListMain');
    
}

SceneTestPopupForText.prototype.PreviousMsg = function(){

	if(this.MsgNumber  == 1){
		this.MsgNumber = MAX_NUMBER_OF_TEXT_FOR_TEXTING;
	}
	else{
		this.MsgNumber--;
	}
	
	this.Title.SetText( "#" + this.MsgNumber);
	this.updatePopupMsg();    
    
}

SceneTestPopupForText.prototype.NextMsg = function(){
	
	if(this.MsgNumber == MAX_NUMBER_OF_TEXT_FOR_TEXTING){
		this.MsgNumber = 1;
	}
	else{
		
		this.MsgNumber++;	
	}
	
	this.Title.SetText( "#" + this.MsgNumber);	
	this.updatePopupMsg();
    
}

SceneTestPopupForText.prototype.initializeMsg = function()
{
	this.MsgNumber = 1;
	
//	this.PopupMsg.visibleObj();
//	this.PopupMsgWithIcon.hiddenObj();
//	this.WarningIcon.hiddenObj();
//	this.CenterPopupMsg.hiddenObj();
		
    this.updatePopupMsg();

}

SceneTestPopupForText.prototype.updatePopupMsg = function()
{
	    
    switch (this.MsgNumber) {
	
		case 1:
			this.PopupMsg.SetText(IDWS_MOIP_PROBLEM_HAS_BEEN_FOUND_DATABASE);
			break;
			
		case 2:
			this.PopupMsg.SetText(IDWS_MOIP_NOT_ENOUGH_SPACE_LEFT_IN_DISK);
			break;

		case 3:
			this.PopupMsg.SetText(IDWS_MOIP_PROBLEM_WITH_EXTERNAL_NETWORK);
			break;
			
		case 4:
			this.PopupMsg.SetText(IDWS_MOIP_NEW_PASS_INVALID);
			break;

		case 5:
			//this.PopupMsg.SetText(IDWS_MOIP_PASSWORD_TOO_LONG);
			this.PopupMsg.SetText( TV_SID_TOO_LONG_20_CHARACTERS_MAX);
			break;
			
		case 6:
			this.PopupMsg.SetText(IDWS_MOIP_PASSWORD_INVALID_CHARACTERS);
			break;

		case 7:
			this.PopupMsg.SetText(IDWS_MOIP_PASSWORD_CONTAINS_SPACE);
			break;						
	}
}

//Calling....
//IDWS_MOIP_SKYPEOUT_FAIL10
