function writeFlash(url, w, h, bgcolor, wmode) {
    if (url!='') {
		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="'+w+'" height="'+h+'" id="flashID" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="'+url+'" />');
		if (wmode==true) {
			document.write('<param name="wmode" value="transparent" />');
				} else {
					document.write('');
					}
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="'+bgcolor+'" />');
		document.write('<embed src="'+url+'" quality="high" bgcolor="'+bgcolor+'"')
		if (wmode==true) {
			document.write(' wmode="transparent"');
				} else {
					document.write('');
					}
		document.write('width="'+w+'" height="'+h+'" name="flashID" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
    } else {
        document.write("Flash object not found");
    }
}


function writeFlashVideo(player, skin, url, w, h, auto, rew) {
	 if (url!='') {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="FLVPlayer">');
		document.write('<param name="movie" value="'+player+'" />');
		document.write('<param name="salign" value="lt" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="scale" value="noscale" />');
		document.write('<param name="FlashVars" value="&MM_ComponentVersion=1&skinName='+skin+'&streamName='+url+'&autoPlay='+auto+'&autoRewind='+rew+'" />');
		document.write('<embed src="'+player+'" flashvars="&MM_ComponentVersion=1&skinName='+skin+'&streamName='+url+'&autoPlay='+auto+'&autoRewind='+rew+'" quality="high" scale="noscale" width="'+w+'" height="'+h+'" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
		} else {
        document.write("Flashvideo object not found");
    }
}

 
function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}



function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' moet een e-mail adres zijn.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' moet een nummer zijn.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' moet een nummer zijn tussen '+min+' en '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is een verplicht veld.\n'; }
  } if (errors) alert('Let op!\n'+errors);
  document.MM_returnValue = (errors == '');
}

function SubmitForm(formId) {
	MM_validateForm('Jaar van montage','','RisNum','Voorletters','','R','Achternaam','','R','klantemail','','RisEmail');
	
	if (document.MM_returnValue == true) {
		var frm = MM_findObj(formId);
		var ccid = MM_findObj("ccid");
		var locationid = MM_findObj("locationid");
		var klantemail = MM_findObj("klantemail");
		var denhaag = MM_findObj("denhaag");
		
		ccid.value = klantemail.value;
		
		if (denhaag.checked) {
			locationid.value="2";
		} else {
			locationid.value="1";
		}
		
		return true;
	} else {
		return false;
	}
}
