function checkWholeForm(theForm) {
    var why = "";
	why += isEmptyFullname(theForm.name.value);
	why += checkemail(theForm.email.value);
	why += isEmptyQuestion(theForm.question.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkWholeFormSell(theForm) {
    var why = "";
	why += isEmptyName(theForm.name.value);
	why += checkemail(theForm.email.value);
	why += isEmptyPhoneno(theForm.phoneno.value);
	why += isEmptyAddress(theForm.address.value);
	why += isEmptyCity(theForm.city.value);
	why += isEmptyState(theForm.state.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkWholeFormBuy(theForm) {
    var why = "";
	why += isEmptyName(theForm.name.value);
	why += checkemail(theForm.email.value);
	why += isEmptyPhoneno(theForm.phoneno.value);
	why += isEmptyAddress(theForm.address.value);
	why += isEmptyCity(theForm.city.value);
	why += isEmptyState(theForm.state.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}


//check email
function checkemail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}
// non-empty textbox

function isEmptyAddress(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your Address. \n"
  }
return error;	  
}

function isEmptyName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your name. \n"
  }
return error;	  
}

function isEmptyPhoneno(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your Phone Number. \n"
  }
return error;	  
}

function isEmptyCity(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your city. \n"
  }
return error;	  
}

function isEmptyFullname(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your name. \n"
  }
return error;	  
}

function isEmptyQuestion(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your Question. \n"
  }
return error;	  
}

function isEmptyState(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your State. \n"
  }
return error;	  
}