function validate(form) {var e = form.elements, m = '';
	if(!e['firstname'].value) {m += '- First name is required.\n';}
	if(!e['lastname'].value) {m += '- Last name is required.\n';}
	if(!e['company'].value) {m += '- Company is required.\n';}
	if(!/.+@[^.]+(\.[^.]+)+/.test(e['emailaddress'].value)) {
	m += '- E-mail requires a valid e-mail address.\n';
	}
	
	if(m) {
	alert('The following error(s) occurred:\n\n' + m);
	return false;
	}
	
	else {
		setCookie();
	}
	
	return true;
}

	
function toggleSubmissionForm()
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( 'submissionForm' );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all['submissionForm'];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers['submissionForm'];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function toggleWhitepaperLink()
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( 'whitepaperLink' );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all['whitepaperLink'];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers['submissionForm'];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function setCookie() {
	var expirationDate = new Date;
	expirationDate.setMonth(expirationDate.getMonth()+6);
	
	document.cookie = '_whitepaper=yes; + "expires=" + expirationDate.toGMTString(); path=/';
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}