/**
 * jQuery for the intropage
 */
jQuery.noConflict();

//JQuery plugin: Lavalamp (for the menu's)
jQuery(document).ready(function() {
	//jQuery("ul.lavaLamp").mouseover();
	jQuery('.nav').lavaLamp({
		//fx: 'easeInExpo',
		speed: 355,
		setOnClick: true,
		autoReturn: false
	});
	
	var activateMenuAnimation = true;
	
	if ( jQuery.browser.msie ) {
	  var ieVersion = parseInt(jQuery.browser.version, 10);
	  
	  if (ieVersion < 9) {
		  // IE becomes a mess with animating Cufon text
		  activateMenuAnimation = false;
	  }
	  
	}

	if (activateMenuAnimation) {
		// fade the navigation links
		jQuery('.nav li a').hover(function(){
			jQuery(this).animate({
				opacity: 0.68
			}, 500);
		}, function () {
			jQuery(this).animate({
				opacity: 1
			}, 500);
		});
	}
});

// Slideshow banners
jQuery(document).ready(function() {
    jQuery('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
});

//// Horizontal and Vertical alignment
// Horizontal alignment for the frontpage > organisatie navigation
(function (jQuery) {
jQuery.fn.vAlign = function() {
	return this.each(function(i){
		var h = jQuery(this).height();
		var oh = jQuery(this).outerHeight();
		var mt = (h + (oh - h)) / 2;
		jQuery(this).css("margin-top", "-" + mt + "px");
		jQuery(this).css("top", "50%");
		jQuery(this).css("position", "absolute");
	});
};
})(jQuery);

(function (jQuery) {
jQuery.fn.hAlign = function() {
	return this.each(function(i){
		var w = jQuery(this).width();
		var ow = jQuery(this).outerWidth();
			var ml = (w + (ow - w)) / 2;
			jQuery(this).css("margin-left", "-" + ml + "px");
			jQuery(this).css("left", "50%");
			jQuery(this).css("position", "absolute");
			});
		};
	})(jQuery);
jQuery(document).ready(function() {
	jQuery(".navbg .nav").hAlign();
});

// IE cufon fade/transparency fix 
(function(jQuery) { 
    jQuery.fn.customFadeIn = function(speed, callback) { 
            jQuery(this).fadeIn(speed, function() { 
                    if(jQuery.browser.msie) 
                            jQuery(this).get(0).style.removeAttribute('filter'); 
                    if(callback != undefined) 
                            callback(); 
            }); 
    }; 
    jQuery.fn.customFadeOut = function(speed, callback) { 
            jQuery(this).fadeOut(speed, function() { 
                    if(jQuery.browser.msie) 
                            jQuery(this).get(0).style.removeAttribute('filter'); 
                    if(callback != undefined) 
                            callback(); 
            }); 
    }; 
})(jQuery);
