﻿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('Naam').value=='')
    {
        window.alert('U heeft uw naam niet ingevuld.');
        document.getElementById('Naam').focus();
        document.getElementById('Naam').style.backgroundColor = '#FF0000';
        return false;
    }
    else{document.getElementById('Naam').style.backgroundColor = '#FFFFFF';}
    
    if(document.getElementById('Bedrijf').value=='')
    {
        window.alert('U heeft uw bedrijf niet ingevuld.');
        document.getElementById('Bedrijf').focus();
        document.getElementById('Bedrijf').style.backgroundColor = '#FF0000';
        return false;
    }
    else{document.getElementById('Bedrijf').style.backgroundColor = '#FFFFFF';}
    
    if(document.getElementById('Land').value=='')
    {
        window.alert('U heeft uw land niet ingevuld.');
        document.getElementById('Land').focus();
        document.getElementById('Land').style.backgroundColor = '#FF0000';
        return false;
    }
    else{document.getElementById('Land').style.backgroundColor = '#FFFFFF';}

    if(document.getElementById('Email').value=='')
    {
        window.alert('U heeft uw e-mail niet ingevuld.');
        document.getElementById('Email').focus();
        document.getElementById('Email').style.backgroundColor = '#FF0000';
        return false;
    }
    else
	{
		var goodEmailA = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmailA){
            document.getElementById('Email').style.backgroundColor = '#FFFFFF';
		}else{
			window.alert('U e-mail is niet in juiste formaat');
			document.getElementById("Email").focus();
            document.getElementById('Email').style.backgroundColor = '#FF0000';
			return false;
		}
	}

    if(document.getElementById('Onderwerp').value=='')
    {
        window.alert('U heeft uw onderwerp niet ingevuld.');
        document.getElementById('Onderwerp').focus();
        document.getElementById('Onderwerp').style.backgroundColor = '#FF0000';
        return false;
    }
    else{document.getElementById('Onderwerp').style.backgroundColor = '#FFFFFF';}
    
    if(document.getElementById('Bericht').value=='')
    {
        window.alert('U heeft uw bericht niet ingevuld.');
        document.getElementById('Bericht').focus();
        document.getElementById('Bericht').style.backgroundColor = '#FF0000';
        return false;
    }
    else{document.getElementById('Bericht').style.backgroundColor = '#FFFFFF';}
}

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 FadeImages(p_strId)
{
var l_aryImages = new Array();
var l_intCounter = 0;
var l_objImg = document.getElementById(p_strId+'_'+l_intCounter);
while(l_objImg)
{
l_aryImages[l_intCounter] = p_strId+'_'+l_intCounter;
l_intCounter++;
l_objImg = document.getElementById(p_strId+'_'+l_intCounter);
}
var l_intNext = 0;
if(l_aryImages.length > 1)
l_intNext = 1;

if(l_intNext = 1)
    setTimeout("Fading(100,0,"+l_intNext+",'"+p_strId+"',"+l_aryImages.length+")",5000);
}

function Fading(p_intOp,p_intStart,p_intNext,p_strId,p_intLength)
{
var l_intLength = p_intLength - 1;
var l_objImgStart = document.getElementById(p_strId+'_'+p_intStart);
var l_intStartOp = p_intOp;
var l_objImgNext = document.getElementById(p_strId+'_'+p_intNext);
var l_intNextOp = 100 - p_intOp;
l_intStartOp = l_intStartOp  - 5;

//alert(l_intStartOp);

l_objImgStart.style.filter = 'alpha(opacity=' + l_intStartOp + ')';
l_objImgStart.style.opacity = l_intStartOp/100;

l_objImgNext.style.filter = 'alpha(opacity=' + l_intNextOp + ')';
l_objImgNext.style.opacity = l_intNextOp/100;

if(l_intStartOp == 0)
{
p_intStart = p_intNext;
if(l_intLength > p_intNext)
p_intNext = p_intNext+1;
else
p_intNext = 0;
l_intStartOp = 100;
//alert(p_intStart + ' ' + p_intNext)
setTimeout("Fading("+l_intStartOp+","+p_intStart+","+p_intNext+",'"+p_strId+"',"+p_intLength+")",5000);
}
else
{
setTimeout("Fading("+l_intStartOp+","+p_intStart+","+p_intNext+",'"+p_strId+"',"+p_intLength+")",40);
}
}