
var VOLUME_TYPE = {  
 	NOTHING		: 0,
 	CALL		: 1,
	TV			: 2,
	MASTER		: 3
}

function SceneVolume(options) {
	this.options = options;
    
    this.VolumeView = null;

	this.cur_mode = VOLUME_MODE.NOTHING;
	this.prev_mode = VOLUME_MODE.NOTHING;
	
	this.current_highlight = VOLUME_TYPE.NOTHING;

	this.caution_label = null;
	
	this.source_volume_icon_lable	= null;
	
	this.tv_volume_slider			= null;
	this.tv_volume_name_lable		= null;
	this.tv_volume_value_lable		= null;
    this.tv_volume_value			= -1;

	this.call_volume_slider			= null;
	this.call_volume_name_lable		= null;
	this.call_volume_value_lable	= null;
    this.call_volume_value			= -1;

	this.master_volume_slider			= null;
	this.master_volume_name_lable		= null;
	this.master_volume_icon_lable		= null;
	this.master_volume_value_lable		= null;
    this.master_volume_value			= -1;
    
}

SceneVolume.prototype.initialize = function () {
	alert("SceneVolume.initialize()"); 
	this.create();
}

SceneVolume.prototype.handleShow = function () {
	alert("SceneVolume.handleShow()");
    this.update();
}

SceneVolume.prototype.handleHide = function () {
	alert("SceneVolume.handleHide()");
	
	WndMgr.stopPopupHideTimer();
}

SceneVolume.prototype.handleFocus = function () {
	alert("SceneVolume.handleFocus() ");

	if(this.cur_mode == VOLUME_MODE.MASTER)
	{
		this.highlight(VOLUME_TYPE.MASTER);		
	}
	else if(this.cur_mode == VOLUME_MODE.SOURCE || this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		this.highlight(VOLUME_TYPE.CALL);
	}
}

SceneVolume.prototype.handleBlur = function () {
	alert("SceneVolume.handleBlur()");
	
	this.highlight(VOLUME_TYPE.NOTHING);
}

SceneVolume.prototype.handleKeyDown = function (keyCode) {
	alert("SceneVolume.handleKeyDown(" + keyCode + ")");
	
	//PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	
	switch (keyCode) {
		case sf.key.VOL_DOWN:
        case sf.key.PANEL_VOL_DOWN:
			this.processVolumeKey(false);
			break;
		case sf.key.VOL_UP:
        case sf.key.PANEL_VOL_UP:
			this.processVolumeKey(true);
			break;
		case sf.key.LEFT:
			this.processleftKey();
			break;
		case sf.key.RIGHT:			
			this.processRightKey();
			break;
		case sf.key.UP:
		case sf.key.DOWN:
			WndMgr.resetPopupHideTimer();
			this.processUpDownKey();
			sf.key.preventDefault();
			break;

        case sf.key.MUTE:
			WndMgr.resetPopupHideTimer();
            this.processMute();
            break;

		case sf.key.ENTER:
			WndMgr.resetPopupHideTimer();
			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;
    }
}

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

