var ie4up = (document.all) ? true : false;

window.onload = function ()
{
	//newstrackert.Start();
	var navi = navigator.appVersion;
	if(navi.indexOf("MSIE")>-1)
	{
		var navAr = navi.split(";");
		document.getElementById("headlines").style.visibility="visible";
		
		runScroller();
	} 
	else 
	{
		document.getElementById("headlines").style.visibility="hidden";
	}
	
	
}

function content(heading)
{
	var _paragraph,
		_i = 0;

	while ((_paragraph = heading.parentNode.getElementsByTagName("p")[_i++])) {
		_paragraph.className = (_paragraph.className == "" ? "hidden" : "");
	}
}

function controle(status)
{
	if (status == 'basic')
	{
		if (document.forms.search.searchfield.value == '')
		{
			alert ('Vul een zoekterm in.');
			return false;
		}
	}
	else
	{
		if (document.forms.search_adv.searchfield.value == '')
		{
			alert ('Vul een zoekterm in.');
			return false;
		}
		
	}
	
}


function Send (form, location)
{
	form.method = 'post';
	form.action = location;
	form.submit();
	
	return false;
}

function ShowDescription(turn)
{
	if (turn == true)
	{
		document.getElementById("productdescription").style.display = 'none';
		document.getElementById("largeproductdescription").style.display = 'block';
	}
	else
	{
		document.getElementById("productdescription").style.display = 'block';
		document.getElementById("largeproductdescription").style.display = 'none';
	}
	
}

function NewsTracker()
{
	this.newsobjects = new Array();
	
	this.currentitem = null;
}

	NewsTracker.prototype.AddNewsObject = function (newsobject)
	{
		this.newsobjects[this.newsobjects.length] = newsobject;
	}
	
	NewsTracker.prototype.Start = function ()
	{
		if (this.newsobjects.length > 0)
		{	
			// starten bij het eerste item indien aanwezig
			if (this.currentitem == null)
			{
				this.currentitem = this.newsobjects[0].id
			}
			// er is minimaal al één cyclus geweest
			else
			{
				for (var i = 0; i < this.newsobjects.length; i++)
				{
					if (this.currentitem == this.newsobjects[i].id)
					{
						if (i == (this.newsobjects.length - 1))
						{
							var index = 0;
						}
						else
						{
							var index = i + 1;
						}
					}
				}
						
				this.currentitem = this.newsobjects[index].id;
			}
			
			for (var i = 0; i < this.newsobjects.length; i++)
			{
				if (this.currentitem == this.newsobjects[i].id)
				{
					this.newsobjects[i].target.innerHTML = '<img src="/images/arrow_orange_left_bg_grey.gif" border="0"/>&nbsp;<a href="/nieuws' + this.newsobjects[i].url  + '">' + this.newsobjects[i].title + '</a>';
					//this.newsobjects[i].Fade(true);
					
				}
			}
			
		}
		
	}
	
		
function NewsObject(id, url, title, sourceid, step, hold, speed, opacitymin, opacitymax, subtitle)
{
	this.id		= id;
	this.url	= url;
	this.title	= title;
	this.subtitle	= subtitle;
	
	this.sourceid	 = sourceid;
	
	this.opacitymin  = opacitymin; 
	this.opacitymax  = opacitymax; 
	this.opacitycur  = opacitymin; 
	
	this.step		 = step;
	this.hold		 = hold;
	this.speed		 = speed;
	
	this.target		 = document.getElementById(sourceid);
	
	this.timer;
}

	NewsObject.prototype.Fade = function (state)
	{
		var self = this;
		
		clearTimeout (this.timer);
		
		if (state)
		{
			this.opacitycur = this.opacitycur + this.step;
			this.opacitycur = (this.opacitycur > this.opacitymax) ? this.opacitymax : this.opacitycur;
			
			if (ie4up)
				this.target.filters.alpha.opacity = this.opacitycur;
			else
				this.target.style.MozOpacity = this.opacitycur / 100;
			
			
			if (this.opacitycur < this.opacitymax)
			{
				this.timer = setTimeout (function(){self.Fade(state)}, this.speed);
			}
			else
			{
				this.timer = setTimeout (function(){self.Fade(false)}, this.hold);
			}
		}
		else
		{
			this.opacitycur = this.opacitycur - this.step;
			this.opacitycur = (this.opacitycur < this.opacitymin) ? this.opacitymin : this.opacitycur;
			
			if (ie4up)
				this.target.filters.alpha.opacity = this.opacitycur;
			else
				this.target.style.MozOpacity = this.opacitycur / 100;
			
			if (this.opacitycur > this.opacitymin)
			{
				this.timer = setTimeout (function(){self.Fade(state)}, this.speed);
			}
			else
			{
				this.timer = setTimeout (function(){newstrackert.Start()}, 1000);
			}
		}
	}
	
		
		


	
	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');

	}
	

