function ChkForm(theForm){
if(theForm.cboCats.selectedIndex < 1){
 	document.getElementById("Msg").innerHTML = "Please select the category of the artwork.";
	theForm.cboCats.focus();
	return(false);
}
  if ((theForm.cboCats.options[theForm.cboCats.selectedIndex].text == "Other")&&(theForm.txtOther.value=="")){
    document.getElementById("Msg").innerHTML = "Please provide the type of Artwork you wish to have Tom create.";
    theForm.txtOther.focus();
     return (false);
 }
 if(theForm.txtPrice.value == ""){
 	document.getElementById("Msg").innerHTML = "Please provide your price range.";
	theForm.txtPrice.focus();
	return(false);
 }
 if(theForm.txtName.value == ""){
 	document.getElementById("Msg").innerHTML = "Please provide your name.";
	theForm.txtName.focus();
	return(false);
 }
 if(theForm.txtPhone.value == ""){
 	document.getElementById("Msg").innerHTML = "Please provide your telephone number.";
	theForm.txtPhone.focus();
	return(false);
 }
  var chkPhone = strip(theForm.txtPhone.value);
  if (chkPhone.length < 10){
    document.getElementById("Msg").innerHTML = "Your telephone number needs to be at least 10 digits.";
	theForm.txtPhone.value = chkPhone;
    theForm.txtPhone.focus();
    return (false);
  }
 if(theForm.txtEmail.value == ""){
 	document.getElementById("Msg").innerHTML = "Please provide your email address.";
	theForm.txtEmail.focus();
	return(false);
 }
var EMValue = theForm.txtEmail.value;	
	var delim1 = EMValue.indexOf("@");
	var delim2 = EMValue.indexOf(".");
	if (delim1 == -1) {
		document.getElementById("Msg").innerHTML = "Please fix your email address.";
		theForm.txtEmail.focus();
		return (false);
	}		
	if (delim2 == -1) {
		document.getElementById("Msg").innerHTML = "Please fix your email address.";
		theForm.txtEmail.focus();
		return (false);
	}		
	if ((delim2 - delim1) < 3) {
		document.getElementById("Msg").innerHTML = "Please fix your email address.";
		theForm.txtEmail.focus();
		return (false);
	}

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@.-_";
  var checkStr = theForm.txtEmail.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)    {
      allValid = false;
      break;
    }
  }
  if (!allValid)  {
    document.getElementById("Msg").innerHTML = "Your EMail Address contains characters we don't recognize.";
    theForm.txtEmail.focus();
    return (false);
  }
	
	if (theForm.txtDetails.value == ""){
		document.getElementById("Msg").innerHTML = "Please provide details regarding your request.";
		theForm.txtDetails.focus();
    return (false);
		}
	return(true)
}

function strip(number) {
 var sOut = '';
 mask = '1234567890';
 for(count = 0; count <= number.length; count++) {
 	if(mask.indexOf(number.substring(count, count+1),0) != -1 ) sOut += number.substring(count,count+1);
 }
 return sOut;
}
