var ie4up = (document.all) ? true : false;

window.onload = function ()
{
	
}


function ImageBrowse (direction, id)
{
	var target = document.getElementById(id);
	
	if (direction == 'previous')
	{
		activerecord = (activerecord == 0) ? (images.length - 1) : activerecord - 1;
		target.src = images[activerecord].url;
	}
	
	if (direction == 'next')
	{
		activerecord = (activerecord == (images.length - 1)) ? 0 : activerecord + 1;
		target.src = images[activerecord].url;
	}
	
	document.getElementById(id + '_index').innerHTML = 'Foto ' + (activerecord + 1) + ' van ' + images.length;
	document.getElementById(id + '_title').innerHTML = images[activerecord].title + '&nbsp;';
	document.getElementById(id + '_description').innerHTML = images[activerecord].description + '&nbsp;';
}


function ShowSlideShow (page)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="687" height="238" id="presentation" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="wmode" value="opaque" />');
	document.write('<param name="movie" value="/images/slide_home.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="/images/slide_home.swf" wmode="opaque" quality="high" bgcolor="#ffffff" width="687" height="238" name="slideshow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

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)
{
	this.id		= id;
	this.url	= url;
	this.title	= title;
	
	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');
	}
	
	
	


