$(document).ready(function(){
	jQuery(function(){jQuery(document).pngFix();});
	$("a.zoom").fancybox({
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">' + (title && title.length ? title : '&nbsp;' ) + '</span>';
		}
	});

});

jQuery.fn.initMenu = function() {  
    return this.each(function(){
        var theMenu = $(this).get(0);
        $('.acitem', this).hide();
        $('li.expand > .acitem', this).show();
        $('li.expand > .acitem', this).prev().addClass('active');
        $('li a', this).click(
            function(e) {
                e.stopImmediatePropagation();
                var theElement = $(this).next();
                var parent = this.parentNode.parentNode;
                if($(parent).hasClass('noaccordion')) {
                    if(theElement[0] === undefined) {
                        window.location.href = this.href;
                    }
                    $(theElement).slideToggle('normal', function() {
                        if ($(this).is(':visible')) {
                            $(this).prev().addClass('active');
                        }
                        else {
                            $(this).prev().removeClass('active');
                        }    
                    });
                    return false;
                }
                else {
                    if(theElement.hasClass('acitem') && theElement.is(':visible')) {
                        if($(parent).hasClass('collapsible')) {
                            $('.acitem:visible', parent).first().slideUp('normal', 
                            function() {
                                $(this).prev().removeClass('active');
                            }
                        );
                        return false;  
                    }
                    return false;
                }
                if(theElement.hasClass('acitem') && !theElement.is(':visible')) {         
                    $('.acitem:visible', parent).first().slideUp('normal', function() {
                        $(this).prev().removeClass('active');
                    });
                    theElement.slideDown('normal', function() {
                        $(this).prev().addClass('active');
                    });
                    return false;
                }
            }
        }
    );
});
};

$(document).ready(function() {$('.linksnieuws').initMenu();});

jQuery(function($){
	$("#contact").validate();
});


var timer;
var speed = 8000;

jQuery(function($) {
	timer = setTimeout(Green, 0);
});

function Green() {
	$(".green").css({left: 0}).
		animate({left: 215}, speed, "linear").
		animate({left: 0}, speed, "linear", function() {
		timer = setTimeout(Green, 0);
	});
}

$(function() {
    $('#pause').click(function() { $('#slides').cycle('pause'); return false; });
    $('#prev').click(function() { $('#slides').cycle('pause'); return false; });
    
    $('#slideshow').hover(
        function() { $('#controls').fadeIn(); },
        function() { $('#controls').fadeOut(); $('#slides').cycle('resume'); }
    );
    
    $('#slides').cycle({
        fx:     'fade',
        speed:   400,
        timeout: 6500,
        next:   '#next',
        prev:   '#prev'
    });
});
