//-- verif qu'on a sélectionné une famille produit dans la recherche
function verifFilter() {
	var msg_alert="";

	if (document.getElementById('id_fam').selectedIndex==0) {
		var kw_obj = document.getElementById('photo_keywords');
		if (kw_obj) {
			if (kw_obj.type == "text" && kw_obj.value == "") {
				msg_alert = "You need to select a collection first, or fill a picture reference!";
			} else if (kw_obj.type == "hidden") {
				msg_alert = "You need to select a collection first!";
			}
		} else {
			msg_alert = "You need to select a collection first!";
		}
		if (msg_alert != "") {
			alert(msg_alert);
			document.getElementById('id_fam').focus();
			return false;
		}
	}
	return true;
}


function Validator(theForm) {
	if (theForm.company.value != "74000")
	{
		if (theForm.name.value == "")	{
			alert("Please enter a value for the \"namez\" field.");
			theForm.name.focus();
			return (false);
			}

		if (theForm.name.value.length > 80)	{
			alert("Please enter at most 80 characters in the \"name\" field.");
			theForm.name.focus();
			return (false);
			}

		if (theForm.company.value == "") {
			alert("Please enter a value for the \"company\" field.");
			theForm.company.focus();
			return (false);
			}

		if (theForm.company.value.length > 80) {
			alert("Please enter at most 80 characters in the \"company\" field.");
			theForm.company.focus();
			return (false);
			}

		if (theForm.submit_by.value == "") {
			alert("Please enter a value for the \"e-mail\" field.");
			theForm.submit_by.focus();
			return (false);
			}

		if (theForm.submit_by.value.length > 50) {
			alert("Please enter at most 80 characters in the \"e-mail\" field.");
			theForm.submit_by.focus();
			return (false);
			}

		var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&#402;&#352;&#338;&#381;&#353;&#339;&#382;&#376;ÀÁÂÃÆÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßáâåëìíîïñóôøúýþÿ0123456789-@-_.";
		var checkStr = theForm.submit_by.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) {
			alert("Please enter only letter, digit and \".@_-\" characters in the \"e-mail\" field.");
			theForm.submit_by.focus();
			return (false);
			}

		adresse = theForm.submit_by.value;
		var place = adresse.indexOf("@",1);
		var point = adresse.indexOf(".",place+1);
		if (!((place > -1)&&(adresse.length >2)&&(point > 1))) {
			alert('Please enter a valid e-mail adress!!!\r Example: name@domain.com');
			theForm.submit_by.focus();
			return (false);
			}

		if (document.theForm.location[7].checked==true) {
			if ((theForm.country.value=="Specify")||(theForm.country.value=="")) {
				alert("Please enter a value for the \"Other (location)\" field.");
				theForm.country.focus();
				return (false);
				}
			}

		if (theForm.comments.value.length > 1500) {
			alert("Please enter at most 200 characters in the \"comments\" field.");
			theForm.comments.focus();
			return (false);
			}
		}
	return (true);
	}
