/**
 * @author Samsung
 */

if(!this.g_Data) {
	this.g_Data = new Object();
}

///////////////  osd timer  //////////////////////////

g_Data.DATA_OSD_TIMER_CALLBACK = new Array(5);

g_Data.SetOSDTimerCallBackFn = function(CallBack_Fn, index)
{
	g_Data.DATA_OSD_TIMER_CALLBACK[index] = CallBack_Fn;
}

///////////////  call  forwarding  //////////////////////

g_Data.DATA_DEFAULT_CALL_FORWARDING_TIME ="120";


///////////////  Signin  info//////////////////////////////////////////////////////////////////////////////////////////////
g_Data.DATA_SIGNIN_INPUT_INFO = new Object();

g_Data.SetSigninInputInfo= function(s_Id, s_Pwd, b_SavePwd)
{
    if(s_Id)
    {
        g_Data.DATA_SIGNIN_INPUT_INFO.id = s_Id;
    }
    
    if(s_Pwd)
    {
        g_Data.DATA_SIGNIN_INPUT_INFO.pwd = s_Pwd;
    }
    
     g_Data.DATA_SIGNIN_INPUT_INFO.save_pwd  = b_SavePwd;
}


///////////////  Create Account info//////////////////////////////////////////////////////////////////////////////////////////////

g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO = new Object();

g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.news = false;

g_Data.SetCreateAccountStep1InputInfo= function(s_Id, s_Pwd, b_SavePwd)
{
    if(s_Id)
    {
        g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.id = s_Id;
    }
    
    if(s_Pwd)
    {
        g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.pwd = s_Pwd;
    }
        
    g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.save_pwd = b_SavePwd;
}

g_Data.SetCreateAccountStep2InputInfo= function(s_Email , s_fullName)
{
    if(s_Email)
    {
        g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.email = s_Email;
    }
	
	g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.full_name = s_fullName;   
}

g_Data.SetCreateAccountSkypeName= function(s_Id)
{
    if(s_Id)
    {
        g_Data.DATA_CREATE_ACCOUNT_INPUT_INFO.id = s_Id;
    }
}

///////////////  Face Recog info//////////////////////////////////////////////////////////////////////////////////////////////

g_Data.DATA_FACE_RECOG_INFO = new Object();

g_Data.DATA_FACE_RECOG_INFO.duplicate_id = "young474"; //temp code for test

g_Data.SetFaceRecogDupliceteSkypeName= function(s_Id)
{
	g_Data.DATA_FACE_RECOG_INFO.duplicate_id = s_Id;
}

g_Data.GetFaceRecogDupliceteSkypeName = function()
{
	return g_Data.DATA_FACE_RECOG_INFO.duplicate_id;
}

g_Data.SetFaceRecogCompleteSkypeName = function(s_Id)
{
	g_Data.DATA_FACE_RECOG_INFO.complete_id = s_Id;
}

g_Data.GetFaceRecogCompleteSkypeName = function()
{
	return g_Data.DATA_FACE_RECOG_INFO.complete_id;
}

g_Data.SetFaceRecogResult = function(result)
{
	g_Data.DATA_FACE_RECOG_INFO.recog_result = null;
	g_Data.DATA_FACE_RECOG_INFO.recog_result = result;
}

g_Data.GetFaceRecogResult = function()
{
	return g_Data.DATA_FACE_RECOG_INFO.recog_result;
}

g_Data.SetFaceRecogAreaInfo = function(info)
{
	g_Data.DATA_FACE_RECOG_INFO.area_info = null;
	g_Data.DATA_FACE_RECOG_INFO.area_info = info;
}

g_Data.GetFaceRecogAreaInfo  = function()
{
	return g_Data.DATA_FACE_RECOG_INFO.area_info;
}

g_Data.SetFaceRecogSelectedIndex = function(index)
{
	g_Data.DATA_FACE_RECOG_INFO.selected_index = index;
}

