function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function

function Validate(theForm)
{

// EMAIL
if (theForm.email.value == "")
  {
    alert("Please fill-in a valid email address, used for order verification");
    theForm.email.focus();
    return (false);
  }

adresse = theForm.email.value;
var place = adresse.indexOf("@",1);
var point = adresse.indexOf(".",place+1);
if (!((place > -1)&&(adresse.length > 2)&&(point > 1)))			
  {
    alert("Please fill-in a valid email address!");		
    theForm.email.focus();
    return (false);
  } 

var em;
for (var i = 0; i < theForm.email.value.length; i++)
  {
    em = theForm.email.value.charAt(i);		
    if ((em == 'é') || (em == 'à') || (em == '{') || (em == '}') || (em == '[')
     || (em == '=') || (em == '+') || (em == '(') || (em == ')') || (em == ']')
     || (em == '*') || (em == '^') || (em == ':') || (em == '°') || (em == 'ù'))

	{
          alert("Unsupported characters have been found in your email address, please verify it again");
          theForm.email.focus();
          return (false);
        }
  }		

if (getSelectedRadio(theForm.B1) == -1)
  {
    alert("Please select an option for question B1");
    return (false);
  }

if (getSelectedRadio(theForm.B2) == -1)
  {
    alert("Please select an option for question B2");
    return (false);
  }

if (getSelectedRadio(theForm.B3) == -1)
  {
    alert("Please select an option for question B3");
    return (false);
  }

if (getSelectedRadio(theForm.B4) == -1)
  {
    alert("Please select an option for question B4");
    return (false);
  }

if (theForm.B5.value == "")
  {
    alert("Please select an option for question B5");
    theForm.B5.focus();
    return (false);
  }

if (getSelectedRadio(theForm.B6) == -1)
  {
    alert("Please select an option for question B6");
    return (false);
  }

if (getSelectedRadio(theForm.B7) == -1)
  {
    alert("Please select an option for question B7");
    return (false);
  }


if (theForm.A1.value == "")
  {
    alert("Please select an option for question A1");
    theForm.A1.focus();
    return (false);
  }

if (getSelectedRadio(theForm.A2) == -1)
  {
    alert("Please select an option for question A2");
    return (false);
  }

if (theForm.A3.value == "")
  {
    alert("Please select an option for question A3");
    theForm.A3.focus();
    return (false);
  }

if (theForm.A4.value == "")
  {
    alert("Please select an option for question A4");
    theForm.A4.focus();
    return (false);
  }

if (theForm.A5.value == "")
  {
    alert("Please select an option for question A5");
    theForm.A5.focus();
    return (false);
  }

if (getSelectedRadio(theForm.A7) == -1)
  {
    alert("Please select an option for question A7");
    return (false);
  }

if (getSelectedRadio(theForm.C2) == -1)
  {
    alert("Please select an option for question C2");
    return (false);
  }

if (getSelectedRadio(theForm.C3) == -1)
  {
    alert("Please select an option for question C3");
    return (false);
  }

if (theForm.C4.value == "")
  {
    alert("Please select an option for question C4");
    theForm.C4.focus();
    return (false);
  }

if (theForm.C5.value == "")
  {
    alert("Please select an option for question C5");
    theForm.C5.focus();
    return (false);
  }

if (getSelectedRadio(theForm.C6) == -1)
  {
    alert("Please select an option for question C6");
    return (false);
  }

if (getSelectedRadio(theForm.C7) == -1)
  {
    alert("Please select an option for question C7");
    return (false);
  }

if (getSelectedRadio(theForm.C8) == -1)
  {
    alert("Please select an option for question C8");
    return (false);
  }

if (getSelectedRadio(theForm.M1) == -1)
  {
    alert("Please select an option for question M1");
    return (false);
  }

if (getSelectedRadio(theForm.M2) == -1)
  {
    alert("Please select an option for question M2");
    return (false);
  }

if (getSelectedRadio(theForm.M5) == -1)
  {
    alert("Please select an option for question M5");
    return (false);
  }

if (getSelectedRadio(theForm.M6) == -1)
  {
    alert("Please select an option for question M6");
    return (false);
  }

if (getSelectedRadio(theForm.O1) == -1)
  {
    alert("Please select an option for question O1");
    return (false);
  }

if (getSelectedRadio(theForm.O2) == -1)
  {
    alert("Please select an option for question O2");
    return (false);
  }

if (getSelectedRadio(theForm.O3) == -1)
  {
    alert("Please select an option for question O3");
    return (false);
  }


return (true);
}

