Moving code around
I was just kind of curious if there is any of the coding here that I can place inside of the dataTables script. I have the the majority of the same coding on each of my module's javascript page so I thought with similar coding I can can put all of the same coding back into that dataTables page.

    $.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay ) {
    oSettings._iDisplayLength = iDisplay;
    oSettings.oApi._fnCalculateEnd( oSettings );

    /* If we have space to show extra rows (backing up from the end point - then do so */
    if ( oSettings._iDisplayEnd == oSettings.aiDisplay.length )
    {
        oSettings._iDisplayStart = oSettings._iDisplayEnd - oSettings._iDisplayLength;
        if ( oSettings._iDisplayStart < 0 )
        {
            oSettings._iDisplayStart = 0;
        }
    }

    if ( oSettings._iDisplayLength == -1 )
    {
        oSettings._iDisplayStart = 0;
    }

    oSettings.oApi._fnDraw( oSettings );

    $('select', oSettings.oFeatures.l).val( iDisplay );
    };

    $(document).ready(function() {
    
    var pageName = $('#pageName').val();    
    
    var oTable = $('#templatesPageList').dataTable( {
        "sDom": 'rti<"pagination"p>',
        "iDisplayLength": 10,
        "sPaginationType": "full_numbers"
    });
    
    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
        $('div.pagination').remove();
    } else {
        $('div.pagination').append();
    }
    if(oTable.fnSettings().fnRecordsTotal() == 0) {
        $('.bt_red').remove();
        $('.bt_blue').remove();
    }
    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
        $('.bt_blue').remove();
    }
    
    var info = $('.dataTables_info');
    $('tfoot tr td.rounded-foot-left').append(info);
    
    $('.edit').live('click', function(e) {
        e.preventDefault();
        var templateID = $(this).attr('id');
        if(!$('div.right_content').hasClass("loading")){
            $('div.right_content').addClass("loading").load('modules/forms/edit/templates.php?templateID=' + templateID, 
            function(){
                $(this).removeClass("loading");
            });
        }
    });
    
    $('a.bt_green').click(function(e) {
        e.preventDefault();
        $('div.right_content').load('modules/forms/addnew/' + $(this).attr('id'));
    });
    
    $('table tr').click(function() {

    	checkBox = $(this).children('td').children('input[type=checkbox]');
    
    	if(checkBox.attr('checked'))
            checkBox.removeAttr('checked');
        else
            checkBox.attr('checked', 'checked');

    });
    
    $('.ask').jConfirmAction( {
    	question : "Are you sure you want to delete the selected row?", 
    	yesAnswer : "Yes", 
    	cancelAnswer : "No", 
    	onYes: function(evt) { 
  		  templates(evt.target); 
    	}
    });
    
    $('.ask2').jConfirmAction( {
        question : "Are you sure you want to delete all selected rows?",
        questionClass: "question2", 
        onYes: function(evt){
            templatesArray(evt.target); 
        }
    });
    
    $('.viewAll').live('click', function(e) {
        e.preventDefault();
        oTable.fnLengthChange(-1);
        $(this).removeClass('viewAll').addClass('paginateRecords');
        $(this).find('strong').html('View Paginated Records');
        $('.pagination').hide();
    }); 
    
    $('.paginateRecords').live('click', function(e) {
        e.preventDefault();
        oTable.fnLengthChange(10);
        $(this).removeClass('paginateRecords').addClass('viewAll');
        $(this).find('strong').html('View All Site Templates'); 
        $('.pagination').show();          
    });
    
    function templates(whatsThis) {
        var templateID = $(whatsThis).parents('td').find('img').attr('id');
        var dataString = 'templateID=' + templateID + '&deleteTemplate=True'; 
        
        var iRow = oTable.fnGetPosition( $(whatsThis).parents('tr').get(0));

        $.ajax({ 
            type: "POST", 
            url: "processes/templates.php", 
            data: dataString,
            success: function(data) {
                if (data.errorsExist) {
                } else {
                    oTable.fnDeleteRow(iRow);     // remove the row from the table
                    if(oTable.fnSettings().fnRecordsTotal() == 0) {
                        $('.bt_red').remove();
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('div.pagination').remove();
                    }

                } 
            }
        });
    }

    
    function templatesArray(whatsThis) {
        var myNewArray = new Array(); 
        var aRow = new Array();
    
        $('input:checkbox[name="templates"]:checked').each(function(i) { 
            myNewArray.push($(this).val());
            aRow.push($(this).closest('tr')[0]);
        }); 
        var dataString = 'templatesArray=' + myNewArray + '&deleteTemplatesArray=True'; 
        $.ajax({ 
            type: "POST", 
            url: "processes/templates.php", 
            data: dataString,
            success: function(data) {
                if (data.errorsExist) {
                } else {
                    $(whatsThis).parents("tr").eq(0).hide(); 
                    for (i in aRow)  // loop over the array of row indexes
                      oTable.fnDeleteRow(aRow[i]);
                    if(oTable.fnSettings().fnRecordsTotal() == 0) {
                        $('.bt_red').remove();
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('div.pagination').remove();
                    }                      
                } 
            }
        });
        
    }
    
    });
Moving code around
===

