﻿var Name = 'Insert your name.';
var Title = 'Insert your title.';
var Company = 'Insert your company.';
var Address = 'Insert your address.';
var Postcode = 'Insert your zip code.';
var City = 'Insert your city.';
var Country = 'Insert your country.';
var Phone = 'Insert your phonenumber.';
var Fax = 'Insert your faxnumber.';
var Email = 'Insert your email.';
var Email2 = 'This is not a valid e-mail';
var Website = 'Insert your website.';
var EndUser = 'Insert an end users company name.';
var EndCountry = 'Insert an end users country.';
var Req = 'Insert your requirements.';

function MakeDutch()
{
        Name = 'Vul uw naam in.';
        Title = 'Vul uw titel in.';
        Company = 'Vul uw bedrjfsnaam in.';
        Address = 'Vul uw adres in.';
        Postcode = 'Vul uw postcode in.';
        City = 'Vul uw plaatsnaam in.';
        Country = 'Vul uw land in.';
        Phone = 'Vul uw telefoonnummer in.';
        Fax = 'Vul uw faxnummer in.';
        Email = 'Vul uw e-mailadres in.';
        Email2 = 'Dit is geen geldig e-mailadres.';
        Website = 'Vul uw website in.';
        EndUser = 'Vul de naam van de eindgebruiker in.';
        EndCountry = 'Vul de edrijfsnaam van de eindgebruiker in.';
        Req = 'Vul uw wensen/vragen in.';
}

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	document.getElementById('Rights').style.position = 'absolute';
    document.getElementById('Rights').style.top = yWithScroll - 25 +'px';
	//document.write( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}

function checkNewsletter()
{
    if(document.getElementById('name').value=='')
    {
        window.alert('Insert your name.');
        document.getElementById('name').focus();
        return false;
    }
    
    if(document.getElementById('company').value=='')
    {
        window.alert('Insert your company.');
        document.getElementById('company').focus();
        return false;
    }

    if(document.getElementById('email').value=='')
    {
        window.alert('Insert your email.');
        document.getElementById('email').focus();
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
		}else{
			window.alert('This is not a valid e-mail');
			document.getElementById("email").focus();
			return false;
		}
	}
}

function checkContact()
{
    if(document.getElementById('lang').value != null && document.getElementById('lang').value == '1')
    {
        MakeDutch();
    }
    
    if(document.getElementById('Name').value=='')
    {
        window.alert(Name);
        document.getElementById('Name').focus();
        return false;
    }
        
    if(document.getElementById('Company').value=='')
    {
        window.alert(Company);
        document.getElementById('Company').focus();
        return false;
    }
    
    if(document.getElementById('Address').value=='')
    {
        window.alert(Address);
        document.getElementById('Address').focus();
        return false;
    }
    
    if(document.getElementById('Postcode').value=='')
    {
        window.alert(Postcode);
        document.getElementById('Postcode').focus();
        return false;
    }
    
    if(document.getElementById('City').value=='')
    {
        window.alert(City);
        document.getElementById('City').focus();
        return false;
    }
    
    if(document.getElementById('Country').value=='')
    {
        window.alert(Country);
        document.getElementById('Country').focus();
        return false;
    }
    
    if(document.getElementById('Phone').value=='')
    {
        window.alert(Phone);
        document.getElementById('Phone').focus();
        return false;
    }
    
    if(document.getElementById('Email').value=='')
    {
        window.alert(Email);
        document.getElementById('Email').focus();
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
		}else{
			window.alert(Email2);
			document.getElementById("Email").focus();
			return false;
		}
	}
}

function checkDownload()
{
    if(document.getElementById('lang').value != null && document.getElementById('lang').value == '1')
    {
        MakeDutch();
    }
    
    if(document.getElementById('Name').value=='')
    {
        window.alert(Name);
        document.getElementById('Name').focus();
        return false;
    }

    if(document.getElementById('Company').value=='')
    {
        window.alert(Company);
        document.getElementById('Company').focus();
        return false;
    }
        
    if(document.getElementById('Email').value=='')
    {
        window.alert(Email);
        document.getElementById('Email').focus();
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
		}else{
			window.alert(Email2);
			document.getElementById("email").focus();
			return false;
		}
	}
}

function checkJob()
{

    if(document.getElementById('name').value=='')
    {
        window.alert('Insert your name.');
        document.getElementById('name').focus();
        return false;
    }
    
    if(document.getElementById('email').value=='')
    {
        window.alert('Insert your email.');
        document.getElementById('email').focus();
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
		}else{
			window.alert('This is not a valid e-mail');
			document.getElementById("email").focus();
			return false;
		}
	}
    
    if(document.getElementById('CV').value=='')
    {
        window.alert('Insert your CV.');
        document.getElementById('CV').focus();
        return false;
    }
}

function PrintPage()
{
	var wHandle;
	
	wHandle = this.window;
	this.focus();
	this.print();
}

function getFileName(fileName)
{
    document.getElementById('filename').value = fileName;
}