SceneVolume.prototype.create = function(){
    alert("SceneVolume.create()");
    
    this.VolumeView = new View("Volume");
    this.VolumeView.SetBgImage(g_Image.IMAGE_POPUP_DIM_BG);
        
    this.VolumeView.CreatePopupBG(0,'volume_single_style');
	this.VolumeView.SetTitleTextofPopupBG(IDWS_MOIP_SETTING_SPEAKER_VOLUME);
	
	
	this.caution_label = new Label(null,"volume_caution_label");
	this.caution_label.SetText(TV_SID_LOWERING_YOUR_TV_VOLUME_MAY_IMPROVE_MSG);
	
	//////////////////////  tv  & call  /////////////////////////////////

	this.source_volume_icon_lable = new Label("volume_source_icon",null);
	this.source_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_POPUP_ICON);

	this.tv_volume_name_lable	= new Label(null,"volume_tv_name");
	this.tv_volume_name_lable.SetText(TV_SID_TV_VOLUME);
	
	this.tv_volume_value_lable	= new Label(null,"volume_tv_value");

	this.call_volume_name_lable	= new Label(null,"volume_call_name");
	this.call_volume_name_lable.SetText(TV_SID_CALL_VOLUME);
	
	this.call_volume_value_lable= new Label(null,"volume_call_value");
	
	//////////////////////  master  /////////////////////////////////
	
	this.master_volume_name_lable = new Label(null,"volume_master_name");
	this.master_volume_name_lable.SetText(SID_VOLUME);

	this.master_volume_icon_lable = new Label("volume_master_icon",null);
	this.master_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_POPUP_ICON);
	
	this.master_volume_value_lable= new Label(null,"volume_master_value");

	////////////////////create  slider //////////////////////////////////
	
	this.CreateTvVolume();
	this.CreateCallVolume();
	this.CreateMasterVolume();
	
	////////////////////set  click event //////////////////////////////////
	var this_ = sf.scene.get("Volume");	
	document.getElementById('volume_tv_click').onclick = function(){this_.processTVClick();};
	document.getElementById('volume_call_click').onclick = function(){this_.processCallClick();};		
	document.getElementById('volume_master_click').onclick = function(){this_.processMasterClick();};


	$('#volume_source').css('display','none');
}

SceneVolume.prototype.highlight = function(type){
	alert("SceneVolume.highlight()");

	if(type == VOLUME_TYPE.CALL)
	{
		this.BlurTvVolume();
		this.FocusCallVolume();
	}
	else if(type == VOLUME_TYPE.TV)
	{
		this.BlurCallVolume();
		this.FocusTvVolume();
	}
	else if(type == VOLUME_TYPE.MASTER)
	{
		this.FocusMasterVolume();
	}
	else
	{
		type = VOLUME_TYPE.NOTHING;
		
		if(this.cur_mode == VOLUME_MODE.SOURCE || this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
		{
			this.BlurTvVolume();
			this.BlurCallVolume();
		}
		else
		{
			this.BlurMasterVolume();
		}		
	}
	
	this.current_highlight = type;

}

SceneVolume.prototype.update= function(){

	this.updateVolumeMode();

	if(this.cur_mode == VOLUME_MODE.SOURCE || this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		WndMgr.startPopupHideTimer(10000);
	}
	else
	{
	   	WndMgr.startPopupHideTimer(4000);		
	}
}

SceneVolume.prototype.processVolumeKey = function(Increase){
    alert("SceneVolume.processVolumeKey() ");
    
    WndMgr.resetPopupHideTimer();
        
	if(this.cur_mode == VOLUME_MODE.SOURCE_MUTE || this.cur_mode == VOLUME_MODE.MASTER_MUTE)
	{
		this.processMute();
		return;
	}
	else if(this.cur_mode == VOLUME_MODE.SOURCE)
	{
		this.setVolumeMode(VOLUME_MODE.MASTER);
		this.updateVolumeMode();
    	return;
	}	

	if(Increase)
	{
		this.master_volume_value++;
		if(this.master_volume_value > 100)
			this.master_volume_value = 100;
	}	
	else
	{
		this.master_volume_value--;
		if(this.master_volume_value < 0)
			this.master_volume_value = 0;			
	}
	
	this.master_volume_value_lable.SetText(this.master_volume_value);
    this.SetMasterVolume(this.master_volume_value);
	PluginAPIMgr.SetSpeakerVolume(this.master_volume_value);
	
}


SceneVolume.prototype.processUpDownKey = function(){
	alert("SceneVolume.processUpDownKey() ");
	
	if(this.current_highlight == VOLUME_TYPE.CALL)
	{
		this.highlight(VOLUME_TYPE.TV);
	}	
	else if(this.current_highlight == VOLUME_TYPE.TV)
	{
		this.highlight(VOLUME_TYPE.CALL);
	}
}

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

	StateMgr.Stop_Volume_Speaker_State(true);

}

