﻿function printPage()
{
	this.focus();
	this.print();
}

function checkMIS()
{
    if(document.getElementById('aanvrager').value=='')
    {
        window.alert('Naam is verplicht.');
        document.getElementById('aanvrager').focus();
        return false;
    }
    
    if(document.getElementById('functie').value=='')
    {
        window.alert('Functie is verplicht.');
        document.getElementById('functie').focus();
        return false;
    }
    
    if(document.getElementById('adres').value=='')
    {
        window.alert('Adres is verplicht.');
        document.getElementById('adres').focus();
        return false;
    }
    
    if(document.getElementById('postcode').value=='')
    {
        window.alert('Postcode is verplicht.');
        document.getElementById('postcode').focus();
        return false;
    }
    
    if(document.getElementById('plaats').value=='')
    {
        window.alert('Woonplaats is verplicht.');
        document.getElementById('plaats').focus();
        return false;
    }
    
    if(document.getElementById('tel_aanvrager').value=='')
    {
        window.alert('Telefoonnummer is verplicht.');
        document.getElementById('tel_aanvrager').focus();
        return false;
    }
    
    if(document.getElementById('email').value=='')
    {
        window.alert('Email is verplicht.');
        document.getElementById('email').focus();
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
		}else{
			window.alert('Dit emailadres is niet valide.');
			document.getElementById("email").focus();
			return false;
		}
    }
    
    if(document.getElementById('enaam').value=='')
    {
        window.alert('Naam evenement is verplicht.');
        document.getElementById('enaam').focus();
        return false;
    }
    
    if(document.getElementById('edatum').value=='')
    {
        window.alert('Datum inzet is verplicht.');
        document.getElementById('edatum').focus();
        return false;
    }
    
    if(document.getElementById('eplaats').value=='')
    {
        window.alert('Plaats inzet is verplicht.');
        document.getElementById('eplaats').focus();
        return false;
    }
    
    if(document.getElementById('eadres').value=='')
    {
        window.alert('Adres inzet is verplicht.');
        document.getElementById('eadres').focus();
        return false;
    }
    
    if(document.getElementById('etijd').value=='')
    {
        window.alert('Begin- en eindtijd evenement is verplicht.');
        document.getElementById('etijd').focus();
        return false;
    }
    
    if(document.getElementById('ebezoekers').value=='')
    {
        window.alert('Verwacht aantal bezoekers is verplicht.');
        document.getElementById('ebezoekers').focus();
        return false;
    }
    
    //if(document.getElementById('activiteit').value=='')
    //{
    //    window.alert('Activiteit in de MIS is verplicht.');
    //    document.getElementById('activiteit').focus();
    //    return false;
    //}
    
    if(document.getElementById('cnaam').value=='')
    {
        window.alert('Naam contactpersoon tijdens op- en afbouw evenement is verplicht.');
        document.getElementById('cnaam').focus();
        return false;
    }
    
    if(document.getElementById('ctelefoon').value=='')
    {
        window.alert('Telefoonnr. contactpersoon tijdens evenement is verplicht.');
        document.getElementById('ctelefoon').focus();
        return false;
    }
    
    if(document.getElementById('idatum').value=='')
    {
        window.alert('Op- en afbouwdatum / -data is verplicht.');
        document.getElementById('idatum').focus();
        return false;
    }
    
    if(document.getElementById('itijd').value=='')
    {
        window.alert('Op- en afbouwtijden is verplicht.');
        document.getElementById('itijd').focus();
        return false;
    }
    
    if(document.getElementById('itijd').value=='')
    {
        window.alert('Op- en afbouwtijden is verplicht.');
        document.getElementById('itijd').focus();
        return false;
    }
    
    if(document.getElementById('afstand').value=='')
    {
        window.alert('Afstand MIS tot electriciteitsaansluiting is verplicht.');
        document.getElementById('afstand').focus();
        return false;
    }
}