g_Data.GetFaceRecogSelectedIndex = function(index)
{
	return g_Data.DATA_FACE_RECOG_INFO.selected_index;
}
//2013 add by minseok
g_Data.DATA_FACE_RECOG_SELECTED_ITEM = new Object();

g_Data.SetFaceRecogSelectedItem = function(obj){
	g_Data.DATA_FACE_RECOG_SELECTED_ITEM = obj;
}
g_Data.GetFaceRecogSelectedItem = function(obj){
	return g_Data.DATA_FACE_RECOG_SELECTED_ITEM;
}
g_Data.DATA_FACE_RECOG_REGISTRATION = new Object();

g_Data.SetFaceRecogSelectedAccount = function(obj){
	g_Data.DATA_FACE_RECOG_REGISTRATION.selectedObj = obj;
}
g_Data.GetFaceRecogSelectedAccount = function(){
	return g_Data.DATA_FACE_RECOG_REGISTRATION.selectedObj;
}
g_Data.SetFaceRecogResultData = function(obj){
	g_Data.DATA_FACE_RECOG_REGISTRATION.result = obj;
}
g_Data.GetFaceRecogResultData = function(){
	return g_Data.DATA_FACE_RECOG_REGISTRATION.result;
}


///////////////  call  info //////////////////////////////////////////////////////////////////////////////////////////////

g_Data.DATA_CREATE_CALL_INPUT_INFO = new Object();

g_Data.SetCreateCallInputInfo= function(s_callee_name, e_call_type)
{
    if(s_callee_name)
    {
        g_Data.DATA_CREATE_CALL_INPUT_INFO.callee_name = s_callee_name;
    }
    
    g_Data.DATA_CREATE_CALL_INPUT_INFO.call_type = e_call_type;
}

g_Data.DATA_CALL_LOCAL_HODE = false;

g_Data.SetCallLocalHold= function(callLocalHold){
    g_Data.DATA_CALL_LOCAL_HODE = callLocalHold;
}

g_Data.GetCallLocalHold=function(){
    return g_Data.DATA_CALL_LOCAL_HODE;
}

g_Data.DATA_CALL_REMOTE_HODE = false;

g_Data.SetCallRemoteHold= function(callRemoteHold){
    g_Data.DATA_CALL_REMOTE_HODE = callRemoteHold;
}

g_Data.GetCallRemoteHold=function(){
    return g_Data.DATA_CALL_REMOTE_HODE;
}

g_Data.DATA_CALL_QUALITY_GAUGE = 1;

g_Data.SetCallQualityGauge= function(CallQualityGauge){
    g_Data.DATA_CALL_QUALITY_GAUGE = CallQualityGauge;
}

g_Data.GetCallQualityGauge=function(){
    return g_Data.DATA_CALL_QUALITY_GAUGE;

}

g_Data.DATA_CALL_DURATION_TIME= "00:00:00";

g_Data.SetCallDuration = function(CallDuration){
    g_Data.DATA_CALL_DURATION_TIME = CallDuration;
}

g_Data.GetCallDuration =function(){
    return g_Data.DATA_CALL_DURATION_TIME;
}

g_Data.DATA_CALL_MEMBER_VIDEO_RESOLUTION = "SD";

g_Data.SetCallMemberVideoResolution= function(CallMemberVideoResolution){
    g_Data.DATA_CALL_MEMBER_VIDEO_RESOLUTION = CallMemberVideoResolution;
}

g_Data.GetCallMemberVideoResolution=function(){
    return g_Data.DATA_CALL_MEMBER_VIDEO_RESOLUTION;

}


g_Data.DATA_VOICE_MAIL_INPUT_INFO = new Object();

g_Data.SetVoiceMailInputInfo= function(s_callee_name)
{
    if(s_callee_name)
    {
        g_Data.DATA_VOICE_MAIL_INPUT_INFO.callee_name = s_callee_name;
    }
}


