$(document).ready(function() {
		
	// Mouseover effect homepage
	$('#wrapper_visuals a').mouseenter(function(){
       $(this).find('img').stop(true, true).fadeTo("fast", 0.50);
    }).mouseleave(function(){
       $(this).find('img').stop(true, true).fadeTo(1000, 1.00);
    });

	$('.home_boxes a').mouseenter(function(){
       $(this).find('img').stop(true, true).fadeTo("fast", 0.50);
    }).mouseleave(function(){
       $(this).find('img').stop(true, true).fadeTo(1000, 1.00);
    });

	// Cycle product mainvisuals
	$('#wrapper_mainvisual').cycle({ 
		fx:    'fade', 
		speed:  3000,
		random:  false,
		timeout: 4500 
	});

	$('.news_more_btn').mouseover(function(){
      $(this).attr('src',this.src.replace( /01.gif$/, '02.gif' ));
    }).mouseout(function(){
        $(this).attr('src',this.src.replace( /02.gif$/, '01.gif' ));
    });

	$('.actie_more_btn').mouseover(function(){
      $(this).attr('src',this.src.replace( /01.gif$/, '02.gif' ));
    }).mouseout(function(){
        $(this).attr('src',this.src.replace( /02.gif$/, '01.gif' ));
    });

	$('.social_btn').mouseover(function(){
      $(this).attr('src',this.src.replace( /01.gif$/, '02.gif' ));
    }).mouseout(function(){
        $(this).attr('src',this.src.replace( /02.gif$/, '01.gif' ));
    });

	$('#language_flags img').mouseover(function(){
      $(this).attr('src',this.src.replace( /02.gif$/, '01.gif' ));
    }).mouseout(function(){
      if(!$(this).hasClass('activeFlag')){
        $(this).attr('src',this.src.replace( /01.gif$/, '02.gif' ));
      }
    });

	// Uitschuif-vlak
	$('#global_options li a').hover(function(){
		$(this).parent().css('background-image','url("/images/global/landenvlakje-over.png")');
		var tmpImageURL = $(this).css('background-image');
		$(this).css('background-image',tmpImageURL.replace( /.png/, '-over.png' ));
    },function(){
		$(this).parent().css('background-image','url("/images/global/landenvlakje.png")');
		var tmpImageURL = $(this).css('background-image');
		$(this).css('background-image',tmpImageURL.replace( /-over.png/, '.png' ));
    });
	$('#language_flags .globe_flag').hover(function(){ $('#global_options').show(); },function(){ });
	$('#language_flags').hover(function(){ },function(){ $('#global_options').hide(); });
	$('#language_flags a img').hover(function(){ if(!$(this).hasClass('globe_flag')){ $('#global_options').hide(); } },function(){ if(!$(this).hasClass('globe_flag')){ $('#global_options').hide(); }});

	


	$('.news_more_btn').click(function(){
		if($(this).hasClass('news_less_btn')){
			$(this).parent().find('span.news_more').slideUp();
			$(this).removeClass('news_less_btn');
			$(this).attr('src',$(this).attr('src').replace('minder','meer'));
		}else{
			$(this).parent().find('span.news_more').slideDown();
			$(this).addClass('news_less_btn');
			$(this).attr('src',$(this).attr('src').replace('meer','minder'));
		}
	});

	$('.actie_more_btn').click(function(){
		if($(this).hasClass('actie_less_btn')){
			$(this).parent().find('div.actie_more').slideUp();
			$(this).removeClass('actie_less_btn');
			$(this).attr('src',$(this).attr('src').replace('dicht','open'));
		}else{
			$(this).parent().find('div.actie_more').slideDown();
			$(this).addClass('actie_less_btn');
			$(this).attr('src',$(this).attr('src').replace('open','dicht'));
		}
	});

	// Load commercial
	$('#youtube_commercial').click(function() {
		$.fancybox({
				'padding'		: 10,
				'autoScale'		: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'none',
				'easingIn'      : 'easeOutBack',
				'title'			: this.title,
				'width'			: 854,
				'height'		: 510,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
									'wmode'				: 'transparent',
									'allowfullscreen'	: 'true'
								  }
			});
	
		return false;
	});
	
	// Initial loading
		$('span.news_more').hide();
		$('div.actie_more').hide();
				
		// Mouseover effect homepage
		//$('.product img').fadeTo("slow", 0.50);
		//$('#wrapper_visuals img').fadeTo("slow", 0.50);
		//$('.home_boxes img').fadeTo("slow", 0.50);
});