SceneVolume.prototype.setVolumeMode = function(mode){
	alert("SceneVolume.setSourceVolume("+mode+")");	
			
	this.prev_mode = this.cur_mode;
	this.cur_mode = mode;
}

SceneVolume.prototype.CreateMasterVolume = function(){
	alert("SceneVolume.CreateMasterVolume() ");

	this.master_volume_slider = new CompBase(); 
	this.master_volume_slider.CreateBG("volume_master_slider");
	this.master_volume_slider.AddImageLayer("volume_master_slider_bg_left");
	this.master_volume_slider.AddJPGImageLayer("volume_master_slider_bg_center");
	this.master_volume_slider.AddImageLayer("volume_master_slider_bg_right");	
	this.master_volume_slider.AddImageLayer("volume_master_slider_progress_left");
	this.master_volume_slider.AddJPGImageLayer("volume_master_slider_progress_center");	
	this.master_volume_slider.AddImageLayer("volume_master_slider_handle");

	this.master_volume_slider.SetImageLayer(1,g_Image.IMAGE_SLIDER_BG_LEFT);		//bg
	this.master_volume_slider.SetImageLayer(2,g_Image.IMAGE_SLIDER_BG_CENTER);		//bg
	this.master_volume_slider.SetImageLayer(3,g_Image.IMAGE_SLIDER_BG_RIGHT);		//bg
	this.master_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMAL_LEFT);
	this.master_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMAL_CENTER);
	this.master_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMAL);

}

SceneVolume.prototype.FocusMasterVolume = function(){
	alert("SceneVolume.FocusMasterVolume() ");
	
	this.master_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMALFOCUS_LEFT);
	this.master_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMALFOCUS_CENTER);
	this.master_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMALFOCUS);
}	

SceneVolume.prototype.BlurMasterVolume = function(){
	alert("SceneVolume.BlurMasterVolume() ");

	this.master_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMAL_LEFT);
	this.master_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMAL_CENTER);
	this.master_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMAL);
}

SceneVolume.prototype.SetMasterVolume = function(value){
	alert("SceneVolume.SetMasterVolume()");

	var val_left = parseInt(value*306/100);
	//alert('val_left = '+val_left);	

	var val_width = val_left - 11 + 30;
	//alert('val_width = '+val_width);

	var leftPosition = val_left+'px';
	var widthPosition = val_width+'px';
	
	$('#volume_master_slider_progress_center').css('width',widthPosition);
	$('#volume_master_slider_handle').css('left',leftPosition);
}

SceneVolume.prototype.CreateTvVolume = function(){
	alert("SceneVolume.CreateTvVolume() ");

	this.tv_volume_slider = new CompBase(); 
	this.tv_volume_slider.CreateBG("volume_tv_slider");
	this.tv_volume_slider.AddImageLayer("volume_tv_slider_bg_left");
	this.tv_volume_slider.AddJPGImageLayer("volume_tv_slider_bg_center");
	this.tv_volume_slider.AddImageLayer("volume_tv_slider_bg_right");	
	this.tv_volume_slider.AddImageLayer("volume_tv_slider_progress_left");
	this.tv_volume_slider.AddJPGImageLayer("volume_tv_slider_progress_center");	
	this.tv_volume_slider.AddImageLayer("volume_tv_slider_handle");

	this.tv_volume_slider.SetImageLayer(1,g_Image.IMAGE_SLIDER_BG_LEFT);		//bg
	this.tv_volume_slider.SetImageLayer(2,g_Image.IMAGE_SLIDER_BG_CENTER);		//bg
	this.tv_volume_slider.SetImageLayer(3,g_Image.IMAGE_SLIDER_BG_RIGHT);		//bg
	this.tv_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMAL_LEFT);
	this.tv_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMAL_CENTER);
	this.tv_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMAL);

}

