var genus = "";
var firstname = "";
var lastname = "";
var company = "";
var email = "";
var newsletter = 0;
var databases = []; //Array(1,26,66);
var Title1, Time1, Index1 = 0; // Variables for step 1 -> likable color
var Title2, Time2, Index2 = 0; // Variables for step 4 -> another likable color
var Title3, Time3 = 0; // Variables for step 6 -> likable shape
var Title4, Time4 = 0; // Variables for step 8 -> another likable shape
var Title5, Time5, Index5 = 0; // Variables for step 10 -> dislikable color
var Title6, Time6, Index6 = 0; // Variables for step 12 -> another dislikable color
var Title7, Time7 = 0; // Variables for step 14 -> dislikable shape
var Title8, Time8 = 0; // Variables for step 16 -> another dislikable shape
var Title9, Time9 = 0; // Variables for step 18 -> likable shading
var Title10, Time10 = 0; // Variables for step 20 -> dislikable shading
//var interval;
var TimeStart;
var TimeStop;
var color_data = [
[1,'Red','#ff0000'],
[2,'Redorange','#ff4000'],
[3,'Orange','#ff8000'],
[4,'Orangeyellow','#ffbf00'],
[5,'Yellow','#ffff00'],
[6,'Greenyellow','#80ff00'],
[7,'Green','#01ff00'],
[8,'Turquoise','#01ebeb'],
[9,'Blue','#2828ff'],
[10,'Blueviolet','#8000ff'],
[11,'Violet','#eb00eb'],
[12,'Redviolet','#ff0080']
];
var colors = [];
colors['Red'] = '#ff0000';
colors['Redorange'] = '#ff4000';
colors['Orange'] = '#ff8000';
colors['Orangeyellow'] = '#ffbf00';
colors['Yellow'] = '#ffff00';
colors['Greenyellow'] = '#80ff00';
colors['Green'] = '#01ff00';
colors['Turquoise'] = '#01ebeb';
colors['Blue'] = '#2828ff';
colors['Blueviolet'] = '#8000ff';
colors['Violet'] = '#eb00eb';
colors['Redviolet'] = '#ff0080';
var svg_forms_name = ['Circle','Octagon','Hexagon','Square'];
var svg_forms = [];
svg_forms['Circle'] = '
'+
'
';
svg_forms['Octagon'] = '';
svg_forms['Hexagon'] = '';
svg_forms['Square'] = ''+
'
';
var svg_forms_name2 = ['ShadingBlack','ShadingDarkgray','ShadingLightgray','ShadingWhite'];
var colors2 = [];
colors2['ShadingBlack'] = '#000000';
colors2['ShadingDarkgray'] = '#555555';
colors2['ShadingLightgray'] = '#aaaaaa';
colors2['ShadingWhite'] = '#ffffff';
var color_id = [];
color_id['Red'] = 1;
color_id['Redorange'] = 2;
color_id['Orange'] = 3;
color_id['Orangeyellow'] = 4;
color_id['Yellow'] = 5;
color_id['Greenyellow'] = 6;
color_id['Green'] = 7;
color_id['Turquoise'] = 8;
color_id['Blue'] = 9;
color_id['Blueviolet'] = 10;
color_id['Violet'] = 11;
color_id['Redviolet'] = 12;
var shape_id = [];
shape_id['Circle'] = 1;
shape_id['Octagon'] = 2;
shape_id['Hexagon'] = 3;
shape_id['Square'] = 4;
var shading_id = [];
shading_id['ShadingBlack'] = 1;
shading_id['ShadingDarkgray'] = 2;
shading_id['ShadingLightgray'] = 3;
shading_id['ShadingWhite'] = 4;
function startTimer(){
TimeStart = Date.now();
}
function scroll_to_header(){
$('html,body').animate({
scrollTop: $("h1").offset().top - 60
}, 1000);
}
$(document).ready(function(){
// Select databases
$('input[name="databases[]"]').click(function(event){
current_id = this.id;
if ($('#'+current_id).is(':checked')){
$('#label_'+current_id).addClass("select-group-active");
} else {
$('#label_'+current_id).removeClass("select-group-active");
}
});
// Start online scan
$("#start_scan_form").submit(function(event){
var error = false;
// Prevent the sending of the form
event.preventDefault();
// Check if genus is empty
if($("input[name=genus]").val() == ""){
$("#genus_container").addClass("has-error");
$("#genus_error").text("");
error = true;
} else {
$("#genus_container").removeClass("has-error");
$("#genus_error").text("");
genus = $("input[name=genus]").val();
}
// Check if firstname is empty
if($("input[name=firstname]").val() == ""){
$("#firstname_container").addClass("has-error");
$("#firstname_error").text("");
error = true;
} else {
$("#firstname_container").removeClass("has-error");
$("#firstname_error").text("");
firstname = $("input[name=firstname]").val();
}
// Check if lastname is empty
if($("input[name=lastname]").val() == ""){
$("#lastname_container").addClass("has-error");
$("#lastname_error").text("");
error = true;
} else {
$("#lastname_container").removeClass("has-error");
$("#lastname_error").text("");
lastname = $("input[name=lastname]").val();
}
// Check if email is empty
if(($("input[name=email]").val() == "") || checkEmail($("input[name=email]").val()) == false){
$("#email_container").addClass("has-error");
$("#email_error").text("");
error = true;
} else {
$("#email_container").removeClass("has-error");
$("#email_error").text("");
email = $("input[name=email]").val();
}
// Get company
company = $("input[name=company]").val();
// Check, if database is selected
databases = [];
$(".databases:checked").each(function() {
databases.push(this.value);
});
if(databases.length == 0){
$("#databases_error").text("");
error = true;
} else {
$("#databases_error").text("");
}
if($("input[name=newsletter]").is(':checked')){
newsletter = 1;
} else newsletter = 0;
//console.log(matches);
if(!error){
// Open popup
var popup_data = {
url: "/products/freescan/scan-step-1.php",
title: "",
category: "",
output: "",
type: "",
textfloat: "",
data: ""
};
popup_open("",popup_data);
}
});
});