// JavaScript Document
var sbmt=0;
function clearInput(dflt,field){
	if(dflt==($(":input#"+field).val()) || $(":input#"+field).val()=="Dit veld is verplicht" ){
		$(":input#"+field).val('');
		$("#"+field).css({'font-style':'normal', 'color':'black'});
		
	}
	//alert($(":input#"+field).val());
}

function clearTextarea(){
	$('#opmerkingen').val('');
}

function validate(field){
	if($(":input#"+field).val()==""){
		//alert ("veld is leeg");
		$(":input#"+field).val(field+' is verplicht');
		$("#"+field).css("color","red");
	}
	
	if($(":input#"+field).val()!="Dit veld is verplicht" && $(":input#"+field).val()!="" && $(":input#"+field).val()!=field+' is verplicht' ){
		sbmt++;
	}
	
	if(sbmt>=7){ 
		$("#bestellen-knop").unbind("click");
		$("#bestellen-knop").click(function(){
			//								
			if($('#voornaam').val() == 'Voornaam (optioneel)'){ $('#voornaam').val(''); }
			if($('#bedrijfsnaam').val() == 'Bedrijfsnaam (optioneel)'){ $('#bedrijfsnaam').val(''); }
			if($('#opmerkingen').val() == 'Opmerkingen (optioneel)'){ $('#opmerkingen').val(''); }
			if($('#voornaam_lev').val() == 'Voornaam (optioneel)'){ $('#voornaam_lev').val(''); }
			if($('#naam').val() == 'Dit veld is verplicht' || $('#naam').val() =='' || $('#naam').val() =='naam is verplicht' ||
				$('#adres').val() == 'Dit veld is verplicht' || $('#adres').val() =='' || $('#adres').val() =='adres is verplicht' ||
				$('#postcode').val() == 'Dit veld is verplicht' || $('#postcode').val() =='' || $('#postcode').val() =='postcode is verplicht' ||
				$('#plaats').val() == 'Dit veld is verplicht' || $('#plaats').val() =='' || $('#plaats').val() =='plaats is verplicht' ||
				$('#telefoon').val() == 'Dit veld is verplicht' || $('#telefoon').val() =='' || $('#telefoon').val() =='telefoon is verplicht' ||
				$('#email').val() == 'Dit veld is verplicht' || $('#email').val() =='' || $('#email').val() =='email is verplicht'
				){
				alert('Gelieve alle velden juist in te vullen');
				return false;
			}
			//alert('t');
			document.gegevens_form.submit();return false;
			});
	}
	
}
function validateBank() { 
	if($(":select#select").val()=="0"){
		alert("U dient een bank te kiezen!");
	} else { 
		document.OrderForm.submit();
	}
}