$.ajaxSetup ({
  cache: false
});

var user_lexikonwrapper__entry_last_opened = 0;
var user_lexikonwrapper__text_of_entry_last_opened;
function user_lexikonwrapper__close_last_description(){
	if(user_lexikonwrapper__entry_last_opened > 0) {
		$("#mehr_box_"+user_lexikonwrapper__entry_last_opened).toggle("fast")
		$("#mehr_box_"+user_lexikonwrapper__entry_last_opened).html(user_lexikonwrapper__text_of_entry_last_opened);
		$("#mehr_box_"+user_lexikonwrapper__entry_last_opened).css({'font-weight' : 'normal'});
		$("#mehr_box_"+user_lexikonwrapper__entry_last_opened).toggle("fast")
		$("#mehr_but_"+user_lexikonwrapper__entry_last_opened).show();
	}
};

function user_lexikonwrapper__open_description(id, search_name, script_path) {
	$(document).ready(function(){
		$("#mehr_but_"+id).click(function () {
			user_lexikonwrapper__register_ajax_toggle(id, search_name, script_path);
			});
		$("#entry_but_"+id).click(function() {
			user_lexikonwrapper__register_ajax_toggle(id, search_name, script_path);
			});
		});
};

function user_lexikonwrapper__register_ajax_toggle(id, search_name, script_path) {
		if(id == user_lexikonwrapper__entry_last_opened) return;
		user_lexikonwrapper__close_last_description();
		user_lexikonwrapper__entry_last_opened = id;
		user_lexikonwrapper__text_of_entry_last_opened = $("#mehr_box_"+id).html();
		$("#mehr_box_"+id).slideUp("fast");
		$("#mehr_box_"+id).load(script_path+"/lexikon/ajax.php?search_id="+id+"&search_name="+search_name, function() {
			$("#mehr_but_"+id).hide();
			$("#mehr_box_"+id).css({'font-weight' : 'bold'});
			$("#mehr_box_"+id).slideDown("fast");
			});
};

