﻿function validateForm() {
  var foutText = '';
  if(document.getElementById('naam').value == '' || document.getElementById('naam').value == 'Naam' || document.getElementById('naam').value.length < 4) {
    foutText += '* Gelieve uw naam in te vullen.\n';
  }
  if(document.getElementById('email').value == '' || document.getElementById('email').value == 'E-mail' || document.getElementById('email').value.length < 6) {
    foutText += '* Gelieve uw e-mailadres in te vullen.\n';
  }
  
  emailVal = document.getElementById('email').value;
  if(emailVal.indexOf("@") == -1 || emailVal.indexOf(".") == -1) {
    foutText += '* Gelieve uw e-mailadres op correcte wijze in te vullen.\n';
  }
 

  if(document.getElementById('vraag').value == '' || document.getElementById('vraag').value == 'Vraag / opmerking' || document.getElementById('vraag').value.length < 4) {
    foutText += '* Gelieve uw vraag / opmerking in te vullen.\n';
  }
  if(foutText != ""){
  	prefoutText = '';
  	prefoutText += 'U heeft de verplichte velden niet ingevuld:\n\n';
  	prefoutText += foutText;
    alert(prefoutText);
    return false;
  }
  else {
  	//if EVERYTHING OK, LAUNCH ANTI ROBOT CHECK:
	Shadowbox.open({
        content:    "checkrobots.php",
        player:		"iframe",
        title:      "Beveiligingscheck",
        height:     350,
        width:      350
    });
    return false;
  }
  return false;
}

$(document).ready(function(){
	$("#naam").click(function(){
		if($("#naam").val() == "Naam"){
			$("#naam").val("");
		}
	});
	$("#email").click(function(){
		if($("#email").val() == "E-mail"){
			$("#email").val("");
		}
	});
	$("#vraag").click(function(){
		if($("#vraag").val() == "Vraag / opmerking"){
			$("#vraag").val("");
		}
	});
	
	
	$(document).mouseup(function(){
		if($("#naam").val() == ""){
			$("#naam").val("Naam");
		}
		if($("#email").val() == ""){
			$("#email").val("E-mail");
		}
		if($("#vraag").val() == ""){
			$("#vraag").val("Vraag / opmerking");
		}
	});

	
	$("#logoDivClickable").click(function(){
		window.open("http://www.inconel.nl","New Window");
	});
	$("#logoDivClickable").mouseenter(function(){
		$(this).css("cursor","pointer");
	});
	
	/*
	windowWidth = $(window).width();
	if(windowWidth <= 980){
		$("#topLeftArea").html("Wenst u meer informatie?");
	}
	*/
	
});

function sendMail(){
	var a = "info";
	var b = "inconel";
	var c = "nl";
	var str = a + "@" + b + "." + c;
	window.location = "mailto: " + str;
}

