
function stringToDate(s) {
	var a=s.split("-");
	var date=new Date(a[2],a[1]-1,a[0]);
	return date;
	}

function completeDate(s){
	var a=s.split("-");
	if (a[0].length<2) a[0]="0" + a[0]
	if (a[1].length<2) a[1]="0" + a[1]
	return a[0] + "-" + a[1] + "-" + a[2];
	}

function dateAdd(date,num,unit){
	var s = 1000;
	var m = s * 60;
	var h = m * 60;
	var d = h * 24;
	var w = d * 5;
	switch (unit){
		case "s":
			num=num * s;
			break;
		case "m":
			num=num * m;
			break;
		case "h":
			num=num * h;
			break;
		case "d":
			num=num * d;
			break;
		case "w":
			num=num * w;
			break;
		}
	return new Date(date.getTime()+num)
	}

var sd=null;
function clock(d){
	if (d) sd=d
	showClock(sd);
	sd = dateAdd(sd, 1, "s");
	setTimeout("clock();",1000);
	}

function showClock(time){	
	var day = time.getDate();
	var weekday = time.getDay();
	var month = time.getMonth();
	var year = time.getFullYear();
	var hour = time.getHours();
	var minute = time.getMinutes();
	var second = time.getSeconds();
	if (parseInt(hour)<10){
		var sHour="0" + hour;
		}
	else {
		var sHour=hour;
		}
	if (parseInt(minute)<10){
		var sMin="0" + minute;
		}
	else {
		var sMin=minute;
		}
	if (parseInt(second)<10){
		var sSec="0" + second;
		}
	else {
		var sSec=second;
		}
	document.getElementById("date").innerHTML = "&nbsp;" + arrDaysNL[weekday] + " " + day + " " + arrMonthNL[month] + " " +year+"  "+sHour + ":" + sMin + ":" + sSec;
	}

function showProgressBar(id){
	jHTML  = "<table  border=\"0\" width=\"100%\" height=\"60%\" cellpadding=\"0\" cellspacing=\"0\" >";
	jHTML += "<tr><td class=\"fontn\" align=\"center\" valign=\"bottom\">";
	switch (document.Form.bpe_language.value) {
		case "NL":
			jHTML += "Uw opdracht wordt verwerkt.<br>Een moment aub...";
			break;
		case "EN":
			jHTML += "Your payment is being processed.<br>Please wait...";
			break;
		case "DE":
			jHTML += "Ihre Bezahlung wird bearbeitet.<br>Ein Moment bitte...";
			break;
		case "FR":
			jHTML += "Uw opdracht wordt verwerkt.<br>Een moment aub...";
			break;
		}
	jHTML += "</td></tr>";
	jHTML += "<tr><td height=\"18\"  align=\"center\" valign=\"bottom\">";
	jHTML += "	<table bgcolor=\"#c0c0c0\" border=\"0\" width=\"250\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:1px groove;\">";
	jHTML += "		<tr><td height=\"18\" id=\"mIndicator\"></td><td id=\"mFill\"></td></tr>";
	jHTML += "	</table>";
	jHTML += "</td></tr></table>";
	document.getElementById(id).innerHTML=jHTML;
	showProgress(0);
	}	
	
function showProgress(i){
	if (document.getElementById('mIndicator')){
		var maxWidth=250;
		var speed=50;
		document.getElementById('mIndicator').style.pixelWidth=i;
		document.getElementById('mIndicator').style.backgroundColor='#392100';
		document.getElementById('mFill').style.pixelWidth=maxWidth-i;
		document.getElementById('mFill').style.backgroundColor='#c0c0c0';
		if (i<maxWidth){
			i++;
			}
		else {
			i=0;
			}
		setTimeout("showProgress("+i+");", speed);
		}
	}

	