I was just kind of curious if there is any of the coding here that I can place inside of the dataTables script. I have the the majority of the same coding on each of my module's javascript page so I thought with similar coding I can can put all of the same coding back into that dataTables page.

    $.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay ) {
    oSettings._iDisplayLength = iDisplay;
    oSettings.oApi._fnCalculateEnd( oSettings );

    /* If we have space to show extra rows (backing up from the end point - then do so */
    if ( oSettings._iDisplayEnd == oSettings.aiDisplay.length )
    {
        oSettings._iDisplayStart = oSettings._iDisplayEnd - oSettings._iDisplayLength;
        if ( oSettings._iDisplayStart < 0 )
        {
            oSettings._iDisplayStart = 0;
        }
    }

    if ( oSettings._iDisplayLength == -1 )
    {
        oSettings._iDisplayStart = 0;
    }

    oSettings.oApi._fnDraw( oSettings );

    $('select', oSettings.oFeatures.l).val( iDisplay );
    };

    $(document).ready(function() {
    
    var pageName = $('#pageName').val();    
    
    var oTable = $('#templatesPageList').dataTable( {
        "sDom": 'rti<"pagination"p>',
        "iDisplayLength": 10,
        "sPaginationType": "full_numbers"
    });
    
    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
        $('div.pagination').remove();
    } else {
        $('div.pagination').append();
    }
    if(oTable.fnSettings().fnRecordsTotal() == 0) {
        $('.bt_red').remove();
        $('.bt_blue').remove();
    }
    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
        $('.bt_blue').remove();
    }
    
    var info = $('.dataTables_info');
    $('tfoot tr td.rounded-foot-left').append(info);
    
    $('.edit').live('click', function(e) {
        e.preventDefault();
        var templateID = $(this).attr('id');
        if(!$('div.right_content').hasClass("loading")){
            $('div.right_content').addClass("loading").load('modules/forms/edit/templates.php?templateID=' + templateID, 
            function(){
                $(this).removeClass("loading");
            });
        }
    });
    
    $('a.bt_green').click(function(e) {
        e.preventDefault();
        $('div.right_content').load('modules/forms/addnew/' + $(this).attr('id'));
    });
    
    $('table tr').click(function() {

    	checkBox = $(this).children('td').children('input[type=checkbox]');
    
    	if(checkBox.attr('checked'))
            checkBox.removeAttr('checked');
        else
            checkBox.attr('checked', 'checked');

    });
    
    $('.ask').jConfirmAction( {
    	question : "Are you sure you want to delete the selected row?", 
    	yesAnswer : "Yes", 
    	cancelAnswer : "No", 
    	onYes: function(evt) { 
  		  templates(evt.target); 
    	}
    });
    
    $('.ask2').jConfirmAction( {
        question : "Are you sure you want to delete all selected rows?",
        questionClass: "question2", 
        onYes: function(evt){
            templatesArray(evt.target); 
        }
    });
    
    $('.viewAll').live('click', function(e) {
        e.preventDefault();
        oTable.fnLengthChange(-1);
        $(this).removeClass('viewAll').addClass('paginateRecords');
        $(this).find('strong').html('View Paginated Records');
        $('.pagination').hide();
    }); 
    
    $('.paginateRecords').live('click', function(e) {
        e.preventDefault();
        oTable.fnLengthChange(10);
        $(this).removeClass('paginateRecords').addClass('viewAll');
        $(this).find('strong').html('View All Site Templates'); 
        $('.pagination').show();          
    });
    
    function templates(whatsThis) {
        var templateID = $(whatsThis).parents('td').find('img').attr('id');
        var dataString = 'templateID=' + templateID + '&deleteTemplate=True'; 
        
        var iRow = oTable.fnGetPosition( $(whatsThis).parents('tr').get(0));

        $.ajax({ 
            type: "POST", 
            url: "processes/templates.php", 
            data: dataString,
            success: function(data) {
                if (data.errorsExist) {
                } else {
                    oTable.fnDeleteRow(iRow);     // remove the row from the table
                    if(oTable.fnSettings().fnRecordsTotal() == 0) {
                        $('.bt_red').remove();
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('div.pagination').remove();
                    }

                } 
            }
        });
    }

    
    function templatesArray(whatsThis) {
        var myNewArray = new Array(); 
        var aRow = new Array();
    
        $('input:checkbox[name="templates"]:checked').each(function(i) { 
            myNewArray.push($(this).val());
            aRow.push($(this).closest('tr')[0]);
        }); 
        var dataString = 'templatesArray=' + myNewArray + '&deleteTemplatesArray=True'; 
        $.ajax({ 
            type: "POST", 
            url: "processes/templates.php", 
            data: dataString,
            success: function(data) {
                if (data.errorsExist) {
                } else {
                    $(whatsThis).parents("tr").eq(0).hide(); 
                    for (i in aRow)  // loop over the array of row indexes
                      oTable.fnDeleteRow(aRow[i]);
                    if(oTable.fnSettings().fnRecordsTotal() == 0) {
                        $('.bt_red').remove();
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('.bt_blue').remove();
                    }
                    if(oTable.fnSettings().fnRecordsTotal() <= 10) {
                        $('div.pagination').remove();
                    }                      
                } 
            }
        });
        
    }
    
    });