$(document).ready(function(){
			
	$("input#autocomplete").autocomplete({
    	source: 'proc/autocomplete.php'
	});
	
	
	//FILTERBUTTONS AUSTAUSCHEN
	$('#filter_where').live("click", function() {
		var imgSrc = $(this).attr("src");
	
		if(imgSrc == "./img/plus_gr.gif"){
			//MIT MINUS ERSETZEN UND FILTER EINBLEDEN	
			$(this).replaceWith('<img src="./img/minus_gr.gif" id="filter_where">');
			$('#box_where').fadeIn(500);
		}
		else{
			//MIT PLUS ERSETZEN UND FILTER AUSBLENDEN			
			$(this).replaceWith('<img src="./img/plus_gr.gif" id="filter_where">');
			$('#box_where').fadeOut(500);
		}

	});
	
	$('#filter_type').live("click", function() {
		var imgSrc = $(this).attr("src");
		
		if(imgSrc == "./img/plus_gr.gif"){
			//MIT MINUS ERSETZEN UND FILTER EINBLEDEN	
			$(this).replaceWith('<img src="./img/minus_gr.gif" id="filter_type">');
			$('#box_type').fadeIn(500);
		}
		else{
			//MIT PLUS ERSETZEN UND FILTER AUSBLENDEN			
			$(this).replaceWith('<img src="./img/plus_gr.gif" id="filter_type">');
			$('#box_type').fadeOut(500);
		}
	});
	
	$('#filter_lang').live("click", function() {
		var imgSrc = $(this).attr("src");
		
		if(imgSrc == "./img/plus_gr.gif"){
			//MIT MINUS ERSETZEN UND FILTER EINBLEDEN	
			$(this).replaceWith('<img src="./img/minus_gr.gif" id="filter_lang">');
			$('#box_lang').fadeIn(500);
		}
		else{
			//MIT PLUS ERSETZEN UND FILTER AUSBLENDEN			
			$(this).replaceWith('<img src="./img/plus_gr.gif" id="filter_lang">');
			$('#box_lang').fadeOut(500);
		}
	});
	
	$('#filter_meta').live("click", function() {
		var imgSrc = $(this).attr("src");
		
		if(imgSrc == "./img/plus_gr.gif"){
			//MIT MINUS ERSETZEN UND FILTER EINBLEDEN	
			$(this).replaceWith('<img src="./img/minus_gr.gif" id="filter_meta">');
			$('#filter_area').append('<div id="box_meta" class="filter_box"><p class="filter_header">META</p><table style="width:100%"><tr><td width="1"><input type="checkbox" name="select_meta[]" value="author" checked="checked"></td><td class="filter_content_left"> Author </td><td width="1"><input type="checkbox" name="select_meta[]" value="judge" checked="checked"></td><td class="filter_content_left"> Judge </td></tr><tr><td width="1"><input type="checkbox" name="select_meta[]" value="party" checked="checked"></td><td class="filter_content_left"> Party </td><td width="1"></td></tr></table></div>');
		}
		else{
			//MIT PLUS ERSETZEN UND FILTER AUSBLENDEN			
			$(this).replaceWith('<img src="./img/plus_gr.gif" id="filter_meta">');
			$('#box_meta').remove();
		}
	});
	
	//EIN UND AUSBLENDEN VON THREADS
	$('.f_documents_showhide').live("click", function(){
		$(this).parent().next().toggle();
		
		if($(this).html() == "hide"){
			$(this).html("show");	
		}
		else{
			$(this).html("hide");	
		}
	});
	
});
