jQuery.noConflict();
jQuery(document).ready(function ($){

    $("#navFiltre a").click(function(){
        reloadRaceList( $(this).attr('id'), '#race1', 'firstLetter', $("#type").val() );
        return false;
    });
    
    
    $("#tabElevage tr:eq(1)").show();
    $("#tabElevageChat tr:eq(1)").show();
    
    cptRow = 11 - $("#tabElevage tr.hide").length;
    $("#addRow").click(function() {
        if(cptRow < (11) ) { 
            cptRow++;
            $("#tabElevage tr").eq( cptRow ).show();
            
            if(cptRow == (10) ) { 
                $(this).hide();
            }
        }
        return false;
    });
    
    cptRowCat = 11 - $("#tabElevageChat tr.hide").length;
    $("#addRowChat").click(function() {
        if(cptRowCat < (11) ) { 
            cptRowCat++;
            $("#tabElevageChat tr").eq( cptRowCat ).show();
            
            if(cptRowCat == (10) ) { 
                $(this).hide();
            }
        }
        return false;
    });

});

function reloadRaceList( filter, target, fetchBy, type ) {
    jQuery( target+ "-AjaxLoader" ).show();
    
    jQuery.get( "/royalcanin/getRaceList/" + filter + "/" + fetchBy + "/" + type , function(data){
        jQuery( target ).html(data);
        jQuery( target ).removeAttr('disabled');
        jQuery( target+ "-AjaxLoader" ).hide();
    });
}

function toggleBloc( target ) {
    jQuery( "#"+target ).toggle();
}

function showBloc( target ) {
    jQuery( "#"+target ).show();
}

function hideBloc( target ) {
    jQuery( "#"+target ).hide();
}

