function checkdata(){
theform = document.dataform;
emailadd = theform.email.value;
zipcode = theform.zip.value;
countryselector = theform.country.value;
yob = theform.yearofbirth.value;
gender = theform.sex.value;
job = theform.jobfunction.value;
checkboxflag=0;
flag=0;

for (a=0; a<=30; a++){
if (theform.listname[a].checked){checkboxflag=1;break;}
}
if (checkboxflag == 0){
alert("Please choose a category by ticking its checkbox");
theform.listname[0].focus();
flag=1;
return false;
}

if(emailadd==""){
alert("Please enter your email address");
theform.email.focus();
flag=1;
return false;
}

if (emailadd.length > 0){
var i   = emailadd.indexOf("@");
var j   = emailadd.indexOf(".",i);
var k   = emailadd.indexOf(",");
var kk  = emailadd.indexOf(" ");
var jj  = emailadd.lastIndexOf(".") + 1;
var len = emailadd.length;
if (!(i > 0 && j > (i + 1) && k == -1 && kk == -1 && (len - jj) >= 2 && (len - jj) <= 4)){
alert("Please enter a valid email address");
theform.email.focus();
flag=1;
return false;
}
}

if(zipcode==""){
alert("Please enter your zip/postal code");
theform.zip.focus();
flag=1;
return false;
}

if(countryselector==""){
alert("Please choose your country");
theform.country.focus();
flag=1;
return false;
}

if(yob==""){
alert("Please enter your year of birth");
theform.yearofbirth.focus();
flag=1;
return false;
}

if ((yob < 1900) || (yob > 2003)){
alert("Please enter your real year of birth");
theform.yearofbirth.focus();
flag=1;
return false;
}

if (gender==""){
alert("Please choose your gender");
theform.sex.focus();
flag=1;
return false;
}

if (job==""){
alert("Please choose your job function/department");
theform.jobfunction.focus();
flag=1;
return false;
}

if (flag==0){
return true}
}

// SAME AS ABOVE FUNCTION BUT FOR SIDE BAR FORM

function checkdata2(){
theform = document.dataform;
emailadd = theform.email.value;
zipcode = theform.zip.value;
checkboxflag=0;
flag=0;

for (a=0; a<=4; a++){
if (theform.listname[a].checked){checkboxflag=1;break;}
}
if (checkboxflag == 0){
alert("Please choose a category by ticking its checkbox");
theform.listname[0].focus();
flag=1;
return false;
}

if(emailadd==""){
alert("Please enter your email address");
theform.email.focus();
flag=1;
return false;
}

if (emailadd.length > 0){
var i   = emailadd.indexOf("@");
var j   = emailadd.indexOf(".",i);
var k   = emailadd.indexOf(",");
var kk  = emailadd.indexOf(" ");
var jj  = emailadd.lastIndexOf(".") + 1;
var len = emailadd.length;
if (!(i > 0 && j > (i + 1) && k == -1 && kk == -1 && (len - jj) >= 2 && (len - jj) <= 4)){
alert("Please enter a valid email address");
theform.email.focus();
flag=1;
return false;
}
}

if(zipcode==""){
alert("Please enter your zip/postal code");
theform.zip.focus();
flag=1;
return false;
}

if (flag==0){
return true}
}