/* Docready Script fengshui-praxis.ch */
/* Amport Webdesign 2011 */


$(document).ready(function() {


/* Fancy Anker Scroll Effekte */
$.localScroll();


    $('#galcont').nivoSlider({
        effect:'fade',
        animSpeed:1000, //Slide transition speed
        pauseTime:6000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:false, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Na
        keyboardNav:false, //Use left & right arrows
        pauseOnHover:false, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.8 //Universal caption opacity
    });


/* Fancybox */
$("a.fancybox").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});



/* Fengshui Quiz */

    var punktestand = 0;
    var beantwortetefragen = 0;
    var anzahlfragen = $('.frage-row').size();

    function ihrepunkte(pluspunkt){

       punktestand = punktestand + pluspunkt;

       $(".punktestand").html(punktestand);

    };
    
    
    function fragebeantwortet(richtig){
        beantwortetefragen = beantwortetefragen +1;
        
        if (beantwortetefragen >= anzahlfragen) {
            $(".naechstefrage").html("Das Bild zum Schluss...");
        	$(".bildzumschluss").show();
            $(".quiz-beendet").animate({right: 0}, 1200 );
            $(".quiz-punktestand").animate({right: 0}, 500 );
            $(".quiz-punktestand").animate({right: -30}, 800 );
            
        }
        else if (richtig) {
            $(".quiz-punktestand").animate({right: 0}, 500 );
            $(".quiz-punktestand").animate({right: -30}, 800 );
        }
    };
    
	
	$(".antwort-istrichtig").hide();
	$(".antwort-istfalsch").hide();
	$(".aufloesung").hide();
	$(".bildzumschluss").hide();
	ihrepunkte(0);
	
	
	

	$(".richtig").one("click", function () { 
	$(this).addClass("angeklickt");
      $(this).parent().parent().find(".antwort-istrichtig").show();
      $(this).parent().parent().find(".aufloesung").slideDown();
      ihrepunkte(1);
      $(this).parent().find("div").unbind(event);
      fragebeantwortet(true);
      
    });

    
    $(".falsch").one("click", function () { 
    $(this).addClass("angeklickt");
      $(this).parent().parent().find(".antwort-istfalsch").slideDown();
      $(this).parent().parent().find(".aufloesung").slideDown();
      $(this).parent().find("div").unbind(event);
      fragebeantwortet();
    });
	
	
      $(".naechstefrage").click(function () { 
         $(this).parents(".frage-row").slideUp("slow");
      });
	
	
	  
	  
	  /* Menu Animation */
        $('#nav').superfish({ 
            delay:       1000,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false,                          // disable drop shadows
            pathClass:   'active'   
        }); 
   
   
 });
