function SceneSettingsOnOffSubList(options) {
	this.options = options;
	
	this.callerObj = null;
	this.cbFunc = null;
	this.curValue = "";

	this.SettingsOnOffSubListView=null;
	this.OnOffSubList = null;
	this.OnBtn = null;
	this.OffBtn = null;

}

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

SceneSettingsOnOffSubList.prototype.handleShow = function() {
	alert("SceneSettingsOnOffSubList.handleShow()");
	// this function will be called when the scene manager show this scene
	this.callerObj = null;
	this.cbFunc = null;
	this.curValue = "";
	
}

SceneSettingsOnOffSubList.prototype.handleHide = function() {
	alert("SceneSettingsOnOffSubList.handleHide()");
	// this function will be called when the scene manager hide this scene

	
	if(this.cbFunc) {
		this.cbFunc(this.curValue);
	}
}

SceneSettingsOnOffSubList.prototype.handleFocus = function() {
	alert("SceneSettingsOnOffSubList.handleFocus()");
	// this function will be called when the scene manager focus this scene
	var  obj = this.SettingsOnOffSubListView.getCurrentHighlight();
	if(obj != null)
	{
		this.highlight(obj);
	}
}

SceneSettingsOnOffSubList.prototype.handleBlur = function() {
	alert("SceneSettingsOnOffSubList.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
	var obj = this.SettingsOnOffSubListView.getCurrentHighlight();
	if(obj != null)
	{
		obj.blur();	
	}
}

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

SceneSettingsOnOffSubList.prototype.processReturnKey = function() {

	alert("SceneSettingsOnOffSubList.ProcessKeyReturn()");
	WndMgr.StopSettingsOnOffSubList();
}

SceneSettingsOnOffSubList.prototype.processMouseOver = function(obj) {
	var currentHighlight = this.SettingsOnOffSubListView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}
}

SceneSettingsOnOffSubList.prototype.highlight = function(obj) {
	alert("SceneSettingsOnOffSubList.highlight() ");
	this.SettingsOnOffSubListView.setCurrenHighlight(obj);
}

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

	var currentHighlight = this.SettingsOnOffSubListView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}
	this.processEnterKey();
}
SceneSettingsOnOffSubList.prototype.processUpDownKey = function() {
	alert("SceneSettingsOnOffSubList.processUpDownKey()");
	var currentHighlight = this.SettingsOnOffSubListView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.OnBtn:
			this.highlight(this.OffBtn);
			break;
		case this.OffBtn:
			this.highlight(this.OnBtn);
			break;
	}
}
SceneSettingsOnOffSubList.prototype.processEnterKey = function() {
	alert("SceneSettingsOnOffSubList.processEnterKey()");
	var currentHighlight = this.SettingsOnOffSubListView.getCurrentHighlight();
	var this_ = sf.scene.get("SettingsOnOffSubList");
	this.curValue = currentHighlight.GetText();
	this.callerObj.SetText(this.curValue);
	WndMgr.StopSettingsOnOffSubList();
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
SceneSettingsOnOffSubList.prototype.create = function() {
	alert("SceneSettingsOnOffSubList.create() ");
	this.SettingsOnOffSubListView = new View("SettingsOnOffSubList");
	this.OnOffSubList = new View("OnOffSubList");
	this.OnOffSubList.CreatePopupBG(2, "OnOff_SubList");
	var this_ = sf.scene.get("SettingsOnOffSubList");
	
	this.OnBtn = new Button();
	this.OnBtn.SetImageObjId("sublist_on_btn", 30);
	this.OnBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);
	this.OnBtn.SetTextObjId("sublist_on_btn_text");
	this.OnBtn.SetText(SID_ON);
	this.OnBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "sublist_btn_text_normal_style");
	this.OnBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "sublist_btn_text_focus_style");
	this.OnBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "sublist_btn_text_dim_style");
	this.OnBtn.SetOnClickCallbackFunc(function(obj) {
		 this_.processClickEvent(obj);
	 });
	this.OffBtn = new Button();
	this.OffBtn.SetImageObjId("sublist_off_btn",30);
	this.OffBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);
	this.OffBtn.SetTextObjId("sublist_off_btn_text");
	this.OffBtn.SetText(SID_OFF);
	this.OffBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "sublist_btn_text_normal_style");
	this.OffBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "sublist_btn_text_focus_style");
	this.OffBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "sublist_btn_text_dim_style");
	 this.OffBtn.SetOnClickCallbackFunc(function(obj) {
		 this_.processClickEvent(obj);
	 });
	this.OnBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
	this.OffBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
}

SceneSettingsOnOffSubList.prototype.start = function(callerObj,sceneObj,cbFunc, curValue) {
	alert("SceneSettingsOnOffSubList.start() " + callerObj.GetObjId());
	var posTop = parseInt($("#" + callerObj.GetObjId()).css('top').replace(/[^-\d\.]/g, ''));
	var posLeft = parseInt($("#" + callerObj.GetObjId()).css('left').replace(/[^-\d\.]/g, ''))+1;
	var posWidth = $("#" + callerObj.GetObjId()).width()+1;
	
	var sceneTop = parseInt($("#" + sceneObj.GetObjId()).css('top').replace(/[^-\d\.]/g, ''));
	var sceneLeft =  parseInt($("#" + sceneObj.GetObjId()).css('left').replace(/[^-\d\.]/g, ''));
	var sceneWidth = parseInt($("#" + sceneObj.GetObjId()).css('width').replace(/[^-\d\.]/g, '')) ;
	var sceneHeight =  parseInt($("#" + sceneObj.GetObjId()).css('height').replace(/[^-\d\.]/g, ''));
	//Adjust position
	var this_ = this;
	$("#SettingsOnOffSubList").css("top",sceneTop+"px");
	$("#SettingsOnOffSubList").css("left",sceneLeft+"px");
	$("#SettingsOnOffSubList").css("height",sceneHeight+"px");
	$("#SettingsOnOffSubList").css("width",sceneWidth+"px");
	$("#SettingsOnOffSubList").bind("click",this_.processReturnKey);
	
	$("#OnOffSubList").css("top",posTop+"px");
	$("#OnOffSubList").css("left",posLeft+"px");
	$("#OnOffSubList").css("width",posWidth+"px");
	this.OnOffSubList.ChangePopupBGSize(null,0,0,posWidth+2,120);
	
	this.OnBtn.ResizeButton("R",posWidth-50);
	this.OffBtn.ResizeButton("R",posWidth-50);
	
	this.callerObj = callerObj;
	this.cbFunc = cbFunc;
	this.curValue = curValue;
	if(curValue==SID_OFF){
		this.highlight(this.OffBtn);
	}else if(curValue==SID_ON){
		this.highlight(this.OnBtn);
	}else
		this.highlight(this.OffBtn);
	
}