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

	this.ContactName = null;

	this.AddContactRequestView = null;
	this.AddContactRequestBG = null;
	this.AddContactRequestDim = null;

	this.TitleBar = null;

	this.ContactThumbnailLabel = null;
	this.ContactSkypeNameLabel = null;
	this.ContactLanguageLabel = null;
	this.ContactLocationLabel = null;

	this.ContactSkypeNameText = new Array(3);
	this.ContactLanguageText = new Array(3);
	this.ContactLocationText = new Array(3);

	this.MsgBoxLeftLabel = null;
	this.MsgBoxArrowLabel = null;
	this.MsgBoxCenterLabel = null;
	this.MsgBoxRightLabel = null;

	this.CancelBtn = null;
	this.EditMsgBtn = null;
	this.SendBtn = null;

	this.AddContactRequestHelpBar = null;

	this.SkypeName = "";
	this.Country = "";
	this.City = "";
	this.Language = "";
	this.AvatarImg = "";
}

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

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

	this.resetData();
	this.highlight(this.SendBtn);

  	var callbackFunction =  function(){
  		sf.scene.get('SceneAddContactRequest').popupTimerCallback();
  	};
  	
	WndMgr.startPopupHideTimer(60000,callbackFunction);

}

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

	WndMgr.stopPopupHideTimer();
}

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

}

