function popup(arg) { window.open(arg,'','height=420, width=490, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no'); }

$(function(){

	// ACTIVATION DES ÉLÉMENTS DES MENUS EN FONCTION DE LA PAGE COURANTE
	$('#menu ul li a[href^="'+$.url.segment(0)+'"]').addClass("active");
	$('#sidebar ul li a[href*="'+$.url.segment(1)+'/"]').addClass("active");
	
	// OUVERTURE DES LIENS EXTÉRIEURS DANS UNE NOUVELLE PAGE
	$('a[rel="ext"]').click(function(){
		window.open(this.href);
		return false;
	});
	
	// RÉINITIALISATION DES CHECKBOXES
	$(':radio').attr("checked", false);
	$(':radio').attr("disabled", false);

	// DÉSACTIVATION DU CHOIX SECONDAIRE EN FONCTION DU CHOIX PRIORITAIRE
	$("input[name='priority']").click(function(){
		var value = $(this).attr('value');
		$("input[name='secondary']").removeAttr("disabled");
		$('input#'+value+'\\.two').attr("disabled", "disabled");
		$('input#'+value+'\\.two').attr("checked", false);
	});

	// VERIFICATION QU'AU MOINS UN CHOIX PRIORITAIRE A ÉTÉ FAIT
	$("#consultationConfirm").click(function(){
		if ($("input[name='priority']:checked").length==0) {
			$("table#consultation td div").addClass("error");
			$("table#consultation tr td.error").removeClass("hidden");
			return false;
		}
	});
	
	// WIDGET
	$('#downloadButton a').click(function(){
		$('#download').animate({'height': '276px','opacity': '0.0'},500);
		$('#download').queue(function(){
			$(this).addClass('more').animate({'opacity':'1.0'});
			$(this).dequeue();
		});
		// $('#container').css({'padding-bottom':'3px'});
		// $('#iframe').css({'height':'538px'});
	});
	
	// COMPETITION
	$('#play a#playCompetition').click(function(){
		$('#competition').animate({'height':'535px'});
		$('#play').hide();
		$('#iframe').show();
		return false;
	});
	
});