jQuery.noConflict();

(function($){

$.extend({

	AnimateInit: function(){
		// Ontwerp
		$("#ontwerp").find('a').append("<div><img /></div>");
		$("#ontwerp").find('img').attr("id","imgOntwerp")
							.css("display","none")
							.css("margin-left","0px")
							.attr("src","images/menu.png");
		$("#ontwerp").find('div:first').attr("id","spanOntwerp")
							.css("height","84px")
							.css("width","85px")
							.css("overflow","hidden");
		
		// Reclame
		$("#reclame").find('a').append("<div><img /></div>");
		$("#reclame").find('img').attr("id","imgOntwerp")
							.css("display","none")
							.css("margin-left","-85px")
							.attr("src","images/menu.png");
		$("#reclame").find('div:first').attr("id","spanOntwerp")
							.css("height","84px")
							.css("width","85px")
							.css("overflow","hidden");
							
		// Media
		$("#media").find('a').append("<div><img /></div>");
		$("#media").find('img').attr("id","imgOntwerp")
							.css("display","none")
							.css("margin-left","-170px")
							.attr("src","images/menu.png");
		$("#media").find('div:first').attr("id","spanOntwerp")
							.css("height","85px")
							.css("width","85px")
							.css("overflow","hidden");
		
		$.AnimateLeft();
	},
	
	AnimateLeft: function(){
		$(document).oneTime(500, function(){
			$("#ontwerp").oneTime(1000, function(){
				$(this).find('img').animate({
					opacity: 'toggle'
				},1500,function(){
					$(this).animate({
						opacity: 'toggle'
					},1500)
				});
			});
			
			$("#reclame").oneTime(1500, function(){		
				$(this).find('img').animate({
					opacity: 'toggle'
				},1500,function(){
					$(this).animate({
						opacity: 'toggle'
					},1500)
				});
			});
			
			$("#media").oneTime(2000, function(){								
				$(this).find('img').animate({
					opacity: 'toggle'
				},1500,function(){
					$(this).animate({
						opacity: 'toggle'
					},1500, function(){
						$.AnimateRight();
					});
				});
			});
		});
	},
	
	AnimateRight: function(){
		$(document).oneTime(500, function(){
			$("#ontwerp").oneTime(2000, function(){
				$(this).find('img').animate({
					opacity: 'toggle'
				},1500,function(){
					$(this).animate({
						opacity: 'toggle'
					},1500)
				});
			});
			
			$("#reclame").oneTime(1500, function(){		
				$(this).find('img').animate({
					opacity: 'toggle'
				},1500,function(){
					$(this).animate({
						opacity: 'toggle'
					},1500)
				});
			});
			
			$("#media").oneTime(1000, function(){								
				$(this).find('img').animate({
					opacity: 'toggle'
				},1500,function(){
					$(this).animate({
						opacity: 'toggle'
					},1500, function(){
						$.AnimateLeft();
					});
				});
			});
		});
	},
	
	TickerControl: function(){
		 $('.ticker').bind('mouseenter', function(){ ticker.stop(); });
		 $('.ticker').bind('mouseleave', function(){ ticker.start(); });
	}
});

$(document).ready(function(){
	
	$.AnimateInit();
	$.TickerControl();
	
	var sSelected = "";
	$('.acc-js h2 > a').each(function(){
		$(this).bind('click', function(e){
			e.preventDefault();
			if($(this).is('.active') == false){
				$(this).addClass('active');
				$(this).parent().next().css('display','block');
				if (sSelected != ""){
					$('a[title=' + sSelected + ']').removeClass('active');
					$('a[title=' + sSelected + ']').parent().next().css('display','none');
				}
				sSelected = $(this).attr("title");
			}
		});
	});
	
});

})(jQuery);
