$(document).ready(function() { 

/*documentation: imagehelp
xirrus GmbH, 2011, Lukas Schuler

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

strict values (CSS and html):
class a.help
class div.help
id help1 help2 etc.
id help1connected help2connected etc.

the function works completely autonomous through ids of the help# links and div (help#connected)
*/
    var classidname = "help";
    var imgextension = "image";
    var imgdefaultsize = "160";
    var imgsmallsize = "80";
    var idextension = "connected";
    var label_to_close = '« ×';
    previousText = new Array();
    previousIMG = new Array();
    previousLeftMargin = new Array();

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


	$("a." + classidname).click(function() {
    	currentID = $(this).attr('id');
    	var img = $(this).find("img")[0];
	    currentIMG = $(img).attr('src');

	    if (currentIMG != "/img_intro/Schliessen.png") {
	    	previousIMG[currentID] = $(img).attr('src');
		    $(img).attr('src',"/img_intro/Schliessen.png");
		    previousLeftMargin[currentID] = $(img).css('marginLeft');
		    if ($(img).css('marginLeft') == "-1px") {$(img).css('marginLeft',"-250px");};
		    $(img).width(imgsmallsize);
		    $(img).height(imgsmallsize);
		    $(img).show('slow');
		} else {
		    $(img).attr('src',previousIMG[currentID]);
		    $(img).css('marginLeft',previousLeftMargin[currentID]);
		    $(img).width(imgdefaultsize);
		    $(img).height(imgdefaultsize);
		    $(img).show('fast');
		};

		$('#' + currentID + idextension).toggle(150, function() { 
			if ($('#' + currentID + idextension).is(':hidden')) { 
			} else { 
			};
		});
	});
});

