function pictureWindow(urltoload) {
	window.showModelessDialog(urltoload, window, "resizable:1;help:0;scroll:0;status:0;dialogWidth:993px;dialogHeight:746px");
}
function inleverData(urltoload) {
	var newdate = new Date();
	var addtostring = newdate.getTime();
	window.showModelessDialog(urltoload+'?'+addtostring, window, "resizable:0;help:0;scroll:1;status:0;dialogWidth:500px;dialogHeight:440px");
}
function printScherm(code) {
	window.open(code,'bestelformulier','width=600,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no');
}
function folderWindow(urltoload) {
	window.showModelessDialog(urltoload, window, "resizable:0;help:0;scroll:0;status:0;dialogWidth:850px;dialogHeight:620px");
}
function insertAtCaret (textEl, text) {
	if (textEl.createTextRange && textEl.caretPos) {
		// MSIE
		var caretPos = textEl.caretPos;
		caretPos.text =
			caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
			text + ' ' : text;
	} else if(textEl.selectionStart && textEl.setSelectionRange) {
		// Mozilla 1.3+
		var val = textEl.value;
		var cpos = textEl.selectionStart;
		var fpos = cpos + text.length;

		var before = val.substr(0,cpos);
		var after = val.substr(cpos, val.length);
		var aspace = after.charAt(0) == ' ' ? "" : " ";
		var bspace = before.charAt(before.length) == ' ' ? "" : " ";

		textEl.value = before + bspace + text + aspace + after;
		textEl.setSelectionRange(fpos,fpos); // set cursor pos to end of text
		textEl.focus();
	} else {
		textEl.value  = textEl.value + text; // otherwise just append
	}

	return true;
} // end insertAtCaret

function checkEmailAddress(field) {
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);

	if (goodEmail){
	   return true;
	} else {
   alert('Vul A.U.B. een correct e-mailadres in.')
   field.focus()
   field.select()
    return false;
  }
}
var thumb = null;
function showThumbnail(which,e)
{
    thumb = document.getElementById('thumb');
    if( thumb && thumb.style.visibility == 'hidden' )
    {
        thumb.style.left       = e.pageX ? pageXOffset + e.clientX + 20 : document.body.scrollLeft + e.x + 20;
        thumb.style.top        = e.pageY ? pageYOffset + e.clientY : document.body.scrollTop  + e.y;
        thumb.style.visibility = 'visible';
        thumb.innerHTML        = '<img src="http://www.jacovuurwerk.nl/phpthumb/thumb.php?' + which + '">';
    }
}
function closeThumbnail()
{
    if( thumb )
        thumb.style.visibility = 'hidden';
}


var TINY={};

function T$(i){return document.getElementById(i)}

