/**
 * Javascript - jQuery enabled
 * 
 * @package WPFramework
 * @subpackage Media
 */

/* Example jQuery
jQuery(document).ready(function($) {
	alert('jQuery + screen.js is loaded and ready to go!');
});
*/

// Dropdown menu using superfish
jQuery(document).ready(function($) {
	
	$('.nav')
	/*.supersubs({
		minWidth: 		9,						// requires em unit.
		maxWidth: 		25,						// requires em unit.
		//extraWidth: 	0						// extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
    })*/.superfish({
		hoverClass:		'sfHover',			// the class applied to hovered list items 
		//pathClass:		'overideThisToUse',		// the class you have applied to list items that lead to the current page 
		pathLevels:		2,						// the number of levels of submenus that remain open or are restored using pathClass 
		delay:			400,					// the delay in milliseconds that the mouse can remain outside a submenu without it closing 
		animation:		{opacity:'show'},		// an object equivalent to first parameter of jQuery’s .animate() method 
		speed:			'normal',				// speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
		autoArrows:		true,					// if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
		disableHI:		false
		//onInit:			function(){},			// callback function fires once Superfish is initialised – 'this' is the containing ul 
	//	onBeforeShow:	function(){},			// callback function fires just before reveal animation begins – 'this' is the ul about to open 
	//	onShow:			function(){},			// callback function fires once reveal animation completed – 'this' is the opened ul 
	//	onHide:			function(){}			// callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
	});
	
//$("input").attr("value", "Verstuur"); 
$('body.pageid-42 input[type=submit]').val("Verstuur");
$('body.pageid-578 input[type=submit]').val("Submit");

$('body.pageid-578 p.wpmlaknowledgement').text("<b>Some</b> new text.");

	
var galleries = $('.ad-gallery').adGallery({
  loader_image: 'http://www.hollandschap.nl/wp/wp-content/themes/hollandschap/library/media/js/ajax-loader.gif',
  width: 700, // Width of the image, set to false and it will read the CSS width
  //height: 430, // Height of the image, set to false and it will read the CSS height
  thumb_opacity: 0.7, // Opacity that the thumbs fades to/from, (1 removes fade effect)
                      // Note that this effect combined with other effects might be resource intensive
                      // and make animations lag
  start_at_index: 0, // Which image should be displayed at first? 0 is the first image
  animate_first_image: true, // Should first image just be displayed, or animated in?
  animation_speed: 600, // Which ever effect is used to switch images, how long should it take?
  display_next_and_prev: false, // Can you navigate by clicking on the left/right on the image?
  display_back_and_forward: true, // Are you allowed to scroll the thumb list?
  scroll_jump: 2, // If 0, it jumps the width of the container
  slideshow: {
    enable: true,
    autostart: true,
    speed: 5000,
    start_label: 'Start',
    stop_label: 'Stop',
    stop_on_scroll: true, // Should the slideshow stop if the user scrolls the thumb list?
    countdown_prefix: '(', // Wrap around the countdown
    countdown_sufix: ')',
    onStart: function() {
      // Do something wild when the slideshow starts
    },
    onStop: function() {
      // Do something wild when the slideshow stops
    }
  },
  effect: 'resize', // or 'slide-vert', 'resize', 'fade', 'none' or false
  enable_keyboard_move: true, // Move to next/previous image with keyboard arrows?
  cycle: true, // If set to false, you can't go from the last image to the first, and vice versa
  // All callbacks has the AdGallery objects as 'this' reference
  callbacks: {
    // Executes right after the internal init, can be used to choose which images
    // you want to preload
    init: function() {
      // preloadAll uses recursion to preload each image right after one another
      //this.preloadAll();
      // Or, just preload the first three
      this.preloadImage(0);
      this.preloadImage(1);
      this.preloadImage(2);
    },
    // This gets fired right after the new_image is fully visible
    afterImageVisible: function() {
      // For example, preload the next image
      var context = this;
      this.loading(true);
      this.preloadImage(this.current_index + 1,
        function() {
          // This function gets executed after the image has been loaded
          context.loading(false);
        }
      );

      // Want slide effect for every other image?
      if(this.current_index % 2 == 0) {
        this.settings.effect = 'resize';
      } else {
        this.settings.effect = 'resize';
      }
    },
    // This gets fired right before old_image is about to go away, and new_image
    // is about to come in
    beforeImageVisible: function(new_image, old_image) {
      // Do something wild!
    }
  }
});


var galleries = $('.ad-gallery-home').adGallery({
  loader_image: 'http://www.hollandschap.nl/wp/wp-content/themes/hollandschap/library/media/js/ajax-loader.gif',
  width: 700, // Width of the image, set to false and it will read the CSS width
  //height: 430, // Height of the image, set to false and it will read the CSS height
  thumb_opacity: 1, // Opacity that the thumbs fades to/from, (1 removes fade effect)
                      // Note that this effect combined with other effects might be resource intensive
                      // and make animations lag
  start_at_index: 0, // Which image should be displayed at first? 0 is the first image
  animate_first_image: true, // Should first image just be displayed, or animated in?
  animation_speed: 600, // Which ever effect is used to switch images, how long should it take?
  display_next_and_prev: true, // Can you navigate by clicking on the left/right on the image?
  display_back_and_forward: false, // Are you allowed to scroll the thumb list?
  scroll_jump: 0, // If 0, it jumps the width of the container
  slideshow: {
    enable: true,
    autostart: true,
    speed: 5000,
    start_label: 'Start',
    stop_label: 'Stop',
    stop_on_scroll: false, // Should the slideshow stop if the user scrolls the thumb list?
    countdown_prefix: '(', // Wrap around the countdown
    countdown_sufix: ')',
    onStart: function() {
      // Do something wild when the slideshow starts
    },
    onStop: function() {
      // Do something wild when the slideshow stops
    }
  },
  effect: 'resize', // or 'slide-vert', 'resize', 'fade', 'none' or false
  enable_keyboard_move: true, // Move to next/previous image with keyboard arrows?
  cycle: true, // If set to false, you can't go from the last image to the first, and vice versa
  // All callbacks has the AdGallery objects as 'this' reference
  callbacks: {
    // Executes right after the internal init, can be used to choose which images
    // you want to preload
    init: function() {
      // preloadAll uses recursion to preload each image right after one another
      //this.preloadAll();
      // Or, just preload the first three
      this.preloadImage(0);
      this.preloadImage(1);
      this.preloadImage(2);
    },
    // This gets fired right after the new_image is fully visible
    afterImageVisible: function() {
      // For example, preload the next image
      var context = this;
      this.loading(true);
      this.preloadImage(this.current_index + 1,
        function() {
          // This function gets executed after the image has been loaded
          context.loading(false);
        }
      );

      // Want slide effect for every other image?
      if(this.current_index % 2 == 0) {
        this.settings.effect = 'resize';
      } else {
        this.settings.effect = 'resize';
      }
    },
    // This gets fired right before old_image is about to go away, and new_image
    // is about to come in
    beforeImageVisible: function(new_image, old_image) {
      // Do something wild!
    }
  }
});



// Set image description
//some_img.data('ad-desc', 'This is my description!');

// Change effect on the fly
//galleries[0].settings.effect = 'fade';

	$.fn.search = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});

};
$("#s").focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
	}
}).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	} });

$('div#children ul li a img').css('opacity', 0.7);

$('div#children ul li').hover(
        function() {
            $(this).find('img').css('opacity', 1.0).end()
            	.find('a.h2link').css('text-indent',-9999);
        },
        function() {
            $(this).find('img').css('opacity', 0.7).end()
            	.find('a.h2link').css('text-indent',0);
        });

//$("a[rel^='prettyPhoto']").prettyPhoto();

});