function sendContactForm(a,p){
	if (a==0){
		var sFields="";
		if	(document.Form.f_naam.value==""){
			alert("Vul uw naam in.");
			document.Form.f_naam.focus();
			return;
			}
		if	(document.Form.f_telefoon.value==""){
			alert("Vul uw telefoonnummer in.");
			document.Form.f_telefoon.focus();
			return;
			}
		if	(document.Form.f_email.value==""){
			alert("Vul uw mailadres in.");
			document.Form.f_email.focus();
			return;
			}
		if (!isEmail(document.Form.f_email.value)){
			alert("Dit is een ongeldig email-adres.");
			document.Form.f_email.select();
			document.Form.f_email.focus();
			return;
			}
		if (!isPhone(document.Form.f_telefoon.value)){
			alert("Dit is een ongeldig telefoonnummer.");
			document.Form.f_telefoon.select();
			document.Form.f_telefoon.focus();
			return;
			}
		for (i=0;i<document.Form.elements.length;i++){
			sFields += document.Form.elements[i].value + "|";
			}
		document.rmForm.rmAction.value="mail";
		document.rmForm.rmReturn.value="sendContactForm";
		document.rmForm.rmParams.value=sFields;
		document.rmForm.submit();
		}
	if (a>0){
		rmResult=parent.fTop.document.body.innerHTML;
		if (rmResult != ""){
			alert("Uw verzoek is verzonden.\nKlik OK om verder te gaan.")
			showMenu('1');
			}	
		}
	}

function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (supported){
    //return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	  return (!r1.test(str) && r2.test(str));
	  }
  }

function isPhone(str) {
// are regular expressions supported?
var supported = 0;
if (window.RegExp) {
	var tempStr = "a";
	var tempReg = new RegExp(tempStr);
	if (tempReg.test(tempStr)) supported = 1;
	}
if (supported){
	//International PhoneNumber
	var r = new RegExp("[^0-9\- ()\+]");
	//var r = new RegExp("^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$");
	//Dutch PhoneNumber
	//var r = new RegExp("^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$"); 	  
	return (!r.test(str));
	}
}

function isZipCode(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported){ 
	  var r1 = new RegExp("^[0-9]{4}\s{0,1}[a-zA-Z]{2}$");
	  return (!r1.test(str));
	  }
	}

function isIPAddress(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported){ 
	  var r1 = new RegExp("^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$");
	  return (!r1.test(str));
	  }
}

function isValidIPAddress(ipaddr){
	var re = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
	if (re.test(ipaddr)) {
		var parts = ipaddr.split(".");
		if (parseInt(parseFloat(parts[0])) == 0) { return false; }
		for (var i=0; i<parts.length; i++) {
			if (parseInt(parseFloat(parts[i])) > 255) { return false; }
			}
		return true;
		}
	else {
		return false;
		}
	}

 
function doSaveAs(){ 
	var isReady = false; 
	if (document.execCommand){ 
		if (isReady){ 
			document.execCommand("SaveAs");
			} 
		} 
	}

function openX(w){
	return parseInt((screen.availWidth-w)/2);
	}

function openY(h){
	return 	parseInt((screen.availHeight-h)/2);
	}

function openWin(win,id){
	switch (win){
		case 'editor':
			var w = screen.availWidth;
			var h = screen.availHeight;
			var x=0;
			var y=0;
			return top.open("../rte/default.asp?handle="+id,"_event"+id, "height="+h+",width="+w+",screenX="+x+",screenY="+y+",left="+x+",top="+y+",menubar=1,resizable=1,scrollbars=yes,status=yes,toolbar=1,titlebar=yes");
			break;

		case 'email':
			var w = 600;
			var h = 400;
			var x=openX(w);
			var y=openY(h);
			return window.open("about:blank","_mail", "height="+h+",width="+w+",screenX="+x+",screenY="+y+",left="+x+",top="+y+",menubar=no,resizable=1,scrollbars=yes,status=yes,toolbar=no,titlebar=no");
			break;
			
		case 'help':
			var w = 400;
			var h = 400;
			var x=openX(w);
			var y=openY(h);
			return window.open("","_"+win, "height="+h+",width="+w+",screenX="+x+",screenY="+y+",left="+x+",top="+y+",menubar=0,resizable=1,scrollbars=no,status=yes,toolbar=0,titlebar=no");
			break;

		case 'invoice':
			var w = 800;
			var h = 600;
			var x=openX(w);
			var y=openY(h);
			return top.open("","_report", "height="+h+",width="+w+",screenX="+x+",screenY="+y+",left="+x+",top="+y+",menubar=1,resizable=1,scrollbars=yes,status=yes,toolbar=0,titlebar=no");
			break;
		}
	}

