// hoofdmenu
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;


jQuery(function($) {

	/*$(window).bind('scroll', function() {
		algeaParallax($);
	});*/

	// Een menu-accordeon.. http://www.youtube.com/watch?v=1R1or3oE9nk

	if($.browser.msie && $.browser.version<8) {
	    //alert('msie 7');
	    // msie 7 cannot do the animation when the logo flash file is loaded
	    // the jquery timer gets lost in the pile of work
		$('#mainnav ul.sub').not('#mainnav .active ul.sub').hide();
		$('#mainnav li span.opensub').toggle( function() {
			$(this).next('ul.sub').show();
		}, function() {
			$(this).next('ul.sub').hide();
		});
	} else {
		$('#mainnav ul.sub').not('#mainnav .active ul.sub').slideUp();
		$('#mainnav li span.opensub').toggle( function() {
			$(this).next('ul.sub').slideDown();
		}, function() {
			$(this).next('ul.sub').slideUp();
		});
	}

	//zelfde hoogte voor verschillende floating columns naast elkaar
	equalHeight($(".newsitem .entry"));

	// Logo laden..
	var flashvars = {
		spd:150000,
		clickTag:"http://www.cellana.com",
		clickTarget:"_top"
	};
	var params = {
		menu:"false",
		wmode:"transparent",
		scale:"noscale"
	};
	var attributes = { };
	swfobject.embedSWF("/graphics/logo.swf", "flash", "95", "130", "8.0.0", "", flashvars, params, attributes);


	// start FAQ toggle function
	$('.faq-entry .faq-answer').hide();
	$('.faq-entry .faq-question').toggle(
		function(e) {
			e.preventDefault();
			$(this).parents('.faq-entry').find('.faq-answer').slideDown('fast');
			$(this).addClass('open');
		},
		function(e) {
			e.preventDefault();
			$(this).parents('.faq-entry').find('.faq-answer').slideUp('fast');
			$(this).removeClass('open');
		}
	);
	// end FAQ toggle function
	
	$('.rightcol-block #sendtofriendslider').hide();
	$('.rightcol-block #sendtofriendwrapper h6').toggle(
		function() {
			$('#sendtofriendslider').slideDown('slow');
		},
		function() {
			$('#sendtofriendslider').slideUp('slow');
		}
	);
	
	
	$('#sendtofriendform input').focus( function() {
		if($(this).val()=="name" || $(this).val()=="email") {
			$(this).val('');
		}
	});
	
	$('#sendtofriendform input').blur( function() {
		if($(this).val() == "") {
			if($(this).attr('id') == "stf_toname" || $(this).attr('id') == "stf_fromname") {
				$(this).val("name") ;
			} else {
				$(this).val("email") ;
			}
		}
	});
	
	$('.fancybox').append('<span class="fancyhover">zoom in</span>');

});



function equalHeight(group) {
	tallest = 0;
	group.each(function() {
	thisHeight = jQuery(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
} 

 jQuery(window).load(function() {
	jQuery('#slider').nivoSlider(
{
		effect:'fade',
		slices:15,
		animSpeed:500,
		pauseTime:3000,
		directionNav:false, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		beforeChange: function(){},
		afterChange: function(){}
	}	
	);
});