SceneVolume.prototype.FocusTvVolume = function(){
	alert("SceneVolume.FocusTvVolume() ");
	
	this.tv_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMALFOCUS_LEFT);
	this.tv_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMALFOCUS_CENTER);
	this.tv_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMALFOCUS);
}	

SceneVolume.prototype.BlurTvVolume = function(){
	alert("SceneVolume.BlurMasterVolume() ");

	this.tv_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMAL_LEFT);
	this.tv_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMAL_CENTER);
	this.tv_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMAL);
}

SceneVolume.prototype.SetTvVolume = function(value){
	alert("SceneVolume.SetTvVolume()");

	var val_left = parseInt(value*306/100);
	//alert('val_left = '+val_left);	

	var val_width = val_left - 11 + 30;
	//alert('val_width = '+val_width);

	var leftPosition = val_left+'px';
	var widthPosition = val_width+'px';
	
	$('#volume_tv_slider_progress_center').css('width',widthPosition);
	$('#volume_tv_slider_handle').css('left',leftPosition);
}

SceneVolume.prototype.CreateCallVolume = function(){
	alert("SceneVolume.CreateCallVolume() ");

	this.call_volume_slider = new CompBase(); 
	this.call_volume_slider.CreateBG("volume_call_slider");
	this.call_volume_slider.AddImageLayer("volume_call_slider_bg_left");
	this.call_volume_slider.AddJPGImageLayer("volume_call_slider_bg_center");
	this.call_volume_slider.AddImageLayer("volume_call_slider_bg_right");	
	this.call_volume_slider.AddImageLayer("volume_call_slider_progress_left");
	this.call_volume_slider.AddJPGImageLayer("volume_call_slider_progress_center");	
	this.call_volume_slider.AddImageLayer("volume_call_slider_handle");

	this.call_volume_slider.SetImageLayer(1,g_Image.IMAGE_SLIDER_BG_LEFT);		//bg
	this.call_volume_slider.SetImageLayer(2,g_Image.IMAGE_SLIDER_BG_CENTER);		//bg
	this.call_volume_slider.SetImageLayer(3,g_Image.IMAGE_SLIDER_BG_RIGHT);		//bg
	this.call_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMAL_LEFT);
	this.call_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMAL_CENTER);
	this.call_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMAL);

}

SceneVolume.prototype.FocusCallVolume = function(){
	alert("SceneVolume.FocusCallVolume() ");
	
	this.call_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMALFOCUS_LEFT);
	this.call_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMALFOCUS_CENTER);
	this.call_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMALFOCUS);
}	

SceneVolume.prototype.BlurCallVolume = function(){
	alert("SceneVolume.BlurCallVolume() ");

	this.call_volume_slider.SetImageLayer(4,g_Image.IMAGE_PROGRESS_NORMAL_LEFT);
	this.call_volume_slider.SetImageLayer(5,g_Image.IMAGE_PROGRESS_NORMAL_CENTER);
	this.call_volume_slider.SetImageLayer(6,g_Image.IMAGE_HANDLE_NORMAL);
}

SceneVolume.prototype.SetCallVolume = function(value){
	alert("SceneVolume.SetCallVolume()");

	var val_left = parseInt(value*306/100);
	//alert('val_left = '+val_left);	

	var val_width = val_left - 11 + 30;
	//alert('val_width = '+val_width);

	var leftPosition = val_left+'px';
	var widthPosition = val_width+'px';
	
	$('#volume_call_slider_progress_center').css('width',widthPosition);
	$('#volume_call_slider_handle').css('left',leftPosition);
}

