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

	this.GenderView = null;
	this.GenderDim = null;
	this.GenderBG = null;

	this.NothingBtn = null;
	this.FemaleBtn = null;
	this.MaleBtn = null
	this.CancelBtn = null;
	
	this.Init_Gender= null;

	this.BeforeBtn = null;
}

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

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

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

	WndMgr.stopPopupHideTimer();
	this.highlight(null);
}

SceneGender.prototype.handleFocus = function() {
	alert("SceneGender.handleFocus()");
	// this function will be called when the scene manager focus this scene

	var currentHighlight = this.GenderView.getCurrentHighlight();
	if(currentHighlight == null) {
		this.highlight(this.CancelBtn);
	} else {
		this.highlight(currentHighlight);
	}
	
}

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

SceneGender.prototype.handleKeyDown = function(keyCode) {
	alert("SceneGender.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;
	}
}

SceneGender.prototype.processReturnKey = function() {
	alert("SceneGender.processReturnKey() ");
	StateMgr.Stop_Gender_State(true);

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

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

	var currentHighlight = this.GenderView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}
	this.processEnterKey();
}
SceneGender.prototype.processUpKey = function() {
	alert("SceneGender.processUpKey()");
	var currentHighlight = this.GenderView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.NothingBtn:
			this.highlight(this.MaleBtn);
			break;
		case this.FemaleBtn:
			this.highlight(this.NothingBtn);
			break;
		case this.MaleBtn:
			this.highlight(this.FemaleBtn);
			break;
		case this.CancelBtn:
			break;
	}
}
SceneGender.prototype.processDownKey = function() {
	alert("SceneGender.processDownKey()");
	var currentHighlight = this.GenderView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.NothingBtn:
			this.highlight(this.FemaleBtn);
			break;
		case this.FemaleBtn:
			this.highlight(this.MaleBtn);
			break;
		case this.MaleBtn:
			this.highlight(this.NothingBtn);
			break;
		case this.CancelBtn:
			break;
	}
}
SceneGender.prototype.processLeftKey = function() {
	alert("SceneGender.processLeftKey()");
	var currentHighlight = this.GenderView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.NothingBtn:
		case this.FemaleBtn:
		case this.MaleBtn:
			break;
		case this.CancelBtn:
			if(this.BeforeBtn == null) {
				this.highlight(this.NothingBtn);
			} else {
				this.highlight(this.BeforeBtn);
			}
			break;
	}
}

SceneGender.prototype.processRightKey = function() {
	alert("SceneGender.processRightKey()");
	var currentHighlight = this.GenderView.getCurrentHighlight();
	switch(currentHighlight) {
		case this.NothingBtn:
		case this.FemaleBtn:
		case this.MaleBtn:
			this.BeforeBtn = currentHighlight;
			this.highlight(this.CancelBtn);
			break;
		case this.CancelBtn:
			break;
	}
}
SceneGender.prototype.processEnterKey = function() {
	alert("SceneGender.processEnterKey()");
	var currentHighlight = this.GenderView.getCurrentHighlight();
	
	var gender = null;
	switch(currentHighlight) {
		case this.NothingBtn:
			gender = "0";
			break;
		case this.FemaleBtn:
			gender = "2";
			break;
		case this.MaleBtn:
			gender = "1";
			break;
		case this.CancelBtn:
			break;
	}
	if(this.Init_Gender != gender && gender!=null)
	{
		this.Init_Gender = gender;
		PluginAPIMgr.SetGender(this.Init_Gender);
		var profile_ = sf.scene.get("ListMainProfile");
		profile_.SetGender(this.Init_Gender);
			
	}
	StateMgr.Stop_Gender_State(true);
}