TINY.box=function(){
	var p,m,b,fn,ic,iu,iw,ih,ia,f=0;
	return{
		show:function(c,u,w,h,a,t){
			if(!f){
				p=document.createElement('div'); p.id='tinybox';
				m=document.createElement('div'); m.id='tinymask';
				b=document.createElement('div'); b.id='tinycontent';
				document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b);
				m.onclick=TINY.box.hide; window.onresize=TINY.box.resize; f=1
			}
			if(!a&&!u){
				p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto';
				p.style.backgroundImage='none'; b.innerHTML=c
			}else{
				b.style.display='none'; p.style.width=p.style.height='100px'
			}
			this.mask();
			ic=c; iu=u; iw=w; ih=h; ia=a; this.alpha(m,1,80,3);
			if(t){setTimeout(function(){TINY.box.hide()},1000*t)}
		},
		fill:function(c,u,w,h,a){
			if(u){
				p.style.backgroundImage='';
				var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
				x.onreadystatechange=function(){
					if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)}
				};
				x.open('GET',c,1); x.send(null)
			}else{
				this.psh(c,w,h,a)
			}
		},
		psh:function(c,w,h,a){
			if(a){
				if(!w||!h){
					var x=p.style.width, y=p.style.height; b.innerHTML=c;
					p.style.width=w?w+'px':''; p.style.height=h?h+'px':'';
					b.style.display='';
					w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight);
					b.style.display='none'; p.style.width=x; p.style.height=y;
				}else{
					b.innerHTML=c
				}
				this.size(p,w,h)
			}else{
				p.style.backgroundImage='none'
			}
		},
		hide:function(){
			TINY.box.alpha(p,-1,0,3)
		},
		resize:function(){
			TINY.box.pos(); TINY.box.mask()
		},
		mask:function(){
			m.style.height=TINY.page.total(1)+'px';
			m.style.width=''; m.style.width=TINY.page.total(0)+'px'
		},
		pos:function(){
			var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t;
			p.style.top=(t+TINY.page.top())+'px';
			p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px'
		},
		alpha:function(e,d,a){
			clearInterval(e.ai);
			if(d==1){
				e.style.opacity=0; e.style.filter='alpha(opacity=0)';
				e.style.display='block'; this.pos()
			}
			e.ai=setInterval(function(){TINY.box.ta(e,a,d)},10)
		},
		ta:function(e,a,d){
			var o=Math.round(e.style.opacity*100);
			if(o==a){
				clearInterval(e.ai);
				if(d==-1){
					e.style.display='none';
					e==p?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''
				}else{
					e==m?this.alpha(p,1,100):TINY.box.fill(ic,iu,iw,ih,ia)
				}
			}else{
				var n=Math.ceil((o+((a-o)*.9))); n=n==1?0:n;
				e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
			}
		},
		size:function(e,w,h){
			e=typeof e=='object'?e:T$(e); clearInterval(e.si);
			var ow=e.offsetWidth, oh=e.offsetHeight,
			wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height);
			var wd=ow-wo>w?0:1, hd=(oh-ho>h)?0:1;
			e.si=setInterval(function(){TINY.box.ts(e,w,wo,wd,h,ho,hd)},10)
		},
		ts:function(e,w,wo,wd,h,ho,hd){
			var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho;
			if(ow==w&&oh==h){
				clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block'
			}else{
				if(ow!=w){var n=ow+((w-ow)*.5); e.style.width=wd?Math.ceil(n)+'px':Math.floor(n)+'px'}
				if(oh!=h){var n=oh+((h-oh)*.5); e.style.height=hd?Math.ceil(n)+'px':Math.floor(n)+'px'}
				this.pos()
			}
		}
	}
}();

TINY.page=function(){
	return{
		top:function(){return document.documentElement.scrollTop||document.body.scrollTop},
		width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},
		height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},
		total:function(d){
			var b=document.body, e=document.documentElement;
			return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):
			Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
		}
	}
}();

function loadTinybox(id) {
	var fotocontent = '<center><img onclick="javascript:TINY.box.hide();" src="phpthumb/bigpic.php?'+id+'" alt="" /></center>';
	TINY.box.show(fotocontent,0,993,746,1,0);
}

function loadTinyboxVid(id) {
	
	var filmcontent = '<div id="new_player">';
	filmcontent += '<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="640" height="480">';
	filmcontent += '	<param name="movie" value="http://www.jacovuurwerk.nl/styles/player.swf" />';
	filmcontent += '	<param name="allowfullscreen" value="true" />';
	filmcontent += '	<param name="allowscriptaccess" value="always" />';
	filmcontent += '	<param name="flashvars" value="file=http://www.jacovuurwerk.nl/content/films/'+id+'.flv&link=www.jacovuurwerk.nl&controlbar=bottom&autostart=true&stretching=exactfit" />';
	filmcontent += '	<embed ';
	filmcontent += '		type="application/x-shockwave-flash" ';
	filmcontent += '		id="player2" ';
	filmcontent += '		name="player2" ';
	filmcontent += '		src="http://www.jacovuurwerk.nl/styles/player.swf" ';
	filmcontent += '		width="640" ';
	filmcontent += '		height="480" ';
	filmcontent += '		allowscriptaccess="always" ';
	filmcontent += '		allowfullscreen="true"';
	filmcontent += '		flashvars="file=http://www.jacovuurwerk.nl/content/films/'+id+'.flv&link=www.jacovuurwerk.nl&controlbar=bottom&autostart=true&stretching=exactfit"/></object></div>';
	TINY.box.show(filmcontent,0,640,480,1,0);

}
function loadTinyboxFolder() {
	
	var foldercontent = '<div id="new_folder"><iframe src="http://www.jacovuurwerk.nl/folder/" width="800" height="600" frameborder="0" scrolling="no"></iframe></div>';
	TINY.box.show(foldercontent,0,800,600,1,0);

}