SceneVolume.prototype.processTVClick = function()
{
	WndMgr.resetPopupHideTimer();

	if(this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		this.processMute();
	}

	var pos_x = event.clientX - 544;
	var volume_x = parseInt(pos_x*100/362);
		
	alert("volume_x: " + volume_x);
	
	this.tv_volume_value = volume_x;
    this.highlight(VOLUME_TYPE.TV);	
	this.tv_volume_value_lable.SetText(volume_x);
    this.SetTvVolume(volume_x);
    PluginAPIMgr.SetTVMixVolume(volume_x);
}


SceneVolume.prototype.processCallClick = function()
{
	WndMgr.resetPopupHideTimer();

	if(this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		this.processMute();
	}

	var pos_x = event.clientX - 544;
	var volume_x = parseInt(pos_x*100/362);
		
	this.call_volume_value = volume_x;
	
	this.highlight(VOLUME_TYPE.CALL);
	this.call_volume_value_lable.SetText(volume_x);    
    this.SetCallVolume(volume_x);
    PluginAPIMgr.SetCallMixVolume(volume_x);
}

SceneVolume.prototype.processMasterClick = function()
{
	WndMgr.resetPopupHideTimer();
	
	if(this.cur_mode == VOLUME_MODE.MASTER_MUTE)
	{
		this.processMute();
	}
	
	var pos_x = event.clientX - 462;
	var volume_x = parseInt(pos_x*100/362);
		
	this.master_volume_value = volume_x;
	this.master_volume_value_lable.SetText(volume_x);
    PluginAPIMgr.SetSpeakerVolume(volume_x);
	this.SetMasterVolume(volume_x);
}

SceneVolume.prototype.processMute = function()
{	
	alert("SceneVolume.processMute()");
	
	if(this.cur_mode == VOLUME_MODE.SOURCE)
	{
		this.highlight(VOLUME_TYPE.NOTHING);
		this.setVolumeMode(VOLUME_MODE.MASTER_MUTE);
	}
	else if(this.cur_mode == VOLUME_MODE.MASTER)
	{
		this.highlight(VOLUME_TYPE.NOTHING);
		this.setVolumeMode(VOLUME_MODE.MASTER_MUTE);
	}
	else if(this.cur_mode == VOLUME_MODE.MASTER_MUTE || this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		this.highlight(VOLUME_TYPE.MASTER);
		this.setVolumeMode(VOLUME_MODE.MASTER);
	}
	else
	{
		alert('error mode!!');
		return;
	}
	
	this.updateVolumeMode();
	
	if(this.cur_mode == VOLUME_MODE.MASTER_MUTE || this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		ProcMgr.processVolumeMute(true);
	}
	else
	{
		ProcMgr.processVolumeMute(false);
	}
}

