﻿function validateForm(form) { //This is the name of the function

if (form.navn.value == "") { //This checks to make sure the field is not empty
   alert("Please give us your company name!"); //Informs user of empty field
   form.navn.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.kontaktperson.value == "") { //This checks to make sure the field is not empty
   alert("Please give us a contact person!"); //Informs user of empty field
   form.kontaktperson.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

if (form.kommentar.value == "") { //This checks to make sure the field is not empty
   alert("Please make a query!"); //Informs user of empty field
   form.kommentar.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

}

function validateFormQ(form) { //This is the name of the function

if (form.navn.value == "") { //This checks to make sure the field is not empty
   alert("Please give us your company name!"); //Informs user of empty field
   form.navn.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.kontaktperson.value == "") { //This checks to make sure the field is not empty
   alert("Please give us a contact person!"); //Informs user of empty field
   form.kontaktperson.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

if (form.comments.value == "") { //This checks to make sure the field is not empty
   alert("Please make a query!"); //Informs user of empty field
   form.comments.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if ((form.type[0].checked == false) && (form.type[1].checked == false) && (form.type[2].checked == false)) {
	alert("Please choose type of encoder!");
	return false;
	}
	
if ((form.ex[0].checked == false) && (form.ex[1].checked == false)) {
	alert("Please choose if the encoder should be EX approved!");
	return false;
	}

if ((form.outputstage[0].checked == false) && (form.outputstage[1].checked == false) && (form.outputstage[2].checked == false) && (form.outputstage[3].checked == false) && (form.outputstage[4].checked == false)) {
	alert("Please choose Output stage");
	return false;
	}
	
if ((form.dutycycle[0].checked == false) && (form.dutycycle[1].checked == false)) {
	alert("Please choose Duty Cycle");
	return false;
	}
	
if ((form.vdc[0].checked == false) && (form.vdc[1].checked == false)) {
	alert("Please if the cable shield should be connected to 0VDC");
	return false;
	}
	
if ((form.output[0].checked == false) && (form.output[1].checked == false) && (form.output[2].checked == false)) {
	alert("Please choose number of output channels");
	return false;
	}
	
if ((form.rotationdirection[0].checked == false) && (form.rotationdirection[1].checked == false)) {
	alert("Please choose rotation direction");
	return false;
	}

if ((form.mechfreewheel[0].checked == false) && (form.mechfreewheel[1].checked == false)) {
	alert("Please choose if you require a mechanical freewheel");
	return false;
	}
	
if ((form.mechtotalizer[0].checked == false) && (form.mechtotalizer[1].checked == false) && (form.mechtotalizer[2].checked == false)) {
	alert("Please choose if you require a mechanical totalizer");
	return false;
	}

if ((form.totalizertype[0].checked == false) && (form.totalizertype[1].checked == false) && (form.totalizertype[2].checked == false) && (form.totalizertype[3].checked == false)) {
	alert("Please choose totalizer type");
	return false;
	}
	
if ((form.popnuts[0].checked == false) && (form.popnuts[1].checked == false)) {
	alert("Please choose if you require 'pop nuts'");
	return false;
	}
	
if ((form.drawingshaft[0].checked == false) && (form.drawingshaft[1].checked == false)) {
	alert("Please choose if you can supply a drawing of the encoder shaft");
	return false;
	}
	
if ((form.supplybracket[0].checked == false) && (form.supplybracket[1].checked == false)) {
	alert("Please choose if Eltomatic must supply a bracket");
	return false;
	}
	
if (form.cablelength.value == "") { //This checks to make sure the field is not empty
   alert("Please specify cable length"); //Informs user of empty field
   form.cablelength.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
 if (form.drivecablelength.value == "") { //This checks to make sure the field is not empty
   alert("Please specify length of drive cable between totalizer and encoder"); //Informs user of empty field
   form.drivecablelength.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
 
 if (form.ppcpr.value == "") { //This checks to make sure the field is not empty
   alert("Please specify number of pulses per channel per revolution."); //Informs user of empty field
   form.ppcpr.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
 
  if (form.supplyvoltage.value == "") { //This checks to make sure the field is not empty
   alert("Please specify supply voltage"); //Informs user of empty field
   form.supplyvoltage.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
if (form.volume.value == "") { //This checks to make sure the field is not empty
   alert("Please specify shaft volume"); //Informs user of empty field
   form.volume.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

}


function validateFormDl(form) { //This is the name of the function

if (form.navn.value == "") { //This checks to make sure the field is not empty
   alert("Please enter your name!"); //Informs user of empty field
   form.navn.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

}

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("You have not entered a valid e-mail adress!")
e.select()
}
return returnval
}


