﻿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 OpenDiv(p_intId)
{
    CloseAllDivs(p_intId)
    var l_objDiv = document.getElementById('Part_'+p_intId);
    if(l_objDiv.style.display == 'none')
        l_objDiv.style.display = 'block';
    else
        l_objDiv.style.display = 'none'
}

function CloseAllDivs(p_intId)
{
    var l_objDiv = document.getElementById('Part_0');
    var l_intCounter = 0;
    while(l_objDiv != null)
    {
        if(p_intId != l_intCounter)
            l_objDiv.style.display = 'none';
        l_intCounter++; 
        l_objDiv = document.getElementById('Part_'+l_intCounter);
    } 
}

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('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('country').value=='')
    {
        window.alert('Insert your country.');
        document.getElementById('country').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('subject').value=='')
    {
        window.alert('Insert a subject.');
        document.getElementById('subject').focus();
        return false;
    }
    
    if(document.getElementById('message').value=='')
    {
        window.alert('Insert a message.');
        document.getElementById('message').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();
}