// JavaScript Document
var Widget_livescore_main = Widget_livescore.extend({
	
	onready:{
		'remove_buttons': function(){$('#audio_chooser').css('opacity','0');}
	}
	,
	binds: {
		'.result:not(.popup)':{
			'click': function(e){
				var click_obj = this;
				e.data.me.popup_box({'url':'/data/eventdetails/' + $(this).parents('tr').attr('id').replace('e_',''), 'title': enet_labels.get_label('LOADING','&nbsp;'), 'obj': click_obj});
				//e.data.me.result_popup(this, e.data.me);
			}
		}
	}
	,
	update_data_each: function(eventFK, val, old, event_row, init, sound){
		var me = this;
		/*Update Result*/
		if(val.st !== 'notstarted'){
			event_row.find('.rs').html(val.p1.rs + '-' + val.p2.rs);
		}else{
			event_row.find('.rs').html('-');
		}
		
		if(!val.el){
		}else if(val.stid != 10 && val.stid != 20 && val.stid != 14 && val.stid != 4 && val.stid != 5 && val.st != 'finished' ){
			event_row.find('td.status').html(val.el+'\'');
		}
		
		/*Sounds and highlight*/
		if(old.p1.rs < val.p1.rs || old.p2.rs < val.p2.rs && !init){
			//if(sound){ me.play_sound('/snd/default/goal.mp3'); }
			me.highlight(event_row);
		}
		if(old.st == 'notstarted' && val.st == 'inprogress' && !init){
			//if(sound){ me.play_sound('/snd/default/startEnd.mp3'); }
			me.highlight(event_row);
			
		}
		if(old.st == 'inprogress' && val.st == 'finished' && !init){
			//if(sound){ me.play_sound('/snd/default/startEnd.mp3'); }
			me.highlight(event_row);
		}
	}
	
});
