function validatecontactinfo() {
  
missinginfo = "";
if (document.contactform.name.value == "") {
missinginfo += "\n     -  Name";
}
if (document.contactform.telephone.value == "") {
missinginfo += "\n     -  Telephone";
}
if (document.contactform.email.value == "") {
missinginfo += "\n     -  Email";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}


function validatennewsletterinfo() {
var emailerror=false;
var at="@"
var dot="."
var str=document.newsletterform.email.value;
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
missinginfo = "";
if (document.newsletterform.name.value == "") {
missinginfo += "\n     -  Name";
}
if (document.newsletterform.mobile.value == "") {
missinginfo += "\n     -  Mobile Number";
}
if (str.indexOf(at)==-1){
   emailerror = true;
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
    emailerror = true;
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
     emailerror = true;
}

 if (str.indexOf(at,(lat+1))!=-1){
     emailerror = true;
 }

 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
     emailerror = true;
 }

 if (str.indexOf(dot,(lat+2))==-1){
     emailerror = true;
 }

 if (str.indexOf(" ")!=-1){
     emailerror = true;
 }

if (emailerror == true) {
missinginfo += "\n     -  Email Address";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}