g_Data.SetIndexOfPlayingVoicemail= function(nIndex)
{	
	g_Data.DATA_VOICE_MAIL_INPUT_INFO.playing_index = nIndex;
}


//it is to notification of stop voicemail if index is -1. 
g_Data.GetIndexOfPlayingVoicemail= function()
{	
	return g_Data.DATA_VOICE_MAIL_INPUT_INFO.playing_index ;
}


///////////////  add conatct  info//////////////////////////////////////////////////////////////////////////////////////////////

g_Data.DATA_ADD_CONTACT_INPUT_INFO = new Object();

g_Data.SetAddContactInfo= function(s_Id, s_avata_path)
{
    g_Data.DATA_ADD_CONTACT_INPUT_INFO.id = s_Id;
    g_Data.DATA_ADD_CONTACT_INPUT_INFO.avata_path= s_avata_path;
}

g_Data.GetAddContactSkypeName= function()
{
     return  g_Data.DATA_ADD_CONTACT_INPUT_INFO.id ;
}

g_Data.GetAddContactAvataPath= function()
{
     return  g_Data.DATA_ADD_CONTACT_INPUT_INFO.avata_path ;
}

///////////////  change pwd  info//////////////////////////////////////////////////////////////////////////////////////////////

g_Data.DATA_CHANGE_PWD_INPUT_INFO = new Object();

g_Data.SetChangePWDInfo= function(s_old_pwd, s_new_pwd, s_re_pwd)
{
    g_Data.DATA_CHANGE_PWD_INPUT_INFO.old_pwd = s_old_pwd;
    g_Data.DATA_CHANGE_PWD_INPUT_INFO.new_pwd = s_new_pwd;
    g_Data.DATA_CHANGE_PWD_INPUT_INFO.re_pwd = s_re_pwd;
}

g_Data.GetChangedPWDInfo=function()
{
	return g_Data.DATA_CHANGE_PWD_INPUT_INFO.new_pwd;
}




///////////////  chat  info//////////////////////////////////////////////////////////////////////////////////////////////
g_Data.DATA_CHAT_INFO = new Object();

