// jQuery basic
jQuery.noConflict();

// fullscreen
// You need to specify the size of your background image here (could be done automatically by some PHP code)
var FullscreenrOptions = {  width: 1500, height: 1000, bgID: '#bgimg' };
// This will activate the full screen background!
jQuery.fn.fullscreenr(FullscreenrOptions);

// navigation: superfish initialise plugins
jQuery(document).ready(function() {
	jQuery('ul.sf-menu').superfish({
 		delay: 1000,  // one second delay on mouseout 
 		animation: {opacity:'show',height:'show'},  // fade-in and slide-down animation 
 		speed: 'fast'  // faster animation speed 
 	});

	// jQuery AnythingSlider settings
	jQuery('.items').anythingSlider({
		width           : 920,       		// if resizeContent is false, this is the default width if panel size is not defined		delay           : 5000,      		// How long between slideshow transitions in AutoPlay mode (in milliseconds)
		height          : 457,       		// if resizeContent is false, this is the default width if panel size is not defined		delay           : 5000,      		// How long between slideshow transitions in AutoPlay mode (in milliseconds)
		resizeContent	: false,
		animationTime   : 1000,       		// How long the slideshow transition takes (in milliseconds)
		delay           : 5000,     		// How long between slideshow transitions in AutoPlay mode (in milliseconds)
		easing          : "easeInOutExpo",	// Anything other than "linear" or "swing" requires the easing plugin
		hashTags        : true,      		// Should links change the hashtag in the URL?
		maxOverallWidth : 32766,    			// Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
		autoPlay        : true,      		// This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
        pauseOnHover	: true,				// If true, and autoPlay is enabled, the show will pause on hover
		startText       : "&nbsp;",   			// Start button text
		stopText        : "&nbsp;",	   		// Stop button text
		buildNavigation : false,      		// If true, builds a list of anchor links to link to each panel
		buildArrows     : true,     		// If true, builds the forwards and backwards buttons
		forwardText     : "&nbsp;", 			// Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
		backText        : "&nbsp;"			// Link text used to move the slider back (hidden by CSS, replace with arrow image)
	});

	// caption slider
	jQuery("#teaser .item .caption").css('top', '0px');
	jQuery("#teaser .image .caption").css('top', '0px');

    jQuery('#teaser .item').hover(function() {
        jQuery(".caption", this).stop().animate({
            top: '-30px'
        }, {
            queue: false,
            duration: 250
        });
    }, function() {
        jQuery(".caption", this).stop().delay(300).animate({
            top: '0px'
        }, {
            queue: true,
            duration: 400
        });
    });
    
    jQuery('#teaser .image').hover(function() {
        jQuery(".caption", this).stop().animate({
            top: '-30px'
        }, {
            queue: false,
            duration: 250
        });
    }, function() {
        jQuery(".caption", this).stop().delay(300).animate({
            top: '0px'
        }, {
            queue: true,
            duration: 400
        });
    });
    
    // remove padding from every 3th home link
    jQuery(".home-link:nth-child(3n)").addClass('no-space');
});

// banner content - show on page enter
jQuery(document).ready(function() {
	// hide banner movie first
	jQuery('.banner .movieContainer').hide();
	
	// animate banner
	jQuery(document).ready(function() {
	    jQuery('.banner').stop().delay(2000).animate(
			{ left: 860 }, {
			    duration: 1200,
			    easing: 'easeInOutElastic'
			}
		);
	});
	
	// show banner movie after animation finished
	jQuery('.banner .movieContainer').delay(3000).show('slow');
	
	/// easing banner - toggle on click
    jQuery('a.close').click(function(event) {
        jQuery(".banner").animate( { 
        	left: 660 }, {
            duration: 500,
            easing: 'easeOutBack'
        });
        
        jQuery(".out").animate( { 
        	left: 860 }, {
            duration: 500,
            easing: 'easeInBack'
        });

    	jQuery(".banner").toggleClass("out");
    	jQuery('a.close').toggleClass("active");
    });
});

// fade image link sibblings (only image link)
jQuery(document).ready(function() {
	//area 1
	jQuery('.image-link').hover(function() {
		jQuery(this).siblings('.image-link').stop().fadeTo(200,0.5);
	}, function() {
		jQuery(this).siblings('.image-link').stop().fadeTo(400,1);
	});
});

// toggle active class of movies
jQuery(document).ready(function() {
	jQuery('.moviePlayButton').click(function() {
		jQuery('.moviePlayButton').removeClass("active-movie").stop();
		jQuery(this).toggleClass("active-movie");
	});
    jQuery('#teaser').click(function() {
    	jQuery('.moviePlayButton').removeClass("active-movie");
	});

});
