﻿function checkLogin()
{
        if(document.getElementById('username').value == '')
		{
			document.getElementById('username').focus();
			window.alert('Username is a mandatory field!');
			return false;
		}
		
		if(document.getElementById('password').value == '')
		{
			document.getElementById('password').focus();
			window.alert('Password is a mandatory field!');
			return false;
		}
}

function checkDescription()
{
        tinyMCE.triggerSave();
        
        if(document.getElementById('description').value == '')
		{
			document.getElementById('description').focus();
			window.alert('Description is a mandatory field!');
			return false;
		}
		
		if(document.getElementById('email').value != '')
		{
	        var goodEmail = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	        if (goodEmail){
	        }  else{
		        window.alert('This is not a valid email address');
		        document.getElementById("email").focus();
		        return false;		
		    }
		}
		
		if(document.getElementById('email2').value != '')
		{
	        var goodEmail2 = document.getElementById("email2").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	        if (goodEmail2){
	        }  else{
		        window.alert('This is not a valid email address');
		        document.getElementById("email2").focus();
		        return false;		
		    }
		}
		
		if(document.getElementById('email3').value != '')
		{
	        var goodEmail3 = document.getElementById("email3").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	        if (goodEmail3){
	        }  else{
		        window.alert('This is not a valid email address');
		        document.getElementById("email3").focus();
		        return false;		
		    }
		}


}

function checkProduct()
{
        //if(document.getElementById('products').options[document.getElementById('products').selectedIndex].value < 1)
        if(document.getElementById('products').value == '')
		{
			document.getElementById('products').focus();
			window.alert('Product is a mandatory field!');
			return false;
		}
		
		//if(document.getElementById('products').value == '')
}


function checkresacti()
{
    if(document.getElementById('Bedrijfsnaam').value == '')
	{
		window.alert('Company name is a mandatory field!');
		document.getElementById('Bedrijfsnaam').focus();
		document.getElementById('btnresacti').style.display='block';
		return false;
	}
	
	if(document.getElementById('Voornaam').value == '')
	{
		window.alert('First name is a mandatory field!');
		document.getElementById('Voornaam').focus();
		document.getElementById('btnresacti').style.display='block';
		return false;
	}
	
	if(document.getElementById('Achternaam').value == '')
	{
		window.alert('Last name is a mandatory field!');
		document.getElementById('Achternaam').focus();
		document.getElementById('btnresacti').style.display='block';
		return false;
	}
	
	if(document.getElementById('Functie').value == '')
	{
		window.alert('Position is a mandatory field!');
		document.getElementById('Functie').focus();
		document.getElementById('btnresacti').style.display='block';
		return false;
	}
	
	if(document.getElementById('Email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
		document.getElementById('Email').focus();
		document.getElementById('btnresacti').style.display='block';
		return false;
	}
	
	if(document.getElementById('Email').value != '')
	{
        var goodEmail = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid email address');
	        document.getElementById("Email").focus();
		    document.getElementById('btnresacti').style.display='block';
	        return false;		
	    }
	}
	
	if(document.getElementById('m2Lid'))
	{
	    if(document.getElementById('m2Lid').value == '')
	    {
		    window.alert('Ons bedrijf reserveert is a mandatory field!');
		    document.getElementById('m2Lid').focus();
		    document.getElementById('btnresacti').style.display='block';
		    return false;
	    }
	}
	

    if(document.getElementById("Voorwaarden").checked == false)
	{
		window.alert('U dient akkoord te gaan met de algemene voorwaarden');
		document.getElementById('btnresacti').style.display='block';
		return false;
	}

    
}

