$(document).ready(function() {

	/***** Open link in new window *****/

    $('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });
    
    /***** Scrollbar *****/
    
    $('#menuPictures').jScrollPane({scrollbarWidth:4});
    
    /***** Submenu *****/
    
  	$("ul.topnav li span").hover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
 
		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});
 
		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	
	/***** Fancybox *****/
	
	$("#standardThumbs a.group").fancybox({
		'overlayOpacity'	:	'0.7',
		'overlayColor'		:	'#000',
		'titlePosition'		:	'over',
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	300, 
		'speedOut'			:	100,
		'cyclic'			:	true,
	});

	$("#wideThumbs a.group").fancybox({
		'overlayOpacity'	:	'0.7',
		'overlayColor'		:	'#000',
		'titlePosition'		:	'over',
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	300, 
		'speedOut'			:	100,
		'cyclic'			:	true,
	});
	
	/***** Open video onload picture page *****/
	
	$("#video").fancybox({
	
	
		onCleanup			:	function(){$('#inlineVideo').css('display','none')},
		'overlayOpacity'	:	'0.7',
		'overlayColor'		:	'#000',
		'titlePosition'		:	'over',
		'transitionIn'		:	'none',
		'transitionOut'		:	'none',
		'cyclic'			:	true,
	}).trigger('click');
	
	/***** Contactform *****/

	/* Label in input */

	$("label").inFieldLabels();
	
	/* Send form */
	
	$('#contactLeft form').submit(function(){
		$('#confirm').load('/nl/contact/a/submit', $(this).serializeArray());		
		return false;
	})
	
});