function readRemote(jRemote){
	if (jRemote != ""){
		var sRemote=jRemote.replace(/;textarea;/g,"</textarea>");
		jRemote="";
		return sRemote;
		}
	}

// Collection() - OBJECT - a dynamic storage structure similar to an Array.
function Collection() {
	this.length = 0; 
	this.add = add; 
	this.replace = replace;
	this.shift = shift;
	this.remove = remove;
	return this;
	}
	
// add() - METHOD of Collection - adds an object to a Collection.
function add(object) {
	this.length++; 
	this[this.length] = object;
	}

// replace() - METHOD of Collection - replaces an existing object in a Collection.
function replace(index, object) {
	this[index] = object;
	}

// shift() - METHOD of Collection - shifts objects in the index of a Collection. Existing objects are overwritten.
function shift(pos) {
	if (pos<0){
		for (x=1;x<=this.length+pos;x++){
			this[x] = this[x-pos];
			}
		this.length=this.length+pos;
		}
	if (pos>0){
		for (x=this.length;x>pos;x--){
			this[x] = this[x-pos];
			}
		}
	}

function remove(index){
	}

	
function logout(a){
	if (a==0){
		if (wacht){
			setTimeout("logout("+a+")",500);
			}
		else {
			wacht=true;
			document.rmForm.rmAction.value="logout";
			document.rmForm.rmReturn.value="parent."+window.name+".logout";
			document.rmForm.rmParams.value="";
			document.rmForm.submit();
			}
		}
	if (a>0){
		wacht=false;
		top.location="../";
		}
	}

function keepAlive(a,p){
	if (a==0){
		document.rmForm.rmAction.value='alive';
		document.rmForm.rmReturn.value='parent.fMain.sLeft.keepAlive';
		document.rmForm.rmParams.value='';
		document.rmForm.submit();
		}
	if (a>0){
		rmResult=top.fTop.document.body.innerHTML;
		setTimeout("keepAlive(0)",600000);
		}
	}


function mousePostion(e){
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)	{
		posx = e.pageX;
		posy = e.pageY;
		}
	else if (e.clientX || e.clientY){
		posx = e.clientX + document.body.scrollLeft;
		posy = e.clientY + document.body.scrollTop;
		}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
	return posx;posy
	}

//Handling both Single-click and Double-click events.
var dcTime=250;    // doubleclick time
var dcDelay=100;   // no clicks after doubleclick
var dcAt=0;        // time of doubleclick
var savEvent=null; // save Event for handling doClick().
var savEvtTime=0;  // save time of click event.
var savTO=null;    // handle of click setTimeOut

function hadDoubleClick() {
   var d = new Date();
   var now = d.getTime();
   if ((now - dcAt) < dcDelay) {
     return true;
   }
   return false;
 }

function handleWisely(which) {
	switch (which) {
 		case "click": 
			// If we've just had a doubleclick then ignore it
			if (hadDoubleClick()) return false;
			// Otherwise set timer to act.  It may be preempted by a doubleclick.
			savEvent = which;
			d = new Date();
			savEvtTime = d.getTime();
			savTO = setTimeout("doClick(savEvent)", dcTime);
			break;
		case "dblclick":
			doDoubleClick(which);
			break;
		default:
		}
	}
 
