
$(document).ready(function(){
	// FILTER TABLE RESULTS
	$(".filterable tr:has(td.player_name)").each(function(){
		var t = $(this).text().toLowerCase();
		$("<td class='indexColumn'></td>").hide().text(t).appendTo(this);
	});
	$("#FilterTextBox").keyup(function(){
		var s = $(this).val().toLowerCase().split(" ");
		$(".filterable tr:hidden").show();
		$.each(s, function(){
			$(".filterable tr:visible .indexColumn:not(:contains('" + this + "'))").parent().hide();
		});
	});

	// HEADER SLIDER
	$(function() {
	    $("#controller").jFlow({
	        slides: "#slides",
	        width: "1000px",
	        height: "342px",
	        duration: 1000,
	        auto: true
	    });
	});
});

    
//** registrovat hraca na turnaj
function checkin_player(t_id) {
  $(document).ready(function() {  
	  var client_code = $("input:client_code").val();
	  //if(isNaN(client_code)===false && client_code!='') {
		$.ajax({
			type: "POST",
			url: "/php/Ajax.class.php",
			data: "tournament_id="+t_id+"&client_code="+client_code+"&f=checkin_player",
			success: function(return_msg) {
				$("#replace_content").html(return_msg);
			}
		});
  });
}

    
//** otvorit shadowbox s allin points konkretneho hraca
function open_shadowbox() {
  $(document).ready(function() {
  
  var client_code = $("#client_code").val();
  
	  if(client_code.length==0) {
	  	alert("Zadajte prosím Vaše registračné číslo");
	  } else {
	  Shadowbox.open({
	        content:    '/templates/html/allin_points.php?id='+client_code,
	        player:     "iframe",
	        title:      "Allin points",
	        height:     170,
	        width:      350,
	        onClose: function() {
	            window.location.reload();
	        }
	    });	    
	  }      
  });
}
