$().ready(function() {

	var autoanim = $("#slides").attr("anim");
	if(autoanim == 'auto') {
		var testvar = true;
	} else {
		var testvar = false;
	}

	$("#controller").jFlow({  
		slides: "#slides",  
		width: "794px",  
		height: "434px",  
		duration: 500,
		auto: testvar
    });


/*
das flow-plugin sendet click-events zum weiter-sliden
darum muss der mouseup-event abgefragt werden, um zu checken, ob wirklich ein mausklick vorliegt
die manual-klasse muss also allen pfeilen, nummern und der lupe gegeben werden
*/

	$(".manual").mouseup(function() {
		$("#slides").attr('clicked','2');
	});


	$(".jFlowControl").click(function () { 
		var folder = $('#slides').attr("bereich");
		var sub = $('#s_'+i).attr("s");
		$('#showproject').attr("href", "./inx/_makeDetails_.php?f="+folder+'&s='+sub);
	});


	$("a.detailbox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'autoDimensions':	false,
		'autoScale'		:	false,
		'width'			:	810,
		'height'		:	480,
	});


	tooltip();
});

// für die lupe überm bild
this.tooltip = function(){	
	xOffset = 50;//ver
	yOffset = 10;//hor	
	// these 2 variable determine popup's distance from the cursor
	// you might want to adjust to get the right result		
	$(".tooltip").hover(function(e){											  
		$("body").append("<img id='tooltip' src='lupe.png' />");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		$("#tooltip").remove();
    });	
	$(".tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