function doClick(which) {
	// preempt if DC occurred after original click.
	if (savEvtTime - dcAt <= 0) {
		showMe(1, "ignore Click");
		return false;
		}
	showMe(1, "Handle Click.  ");
	}
 
function doDoubleClick(which) {
	var d = new Date();
	dcAt = d.getTime();
	if (savTO != null) {
		clearTimeout( savTO );          // Clear pending Click  
		savTO = null;
		}
	showMe(1, "Handle DoubleClick at " + dcAt);
	}
 
//End Handling Both Single-click and Double-click events 

function chgLang(l){
	binnenkort();
	}

function binnenkort(){
	alert("Deze functie is binnenkort beschikbaar.");
	}
	
function clearbizpaymentmethods() {
	document.rqForm.fMethIdeal.checked=false;
	document.rqForm.fMethCcards.checked=false;
	document.rqForm.fMethAmex.checked=false;
	document.rqForm.fMethIncasso.checked=false;
	document.rqForm.fMethTransfer.checked=false;
	document.rqForm.fMethIMN.checked=false;
}

function selectbizneruitgebreidideal() {
	document.rqForm.fMethIdeal.checked=true;
}

function selectbiztotal() {
	document.rqForm.fbiznertype[1].checked=true;
	document.rqForm.fMethIdeal.checked=true;
	
}
function checkBizFrmvalues() {
	if (!document.rqForm.fbiznertype[0].checked && !document.rqForm.fbiznertype[1].checked) {
		alert("Selecteer welke variant uw voorkeur heeft.");
		document.rqForm.fbiznertype[0].focus();
		return false;
	}
	if (document.rqForm.fDomain1.value.length==0) {
		alert("Vul de domeinnaam van de website in.");
		document.rqForm.fDomain1.focus();
		document.rqForm.fDomain1.select();
		return false;
	}
	if (document.rqForm.fHandelsnaamDomain1.value.length==0) {
		alert("Vul de handelsnaam van de website in.");
		document.rqForm.fHandelsnaamDomain1.focus();
		document.rqForm.fHandelsnaamDomain1.select();
		return false;
	}
	if (document.rqForm.fCompany.value.length==0) {
		alert("Vul de bedrijfsnaam in.");
		document.rqForm.fCompany.focus();
		document.rqForm.fCompany.select();
		return false;
	}
	if (document.rqForm.fContact.value.length==0) {
		alert("Vul de naam van de contactpersoon in.");
		document.rqForm.fContact.focus();
		document.rqForm.fContact.select();
		return false;
	}
	if (!document.rqForm.fGender[0].checked && !document.rqForm.fGender[1].checked) {
		alert("Vul het geslacht van de contactpersoon in.");
		document.rqForm.fGender[0].focus();
		return false;
	}
	if (document.rqForm.fPhone.value.length==0) {
		alert("Vul het telefoonnummer van de contactpersoon in.");
		document.rqForm.fPhone.focus();
		document.rqForm.fPhone.select();
		return false;
	}
	if (document.rqForm.fAddress.value.length==0) {
		alert("Vul het vestigingsadres in.");
		document.rqForm.fAddress.focus();
		document.rqForm.fAddress.select();
		return false;
	}
	if (document.rqForm.fZip.value.length==0) {
		alert("Vul postcode in.");
		document.rqForm.fZip.focus();
		document.rqForm.fZip.select();
		return false;
	}
	if (document.rqForm.fCity.value.length==0) {
		alert("Vul plaats in.");
		document.rqForm.fCity.focus();
		document.rqForm.fCity.select();
		return false;
	}
	if (document.rqForm.fMail.value.length==0) {
		alert("Vul het emailadres van de contactpersoon in.");
		document.rqForm.fMail.focus();
		document.rqForm.fMail.select();
		return false;
	}
	sendRequest(0,'reqRFI','content');
	
}

