Hello!
I am a newbie and I am having trouble with the javascript on an assignment for school. I am using some DataTables framework. I am trying to use a few different functions the framework provides, but I can't seem to figure out how to get the javascript to work properly. I want a table that can be filtered and the filtered results can be exported to pdf, csv, xls, or just copied. When I try to combine the code for these functions, I get errors.

Here is some of the code:

Code:
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				var oTable;
				
				/* Add the events etc before DataTables hides a column */
				$("thead input").keyup( function () {
					/* Filter on the column (the index) of this element */
					oTable.fnFilter( this.value, oTable.oApi._fnVisibleToColumnIndex( 
						oTable.fnSettings(), $("thead input").index(this) ) );
				} );
				
				/*
				 * Support functions to provide a little bit of 'user friendlyness' to the textboxes
				 */
				$("thead input").each( function (i) {
					this.initVal = this.value;
				} );
				
				$("thead input").focus( function () {
					if ( this.className == "search_init" )
					{
						this.className = "";
						this.value = "";
					}
				} );
				
				$("thead input").blur( function (i) {
					if ( this.value == "" )
					{
						this.className = "search_init";
						this.value = this.initVal;
					}
				} );
				
				oTable = $('#example').dataTable( {
					"sDom": 'RC<"clear">lfrtip',
					"aoColumnDefs": [
						{ "bVisible": false, "aTargets": [ 2 ] }
					],
					"oLanguage": {
						"sSearch": "Search all columns:"
					},
					"bSortCellsTop": true
				} );
			} );
		</script>
<script type="text/javascript" charset="utf-8">
				$(document).ready( function () {
    				$('#example').dataTable( {
      				  "sDom": 'T<"clear">lfrtip',
     				   "oTableTools": {
            			"sSwfPath": "/swf/copy_csv_xls_pdf.swf"
        }
    } );
} );
</script>
I apologize if I am not explaining myself well. I would appreciate any insight anyone can offer

Thanks in advance for your time