function checkNewMember()
{
        if(document.getElementById('TypeLidmaatschap').value == '')
		{
			window.alert('Type lidmaatschap is a mandatory field!');
			document.getElementById('TypeLidmaatschap').focus();
			return false;
		}
        
        if(document.getElementById('Bedrijfsnaam').value == '')
		{
			window.alert('Company name is a mandatory field!');
			document.getElementById('Bedrijfsnaam').focus();
			return false;
		}
		
		if(document.getElementById('PostbusAdres').value == '')
		{
			window.alert('Postbus/Postal address is a mandatory field!');
			document.getElementById('PostbusAdres').focus();
			return false;
		}
		
		if(document.getElementById('Postcode').value == '')
		{
			window.alert('ZIP code is a mandatory field!');
			document.getElementById('Postcode').focus();
			return false;
		}
		
		if(document.getElementById('Plaatsnaam').value == '')
		{
			window.alert('City is a mandatory field!');
			document.getElementById('Plaatsnaam').focus();
			return false;
		}
		
		if(document.getElementById('Telefoon').value == '')
		{
			window.alert('Phone is a mandatory field!');
			document.getElementById('Telefoon').focus();
			return false;
		}
	
		
		if(document.getElementById('contactalgemeen').value == '')
		{
			window.alert('Contactpersoon algemeen is a mandatory field!');
			document.getElementById('contactalgemeen').focus();
			return false;
		}
		
		if(document.getElementById('emailalgemeen').value == '')
		{
			window.alert('Email algemeen is a mandatory field!');
			document.getElementById('emailalgemeen').focus();
			return false;
		}
		else
		{
		    var goodEmail = document.getElementById("emailalgemeen").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		    if (goodEmail){
		    }  else{
			    window.alert('This is not a valid email address');
			    document.getElementById("emailalgemeen").focus();
			    return false;		
			}
		}
		
		if(document.getElementById('naamaanvrager').value == '')
		{
			window.alert('Naam tekeningsbevoegde is a mandatory field!');
			document.getElementById('naamaanvrager').focus();
			return false;
		}
		
		if(document.getElementById('emailaanvrager').value == '')
		{
			window.alert('Email tekeningsbevoegde is a mandatory field!');
			document.getElementById('emailaanvrager').focus();
			return false;
		}else{
		    var goodEmail2 = document.getElementById("emailaanvrager").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		    if (goodEmail2){
		    }  else{
			    window.alert('This is not a valid email address');
			    document.getElementById("emailaanvrager").focus();
			    return false;		
			}
		}
		

		
    if(document.getElementById("checkaanvraag").checked == false)
	{
		window.alert('U dient akkoord te gaan met het lidmaatschap');
		return false;
	}
}

function setchangeacti(p_intID)
{
    if(p_intID == 1)
    {
        document.getElementById('Postadres').value = 'n.v.t';
        document.getElementById('Postadres').disabled = true;
        document.getElementById('Telefoon').value = 'n.v.t';
        document.getElementById('Telefoon').disabled = true;
        document.getElementById('Fax').value = 'n.v.t';
        document.getElementById('Fax').disabled = true;
    }else{
        document.getElementById('Postadres').value = '';
        document.getElementById('Postadres').disabled = false;
        document.getElementById('Telefoon').value = '';
        document.getElementById('Telefoon').disabled = false;
        document.getElementById('Fax').value = '';
        document.getElementById('Fax').disabled = false;
    }
}

function checkProdSearch()
{
    if(document.getElementById('homeprodsearch').value == '')
	{
		window.alert('Searchterm is a mandatory field!');
		document.getElementById('homeprodsearch').focus();
		return false;
	}
}

function checkSearchProfiel()
{
    if(document.getElementById('profsearch').value == '')
	{
		window.alert('Searchterm is a mandatory field!');
		document.getElementById('profsearch').focus();
		return false;
	}
}

function checkSearchProducts()
{
    if(document.getElementById('prodsearch').value == '')
	{
		window.alert('Searchterm is a mandatory field!');
		document.getElementById('prodsearch').focus();
		return false;
	}
}

function checkSearchBrands()
{
    if(document.getElementById('brandssearch').value == '')
	{
		window.alert('Searchterm is a mandatory field!');
		document.getElementById('brandssearch').focus();
		return false;
	}
}

function checkMarktSearch()
{
    if(document.getElementById('marktsearch').value == '')
	{
		window.alert('Searchterm is a mandatory field!');
		document.getElementById('marktsearch').focus();
		return false;
	}
}

