// JavaScript Document
$(document).ready(function() {
	$("a.fb").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0.6,
		'overlayColor'	:	'#FFF',
		'centerOnScroll':	true,
		'cyclic'		:	true,
		'titlePosition'	:	'over',
		'onComplete'	:	function() {
								$("#fancybox-wrap").hover(function() {
									$("#fancybox-title").show();
								}, function() {
									$("#fancybox-title").hide();
								});
							}

	});

	$("div.fbhinweis").fancybox({
		'transitionIn'	:	'none',
		'transitionOut'	:	'elastic',
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0,
		'overlayColor'	:	'#FFF',
		'centerOnScroll':	true,
		'cyclic'		:	false,
		'titlePosition'	:	'over'
	});
	$("div.fbhinweis").trigger('click');
	

	//find all form with class jqtransform and apply the plugin
	$("form.jqtransform").jqTransform();
	$("form.jqtransform select").addClass("hideme");
	$.preloadCssImages();
	
	// SLIDER
	$("#projekt_bilder").slides({
		preload: true,
		preloadImage: '/templates/js/img/lightbox-ico-loadingbar.gif',
		generatePagination: false,
		effect: 'fade',
		crossfade: true,
		fadeSpeed: 900,
		play: 6000
	});
	
	// FOLLOWER / TOOL-TIP
	// PREV
	$("a.prev").mousemove(function(e){
        $("#tooltip").show();
		var x = e.pageX; var y = e.pageY; var mL = -Math.round($("#tooltip").width()/2);
        $("#tooltip").css({
            top: y + "px",
            left: x + "px",
			marginLeft: mL + "px"
        });
        $("#tooltip").find("div#tip").html("Previous");
    });
    $("a.prev").mouseleave(function(e){
        $("#tooltip").hide();
    });
	// NEXT
	$("a.next").mousemove(function(e){
        $("#tooltip").show();
		var x = e.pageX; var y = e.pageY; var mL = -Math.round($("#tooltip").width()/2);
        $("#tooltip").css({
            top: y + "px",
            left: x + "px",
			marginLeft: mL + "px"
        });
        $("#tooltip").find("div#tip").html("Next");
    });
    $("a.next").mouseleave(function(e){
        $("#tooltip").hide();
    });
	
	
});