function CheckPerData()
{
    if(document.getElementById('password').value=='')
    {
        window.alert('Paswoord is verplicht.');
        document.getElementById('password').focus();
        return false;
    }
    else
    {
        if(document.getElementById('password').value==document.getElementById('OldPassWord').value)
        {
            window.alert('Uw paswoord mag niet gelijk zijn aan uw oude paswoord');
            document.getElementById('password').focus();
            return false;
        }
    }

}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '' + num + ',' + cents);
}

function CountArray(p_arrField, p_objTotalField)
{
    var l_intVal = 0;
    var l_intVal2 = 0;
    var i=0;
    while (i < p_arrField.length){
       if(document.getElementById(p_arrField[i]).value!='')
       {
            l_intVal2 = parseFloat(document.getElementById(p_arrField[i]).value.replace(',','.'));
            l_intVal = l_intVal + l_intVal2;
       }
       i++;
    }
    l_intVal = formatCurrency(l_intVal);
    p_objTotalField.value = l_intVal.toString().replace('.',',');
}

function CheckAndEditNum(p_objField)
{
    if (p_objField.value < 10 && p_objField.value.length < 2)
        p_objField.value = '0' + p_objField.value;
}
// <Afrekenstaat>
function CheckAfrekenstaat () {
    TelAllesOp();
    if(document.getElementById ('volgnummer').value.length < 1) {
        alert ('Volgnummer is verplicht!');
        document.getElementById ('volgnummer').focus ();
        return false;
    }      
    if(document.getElementById ('locatie').value.length < 1) {
        alert ('Locatie is verplicht!');
        document.getElementById ('locatie').focus ();
        return false;
    }
    if(document.getElementById ('gemeente').value.length < 1) {
        alert ('Gemeente is verplicht!');
        document.getElementById ('gemeente').focus ();
        return false;
    }
    if(document.getElementById ('locatienr').value.length < 1) {
        alert ('Locatienummer is verplicht!');
        document.getElementById ('locatienr').focus ();
        return false;
    }
    if(document.getElementById ('rayon').value.length < 1) {
        alert ('Rayon is verplicht!');
        document.getElementById ('rayon').focus ();
        return false;
    }
//    if(document.getElementById ('contanttotaalvoorkomma').value.length < 1) {
//        alert ('Totaal aan contanten is verplicht!');
//        document.getElementById ('contanttotaalvoorkomma').focus ();
//        return false;
//    }
//    if(document.getElementById ('totaaltotaalvoorkomma').value.length < 1) {
//        alert ('Totaal opbrengst is verplicht!');
//        document.getElementById ('totaaltotaalvoorkomma').focus ();
//        return false;
//    }
    if(document.getElementById ('stortbedragvoorkomma').value.length < 1) {
        alert ('Over te schrijven is verplicht!');
        document.getElementById ('stortbedragvoorkomma').focus ();
        return false;
    }
    
    if(document.getElementById ('stortingswijzeacceptgiro').checked) {
        if(document.getElementById ('girodag').value.length < 1) {
            alert ('Dag is verplicht!');
            document.getElementById ('girodag').focus ();
            return false;
        }
        if(document.getElementById ('giromaand').value.length < 1) {
            alert ('Maand is verplicht!');
            document.getElementById ('giromaand').focus ();
            return false;
        }
        if(document.getElementById ('girojaar').value.length < 1) {
            alert ('Jaar is verplicht!');
            document.getElementById ('girojaar').focus ();
            return false;
        }
    }

    if(document.getElementById ('naam1').value.length < 1) {
        alert ('Naam van eerste contactpersoon is verplicht!');
        document.getElementById ('naam1').focus ();
        return false;
    }
    if(document.getElementById ('naam2').value.length < 1) {
        alert ('Naam van tweede contactpersoon is verplicht!');
        document.getElementById ('naam2').focus ();
        return false;
    }
    if(document.getElementById ('adres1').value.length < 1) {
        alert ('Adres van eerste contactpersoon is verplicht!');
        document.getElementById ('adres1').focus ();
        return false;
    }
    if(document.getElementById ('adres2').value.length < 1) {
        alert ('Adres van tweede contactpersoon is verplicht!');
        document.getElementById ('adres2').focus ();
        return false;
    }
    if(document.getElementById ('woonplaats1').value.length < 1) {
        alert ('Woonplaats van eerste contactpersoon is verplicht!');
        document.getElementById ('woonplaats1').focus ();
        return false;
    }
    if(document.getElementById ('woonplaats2').value.length < 1) {
        alert ('Woonplaats van tweede contactpersoon is verplicht!');
        document.getElementById ('woonplaats2').focus ();
        return false;
    }
    if(document.getElementById ('telefoon1').value.length < 1) {
        alert ('Telefoonnummer van eerste contactpersoon is verplicht!');
        document.getElementById ('telefoon1').focus ();
        return false;
    }
    if(document.getElementById ('telefoon2').value.length < 1) {
        alert ('Telefoonnummer van tweede contactpersoon is verplicht!');
        document.getElementById ('telefoon2').focus ();
        return false;
    }
    if(document.getElementById ('email1').value.length < 1) {
        alert ('E-mailadres van eerste contactpersoon is verplicht!');
        document.getElementById ('email1').focus ();
        return false;
    }
    if(document.getElementById ('email2').value.length < 1) {
        alert ('E-mailadres van tweede contactpersoon is verplicht!');
        document.getElementById ('email2').focus ();
        return false;
    }
}
function EnableAcceptgiro () {
    document.getElementById ('DeelstortingTable').style.display='none';
    document.getElementById ('girodag').disabled=false;
    document.getElementById ('giromaand').disabled=false;
    document.getElementById ('girojaar').disabled=false;
    document.getElementById ('stortingdatum1').disabled=true;
    document.getElementById ('stortingbank1').disabled=true;
    document.getElementById ('stortingplaats1').disabled=true;
    document.getElementById ('stortingrekening1').disabled=true;
    document.getElementById ('stortingbedrag1voorkomma').disabled=true;
    document.getElementById ('stortingbedrag1nakomma').disabled=true;
    document.getElementById ('stortingdatum2').disabled=true;
    document.getElementById ('stortingbank2').disabled=true;
    document.getElementById ('stortingplaats2').disabled=true;
    document.getElementById ('stortingrekening2').disabled=true;
    document.getElementById ('stortingbedrag2voorkomma').disabled=true;
    document.getElementById ('stortingbedrag2nakomma').disabled=true;
    document.getElementById ('stortingdatum3').disabled=true;
    document.getElementById ('stortingbank3').disabled=true;
    document.getElementById ('stortingplaats3').disabled=true;
    document.getElementById ('stortingrekening3').disabled=true;
    document.getElementById ('stortingbedrag3voorkomma').disabled=true;
    document.getElementById ('stortingbedrag3nakomma').disabled=true;
}
function EnableStorting () {
    document.getElementById ('DeelstortingTable').style.display='block';
    document.getElementById ('girodag').disabled=true;
    document.getElementById ('giromaand').disabled=true;
    document.getElementById ('girojaar').disabled=true;
    document.getElementById ('stortingdatum1').disabled=false;
    document.getElementById ('stortingbank1').disabled=false;
    document.getElementById ('stortingplaats1').disabled=false;
    document.getElementById ('stortingrekening1').disabled=false;
    document.getElementById ('stortingbedrag1voorkomma').disabled=false;
    document.getElementById ('stortingbedrag1nakomma').disabled=false;
    document.getElementById ('stortingdatum2').disabled=false;
    document.getElementById ('stortingbank2').disabled=false;
    document.getElementById ('stortingplaats2').disabled=false;
    document.getElementById ('stortingrekening2').disabled=false;
    document.getElementById ('stortingbedrag2voorkomma').disabled=false;
    document.getElementById ('stortingbedrag2nakomma').disabled=false;
    document.getElementById ('stortingdatum3').disabled=false;
    document.getElementById ('stortingbank3').disabled=false;
    document.getElementById ('stortingplaats3').disabled=false;
    document.getElementById ('stortingrekening3').disabled=false;
    document.getElementById ('stortingbedrag3voorkomma').disabled=false;
    document.getElementById ('stortingbedrag3nakomma').disabled=false;
}
function CorrectDagInDatum (p_objInput) {
    try {
        p_objInput = parseInt (p_objInput);
    } catch (l_objError) {
        p_objInput = 0;
    }
    if(p_objInput + '' == 'NaN')
        p_objInput = '1';
    if(p_objInput > 31)
        p_objInput = '1';
    if(parseInt(p_objInput) < 10)
        p_objInput = '0' + parseInt(p_objInput);
    return p_objInput;
}
function CorrectMaandInDatum (p_objInput) {
    try {
        p_objInput = parseInt (p_objInput);
    } catch (l_objError) {
        p_objInput = 0;
    }
    if(p_objInput + '' == 'NaN')
        p_objInput = '1';
    if(p_objInput > 12)
        p_objInput = '1';
    if(parseInt(p_objInput) < 10)
        p_objInput = '0' + parseInt(p_objInput);
    return p_objInput;
}
function CorrectJaarInDatum (p_intInput) {
    try {
        p_objInput = parseInt (p_objInput);
    } catch (l_objError) {
        p_objInput = 0;
    }
    if(p_objInput + '' == 'NaN')
        p_objInput = '2009';
    if(p_objInput < 1950 || p_objInput > 2050)
        p_objInput = '2010';
    return p_objInput;
}
function CorrectBedragVoorKomma (p_objInput) {
    while (p_objInput.indexOf('.') > -1) {
        p_objInput = p_objInput.replace('.', '');
    }
    if(p_objInput == '') {
        p_objInput = '0';
    }
    if(isNaN(p_objInput)) {
        p_objInput = '0';
    }
    if(p_objInput < 0) {
        p_objInput = '' + parseInt(p_objInput / -1);
    }
    var l_strTemp = '';
    for(l_intCount = 1; l_intCount <= (p_objInput.length + 2) / 3; l_intCount++) {
        l_intPosition = p_objInput.length - (l_intCount * 3);
        l_strTemp = p_objInput.substring(l_intPosition, l_intPosition + 3)  + '.' + l_strTemp;
    }
    p_objInput = l_strTemp;
    if(p_objInput.lastIndexOf('.') == p_objInput.length - 1) {
        p_objInput = p_objInput.substring(0, p_objInput.length - 1);
    }
    TelAllesOp ();
    return p_objInput;
}
function CorrectBedragNaKomma (p_objInput) {
    while (p_objInput.indexOf('.') > -1) {
        p_objInput = p_objInput.replace('.', '');
    }
    if(p_objInput == '') {
        p_objInput = '00';
    }
    if(isNaN(p_objInput)) {
        p_objInput = '00';
    }
    p_objInput = '' + parseInt(p_objInput);
    if(p_objInput < 0) {
        p_objInput = '' + parseInt(p_objInput / -1);
        p_objInput = p_objInput.replace(' ', '');
    }
    if(p_objInput < 10 && p_objInput.length < 2) {
        p_objInput = '0' + p_objInput;
    }
    TelAllesOp ();
    return p_objInput;
}
function ZetPuntjesNaDuizendtal(p_objInput) {
    var l_strTemp = '';
    p_objInput = '' + p_objInput;
    for(l_intCount = 1; l_intCount <= (p_objInput.length + 2) / 3; l_intCount++) {
        l_intPosition = p_objInput.length - (l_intCount * 3);
        l_strTemp = p_objInput.substring(l_intPosition, l_intPosition + 3)  + '.' + l_strTemp;
    }
    if(l_strTemp.lastIndexOf('.') == l_strTemp.length - 1) {
        l_strTemp = l_strTemp.substring(0, l_strTemp.length - 1);
    }
    return l_strTemp;
}
function TelAllesOp () {
    //debugger;
    var l_intBedragVoor = 0;
    var l_intBedragNa = 0;
    try {
        if(parseInt(document.getElementById('contantthuisvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('contantthuisvoorkomma').value.replace('.', ''));
        }
//        if(parseInt(document.getElementById('contantbedrijfvoorkomma').value).toString() != 'NaN') {
//            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('contantbedrijfvoorkomma').value.replace('.', ''));
//        }
//        if(parseInt(document.getElementById('contantthuisnakomma').value).toString() != 'NaN') {
//            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('contantthuisnakomma').value.replace('.', ''));
//        }
//        if(parseInt(document.getElementById('contantbedrijfnakomma').value).toString() != 'NaN') {
//            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('contantbedrijfnakomma').value.replace('.', ''));
//        }
//        l_intBedragVoor = parseInt(l_intBedragVoor + parseInt(l_intBedragNa / 100));
//        l_intBedragNa = parseInt(l_intBedragNa % 100);
//        document.getElementById('contanttotaalvoorkomma').value = ZetPuntjesNaDuizendtal(l_intBedragVoor);
//        if(l_intBedragNa < 10)
//            l_intBedragNa = '0' + l_intBedragNa;
//        document.getElementById('contanttotaalnakomma').value = l_intBedragNa;      
    } catch (l_objError){
        document.getElementById('contanttotaalvoorkomma').value = '0';
        document.getElementById('contanttotaalnakomma').value = '00';
    }
    l_intBedragVoor = 0;
    l_intBedragNa = 0;
    try {
        if(parseInt(document.getElementById('contantthuisvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('contantthuisvoorkomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('girohuisvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('girohuisvoorkomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('contantthuisnakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('contantthuisnakomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('girohuisnakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('girohuisnakomma').value.replace('.', ''));
        }
        l_intBedragVoor = parseInt(l_intBedragVoor + parseInt(l_intBedragNa / 100));
        l_intBedragNa = parseInt(l_intBedragNa % 100);
        document.getElementById('totaalhuisvoorkomma').value = ZetPuntjesNaDuizendtal(l_intBedragVoor);
        if(l_intBedragNa < 10)
            l_intBedragNa = '0' + l_intBedragNa;
        document.getElementById('totaalhuisnakomma').value = l_intBedragNa;      
    } catch (l_objError){
        document.getElementById('totaalhuisvoorkomma').value = '0';
        document.getElementById('totaalhuisnakomma').value = '00';
    }
    l_intBedragVoor = 0;
    l_intBedragNa = 0;
//    try {
//        if(parseInt(document.getElementById('contantbedrijfvoorkomma').value).toString() != 'NaN') {
//            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('contantbedrijfvoorkomma').value.replace('.', ''));
//        }
//        if(parseInt(document.getElementById('girobedrijfvoorkomma').value).toString() != 'NaN') {
//            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('girobedrijfvoorkomma').value.replace('.', ''));
//        }
//        if(parseInt(document.getElementById('contantbedrijfnakomma').value).toString() != 'NaN') {
//            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('contantbedrijfnakomma').value.replace('.', ''));
//        }
//        if(parseInt(document.getElementById('girobedrijfnakomma').value).toString() != 'NaN') {
//            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('girobedrijfnakomma').value.replace('.', ''));
//        }
//        l_intBedragVoor = parseInt(l_intBedragVoor + parseInt(l_intBedragNa / 100));
//        l_intBedragNa = parseInt(l_intBedragNa % 100);
//        document.getElementById('totaalbedrijfvoorkomma').value = ZetPuntjesNaDuizendtal(l_intBedragVoor);
//        if(l_intBedragNa < 10)
//            l_intBedragNa = '0' + l_intBedragNa;
//        document.getElementById('totaalbedrijfnakomma').value = l_intBedragNa;      
//    } catch (l_objError){
//        document.getElementById('totaalbedrijfvoorkomma').value = '0';
//        document.getElementById('totaalbedrijfnakomma').value = '00';
//    }
    l_intBedragVoor = 0;
    l_intBedragNa = 0;
    try {
        if(parseInt(document.getElementById('totaalhuisvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('totaalhuisvoorkomma').value.replace('.', ''));
        }
//        if(parseInt(document.getElementById('totaalbedrijfvoorkomma').value).toString() != 'NaN') {
//            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('totaalbedrijfvoorkomma').value.replace('.', ''));
//        }
        if(parseInt(document.getElementById('totaalhuisnakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('totaalhuisnakomma').value.replace('.', ''));
        }
//        if(parseInt(document.getElementById('totaalbedrijfnakomma').value).toString() != 'NaN') {
//            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('totaalbedrijfnakomma').value.replace('.', ''));
//        }
//        l_intBedragVoor = parseInt(l_intBedragVoor + parseInt(l_intBedragNa / 100));
//        l_intBedragNa = parseInt(l_intBedragNa % 100);
//        document.getElementById('totaaltotaalvoorkomma').value = ZetPuntjesNaDuizendtal(l_intBedragVoor);
//        if(l_intBedragNa < 10)
//            l_intBedragNa = '0' + l_intBedragNa;
//        document.getElementById('totaaltotaalnakomma').value = l_intBedragNa;      
    } catch (l_objError){
        document.getElementById('totaaltotaalvoorkomma').value = '0';
        document.getElementById('totaaltotaalnakomma').value = '00';
    }
    l_intBedragVoor = 0;
    l_intBedragNa = 0;
    try {
        if(parseInt(document.getElementById('stortingkostenvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('stortingkostenvoorkomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('overigekostenvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('overigekostenvoorkomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('lokatiekostenvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('lokatiekostenvoorkomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('stortingkostennakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('stortingkostennakomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('overigekostennakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('overigekostennakomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('lokatiekostennakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('lokatiekostennakomma').value.replace('.', ''));
        }
        l_intBedragVoor = parseInt(l_intBedragVoor + parseInt(l_intBedragNa / 100));
        l_intBedragNa = parseInt(l_intBedragNa % 100);
        document.getElementById('totaalkostenvoorkomma').value = ZetPuntjesNaDuizendtal(l_intBedragVoor);
        if(l_intBedragNa < 10)
            l_intBedragNa = '0' + l_intBedragNa;
        document.getElementById('totaalkostennakomma').value = l_intBedragNa;      
    } catch (l_objError){
        document.getElementById('totaalkostenvoorkomma').value = '0';
        document.getElementById('totaalkostennakomma').value = '00';
    }
    l_intBedragVoor = 0;
    l_intBedragNa = 0;
    //debugger;
    try {
//        if(parseInt(document.getElementById('totaaltotaalvoorkomma').value).toString() != 'NaN') {
//            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('contanttotaalvoorkomma').value.replace('.', ''));
//        }
        if(parseInt(document.getElementById('totaalkostenvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor - parseInt(document.getElementById('totaalkostenvoorkomma').value.replace('.', ''));
        }
//        if(parseInt(document.getElementById('totaaltotaalnakomma').value).toString() != 'NaN') {
//            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('contanttotaalnakomma').value.replace('.', ''));
//        }
        if(parseInt(document.getElementById('totaalkostennakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa - parseInt(document.getElementById('totaalkostennakomma').value.replace('.', ''));
        }
    
        if(parseInt(document.getElementById('contantthuisvoorkomma').value).toString() != 'NaN') {
            l_intBedragVoor = l_intBedragVoor + parseInt(document.getElementById('contantthuisvoorkomma').value.replace('.', ''));
        }
        if(parseInt(document.getElementById('contantthuisnakomma').value).toString() != 'NaN') {
            l_intBedragNa = l_intBedragNa + parseInt(document.getElementById('contantthuisnakomma').value.replace('.', ''));
        }
        if(l_intBedragNa < 0) {
            if(l_intBedragVoor > 0) {
                l_intBedragNa = 100 + l_intBedragNa;
                l_intBedragVoor = l_intBedragVoor - 1;
            } else {
                l_intBedragNa = l_intBedragNa / -1;
            }
        }
        if(l_intBedragNa < 10)
            l_intBedragNa = '0' + l_intBedragNa;
        document.getElementById('stortbedragvoorkomma').value = ZetPuntjesNaDuizendtal(l_intBedragVoor);
        document.getElementById('stortbedragnakomma').value = l_intBedragNa;      
    } catch (l_objError){
        document.getElementById('stortbedragvoorkomma').value = '0';
        document.getElementById('stortbedragnakomma').value = '00';
    }
}
// </Afrekenstaat>

// <MIS>
function MisAndereKeuze (p_objInput) {
    if(p_objInput) {
        document.misform.inzetthemaanders.disabled=false;
    } else {
        document.misform.inzetthemaanders.disabled=true;
    }
}
// </MIS>


// Start - Forum functions
function Reply()
{
    var l_objForm = document.getElementById("ReplyFormContainer");
    if(l_objForm!=null)
    {
        l_objForm.style.display = "block";
    }
}
function CancelReply()
{
    var l_objForm = document.getElementById("ReplyFormContainer");
    if(l_objForm!=null)
    {
        l_objForm.style.display = "none";
    }
}

function AddArticle()
{
    var l_objForm = document.getElementById("AddArticleFormContainer");
    if(l_objForm!=null)
    {
        l_objForm.style.display = "block";
    }
}
function CancelAddArticle()
{
    var l_objForm = document.getElementById("AddArticleFormContainer");
    if(l_objForm!=null)
    {
        l_objForm.style.display = "none";
    }
}

function MinItem(ThisObject, Company, Voorraad)
{
	if(ThisObject.value>0)
	{
		ThisObject.value= parseInt(ThisObject.value)-1;
	}
}

function PlusItem(ThisObject, Company, Voorraad)
{
	ThisObject.value=parseInt(ThisObject.value)+1;
}

function SetPersonWheelChair(p_strValue)
{
    if (p_strValue == '1')
    {
        document.getElementById('rolstoelnum').style.backgroundColor='#FFFFFF';
        document.getElementById('rolstoelnum').disabled=false;
        document.getElementById('rolstoelnum').focus();
    }
    else
    {
        document.getElementById('rolstoelnum').style.backgroundColor='#dcdcdc';
        document.getElementById('rolstoelnum').value='';
        document.getElementById('rolstoelnum').disabled=true;
    }
}

function CheckVriendenDag(p_objForm)
{
    if(document.getElementById('voorletters0').value=='')
    {
        window.alert('Uw voorletters zijn verplicht.');
        document.getElementById('voorletters0').focus();
        return false;
    }
    
    if(document.getElementById('naam0').value=='')
    {
        window.alert('Uw achternaam is verplicht.');
        document.getElementById('naam0').focus();
        return false;
    }
    
    if(document.getElementById('adres').value=='')
    {
        window.alert('Uw adres is verplicht.');
        document.getElementById('adres').focus();
        return false;
    }
    
    if(document.getElementById('postcode').value=='')
    {
        window.alert('Uw postcode is verplicht.');
        document.getElementById('postcode').focus();
        return false;
    }
    
    if(document.getElementById('plaats').value=='')
    {
        window.alert('Uw woonplaats is verplicht.');
        document.getElementById('plaats').focus();
        return false;
    }
    
    if(document.getElementById('email').value=='')
    {
        window.alert('Uw e-mail is verplicht.');
        document.getElementById('email').focus();
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
		}else{
			window.alert('Uw e-mailadres is niet valide.');
			document.getElementById("email").focus();
			return false;
		}
    }
    
    if (document.getElementById('rolstoel').value=='1')
    {
        if(document.getElementById('rolstoelnum').value=='')
        {
			window.alert('Uw heeft gekozen voor rolstoel bezoekers maar nog niet het aantal ingevuld.');
			document.getElementById("rolstoelnum").focus();
			return false;
        }
    }
    
    
    p_objForm.submit();
}

// End - Forum functions