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

    this.AddContactView=null;
    this.AddContactPopupView=null;
	this.AddContactDim=null;
    
    this.TitleBar = null;    
    this.MsgLabel = null;

    this.SkypeNameBtn = null;
    this.PhoneNumberBtn = null;
    
    this.AddContactHelpBar = null;
	
	this.flagResetData = false;

}

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

SceneAddContact.prototype.handleShow = function () {
	alert("SceneAddContact.handleShow()");
	// this function will be called when the scene manager show this scene 
	
	this.AddContactDim.show();
	
	if(this.flagResetData== true)
	{
		this.resetData();
	}   

	WndMgr.startPopupHideTimer(60000);
}

SceneAddContact.prototype.handleHide = function () {
	alert("SceneAddContact.handleHide()");
	// this function will be called when the scene manager hide this scene  
	
	this.AddContactDim.hide();
	
	WndMgr.stopPopupHideTimer();
}

SceneAddContact.prototype.handleFocus = function () {
	alert("SceneAddContact.handleFocus()");
	// this function will be called when the scene manager focus this scene
	var currentHighlight =  this.AddContactView.getCurrentHighlight();
    if(currentHighlight ==null)
    {
        this.highlight(this.SkypeNameBtn);
    }
    else
    {
         this.highlight(currentHighlight);
    }
	WndMgr.resetPopupHideTimer();
}

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

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

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

SceneAddContact.prototype.create = function(){
    alert("SceneAddContact.create()");
	
    this.AddContactPopupView = new View("AddContactBg");
    this.AddContactPopupView.CreatePopupBG(0,"AddContact_popup_Bg");
	this.AddContactPopupView.SetTitleTextofPopupBG(IDWS_MOIP_SKYPE_ADD_A_SKYPE_CONTACT);
    
    this.AddContactView = new View("AddContact");
//    this.AddContactView.SetBgImage(g_Image.IMAGE_ADD_CONTACT_BG);
	
	this.AddContactDim = new DimBg("AddContactDim", "AddContact");
    
    
    this.MsgLabel = new Label(null,"add_contact_msg");
    this.MsgLabel.SetTextStyle("add_contact_msg_style");
    this.MsgLabel.SetText(IDWS_MOIP_SKYPE_SELECT_A_CONTACT_TYPE);
    
    var this_ = sf.scene.get("AddContact");
	var clickCF =  function(obj){this_.processClickEvent(obj);};
	var overCF =  function(obj){this_.processMouseOverEvent(obj);};
        
    this.SkypeNameBtn = new Button();
    this.SkypeNameBtn.SetImageObjId("add_contact_skype_name_btn", 20);
    this.SkypeNameBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.SkypeNameBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);	
    this.SkypeNameBtn.SetTextObjId("add_contact_skype_name_btn_text");
    this.SkypeNameBtn.SetText(IDWS_MOIP_SKYPE_ADD_A_SKYPE_CONTACT);
	this.SkypeNameBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"cPopup_btn_text");
   	this.SkypeNameBtn.SetOnClickCallbackFunc(clickCF);
   	this.SkypeNameBtn.SetOnMouseOverCallbackFunc(overCF);
   
    this.PhoneNumberBtn = new Button();
    this.PhoneNumberBtn.SetImageObjId("add_contact_phone_number_btn", 20);
    this.PhoneNumberBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_IMG, g_Image.IMAGE_POPUP_BTN_NORMAL);
    this.PhoneNumberBtn.SetBgImage(BtnImgIndex.BTN_NORMAL_FOCUS_IMG, g_Image.IMAGE_POPUP_BTN_NORMALFOCUS);	
    this.PhoneNumberBtn.SetTextObjId("add_contact_phone_number_btn_text");
    this.PhoneNumberBtn.SetText(IDWS_MOIP_SKYPE_ADD_A_PHONE_NUMBER);
	this.PhoneNumberBtn.SetTextStyle(BtnTextStyleIndex.BTN_TEXT_NORMAL_STYLE,"cPopup_btn_text");
	this.PhoneNumberBtn.SetOnClickCallbackFunc(clickCF);
	this.PhoneNumberBtn.SetOnMouseOverCallbackFunc(overCF);

	var CurLangID = ResMgr.GetCurLanguage();
	if(CurLangID == ENUM_TV_LANGUAGE.MON)
	{
		$(".cPopup_title").css('font-size', "24px" ); 
		$(".cPopup_btn_text").css('font-size', "22px" );
	}
}

SceneAddContact.prototype.setResetFlag= function(reset_flag){
     this.flagResetData = reset_flag;
}

SceneAddContact.prototype.resetData = function()
{  
	this.highlight(null);
    this.flagResetData= false;	
}

SceneAddContact.prototype.highlight=function(obj)
{
    this.AddContactView.setCurrenHighlight(obj);

}

SceneAddContact.prototype.processUpKey = function(){
	alert("SceneAddContact.processUpKey() ");
	var currentHighlight =  this.AddContactView.getCurrentHighlight();
	if(currentHighlight==this.PhoneNumberBtn){
		this.highlight(this.SkypeNameBtn);
	}
}

SceneAddContact.prototype.processDownKey = function(){
    alert("SceneAddContact.processDownKey() ");
    
    var currentHighlight =  this.AddContactView.getCurrentHighlight();
    if(currentHighlight==this.SkypeNameBtn){
            this.highlight(this.PhoneNumberBtn);
    }
}


SceneAddContact.prototype.processEnterKey = function(){
    alert("SceneAddContact.processEnterKey() ");
    
    var currentHighlight =  this.AddContactView.getCurrentHighlight();
    
    switch(currentHighlight)
    {
        case this.SkypeNameBtn:
            WndMgr.StartAddContactSkypeNameStep();
            break;
            
        case this.PhoneNumberBtn:
        	WndMgr.StartAddContactPhoneNumberStep();            
            break;
    }
}

SceneAddContact.prototype.processReturnKey = function(){
    alert("SceneAddContact.processReturnKey() ");
    StateMgr.Stop_Add_Contact_State(true);

}

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

}


SceneAddContact.prototype.processClickEvent = function(obj){
	alert("SceneVoiceCall.processClickEvent() ");
	
	/*var currentHighlight =  this.AddContactView.getCurrentHighlight();
    if(currentHighlight != obj)
    {
    	this.highlight(obj);
    }*/
	
	this.processEnterKey();
}
SceneAddContact.prototype.processMouseOverEvent = function(obj){
	alert("SceneVoiceCall.processMouseOverEvent() ");
	
	var currentHighlight =  this.AddContactView.getCurrentHighlight();
    if(currentHighlight != obj)
    {
    	this.highlight(obj);
    }
	
}