SceneGender.prototype.InitGender = function() {
	alert("SceneGender.InitGender()");

	this.NothingBtn.hiddenChkBox();
	this.MaleBtn.hiddenChkBox();
	this.FemaleBtn.hiddenChkBox();
	
	var profile_ = sf.scene.get("ListMainProfile");
	this.Init_Gender = profile_.GetGender();
	
	switch(this.Init_Gender) {
		case "1":
			this.highlight(this.MaleBtn);
			this.MaleBtn.visibleChkBox();
			break;
		case "2":
			this.highlight(this.FemaleBtn);
			this.FemaleBtn.visibleChkBox();
			break;
		default:
			this.highlight(this.NothingBtn);
			this.NothingBtn.visibleChkBox();
			break;
	}
}

SceneGender.prototype.create = function() {
	alert("SceneGender.create()");
	this.GenderView = new View("Gender");
	this.GenderBG = new View("GenderBG");
	this.GenderBG.CreatePopupBG(0, "Gender_popup_BG");
	this.GenderBG.CreateInnerBox("Gender_popup_innerbox");
	this.GenderBG.SetTitleTextofPopupBG(IDWS_MOIP_SETTING_GENDER);
	this.GenderDim = new DimBg("GenderDim", "GenderBG");

	var this_ = sf.scene.get("Gender");
	var clickCF = function(obj) {
		this_.processClickEvent(obj);
	};
	this.NothingBtn = new Button();
	this.NothingBtn.SetImageObjId("genderlist_nothing_btn", 30);
	this.NothingBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.NothingBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);

	this.NothingBtn.SetTextObjId("genderlist_nothing_btn_text");
	this.NothingBtn.SetText(TV_SID_NOT_SPECIFIED);
	this.NothingBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.NothingBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.NothingBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.NothingBtn.SetChkObjId("genderlist_nothing_btn_chkbox");
	this.NothingBtn.SetBgCheckBox(g_Image.IMAGE_GENDER_BTN_CHK);
	this.NothingBtn.SetOnClickCallbackFunc(clickCF);

	this.FemaleBtn = new Button();
	this.FemaleBtn.SetImageObjId("genderlist_female_btn", 30);
	this.FemaleBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.FemaleBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);

	this.FemaleBtn.SetTextObjId("genderlist_female_btn_text");
	this.FemaleBtn.SetText(SID_FEMALE_KR_WOMAN);
	this.FemaleBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.FemaleBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.FemaleBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.FemaleBtn.SetChkObjId("genderlist_female_btn_chkbox");
	this.FemaleBtn.SetBgCheckBox(g_Image.IMAGE_GENDER_BTN_CHK);
	this.FemaleBtn.SetOnClickCallbackFunc(clickCF);

	this.MaleBtn = new Button();
	this.MaleBtn.SetImageObjId("genderlist_male_btn", 30);
	this.MaleBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, null);
	this.MaleBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_LIST_SELECTION_HIGH);

	this.MaleBtn.SetTextObjId("genderlist_male_btn_text");
	this.MaleBtn.SetText(SID_MALE_KR_MAN);
	this.MaleBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "list_selection_btn_text_style_nor");
	this.MaleBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_FOCUS_STYLE, "list_selection_btn_text_style_focus");
	this.MaleBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_DIM_STYLE, "list_selection_btn_text_style_dim");
	this.MaleBtn.SetChkObjId("genderlist_male_btn_chkbox");
	this.MaleBtn.SetBgCheckBox(g_Image.IMAGE_GENDER_BTN_CHK);
	this.MaleBtn.SetOnClickCallbackFunc(clickCF);

	this.CancelBtn = new Button();
	this.CancelBtn.SetImageObjId("GenderListCancelBtn", 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.SetBgImage(BtnImgIndex.BTN_TEXT_DIM_STYLE, g_Image.IMAGE_POPUP_BTN_DIM);
	this.CancelBtn.SetTextObjId("GenderListCancelBtn_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.NothingBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
	this.FemaleBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
	this.MaleBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
	this.CancelBtn.SetOnMouseOverCallbackFunc(function(obj) {
		this_.processMouseOver(obj);
	});
}