//***********************************************************************
// Author: Veronique Molinari
//***********************************************************************
//emailCheck(theForm)
//validate(theForm)
//***********************************************************************




//**********************************************************
//Check that the e-mail address entered is like a@a.a
//**********************************************************

function emailCheck(theForm) {
txt=theForm.q8_email.value;
if (txt.indexOf("@")<1){
alert("I'm sorry. This email address seems wrong. Please"
+" check the prefix and '@' sign.");
return true;
}

str=txt.substr(txt.indexOf("@"))
if ((str.indexOf(".")<2)) {
	return true;
   }

return false;
}




//**********************************************************
//Check that the required fields are not left blank
//**********************************************************

function validate(theForm)

{

	if (theForm.q8_email.value == ""){
		theForm.q8_email.focus();
		alert("Please enter an e-mail address.");
		return (false);
	}

 	if (emailCheck(theForm)){
		alert("Please enter a valid e-mail address.");
		theForm.q8_email.focus();
		return (false);
	}


	if (theForm.q8_name.value == ""){
		theForm.q8_name.focus();
		alert("Please enter your Name.");
		return (false);
	}


/*      if ((theForm.q9.value == ""))  {   
                alert("What market segment would you say is your primary focus?");
              return (false);
        }



if ( !((theForm.q9[0].checked) || (theForm.q9[1].checked) || (theForm.q9[2].checked) || (theForm.q9[3].checked)|| (theForm.q9[4].checked) || (theForm.q9[5].checked) || (theForm.q9[6].checked) ) && (theForm.returning.value == "1"))
           { 
              alert("What market segment would you say is your primary focus?"); 
	return (false);
}
	


if ( (!(theForm.q9[0].checked) && (theForm.returning[0].checked )) )
           {
              alert("What market segment would you say is your primary focus?");
        return (false);
}
       
*/


return (true);
}