SceneAddContactRequest.prototype.handleBlur = function() {
	alert("SceneAddContactRequest.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
}

SceneAddContactRequest.prototype.handleKeyDown = function(keyCode) {
	alert("SceneAddContactRequest.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:

			break;
		case sf.key.DOWN:

			break;

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

		case sf.key.RETURN:
			this.processReturnKey();
			//2013 modify by minseok
            sf.key.preventDefault();
			break;

		case sf.key.EXIT:
			this.processExitKey();
			//2013 modify by minseok
            sf.key.preventDefault();
			break;

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

SceneAddContactRequest.prototype.create = function() {
	alert("SceneAddContactRequest.create()");
	this.AddContactRequestView = new View("AddContactRequest");

	this.AddContactRequestBG = new View("AddContactRequestBG");
	this.AddContactRequestBG.CreatePopupBG(0,"AddContactRequest_popup_BG");
	this.AddContactRequestBG.SetTitleTextofPopupBG(IDWS_MOIP_SKYPE_ADD_A_SKYPE_CONTACT);
	this.AddContactRequestDim = new DimBg("AddContactRequestDim", "AddContactRequest");

	// this.TitleBar = new Label(null, "add_contact_request_title");
	// this.TitleBar.SetTextStyle("add_contact_request_title_style");
	// this.TitleBar.SetText(IDWS_MOIP_SKYPE_ADD_A_SKYPE_CONTACT);

	this.ContactThumbnailLabel = new Label("add_contact_request_thumbnail", null);
	this.ContactThumbnailLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_REQUEST_THUMBNAIL);
	this.ContactThumbnailLabel.AppendFgImage("add_contact_request_thumbnail_avata", "7px", "7px", "60px", "60px");


	var a = 1;
	for( a = 1; a <= 3; a++) {
		this.ContactSkypeNameText[a - 1] = new Label(null, "add_contact_request_skype_name" + "_" + a);
		this.ContactSkypeNameText[a - 1].SetTextStyle("add_contact_request_text_style" + "_" + a);

		this.ContactLanguageText[a - 1] = new Label(null, "add_contact_request_language" + "_" + a);
		this.ContactLanguageText[a - 1].SetTextStyle("add_contact_request_text_style" + "_" + a);

		this.ContactLocationText[a - 1] = new Label(null, "add_contact_request_location" + "_" + a);
		this.ContactLocationText[a - 1].SetTextStyle("add_contact_request_text_style" + "_" + a);

		if(a == 1) {
			this.ContactSkypeNameText[0].SetText(IDWS_MOIP_SKYPE_NAME);
			this.ContactLanguageText[0].SetText(SID_LANGUAGE);
			this.ContactLocationText[0].SetText(SID_LOCATION_KR_LOCATE);
		}

		if(a == 2) {
			this.ContactSkypeNameText[1].SetText(":");
			this.ContactLanguageText[1].SetText(":");
			this.ContactLocationText[1].SetText(":");
		}

		if(a == 3) {
			this.ContactSkypeNameText[2].SetReverseDisable(true);
			this.ContactLanguageText[2].SetReverseDisable(true);
			this.ContactLocationText[2].SetReverseDisable(true);
			
			this.ContactSkypeNameText[2].SetIsPlainText(true);
			this.ContactLanguageText[2].SetIsPlainText(true);
			this.ContactLocationText[2].SetIsPlainText(true);
		}
	}

	this.MsgBoxLeftLabel = new Label("add_contact_request_msg_box_left", null);
	this.MsgBoxLeftLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_REQUEST_INPUTBOX_NORMAL_LEFT);


	this.MsgBoxCenterLabel = new Label("add_contact_request_msg_box", "add_contact_request_msg_box_text");
	this.MsgBoxCenterLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_REQUEST_INPUTBOX_NORMAL_CENTER);
	this.MsgBoxCenterLabel.SetText("");
	this.MsgBoxCenterLabel.SetTextStyle("add_contact_request_msg_box_text_style");
	this.MsgBoxCenterLabel.SetHelpText(IDWS_MOIP_ENTER_A_MESSAGE_TO_INTRODUCE_YOURSELF);
	this.MsgBoxCenterLabel.SetMaxStringLength(50);
	this.MsgBoxCenterLabel.SetIsPlainText(true);
	this.MsgBoxCenterLabel.SetTextEditorInfo(IDWS_MOIP_SKYPE_ADD_A_SKYPE_CONTACT, IDWS_MOIP_ENTER_A_MESSAGE_TO_INTRODUCE_YOURSELF);

	this.MsgBoxRightLabel = new Label("add_contact_request_msg_box_right", null);
	this.MsgBoxRightLabel.SetBgImage(g_Image.IMAGE_ADD_CONTACT_REQUEST_INPUTBOX_NORMAL_RIGHT);

	var this_ = sf.scene.get("AddContactRequest");
	var clickCF = function(obj) {
		this_.processClickEvent(obj);
	};
	var overCF =  function(obj){this_.processMouseOverEvent(obj);};

	this.SendBtn = new Button();
	this.SendBtn.SetImageObjId("add_contact_request_send_btn",20);
	this.SendBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
	this.SendBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);
	this.SendBtn.SetTextObjId("add_contact_request_send_btn_text");
	this.SendBtn.SetText(SID_SEND_KR_TRANSFER);
	this.SendBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "cPopup_btn_text");
	this.SendBtn.SetOnClickCallbackFunc(clickCF);
	this.SendBtn.SetOnMouseOverCallbackFunc(overCF);

	this.EditMsgBtn = new Button();
	this.EditMsgBtn.SetImageObjId("add_contact_request_edit_msg_btn",20);
	this.EditMsgBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
	this.EditMsgBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);
	this.EditMsgBtn.SetTextObjId("add_contact_request_edit_msg_btn_text");
	this.EditMsgBtn.SetText(TV_EDIT_MESSAGE);
	this.EditMsgBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "cPopup_btn_text");

	/*var CurLangID = ResMgr.GetCurLanguage();

	if(CurLangID == ENUM_TV_LANGUAGE.BUL) {
		$("#add_contact_request_edit_msg_btn_text").css("font-size", "17px");
	}*/

	this.EditMsgBtn.SetOnClickCallbackFunc(clickCF);
	this.EditMsgBtn.SetOnMouseOverCallbackFunc(overCF);

	this.CancelBtn = new Button();
	this.CancelBtn.SetImageObjId("add_contact_request_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("add_contact_request_cancel_btn_text");
	this.CancelBtn.SetText(SID_CANCEL);
	this.CancelBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE, "cPopup_btn_text");
	this.CancelBtn.SetOnClickCallbackFunc(clickCF);
	this.CancelBtn.SetOnMouseOverCallbackFunc(overCF);


}

SceneAddContactRequest.prototype.highlight = function(obj) {
	this.AddContactRequestView.setCurrenHighlight(obj);
}