function checkNieuwsbrief()
{
    if(document.getElementById('emailnieuws').value == '')
	{
		window.alert('E-mail is a mandatory field!');
		document.getElementById('emailnieuws').focus();
		return false;
	}
	else
	{
	    var goodEmail = document.getElementById("emailnieuws").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	    if (goodEmail){
	    }  else{
		    window.alert('This is not a valid e-mail address');
		    document.getElementById("emailnieuws").focus();
		    return false;		
		}
	}
}

function checkSearchNews()
{
    if(document.getElementById('newssearch').value == '')
    {
	    window.alert('Searchterm is a mandatory field!');
	    document.getElementById('newssearch').focus();
	    return false;
    }
}

function checkVraagAntwoord()
{
    if(document.getElementById('voornaam').value == '')
	{
		window.alert('First name is a mandatory field!');
		document.getElementById('voornaam').focus();
		return false;
	}
	
    if(document.getElementById('email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('email').focus();
		return false;
	}
	
	if(document.getElementById('email').value != '')
	{
        var goodEmail = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("email").focus();
	        return false;		
	    }
	}
	
	if(document.getElementById('vraag').value == '')
	{
		window.alert('Question is a mandatory field!');
		document.getElementById('vraag').focus();		
		return false;
	}
	
}

function checkSearchClippers()
{
    if(document.getElementById('searchclippers').value == '')
    {
	    window.alert('Searchterm is a mandatory field!');
	    document.getElementById('searchclippers').focus();
	    return false;
    }
}

function CheckSearchJobs()
{
    if(document.getElementById('searchjobs').value == '')
    {
	    window.alert('Searchterm is a mandatory field!');
	    document.getElementById('searchjobs').focus();
	    return false;
    }
}

function checkMainSearch()
{
    if(document.getElementById('searchMain').value == '')
	{
		window.alert('Searchterm is a mandatory field!');
		document.getElementById('searchMain').focus();
		return false;
	}
}

function checkHMECatalogus()
{
    if(document.getElementById('voornaam').value == '')
	{
		window.alert('First name is a mandatory field!');
		document.getElementById('voornaam').focus();
		return false;
	}
	
	if(document.getElementById('achternaam').value == '')
	{
		window.alert('Last name is a mandatory field!');
		document.getElementById('achternaam').focus();
		return false;
	}
	
	if(document.getElementById('adres').value == '')
	{
		window.alert('Address is a mandatory field!');
		document.getElementById('adres').focus();
		return false;
	}
	
	if(document.getElementById('postcode').value == '')
	{
		window.alert('ZIP code is a mandatory field!');
		document.getElementById('postcode').focus();
		return false;
	}
	
	if(document.getElementById('plaatsnaam').value == '')
	{
		window.alert('City is a mandatory field!');
		document.getElementById('plaatsnaam').focus();
		return false;
	}
	
    if(document.getElementById('email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('email').focus();
		return false;
	}
	
	if(document.getElementById('email').value != '')
	{
        var goodEmail = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("email").focus();
	        return false;		
	    }
	}
	
	if(document.getElementById('taal').value == '')
	{
		window.alert('Language is a mandatory field!');
        document.getElementById('taal').focus();
		return false;
	}
	
}

function checkHMEJaarbericht()
{
    if(document.getElementById('voornaam').value == '')
	{
		window.alert('First name is a mandatory field!');
		document.getElementById('voornaam').focus();
		return false;
	}
	
	if(document.getElementById('achternaam').value == '')
	{
		window.alert('Last name is a mandatory field!');
		document.getElementById('achternaam').focus();
		return false;
	}
	
	if(document.getElementById('adres').value == '')
	{
		window.alert('Address is a mandatory field!');
		document.getElementById('adres').focus();
		return false;
	}
	
	if(document.getElementById('postcode').value == '')
	{
		window.alert('ZIP code is a mandatory field!');
		document.getElementById('postcode').focus();
		return false;
	}
	
	if(document.getElementById('plaatsnaam').value == '')
	{
		window.alert('City is a mandatory field!');
		document.getElementById('plaatsnaam').focus();
		return false;
	}
	
    if(document.getElementById('email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('email').focus();
		return false;
	}
	
	if(document.getElementById('email').value != '')
	{
        var goodEmail = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("email").focus();
	        return false;		
	    }
	}	
}

