$(document).ready(function(){
	var currentL = 0;
	
	// Insert controls in the DOM
	$('#leistungen')
		.append('<a id="aL"><span class="openL"></span><span class="closeL"></span></a>');
	
	// Hide closeL on first load
  	manageL(currentL);
	
	// Create event listeners for clicks
	$("#aL").click(function(event) {
		//alert(currentL);
		// Determine new currentHeight
		currentHeight = (currentL==0) ? "560px" : "1px";
		// Open/Close Content
		$("#leistungen_content").animate({
			height: currentHeight
		}, 500 );
		
		// Determine new currentL
		currentL = (currentL==0) ? 1 : 0;
		// Hide / show controls
		manageL(currentL);
		
		event.preventDefault();
	});
	
	// manageControls: Hides and Shows controls depending on currentPosition
	function manageL(pos){
		// Hide left arrow if position is first slide
		if(pos==0){
			$('.closeL').hide();
			$('.openL').show();
		} else{
			$('.closeL').show();
			$('.openL').hide();
		}
	}
});
