function CheckEmail(str) {
var at="@";
var dot=".";
var lat=str.indexOf(at);
var lstr=str.length;
var ldot=str.indexOf(dot);
if (str.indexOf(at)==-1) {
return false;
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
return false;
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
return false;
}
if (str.indexOf(at,(lat+1))!=-1) {
return false;
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
return false;
}
if (str.indexOf(dot,(lat+2))==-1) {
return false;
}
if (str.indexOf(" ")!=-1) {
return false;
}
return true;
}

function Validate() {
if(document.getElementById('FirstName').value.replace(/^\s+|\s+$/g, '') == "") {
alert("First Name is required, please enter a valid first name!");
document.getElementById('FirstName').focus();
return false;
}
if(document.getElementById('LastName').value.replace(/^\s+|\s+$/g, '') == "") {
alert("Last Name is required, please enter a valid last name!");
document.getElementById('LastName').focus();
return false;
}
if(document.getElementById('Industry').value.replace(/^\s+|\s+$/g, '') == "") {
alert("Industry Type is required, please enter a valid industry type!");
document.getElementById('Industry').focus();
return false;
}

if(!CheckEmail(document.getElementById('Email').value)) {
alert("Invalid E-mail Address!");
document.getElementById('Email').focus();
return false;
}
if (!document.getElementById('agreeToReceive').checked) {
alert('You must agree to receive updates from the Carbon Reduction Institute and the Low Carbon Economy Members.');
return false;
}
return true;
}