Event.observe(window, 'load', function() 
{
	newNavigator = new NavigatorCollection();
	newNavigator.getNavigator(
	{
		'id'				: "mainmenu",
		'submenu'			: "downblind",
		'effect'			: "slide"
	});
	
	if($('searchtype'))
	{
		Event.observe('searchtype', 'change', function(event)
		{
			if ($('searchtype').value == 'borstelhoudend' || $('searchtype').value == 'borstelloos')
			{
				$('borstel').show();
				$('lineair').hide();
			}
			
			if ($('searchtype').value == 'lineair')
			{
				$('borstel').hide();
				$('lineair').show();
			}
			
			if ($('searchtype').value == '' || $('searchtype').value == 'componenten' || $('searchtype').value == 'elektronica')
			{
				$('borstel').hide();
				$('lineair').hide();
			}
			
			
		});
	}

	
	
	newAnimation = new Animation();
	newAnimation.slideshow(1, 4000, 'trailer');
	newAnimation.slideshow(1, 4000, 'imgtrailer1');
	newAnimation.slideshow(1, 4000, 'imgtrailer2');
	newAnimation.slideshow(1, 4000, 'imgtrailer3');
	newAnimation.slideshow(1, 4000, 'imgtrailer4');

	
});


	function RunFoo(imageurl)
	{
		
		document.write('<object style="margin-left:-9px;margin-right:-4px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="158" height="158" id="product" align="middle">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
		document.write('<param name="movie" value="/images/product.swf?q='+imageurl+'&dummyVar='+Math.random()+'" />\n');
		
		document.write('<param name="quality" value="high" />\n');
		document.write('<param name="bgcolor" value="#ed8000" />\n');
		document.write('<param name="wmode" value="opaque" />\n');

		document.write('<embed src="/images/product.swf?q='+imageurl+'" quality="high" bgcolor="#ed8000" width="159" height="159" name="product" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		
		document.write('</object>\n');
	}
	
	function RunVideo()
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="322" height="284" align="middle">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain">\n');
		document.write('<param name="movie" value="EAT-promo-ADT.swf">\n');
		document.write('<param name="quality" value="high">\n');
		document.write('<param name="bgcolor" value="#ffffff">\n');
		document.write('<param name="allowFullScreen" value="true">\n');
		document.write('<embed src="EAT-promo-ADT.swf" quality="high" align="middle" bgcolor="#ffffff" width="322" height="284" allowFullScreen="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
		document.write('</object>\n');

	}
		
	function RunVideo2()
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="322" height="284" align="middle">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain">\n');
		document.write('<param name="movie" value="/Zwoom.swf">\n');
		document.write('<param name="quality" value="high">\n');
		document.write('<param name="bgcolor" value="#ffffff">\n');
		document.write('<param name="allowFullScreen" value="true">\n');
		document.write('<embed src="/Zwoom.swf" quality="high" align="middle" bgcolor="#ffffff" width="322" height="284" allowFullScreen="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
		document.write('</object>\n');

	}
	
	function RunVideo3()
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="560" height="106" align="middle">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain">\n');
		document.write('<param name="movie" value="/challenge1.swf">\n');
		document.write('<param name="quality" value="high">\n');
		document.write('<param name="bgcolor" value="#ffffff">\n');
		document.write('<param name="allowFullScreen" value="true">\n');
		document.write('<embed src="/challenge1.swf" quality="high" align="middle" bgcolor="#ffffff" width="560" height="106" allowFullScreen="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
		document.write('</object>\n');

	}
	
	function SwapImage(element)
	{
		this.active = element;
	}
	
		SwapImage.prototype.swap = function(element, id, src)
		{
			if (this.active.id != element.id)
			{
				element.className = 'active';
				
				document.getElementById(id).src = src;
				
				this.active.className = '';
				this.active = element;
			}
		}
	
	
var VideoPlayer = Class.create(
{
	initialize: function()
	{
		
	},
	play: function(source, target, width, height, prerollimage)
	{
		
		var flashvars = {
			flvpFolderLocation: "/flvplayer/",
			flvpAutoStartMovie: false,
			flvpPreRollImage: prerollimage,
			flvpVideoSource: source,
			flvpWidth: width,
			flvpHeight: height,
			flvpTurnOnCorners: false,
			flvpShowbInfo: false,
			flvpShowbCc: false,
			flvpShowbMenu: false,
			flvpInterfaceDisplay : "autohide",
			flvpBackButtonRollOverColor: "0x546472",
			flvpPlayButtonRollOverColor: "0x546472",
			flvpPauseButtonRollOverColor: "0x546472",
			flvpStopButtonRollOverColor: "0x546472",
			flvpForwardButtonRollOverColor: "0x546472",
			flvpInfoButtonRollOverColor: "0x546472",
			flvpCCButtonRollOverColor: "0x546472",
			flvpFullscreenButtonRollOverColor: "0x546472",
			flvpMenuButtonRollOverColor: "0x546472",
			flvpCloseMenuButtonRollOverColor: "0x546472",
			flvpScrubBarDragRollOverColor: "0x546472",
			flvpVolumeButtonOnRollOverColor: "0x546472",
			flvpVolumeButtonOffRollOverColor: "0x546472",
			flvpVolumeDragRollOverColor: "0x546472",
			flvpScrubBarFrontColor : "0x546472",
			flvpVolumeFrontColor : "0x546472"
		};
		
		var params = {
			wmode: "transparent",
			menu: "true", 
			allowfullscreen: "true"
		};
		
		swfobject.embedSWF("/flvplayer/flvplayer.swf", target, width, height, "9.0.0", "/flash/expressInstall.swf", flashvars, params);
	}
});

var Animation = Class.create(
{
	slideshow: function(start, interval, target)
	{
		var last		= 0;
		var frame 		= start;   
		var nextframe 	= start+1;  
		
		$$('.' + target).each(function(item, index) { last = last + 1; }.bind(this));
		
		if (last > 1)
		{
			Effect.Appear(target+'1',{duration:.5,from:0.0,to:1.0});   
			
			setInterval(function()
			{   
				Effect.Fade(target+frame,
				{	
					duration: .5,
					from: 1.0,
					to: 0.0,
					afterFinish:function()
					{
						$(target+frame).hide();
						
					    frame = nextframe;
					    nextframe = (frame == last) ? start : nextframe+1;
					},
					beforeStart:function()
					{
					    Effect.Appear(target + nextframe,{duration:.5,from:0.0,to:1.0});
					}
				});
			}, interval);
			return; 
		}
	}
});
