/*
________________________________________________________________________________________________
GESTION POPUP
*/
function closeDivPopup()
{	
	$("#futur_popup").removeAttr("style");
	$("#futur_popup").html('');
}

function openDivPopup(params, vertical)
{	
	// vertical: si vertical ou non
	if (typeof(vertical)=="undefined") vertical=false;
	
	$("#futur_popup").show();
	
	var newHeight="100%";
	var newWidth="100%";
	if (document.all) 
		newHeight=document.body.scrollHeight+"px";
	else 
		newHeight=document.documentElement.scrollHeight+"px";
	
	$("#futur_popup").css('height', newHeight);
	$("#futur_popup").css('width', newWidth);
	
	$.ajax({
		type: "GET",
		url: "/_global/popup/view.php",
		data: params + "&pv=" + (vertical?'on':''),
		success: function(transport){
			//alert( "Data Saved: " + transport );
			if(transport != 0)
			{
				$("#futur_popup").html(transport);
			} else location.href = '/_erreur/index.php';
		}		   
	});
}

/*
________________________________________________________________________________________________
CONFIRMATION
*/
function confirmation(message,lien) {
	if (confirm(message)) location.href=lien;
}

/*
________________________________________________________________________________________________
GESTION TOOLS RESIZE
*/
//Sp�cifie la fourchette des diff�rentes tailles
var tailles = new Array( '80%','90%','100%','110%','120%','130%' );
var firstSize = 2;  
function resizeFonts(classe, coef) {
	/* Construit la taille du texte : + / - */
	var taille = firstSize;
	taille += coef;
	if ( taille < 0 ) taille = 0;
	if ( taille > 4 ) taille = 4;
	firstSize = taille;
	
	/* R�cupere les classe aui vont �tr modifier*/
	cibles = $('.' + classe);
	for(i=0; i < cibles.length; i++)
	{
		cibles[i].style.fontSize = tailles[taille];
	}
}

/*
________________________________________________________________________________________________
BACK TOP
*/
$(document).ready(function() {
    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
	$('.btns').hover(
		function(){
			$(this).addClass('btns_actif'); 
		},
		function(){
			$(this).removeClass('btns_actif');
		}
	);
	
	$('.checkGenre').parent('tr').click(
		function(e){
			if( $(this).find('input[type=checkbox]').is(':checked') && ( !$(e.target).is(':input') && !$(e.target).is('label') ) ){
				$(this).find('input[type=checkbox]').attr( 'checked' , false );
				$(this).parents('table.table_secondaire').find( 'tbody' ).hide();
			}else if( ( $(e.target).is(':input') || $(e.target).is('label') ) ){
				if( $(this).find('input[type=checkbox]').is(':checked') )
					$(this).parents('table.table_secondaire').find( 'tbody' ).show();
				else
					$(this).parents('table.table_secondaire').find( 'tbody' ).hide();
			}else{
				if( $(this).find('input[type=checkbox]').is(':checked') )
					$(this).parents('table.table_secondaire').find( 'tbody' ).hide();
				else{
					$(this).find('input[type=checkbox]').attr( 'checked' , true );
					$(this).parents('table.table_secondaire').find('tbody').show();
				}
			}
		}
	);
});