SceneAddContactRequest.prototype.resetData = function() {
	var UserProfile = PluginAPIMgr.GetProfileInfo();

	alert("UserProfile = " + UserProfile);

	if(UserProfile) {
		var STX = String.fromCharCode(2);
		var ETX = String.fromCharCode(3);
		var splitter = ETX + STX;

		var Result = UserProfile.split(splitter);

		this.SkypeName = Result[0];
		//this.FullName = Result[1];
		this.Country = Result[2];
		this.City = Result[3];
		this.Language = Result[4];
		//this.MoodMsg = Result[5];
		this.AvatarImg = Result[6];
	}

	//this.ContactSkypeNameLabel.SetText(IDWS_MOIP_SKYPE_NAME+ " : " + this.SkypeName);
	//this.ContactLanguageLabel.SetText(SID_LANGUAGE+ " : " + this.Language);

	this.ContactSkypeNameText[2].SetText(this.SkypeName);
	this.ContactLanguageText[2].SetText(this.Language);

	var Location;

	if(this.Country) {
		if(this.City) {
			Location = this.Country + " / " + this.City;
		} else {
			Location = this.Country;
		}
	} else {
		if(this.City) {
			Location = this.City;
		} else {
			Location = "";
		}
	}

	//this.ContactLocationLabel.SetText(SID_LOCATION_KR_LOCATE+ " : " + Location);
	this.ContactLocationText[2].SetText(Location);

	if(!this.AvatarImg) {
		this.AvatarImg = g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_NO_GENDER_BIG;
	}

	this.ContactThumbnailLabel.SetFgImage(this.AvatarImg);

	this.MsgBoxCenterLabel.SetText("");
}

SceneAddContactRequest.prototype.processLeftKey = function() {
	alert("SceneAddContactRequest.processLeftKey() ");

	var currentHighlight = this.AddContactRequestView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.SendBtn:
			break;

		case this.EditMsgBtn:
			this.highlight(this.SendBtn);
			break;

		case this.CancelBtn:
			this.highlight(this.EditMsgBtn);
			break;
	}
}

SceneAddContactRequest.prototype.processRightKey = function() {
	alert("SceneAddContactRequest.processRightKey() ");

	var currentHighlight = this.AddContactRequestView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.SendBtn:
			this.highlight(this.EditMsgBtn);
			break;

		case this.EditMsgBtn:
			this.highlight(this.CancelBtn);
			break;

		case this.CancelBtn:
			break;
	}
}

SceneAddContactRequest.prototype.processEnterKey = function() {
	alert("SceneAddContactRequest.processEnterKey() ");

	var currentHighlight = this.AddContactRequestView.getCurrentHighlight();

	switch(currentHighlight) {
		case this.CancelBtn:
			StateMgr.Stop_Add_Contact_State(true);
			break;

		case this.EditMsgBtn:
			if(this.CloseTimer == true) {
				WndMgr.stopPopupHideTimer();
			}
			WndMgr.StartTextEditor(this.MsgBoxCenterLabel, "AddContactRequest", this.AddContactRequestDim, true);
			break;

		case this.SendBtn:

			var helloMsg = this.MsgBoxCenterLabel.GetText();
			if(helloMsg.length == 0) {
				helloMsg = IDWS_MOIP_SAY_HELLO;
			}
			ProcMgr.AddContact(this.SkypeName, helloMsg);
			break;
	}
	//added 10.5
	var scene = sf.scene.get(WndMgr.GetMainSubSceneID());	
		scene.Activation();
}

SceneAddContactRequest.prototype.processReturnKey = function() {
	alert("SceneAddContactRequest.processReturnKey() ");

	WndMgr.BackStepAddContact();
}

SceneAddContactRequest.prototype.processExitKey = function() {
	alert("SceneAddContactRequest.processExitKey() ");
	StateMgr.Stop_Add_Contact_State(true);

}


SceneAddContactRequest.prototype.popupTimerCallback = function() {
	alert("SceneAddContactRequest.popupTimerCallback() ");

	WndMgr.BackStepAddContact();
}

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


	this.processEnterKey();
}
SceneAddContactRequest.prototype.processMouseOverEvent = function(obj) {
	alert("SceneAddContactRequest.processMouseOverEvent() ");

	var currentHighlight = this.AddContactRequestView.getCurrentHighlight();
	if(currentHighlight != obj) {
		this.highlight(obj);
	}

	//this.processEnterKey();
}
