//begin main function all coding will be within this main function
$(document).ready(function() {
						   

//Set Current Url Equal to a Variable, current_url.
current_url= window.location.hostname;
 	//Sets the directory table equal to a variable and makes it a jquery.dataTable
	the_table = $('#FacDirectory').dataTable({
		//turns of the default paginate so it will display full list on load									 
		"bSort": false,
		"bPaginate": false,
		"aoColumns":[
					 
					null,
					null,
					null,
					null,
					{ "bVisible": false }
					]
		
	});
	//calls a change function for when the user selects the drop down menu
	//begin first function with drop down menu #ci_dir
	$('#ci_dir').change(function() {
		my_val = $(this).children('option:selected').attr('value');
//these are all referiing to the options within the select tags
		if (my_val == 'all')
			
			location.href='?list=all';
		 if(my_val == 'dean')
		
			location.href='?list=dean';
		else if(my_val =='lib')
			
			location.href='?list=lib';
		else if(my_val =='faculty')
		
			location.href='?list=faculty';
		else if(my_val =='staff')
		
			location.href='?list=staff';
		else if(my_val =='adjunct')
		
			location.href='?list=adjunct';
		else if(my_val =='other')
		
			location.href='?list=other';
		else if(my_val =='helpdesk')
			
			location.href='?list=helpdesk';
		else if(my_val =='deansstaff')
			
			location.href='?list=deansstaff';
		else if(my_val =='clinicaleducator')
			
			location.href='?list=clinicaleducator';
		else
			location.href='?list=all';
	});
	//end first function
	
	//begin second function with drop down #school_dir

	$('#school_dir').change(function() {
		my_val = $(this).children('option:selected').attr('value');

		if (my_val == 'all')
			
			the_table.fnFilter('', 4);
			//location.href='?school_dir=all'

		else if(my_val == 3)
			
			//alert('Library of Information Studies')
			the_table.fnFilter(my_val, 4);
			//location.href='?school_dir=3'
		else if(my_val == 1)
			
			//alert('School of Communication')
			the_table.fnFilter(my_val, 4);
			//location.href='?school_dir=1'
		else if(my_val == 2)
			
			//alert('School of Communication Disorders')
			the_table.fnFilter(my_val, 4);
			//location.href='?school_dir=2'
		else if(my_val == 4)
			
			//alert('School of Communication &amp; Information')
			the_table.fnFilter(my_val, 4);
			//location.href='?school_dir=4'
		else
			
			the_table.fnFilter('', 4);
	});
	//end second function
	
	//This will take the current url and when the page loads will automatically sort the page according to school
	//compares url to predicted url
/*	if (current_url == 'dev.cci.fsu.edu')
	{
		//set the value in the filtered column
		my_val="4";
		
		//chooses value in drop down
		$("#school_dir").val(my_val);
		
		//filters the table accordingly
		the_table.fnFilter(my_val, 4);
	}
	else if (current_url == 'dev.slis.fsu.edu')
	{
		//set the value in the filtered column
		my_val="3";
		
		//chooses value in drop down
		
		
		//filters the table accordingly
		the_table.fnFilter(my_val, 4);
	}
	else if (current_url == 'cci.fsu.edu')
	{
		//set the value in the filtered column
		my_val="4";
		
		//chooses value in drop down
		$("#school_dir").val(my_val);
		
		//filters the table accordingly
		the_table.fnFilter(my_val, 4);
	}
	else if (current_url == 'slis.fsu.edu')
	{
		//set the value in the filtered column
		my_val="3";
		
		//chooses value in drop down
		$("#school_dir").val(my_val);
		
		//filters the table accordingly
		the_table.fnFilter(my_val, 4);
	}
	else if (current_url == 'slis.cci.fsu.edu')
	{
		//set the value in the filtered column
		my_val="3";
		
		//chooses value in drop down
		$("#school_dir").val(my_val);
		
		//filters the table accordingly
		the_table.fnFilter(my_val, 4);
	}
	else 
	{
		my_val=" ";
			
			$("#school_dir").val(my_val);
			the_table.fnFilter(my_val, 4);
	}
*/






});
//end main function
