text: var selectedMegapool = $('#selected_megapool_url option:selected').val();
  if(selectedMegapool != ''){
  	setInterval(function(){
  		$.ajax({
  			url: base_path+"check-draft-selection-timing",
  			type: "POST",
  			data: {megapool_url: selectedMegapool},
  			dataType: 'json',
  			success: function (response) {
  				if(response.status === 1){
  					let data_json = response.draft_list_status;
  					
  					$.each(data_json, function(index, item) {
  						var team_selection_ended 	= item.team_selection_ended;
  						var team_selection_started 	= item.team_selection_started;
  						var draft_url 				= item.draft_url;
  						var is_commissioner			= item.user_id == $('#currentUser').val();
  						
  						if(item.is_expired){
  							$('#selection_status_'+draft_url).removeClass('btn-warning');
  							$('#selection_status_'+draft_url).removeClass('btn-success');
  							$('#selection_status_'+draft_url).removeClass('btn-info');
  							$('#selection_status_'+draft_url).addClass('btn-danger');
  							$('#selection_status_'+draft_url).text('Selection Expired');
  							$('#selection_status_'+draft_url).prop('disabled', true);
  							$('#selection_end_'+draft_url).hide();
  						} else {
  							if(team_selection_started == 1 && team_selection_ended == 2){
  								$('#selection_status_'+draft_url).removeClass('btn-warning');
  								$('#selection_status_'+draft_url).removeClass('btn-success');
  								$('#selection_status_'+draft_url).addClass('btn-success');
  								if(is_commissioner) {
  									$('#selection_status_'+draft_url).text('Pause Selection');
  									$('#selection_status_'+draft_url).prop('disabled', false);
  									$('#selection_end_'+draft_url).show();
  								} else {
  									$('#selection_status_'+draft_url).text('Selection Started');
  									$('#selection_status_'+draft_url).prop('disabled', true);
  								}
  							}else if(team_selection_started == 3 && team_selection_ended == 2){
  								$('#selection_status_'+draft_url).removeClass('btn-danger');
  								$('#selection_status_'+draft_url).removeClass('btn-success');
  								$('#selection_status_'+draft_url).addClass('btn-warning');
  								if(is_commissioner) {
  									$('#selection_status_'+draft_url).text('Resume Selection');
  									$('#selection_status_'+draft_url).prop('disabled', false);
  									$('#selection_end_'+draft_url).show();
  								} else {
  									$('#selection_status_'+draft_url).text('Selection Paused');
  									$('#selection_status_'+draft_url).prop('disabled', true);
  								}
  							}else if(team_selection_started == 2 && team_selection_ended == 1){
  								$('#selection_status_'+draft_url).removeClass('btn-warning');
  								$('#selection_status_'+draft_url).removeClass('btn-success');
  								$('#selection_status_'+draft_url).addClass('btn-danger');
  								$('#selection_status_'+draft_url).text('Selection Ended');
  								$('#selection_status_'+draft_url).prop('disabled', true);
  								$('#selection_end_'+draft_url).hide();
  							}else if(team_selection_started == 2 && team_selection_ended == 2){
  								$('#selection_status_'+draft_url).removeClass('btn-danger');
  								$('#selection_status_'+draft_url).removeClass('btn-success');
  								$('#selection_status_'+draft_url).addClass('btn-info');
  								if(is_commissioner) {
  									$('#selection_status_'+draft_url).text('Start Selection');
  									$('#selection_status_'+draft_url).prop('disabled', false);
  									$('#selection_end_'+draft_url).hide();
  								} else {
  									$('#selection_status_'+draft_url).text('Selection not Started');
  									$('#selection_status_'+draft_url).prop('disabled', true);
  								}
  							}
  						}
  					});
  				}
  			}
  		});
  	}, 5000);
  }
  
  function listDrafts() {
  	var selectedMegapool = $('#selected_megapool_url option:selected').val();
  	if(selectedMegapool != ''){
  		var getUrl = window.location;
  		var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1] + "/";
  		window.location.href = baseUrl+selectedMegapool;
  	}
  }