
function showHide(photoId,total){

    var i = 0
	
	while(i < total) {
        
    	i = i + 1;
    	
        document.getElementById("photo"+i).style.display = 'none';
        	
    }
    
    document.getElementById("photo"+photoId).style.display = 'inline';
}

function showDiv(divID,operator) {
  d = document.getElementById(divID);
  if(operator == "on") {
    d.style.display = "block";
  } else if(operator == "off") {
    d.style.display = "none";
  }
}

function checkShowDiv(divID,operator) {

  d = document.getElementById(divID);
  
  if (divID == 'paymentMessage') {

	  nederland = document.getElementById('customerPayment');
	  belgie = document.getElementById('customerPaymentBe');
	  overig = document.getElementById('paymentMessageOverig');
	  bank = document.getElementById('bank');
	  overigCountry = document.getElementById('overigCountry');

  	  postcalCodeBox1 = document.getElementById('postalCodeBox1');
  	  postcalCodeBox2 = document.getElementById('postalCodeBox2');
	  
	  customerPostalCode1 = document.getElementById('customerPostalCode1');
	  customerPostalCode2 = document.getElementById('customerPostalCode2');
	  customerPostalCode3 = document.getElementById('customerPostalCode3');

	  customerPayment = document.getElementById('customerPayment');
  
  		if (operator == 'Nederland') {
		
			d.style.display = "block";
			nederland.style.display = "block";
			belgie.style.display = "none";
			overig.style.display = "none";
			overigCountry.style.display = "none";
			
			postcalCodeBox1.style.display = "block";
			postcalCodeBox2.style.display = "none";
			
			customerPostalCode3.value = '';
		
		} else if (operator == 'Belgie') {
		
			d.style.display = "block";
			nederland.style.display = "none";
			belgie.style.display = "block";
			overig.style.display = "none";
			overigCountry.style.display = "none";
			
			customerPayment.value = '';
			//bank.style.display = "none";
			
			postcalCodeBox1.style.display = "none";
			postcalCodeBox2.style.display = "block";
			
			if (customerPostalCode3.value == '') {
				
				customerPostalCode3.value = customerPostalCode1.value + ' ' + customerPostalCode2.value;
				
			}
			
			customerPostalCode1.value = '';
			customerPostalCode2.value = '';
		
		} else if (operator == 'Overig') {
		
			d.style.display = "none";
			nederland.style.display = "block";
			belgie.style.display = "none";
			overig.style.display = "block";
			overigCountry.style.display = "inline-block";
			
			postcalCodeBox1.style.display = "none";
			postcalCodeBox2.style.display = "block";
			
			if (customerPostalCode3.value == '') {
				
				customerPostalCode3.value = customerPostalCode1.value + ' ' + customerPostalCode2.value;
				
			}
	
			customerPostalCode1.value = '';
			customerPostalCode2.value = '';

		}  
  
  } 
  
}

function checkEmail(emailAddress) {
    var foundAtSymbol = 0;
    var foundDot = 0;
    var md;
    
    for (var x=0; x<emailAddress.length - 1; x++) {
        md = emailAddress.substr(x, 1);
    
        if (md == '@') {
            foundAtSymbol++;
        }
    
        if (md == '.' && foundAtSymbol == 1) {
            foundDot++;
        }
    }
    
    if (foundDot > 0 && foundAtSymbol == 1) {
        return true;
    } else{
        return false;
    }
}

function checkform(){
d = document.getElementById("getClientData");

  if(d.customerFirstName.value==''){
    alert('U moet uw voornaam invullen!');
    return false;
  }

  if(d.customerLastName.value==''){
    alert('U moet uw achternaam invullen!');
    return false;
  }

  checked = '';
  for (i=0; i < d.customerSex.length; i++)
  {
	if (d.customerSex[i].checked)
  {
	checked = d.customerSex[i].value;
  }
  }

  if(checked==''){
    alert('U moet uw geslacht opgeven!');
    return false;
  }

  if(d.customerStreet.value==''){
    alert('U moet uw straatnaam invullen!');
    return false;
  }

  if(d.customerHomeNumber.value==''){
    alert('U moet uw huisnummer invullen!');
    return false;
  }

  if(d.customerPostalCode1.value=='' && d.customerPostalCode3.value==''){
    alert('U moet uw postcode helemaal invullen!');
    return false;
  }

  if(d.customerPostalCode2.value=='' && d.customerPostalCode3.value==''){
    alert('U moet uw postcode helemaal invullen!');
    return false;
  }

  if(d.customerCity.value==''){
    alert('U moet uw woonplaats invullen!');
    return false;
  }

  if(d.customerCountry.value=='' || (d.customerCountry.value=='Overig' && d.overigCountry.value=='')){
    alert('U moet het land waarin u woont opgeven!');
    return false;
  }

  if(d.customerPhone.value==''){
    alert('U moet uw telefoonnummer invullen!');
    return false;
  }

    if(d.customerEmail.value==''){
        alert('U moet uw e-mailadres correct invullen!');
        return false;
    }
    
    emailAddress = d.customerEmail.value;
    if(checkEmail(emailAddress)==false){
        alert('U moet uw e-mailadres correct invullen!');
        return false;
    }

//  if(d.customerPassword.value==''){
//    alert('Je moet je wachtwoord invullen!');
//    return false;
//  }

  if(d.customerCountry.value=='Nederland' && d.customerPayment.value==''){
    alert('U moet een betalingswijze opgeven!');
    return false;
  }

  if(d.customerCountry.value=='Belgie' && d.customerPaymentBe.value==''){
    alert('U moet een betalingswijze opgeven!');
    return false;
  }
  
  if (!d.agreement.checked) {
    alert('U moet akkoord gaan met de voorwaarden!');
    return false;
  }

}

function faq(q) {

  if (q == 'Pass') {
    alert('Als je een wachtwoord intypt, kun je volgende keer snel een bestelling doen door alleen je e-mailadres en wachtwoord in te voeren.');
  }


}