function loadTinyboxTijden() {
	var foldercontent = '<table border="0" cellspacing="2" cellpadding="1" style="font-size: 11pt;"><tr><td width="150" valign="top">Za 5 dec.</td><td width="200" valign="top"> 10.00 - 16.00 uur.</td></tr><tr><td width="150" valign="top">Zo 6 dec.</td><td width="200" valign="top"> Gesloten.</td></tr><tr><td width="150" valign="top">Ma 7 dec.</td><td width="200" valign="top"> Gesloten.</td></tr><tr><td width="150" valign="top">Di 8 dec.</td><td width="200" valign="top"> 9.00 - 17.30 uur.</td></tr><tr><td width="150" valign="top">Wo 9 dec.</td><td width="200" valign="top"> 9.00 - 17.30 uur.</td></tr><tr><td width="150" valign="top">Do 10 dec.</td><td width="200" valign="top">  9.00 - 17.30 uur.</td></tr><tr><td width="150" valign="top">Vr 11 dec.</td><td width="200" valign="top">  9.00 - 20.00 uur.</td></tr><tr><td width="150" valign="top">Za 12 dec.</td><td width="200" valign="top">  10.00 - 17.00 uur.</td></tr><tr><td width="150" valign="top">Zo 13 dec.</td><td width="200" valign="top">  Gesloten.</td></tr><tr><td width="150" valign="top">Ma 14 dec.</td><td width="200" valign="top">  12.00 - 17.30 uur.</td></tr><tr><td width="150" valign="top">Di 15 dec.</td><td width="200" valign="top">  9.00 -17.30 uur.</td></tr><tr><td width="150" valign="top">Wo 16 dec.</td><td width="200" valign="top">  9.00 -17.30 uur.</td></tr><tr><td width="150" valign="top">Do 17 dec.</td><td width="200" valign="top">  9.00 -17.30 uur.</td></tr><tr><td width="150" valign="top">Vr 18 dec.</td><td width="200" valign="top">  9.00 -21.00 uur.</td></tr><tr><td width="150" valign="top">Za 19 dec.</td><td width="200" valign="top">  10.00 - 17.00 uur.</td></tr><tr><td width="150" valign="top">Zo 20 dec.</td><td width="200" valign="top">  Gesloten</td></tr><tr><td width="150" valign="top">Ma 21 dec.</td><td width="200" valign="top">  9.00 -17.30 uur.</td></tr><tr><td width="150" valign="top">Di 22 dec.</td><td width="200" valign="top">  9.00 - 21.00 uur.</td></tr><tr><td width="150" valign="top">Wo 23 dec.</td><td width="200" valign="top">  9.00 - 21.00 uur.</td></tr><tr><td width="150" valign="top">Do 24 dec.</td><td width="200" valign="top">  9.00 - 17.00 uur.</td></tr><tr><td width="150" valign="top">Vr 25 dec.</td><td width="200" valign="top">  Gesloten ivm kerst</td></tr><tr><td width="150" valign="top">Za 26 dec.</td><td width="200" valign="top">  Gesloten ivm kerst</td></tr><tr><td width="150" valign="top">Zo 27 dec.</td><td width="200" valign="top">  Gesloten.</td></tr><tr><td width="150" valign="top">Ma 28 dec.</td><td width="200" valign="top"> Gesloten i.v.m. voorbereiding losse verkoopdagen.</td></tr><tr><td width="150" valign="top">Di 29 dec.</td><td width="200" valign="top"> 9.00 - 21.00 uur 1e verkoopdag vuurwerk.</td></tr><tr><td width="150" valign="top">Wo 30 dec.</td><td width="200" valign="top"> 9.00 - 21.00 uur 2e verkoopdag vuurwerk.</td></tr><tr><td width="150" valign="top">Do 31 dec.</td><td width="200" valign="top">  9.00 - 17.00 uur 3e verkoopdag vuurwerk.</td></tr></table>';
	TINY.box.show(foldercontent,0,350,760,1,0);
}


var last_clicked;                                                     
function trMouseover(art)                                             
{                           
	if( art != last_clicked )
	{
		document.getElementById('row_'+art).style.cursor = 'hand';          
		document.getElementById('row_'+art).style.backgroundColor='#d9d9d9';
	}
}
function trMouseout(art)
{
	if( art != last_clicked )
	{
		document.getElementById('row_'+art).style.backgroundColor='#fafafa';
	}
}
function trMouseClick(art)
{
	if( last_clicked != '' ) 
	{
		document.getElementById('row_'+last_clicked).style.backgroundColor='#fafafa';
	}
	last_clicked = art;
	document.getElementById('row_'+art).style.backgroundColor='#E2E2E2';	
}