$(function($){
	var theTable = $('table.tableau1');
	theTable.find("tbody > tr").find("td:eq(1)").mousedown(function(){
		$(this).prev().find(":checkbox").click()
	});
	$("select[name='filter']").change(function() {
		$.uiTableFilter( theTable, this.value );
	})
	$('#filter-form').submit(function(){
		theTable.find("tbody > tr:visible > td:eq(1)").mousedown();
		return false;
	}).focus();
	
	
	

	$("#cible").load("http://www.omplanete.com/services/paris-bwin-ajax.php");
	$("[name=prix]").format({precision: 2,autofix:true});
	$("[name=typepari]").click(function(){
		var TypePari=$(this).val();
		alert($(this).val());
	}); 
	$("a.setcote").click(function(){
		var ArrayCote = $(this).attr('id').split("|");
		var MatchEquipe = ArrayCote[0];
		var MatchCote = ArrayCote[2];
		var MatchId = ArrayCote[3];
		var MatchMise = parseFloat($("[name=prix]").val());
		var TypePari=$("[name=typepari]").val();
		$.ajax({
			type: "POST",
			url: "http://www.omplanete.com/services/paris-bwin-ajax.php",
			data: "add=1&equipe=" + MatchEquipe + "&cote=" + MatchCote + "&mise=" + MatchMise + "&typepari=" + TypePari + "&id=" + MatchId,
			success: function(){
				$("#cible").load("http://www.omplanete.com/services/paris-bwin-ajax.php");
			}
		});
		return false;
	}); 
	$.live_bind("img.unsetcote", 'click', function(){
			var MatchId = $(this).attr('id');
			$.ajax({
				type: "POST",
				url: "http://www.omplanete.com/services/paris-bwin-ajax.php",
				data: "del=1&id=" + MatchId,
				success: function(){
					$("#cible").load("http://www.omplanete.com/services/paris-bwin-ajax.php");
				}
			});
			return false;
		}
	);
});