function checkHMEdedelingenVerzendlijst()
{
    if(document.getElementById('voornaam').value == '')
	{
		window.alert('First name is a mandatory field!');
		document.getElementById('voornaam').focus();
		return false;
	}
	
	if(document.getElementById('achternaam').value == '')
	{
		window.alert('Last name is a mandatory field!');
		document.getElementById('achternaam').focus();
		return false;
	}
	
	if(document.getElementById('adres').value == '')
	{
		window.alert('Address is a mandatory field!');
		document.getElementById('adres').focus();
		return false;
	}
	
	if(document.getElementById('postcode').value == '')
	{
		window.alert('ZIP code is a mandatory field!');
		document.getElementById('postcode').focus();
		return false;
	}
	
	if(document.getElementById('plaatsnaam').value == '')
	{
		window.alert('City is a mandatory field!');
		document.getElementById('plaatsnaam').focus();
		return false;
	}
	
    if(document.getElementById('email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('email').focus();
		return false;
	}
	
	if(document.getElementById('email').value != '')
	{
        var goodEmail = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("email").focus();
	        return false;		
	    }
	}
}

function checkMarktstudies()
{
    if(document.getElementById('bedrijfsnaam').value == '')
	{
		window.alert('Company name is a mandatory field!');
		document.getElementById('bedrijfsnaam').focus();
		return false;
	}
    
    if(document.getElementById('naam').value == '')
	{
		window.alert('Name is a mandatory field!');
		document.getElementById('naam').focus();
		return false;
	}

    if(document.getElementById('email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('email').focus();
		return false;
	}
	
	if(document.getElementById('email').value != '')
	{
        var goodEmail = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("email").focus();
	        return false;		
	    }
	}
	
	if(document.getElementById('telefoon').value == '')
	{
		window.alert('Direct phone is a mandatory field!');
		document.getElementById('telefoon').focus();
		return false;
	}
	
	if(document.getElementById("Voorwaarden").checked == false)
	{
		window.alert('U dient akkoord te gaan met de algemene leverings voorwaarden');
		return false;
	}
}

function showActiviteit(field)
{
    if(document.getElementById(field).style.display == 'block')
    {
        document.getElementById(field).style.display = 'none';
    }else{
        document.getElementById(field).style.display = 'block';
    }
}

function checkNieuws()
{
    tinyMCE.triggerSave();
    
    if(document.getElementById('Titel').value == '')
	{
		window.alert('Title is a mandatory field!');
        document.getElementById('Titel').focus();
		return false;
	}
	
	if(document.getElementById('Intro').value == '')
	{
		window.alert('Intro is a mandatory field!');
        document.getElementById('Intro').focus();
		return false;
	}
	
	if(document.getElementById('Tekst').value == '')
	{
		window.alert('Text is a mandatory field!');
        document.getElementById('Tekst').focus();
		return false;
	}
	
	if(document.getElementById('Email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('Email').focus();
		return false;
	}
	
	if(document.getElementById('Email').value != '')
	{
        var goodEmail = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("Email").focus();
	        return false;		
	    }
	}
	
}

function checkLandForm()
{
    if(document.getElementById('Naam').value == '')
	{
		window.alert('Name is a mandatory field!');
        document.getElementById('Naam').focus();
		return false;
	}
    
    if(document.getElementById('Email').value == '')
	{
		window.alert('E-mail is a mandatory field!');
        document.getElementById('Email').focus();
		return false;
	}
	
	if(document.getElementById('Email').value != '')
	{
        var goodEmail = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
        if (goodEmail){
        }  else{
	        window.alert('This is not a valid e-mail address');
	        document.getElementById("Email").focus();
	        return false;		
	    }
	}
	
	if(document.getElementById('Omschrijving').value == '')
	{
		window.alert('Remarks is a mandatory field!');
        document.getElementById('Omschrijving').focus();
		return false;
	}
}