function checkRFIFrmvalues() {
	if (document.reqRFI.fCompany.value.length==0) {
		alert("Vul de bedrijfsnaam in.");
		document.reqRFI.fCompany.focus();
		document.reqRFI.fCompany.select();
		return false;
	}
	if (document.reqRFI.fContact.value.length==0) {
		alert("Vul de naam van de contactpersoon in.");
		document.reqRFI.fContact.focus();
		document.reqRFI.fContact.select();
		return false;
	}
	if (document.reqRFI.fPhone.value.length==0) {
		alert("Vul het telefoonnummer van de contactpersoon in.");
		document.reqRFI.fPhone.focus();
		document.reqRFI.fPhone.select();
		return false;
	}
	if (document.reqRFI.fMail.value.length==0) {
		alert("Vul het emailadres van de contactpersoon in.");
		document.reqRFI.fMail.focus();
		document.reqRFI.fMail.select();
		return false;
	}
	sendRequest(0,'reqRFI','subcontent');
	
}

function submitKennismakingsWorkshopForm() {
		if (document.KennismakingsWorkshopForm.Bedrijf.value.length==0) {
			alert("Vul de bedrijfsnaam in aub.");
			document.KennismakingsWorkshopForm.Bedrijf.focus();
			document.KennismakingsWorkshopForm.Bedrijf.select();
			return false;
		}
		if (document.KennismakingsWorkshopForm.Naam.value.length==0) {
			alert("Vul uw naam in aub.");
			document.KennismakingsWorkshopForm.Naam.focus();
			document.KennismakingsWorkshopForm.Naam.select();
			return false;
		}
		if (document.KennismakingsWorkshopForm.Telefoon.value.length==0) {
			alert("Vul uw telefoonnummer in aub.");
			document.KennismakingsWorkshopForm.Telefoon.focus();
			document.KennismakingsWorkshopForm.Telefoon.select();
			return false;
		}
		if (document.KennismakingsWorkshopForm.Email.value.length==0) {
			alert("Vul uw emailadres in aub.");
			document.KennismakingsWorkshopForm.Email.focus();
			document.KennismakingsWorkshopForm.Email.select();
			return false;
		}
		sendRequest(0,'KennismakingsWorkshopForm','content');
}

function submitPDForm() {
		if (document.PDForm.fCompany.value.length==0) {
			alert("Vul de bedrijfsnaam in aub.");
			document.PDForm.fCompany.focus();
			document.PDForm.fCompany.select();
			return false;
		}
		if (document.PDForm.fContact.value.length==0) {
			alert("Vul uw naam in aub.");
			document.PDForm.fContact.focus();
			document.PDForm.fContact.select();
			return false;
		}
		if (document.PDForm.fAddress.value.length==0) {
			alert("Vul het vestigingsadres in aub.");
			document.PDForm.fAddress.focus();
			document.PDForm.fAddress.select();
			return false;
		}
		if (document.PDForm.fZip.value.length==0) {
			alert("Vul de postcode in aub.");
			document.PDForm.fZip.focus();
			document.PDForm.fZip.select();
			return false;
		}
		if (document.PDForm.fCity.value.length==0) {
			alert("Vul de plaatsnaam in aub.");
			document.PDForm.fCity.focus();
			document.PDForm.fCity.select();
			return false;
		}
		if (document.PDForm.fPhone.value.length==0) {
			alert("Vul uw telefoonnummer in aub.");
			document.PDForm.fPhone.focus();
			document.PDForm.fPhone.select();
			return false;
		}
		if (document.PDForm.fMail.value.length==0) {
			alert("Vul uw emailadres in aub.");
			document.PDForm.fMail.focus();
			document.PDForm.fMail.select();
			return false;
		}
		sendRequest(0,'PDForm','content');
		
	}
