$(document).ready(function() { 

/*documentation: show
xirrus GmbH, 2010, Lukas Schuler

the shower function does the following:
<a class="show" id="show#"></link> will be used as a button with any integer number
<div class="show" id="show#connected"></div> will be used as shower tooltip with corresponding integer number #
the shower function toggles between hidden and shown shower div, the link changes its text attribute
to the label_to_close declared below.

strict values (CSS and html):
class a.show
class div.show
id show1 show2 etc.
id show1connected show2connected etc.

the function works completely autonomous through ids of the show# links and div (show#connected)
*/
    var classidname = "show";
    var idextension = "connected";
    var label_to_close = '« ×';
    previousText = new Array();

	$("div." + classidname).hide();

	$("a." + classidname).click(function() {
    currentID = $(this).attr('id');

    if ($('#' + currentID).text() != label_to_close) {previousText[parseInt(currentID.substr(classidname.length,currentID.length - classidname.length))] = $('#' + currentID).text()};
		$('#' + currentID + idextension).toggle(150, function() { 
			if ($('#' + currentID + idextension).is(':hidden')) { 
	    	    $('#' + currentID).text(function(index) {return previousText[parseInt(currentID.substr(classidname.length,currentID.length - classidname.length))];});
			} else { 
				$('#' + currentID).text(function(index) {return label_to_close;});
			};
		}); 
	});

});