g_Data.SetChatMemberInfo= function(s_member_name)
{
    g_Data.DATA_CHAT_INFO.member_name = s_member_name;

	if(g_Data.DATA_CHAT_INFO.member_name.indexOf(",") == -1)
	{
		g_Data.DATA_CHAT_INFO.flag_multi_chat = false;
	}
	else
	{
		g_Data.DATA_CHAT_INFO.flag_multi_chat = true;
	}
	
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////
g_Data.DATA_CALL_LIVE = false;

g_Data.DATA_CALL_DURATION ="00:00:01";

g_Data.DATA_CALL_MEMBER_NAME = "Anna";
g_Data.DATA_CALL_MEMBER_MOOD_MESSAGE="Call Member Mood Message";


g_Data.DATA_MY_ACCOUNT_SKYPE_NAME =null;
g_Data.DATA_MY_ACCOUNT_DISPLAY_NAME =null;
g_Data.DATA_MY_ACCOUNT_MOOD_MESSAGE ="My Account Mood Message";
g_Data.DATA_MY_ACCOUNT_CREDIT_VALUE ="$ 15.00";
g_Data.DATA_MY_ACCOUNT_COUNTRY_NAME ="Switzerland";
g_Data.DATA_MY_ACCOUNT_AVATAR = null;

g_Data.DATA_ADD_CONTACT_NAME ="Moonpk";
g_Data.DATA_ADD_CONTACT_MOOD_MESSAGE ="Contact Mood Message";
g_Data.DATA_ADD_CONTACT_SKYPE_NAME ="manoo";
g_Data.DATA_ADD_CONTACT_LANGUAGE ="Korean";
g_Data.DATA_ADD_CONTACT_LOCATION ="Suwon, Korea, South";


g_Data.DATA_MAX_NUM_OF_COUNTRY = 0;
g_Data.DATA_COUNTRY_NAME_ARRAY = null;
g_Data.DATA_COUNTRY_CODE_ARRAY = null;
g_Data.DATA_COUNTRY_PREFIX_ARRAY = null;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////


g_Data.SetCallLive= function(callLive){
    g_Data.DATA_CALL_LIVE = callLive;
}

g_Data.GetCallLive=function(){
    return g_Data.DATA_CALL_LIVE;

}

g_Data.SetCallDuration= function(CallDuration){
    g_Data.DATA_CALL_DURATION = CallDuration;
}

g_Data.GetCallDuration=function(){
    return g_Data.DATA_CALL_DURATION;

}

g_Data.SetCallMemberName= function(CallMemberName){
    g_Data.DATA_CALL_MEMBER_NAME = CallMemberName;
}

g_Data.GetCallMemberName=function(){
    return g_Data.DATA_CALL_MEMBER_NAME;

}


g_Data.SetCallMemberMoodMessage= function(CallMemberMoodMessage){
    g_Data.DATA_CALL_MEMBER_MOOD_MESSAGE = CallMemberMoodMessage;
}

g_Data.GetCallMemberMoodMessage=function(){
    return g_Data.DATA_CALL_MEMBER_MOOD_MESSAGE;

}

///////////////////////Add Contact////////////////////////////
g_Data.DATA_SEARCHED_CONTACT_NAME = null;

g_Data.GetSearchedContactName=function(){
	
	return g_Data.DATA_SEARCHED_CONTACT_NAME;
}

g_Data.SetSearchedContactName=function(ContactName){
	g_Data.DATA_SEARCHED_CONTACT_NAME = ContactName;
}


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

g_Data.SetMyAccountSkypeName= function(Name){
    g_Data.DATA_MY_ACCOUNT_SKYPE_NAME = Name;   
}

g_Data.GetMyAccountSkypeName=function(){
	
	if(g_Data.DATA_MY_ACCOUNT_SKYPE_NAME == null)
	{
		PluginAPIMgr.GetMySkyeName();
	}
    return g_Data.DATA_MY_ACCOUNT_SKYPE_NAME;
}

g_Data.SetMyAccountDisplayName= function(Name){
    g_Data.DATA_MY_ACCOUNT_DISPLAY_NAME = Name;    
}

g_Data.GetMyAccountDisplayName=function(){
	
	if(g_Data.DATA_MY_ACCOUNT_DISPLAY_NAME == null)
	{
		PluginAPIMgr.GetMyDisplayName();
	}
    return g_Data.DATA_MY_ACCOUNT_DISPLAY_NAME;

}

g_Data.SetMyAccountMoodMessage= function(MyAccountMoodMessage){
    g_Data.DATA_MY_ACCOUNT_MOOD_MESSAGE = MyAccountMoodMessage;
}

g_Data.GetMyAccountMoodMessage=function(){
    return g_Data.DATA_MY_ACCOUNT_MOOD_MESSAGE;

}

g_Data.SetMyAccountCreditValue= function(MyAccountCreditValue){
    g_Data.DATA_MY_ACCOUNT_CREDIT_VALUE = MyAccountCreditValue;
}

g_Data.GetMyAccounCreditValue=function(){
    return g_Data.DATA_MY_ACCOUNT_CREDIT_VALUE;

}

g_Data.SetMyAccountCountryName= function(MyAccountCountryName){
    g_Data.DATA_MY_ACCOUNT_COUNTRY_NAME = MyAccountCountryName;
}

g_Data.GetMyAccountCountryName=function(){
    return g_Data.DATA_MY_ACCOUNT_COUNTRY_NAME;

}


g_Data.SetMyAccountAvataImage= function(AvatarImg){
    g_Data.DATA_MY_ACCOUNT_AVATAR = AvatarImg;   
}

g_Data.GetMyAccountAvataImage=function(){
	
	if(g_Data.DATA_MY_ACCOUNT_AVATAR == null)
	{
		PluginAPIMgr.GetMyAvataImage();
	}
    return g_Data.DATA_MY_ACCOUNT_AVATAR;
}

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


g_Data.SetAddContactName= function(AddContactName){
    g_Data.DATA_ADD_CONTACT_NAME = AddContactName;
}

g_Data.GetAddContactName=function(){
    return g_Data.DATA_ADD_CONTACT_NAME;

}

g_Data.SetAddContactMoodMessage= function(AddContactMoodMessage){
    g_Data.DATA_ADD_CONTACT_MOOD_MESSAGE = AddContactMoodMessage;
}

g_Data.GetAddContactMoodMessage=function(){
    return g_Data.DATA_ADD_CONTACT_MOOD_MESSAGE;

}

g_Data.SetAddContactLanguage= function(AddContactLanguage){
    g_Data.DATA_ADD_CONTACT_LANGUAGE = AddContactLanguage;
}

g_Data.GetAddContactLanguage=function(){
    return g_Data.DATA_ADD_CONTACT_LANGUAGE;

}

g_Data.SetAddContactLocation= function(AddContactLocation){
    g_Data.DATA_ADD_CONTACT_LOCATION = AddContactLocation;
}

g_Data.GetAddContactLocation=function(){
    return g_Data.DATA_ADD_CONTACT_LOCATION;
}


g_Data.GetCountryNameWithPrePix = function(Prefix){

	var MaxNumOfCountry = g_Data.GetNumOfCountry();
	alert("MaxNumOfCountry = " + MaxNumOfCountry);
	
	for (var i=0; i<MaxNumOfCountry; i++) {
	
		if(g_Data.DATA_COUNTRY_PREFIX_ARRAY[i] == Prefix){
			
			return g_Data.DATA_COUNTRY_NAME_ARRAY[i];
		}
	}
	alert("GetCountryNameWithPrePix >>>> return Null");
	return "";
}


g_Data.GetNumOfCountry = function(){

	if(g_Data.DATA_MAX_NUM_OF_COUNTRY == 0) {
		
		alert("DATA_MAX_NUM_OF_COUNTRY was not made");
		g_Data.GetCountryList(ResMgr.GetCurSkypeLanguageCode());
	
	}

	return g_Data.DATA_MAX_NUM_OF_COUNTRY;

}

var COUNTRY_LIST_PROPERTY = 3;

g_Data.GetCountryList = function(langCode){

	alert("g_Data.GetCountryList");
	var strCountryList = PluginAPIMgr.GetCountryList(langCode);
	//alert("CountryList = " + strCountryList );
		
	var NumOfCountrySet = 0;						
	var TokenNum		= 0;

					
	if (strCountryList) {
	
		var STX = String.fromCharCode(2);
		var ETX = String.fromCharCode(3);
		var splitter = ETX + STX;
		
		var Result = strCountryList.split(splitter);
		NumOfCountrySet = parseInt(Result.length / COUNTRY_LIST_PROPERTY);
		
		//alert("NumOfCountrySet = " + NumOfCountrySet);
		
		g_Data.DATA_MAX_NUM_OF_COUNTRY = NumOfCountrySet;
		g_Data.DATA_COUNTRY_NAME_ARRAY = new Array(NumOfCountrySet);
		g_Data.DATA_COUNTRY_CODE_ARRAY = new Array(NumOfCountrySet);
		g_Data.DATA_COUNTRY_PREFIX_ARRAY = new Array(NumOfCountrySet);
		
		
		for (var i = 0; i < NumOfCountrySet; i++) {
		
			TokenNum = i * COUNTRY_LIST_PROPERTY;
			
			g_Data.DATA_COUNTRY_NAME_ARRAY[i] = Result[TokenNum];
			g_Data.DATA_COUNTRY_PREFIX_ARRAY[i] = Result[TokenNum + 1];
			g_Data.DATA_COUNTRY_CODE_ARRAY[i] = Result[TokenNum + 2];
						
		}
		
	}	


}

g_Data.GetMyCountryIndex = function(){

	var myCountryCode = PluginAPIMgr.GetMyCountryCode();
	alert(">>> myCountryCode = " + myCountryCode );

	var MaxNumOfCountry = g_Data.GetNumOfCountry();


	for (var i=0; i < MaxNumOfCountry; i++) {
			
		if(myCountryCode == g_Data.DATA_COUNTRY_CODE_ARRAY[i]){
			return i;
		}
		
	}	
	return 0;

}

g_Data.GetCountryIndexWithCode = function(Code){

	var MaxNumOfCountry = g_Data.GetNumOfCountry();

	for (var i=0; i < MaxNumOfCountry; i++) {
			
		if(Code == g_Data.DATA_COUNTRY_CODE_ARRAY[i]){
			return i;
		}		
	}	
		
	return -1;
}

/////////////////////////////////////UTILL FUNCTION//////////////////////////////

g_Data.TransDuration = function(data){
	
    var time_h= data;
    var h_i = Math.floor(time_h / 3600);
    var h = String(h_i);
    
    var time_m = time_h % 3600;
    var m_i = Math.floor(time_m / 60);
    var m = String(m_i);
    
    var s_i= time_m % 60;
    var s = String(s_i);   
    
    var time = "";

    if(h.length < 2)
    {
        time +="0"+h+":";
    }
    else
    {
        time += h+":";
    }
    
        if(m.length < 2)
    {
        time +="0"+m+":";
    }
    else
    {
        time+=m+":";
    }

      if(s.length < 2)
    {
        time +="0"+s;
    }
    else
    {
        time+=s;
}

	return time;

}
/// 	<<A>>
g_Data.CombinateStrings = function(sentence,Word){
		
	var splitter = '<<A>>';	
	var result = sentence.split(splitter);
	
	if(result.length == 2){
				
		return result[0] + Word + result[1];
	}
	else{
		
		return '';
	}
	
}
/// 	<<A>> & '...'
g_Data.CombinateStringsWithEllipsis = function(sentence,Word,width){
		
	var splitter = '<<A>>';	
	var result = sentence.split(splitter);
	if(result.length == 2){
		var HTMLString ="<span class='span_with_ellipsis' style='width:"+width+"px;'>"+Word+"</span>"
				
		return result[0] + HTMLString + result[1];
	}
	else{
		
		return '';
	}
	
}

/////

g_Data.counterNum = 0;

g_Data.GetImgSuffixPath = function(){

	g_Data.counterNum++;
	
	if(g_Data.counterNum > 999){
		g_Data.counterNum = 0;
	}
	
	return "?" + g_Data.counterNum;
}


var POPUP_WINDOW_CLOSE_TIME = 30000;

//////////////////////////////////////////////////////////////////////////////////////////////////////
//****************  For BT Qwerty keyboard!  *******************************************************//
//////////////////////////////////////////////////////////////////////////////////////////////////////
 
var APPCOMMON_MESSAGE_QWERTY_KEY_INPUT = 50;

var g_AppCommon = sf.core.plugin('APPCOMMON');//$_('pluginObjectAppCommon_Skype');



var g_NumObj = null;
	
function BT_Input(str) {
        alert("BT_Input() [" + str + "]");
        var rlt = str.split("/", 3);

        rlt[0] = Number(rlt[0]);
        rlt[1] = Number(rlt[1]);
        rlt[2] = Number(rlt[2]);

		if(rlt[0] == APPCOMMON_MESSAGE_QWERTY_KEY_INPUT){
			if (_g_ime.pluginAppCommonVer > "APPCOMMON-0012" /*&& (_g_ime.area_id == IMEvar.area.KOR || _g_ime.area_id == IMEvar.area.USA)*/) 
			{
				ProcessBTKey_kr(rlt[1], rlt[2]);
			}
			else
			{
					ProcessBTKey(rlt[1]);
				}				
			}
		else
		{
                alert(" callback RETURN SINCE IT IS NOT MINE -----------");
                return;
        }     
}

function ProcessBTKey(KeyValue){
	
	switch(KeyValue)
	{
		case (8): //backspace
			keyCode = 259;
			if(g_NumObj != null)	
			{
				g_NumObj.processPreChKey();
		    
		    	if(g_NumObj.anyKeyFunc)
		    	{
		        	g_NumObj.anyKeyFunc(keyCode);
		    	} 
			}
				alert("ProcessBT_Key(): input backspace ");
		 break;
		 
		 case (43): //+
		 	keyCode = 35;
			
			if(g_NumObj != null)
			{
				 if(g_NumObj.flagPhoneNumber==true)
			    {
			        g_NumObj.processNumberKey(keyCode);
			    
			        if(g_NumObj.anyKeyFunc)
			        {
			            g_NumObj.anyKeyFunc(keyCode);
			        }
			    }
			    else
			    {
			        return;
			    }				
			}

			alert("ProcessBT_Key(): input + ");
		 break;
		 
		 case (27) : // escape (ESC)
		 
		 	keyCode = 259;
			if(g_NumObj != null)	
			{
				g_NumObj.deleteAllText();
		    
		    	if(g_NumObj.anyKeyFunc)
		    	{
		        	g_NumObj.anyKeyFunc(keyCode);
		    	} 
			}
			alert("ProcessBT_Key(): input (ESC) ");
		 break;
	}
}

function ProcessBTKey_kr(mod, uid){
	alert("ProcessBTKey_kr(): mod -> "+mod +", uid -> "+uid);
	
	if (mod != "number") {
		switch (uid)
		{
			case (42): // backspace
				ProcessBTKey(8);
				break;

			case (46): //+
				ProcessBTKey(43);
				break;

			case (41): // escape (ESC)
				ProcessBTKey(27);
				break;			
		}
	}

}

/////////////////////////////////////////<Add Assigned Phone Number>/////////////////////////////////////////////

g_Data.DATA_ASSINGED_PHONENUMBER_POPUP = new Object();


g_Data.SetAssignedPhoneNumberInfo = function(SkypeName, Index ,Type, Phonenumber, UseTool)
{
	//alert("g_Data.SetAssignedPhoneNumberInfo");
	
    g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.name = SkypeName;
    g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.index = Index;    
    g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.type = Type;
    g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.phonenumber = Phonenumber;
	g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.tool = UseTool;
}

g_Data.GetAssignedPhoneNumberTool = function()
{
	return g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.tool;
}

g_Data.GetAssignedPhoneNumberPhonenumber = function()
{
	return g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.phonenumber;
}

g_Data.GetAssignedPhoneNumberType = function()
{
	return g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.type;
}

g_Data.GetAssignedPhoneNumberIndex = function()
{
	return g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.index;
}

g_Data.GetAssignedPhoneNumberName = function()
{
	return g_Data.DATA_ASSINGED_PHONENUMBER_POPUP.name;
}

g_Data.IsNoTimerPopupList = function(data){
	if(OneBtnPopupIndex==null){
		return false;
	}else{
		for(var i=0;i<NO_TIMER_POPUP_LIST.length;i++){
			if(NO_TIMER_POPUP_LIST[i]==data){
				return true;
			}
		}
		return false;
	}
}



////////////////////////app jump//////////////////////////

g_Data.WIDGET_PARAM = new Object();

g_Data.InitWidgetParam = function()
{
	alert('g_Data.InitWidgetParam');
		
	this.WIDGET_PARAM.start = false;			//come with anwser
	this.WIDGET_PARAM.mode = 'None';
	
	this.WIDGET_PARAM.skypename = null;
	this.WIDGET_PARAM.calltype = null;
	this.WIDGET_PARAM.source = null;
	this.WIDGET_PARAM.timestamp = null;
	this.WIDGET_PARAM.socail = false;
	this.WIDGET_PARAM.tryHideConnectWnd = false;
	
	//2013 add by minseok  : for app jump!
	this.WIDGET_PARAM.jumpFlag = false;
}

g_Data.SetWidgetParam = function(param_data)
{
	alert('g_Data.SetWidgetParam');
	
	if(param_data)
	{
		alert('param_data = ' + param_data);

		this.WIDGET_PARAM.start = true;
			
		var STX = String.fromCharCode(2);
		var ETX = String.fromCharCode(3);
		var splitter = ETX + STX;
				
		var ParamList = param_data.split(splitter);
		
		if(ParamList.length == 1)
		{
			var splitter2 = '%03%02';
			ParamList = param_data.split(splitter2);
		}
				
		//mode
		if(ParamList[0])
		{
			alert('ParamList[0] = ' + ParamList[0]);
			if(ParamList[0] == 'Videocall')
			{
				this.WIDGET_PARAM.socail = true;
				this.WIDGET_PARAM.mode = 'Calling';
				this.WIDGET_PARAM.calltype = 1;
				
				if(ParamList[1])
				{
					alert('ParamList[1] = ' + ParamList[1]);
					this.WIDGET_PARAM.skypename = ParamList[1];
				}
			}
			else if(ParamList[0] == 'Voicecall')
			{
				this.WIDGET_PARAM.socail = true;
				this.WIDGET_PARAM.mode = 'Calling';
				this.WIDGET_PARAM.calltype = 0;

				if(ParamList[1])
				{
					alert('ParamList[1] = ' + ParamList[1]);
					this.WIDGET_PARAM.skypename = ParamList[1];
				}				
			}
			else if(ParamList[0] == 'Voicemail')
			{
				this.WIDGET_PARAM.socail = true;
				this.WIDGET_PARAM.mode = 'Voicemail';

				if(ParamList[1])
				{
					alert('ParamList[1] = ' + ParamList[1]);
					this.WIDGET_PARAM.timestamp = ParamList[1];
				}
			}
			else if(ParamList[0]=='MissedCallHistory')
			{
				this.WIDGET_PARAM.socail = true;
				this.WIDGET_PARAM.mode = 'MissedCallHistory';
			}
			else if(ParamList[0] == 'TVModeVideo')
			{
				this.WIDGET_PARAM.mode = 'InCallFormTV';
				this.WIDGET_PARAM.calltype = 1;
			}
			else if(ParamList[0] == 'TVModeAudio')
			{
				this.WIDGET_PARAM.mode = 'InCallFormTV';
				this.WIDGET_PARAM.calltype = 0;
			}	
			else{
				this.WIDGET_PARAM.mode = 'InCall';
			}
		}
	}
}
g_Data.SetWidgetParamJumpFlag = function(flag){
	this.WIDGET_PARAM.jumpFlag = flag;
}
g_Data.GetWidgetParamJumpFlag = function(){
	return this.WIDGET_PARAM.jumpFlag;
}

g_Data.CheckWidgetParamFormApp = function(){

	if(this.WIDGET_PARAM.start == false)
	{		
		if(PluginAPIMgr.IsWidgetActivatedByAnswer() == 1)
		{
			if(ProcMgr.isIncomingCall==false && ProcMgr.isCalling==false)
			{
				this.WIDGET_PARAM.start = false;
			}
			else
			{
				this.WIDGET_PARAM.start = true;
			}
		}
	}
}



////////////////////////UTIL/////////////////////////////


function utill_LoadMode(mode, callbacFunc){
	
	alert('!!!@@@ mode loaded @@@');
	
	var modeName =  eval("SKYPE_MODE." + mode);
	
	sf.scene.loadScenes(modeName.scenes, function () {
	
	    sf.core.loadJS(modeName.files, callbacFunc);	
	});	
}

function print_run_time(timeNum)
{
	var today = new Date();
	alert(timeNum + ' >>>>> ' + today.getTime());
}

//Widget Object
g_WidgetAPI = new Common.API.Widget();