SceneVolume.prototype.updateVolumeMode = function()
{	
	alert("SceneVolume.updateVolumeMode()");
	
	if(this.cur_mode == VOLUME_MODE.SOURCE || this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		if(this.prev_mode != VOLUME_MODE.SOURCE && this.prev_mode != VOLUME_MODE.SOURCE_MUTE)
		{
			alert("SceneVolume.update()");
			this.VolumeView.ChangePopupBGSize('volume_double_style');
			this.VolumeView.SetTitleTextofPopupBG(SID_VOLUME);
			
			$('#volume_master').css('display','none');
			$('#volume_source').css('display','block');

			var dataInfo = {
				'leftright' : TV_SID_VOLUME_DOWN_UP,
				'return' : SID_RETURN
			};
			this.VolumeView.SetHelpbarContentsOfPopupBG(dataInfo);
		}
		
		if(this.cur_mode == VOLUME_MODE.SOURCE)
		{
			this.source_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_POPUP_ICON);			
		}
		else if(this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
		{
			this.source_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_MUTE_POPUP_ICON);
		}

		this.tv_volume_value	= PluginAPIMgr.GetTVMixVolume();
	    this.call_volume_value	= PluginAPIMgr.GetCallMixVolume();

		this.tv_volume_value_lable.SetText(this.tv_volume_value);
	    this.call_volume_value_lable.SetText(this.call_volume_value);
			
		this.SetTvVolume(this.tv_volume_value);
		this.SetCallVolume(this.call_volume_value);	

	}
	else
	{
		if(this.prev_mode == VOLUME_MODE.SOURCE || this.prev_mode == VOLUME_MODE.SOURCE_MUTE)
		{
			this.VolumeView.ChangePopupBGSize('volume_single_style');
			this.VolumeView.SetTitleTextofPopupBG(IDWS_MOIP_SETTING_SPEAKER_VOLUME);
			
			$('#volume_master').css('display','block');
			$('#volume_source').css('display','none');

			var dataInfo = {
				'return' : SID_RETURN
			};
			this.VolumeView.SetHelpbarContentsOfPopupBG(dataInfo);			
		}
		this.master_volume_value = PluginAPIMgr.GetSpeakerVolume();
		
		if(this.cur_mode == VOLUME_MODE.MASTER_MUTE)
		{
			this.master_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_MUTE_POPUP_ICON);
		    this.master_volume_value_lable.SetText(0);
			this.SetMasterVolume(0);
		}
		else if(this.cur_mode == VOLUME_MODE.MASTER)
		{			
			if(ProcMgr.CallInfo.IsSpeakerMute == true)
			{
				ProcMgr.processVolumeMute(false);
			}
			
			this.master_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_POPUP_ICON);
		    this.master_volume_value_lable.SetText(this.master_volume_value);
			this.SetMasterVolume(this.master_volume_value);			
		}
	}
}

SceneVolume.prototype.processleftKey = function()
{
	alert("SceneVolume.processleftKey()");

    WndMgr.resetPopupHideTimer();
    this.processSouceVolume(false);
}

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

    WndMgr.resetPopupHideTimer();
    this.processSouceVolume(true);
}


SceneVolume.prototype.processSouceVolume = function(bVolumUp)
{
	alert("SceneVolume.processSouceVolume()");

    if(this.cur_mode != VOLUME_MODE.SOURCE && this.cur_mode != VOLUME_MODE.SOURCE_MUTE)
    {
		return;
    }

	if(this.cur_mode == VOLUME_MODE.SOURCE_MUTE)
	{
		this.setVolumeMode(VOLUME_MODE.SOURCE);
		this.source_volume_icon_lable.SetBgImage(g_Image.IMAGE_VOLUME_POPUP_ICON);
		ProcMgr.processVolumeMute(false);
	}

    var volume_progress = null;
    var volume_value = 	-1;
    
	if(this.current_highlight == VOLUME_TYPE.CALL)
	{
		volume_progress = '#volume_call_progress';

		if(bVolumUp)
		{
			this.call_volume_value++;
			if(this.call_volume_value > 100)
				this.call_volume_value = 100;
		}	
		else
		{
			this.call_volume_value--;
			if(this.call_volume_value < 0)
				this.call_volume_value = 0;			
		}
		
		volume_value = this.call_volume_value;
		
	    this.call_volume_value_lable.SetText(this.call_volume_value);
		this.SetCallVolume(this.call_volume_value);
	    PluginAPIMgr.SetCallMixVolume(this.call_volume_value );
	    
	}	
	else if(this.current_highlight == VOLUME_TYPE.TV)
	{
		volume_progress = '#volume_tv_progress';

		if(bVolumUp)
		{
			this.tv_volume_value++;
			if(this.tv_volume_value > 100)
				this.tv_volume_value = 100;
		}	
		else
		{
			this.tv_volume_value--;
			if(this.tv_volume_value < 0)
				this.tv_volume_value = 0;			
		}
		
		volume_value = this.tv_volume_value;
		this.tv_volume_value_lable.SetText(this.tv_volume_value);
		this.SetTvVolume(this.tv_volume_value);
	    PluginAPIMgr.SetTVMixVolume(this.tv_volume_value);
	}
}
	