/*function select_model(marque) {
	var form = marque.form, brand = marque.value;
	if(brand.toLowerCase() == 'nokia') {
		form.elements['model'].style.display = 'none';
		form.elements['nokia_model'].style.display = 'block';
	} else {
		form.elements['model'].style.display = 'block';
		form.elements['nokia_model'].style.display = 'none';
	}
}
function check_if_other(op) {
	var form = op.form, operator = op.value;
	if(operator == 'AM') {
		form.elements['other_operator'].style.display = 'block';
	} else {
		form.elements['other_operator'].style.display = 'none';
	}
}*/
function check_fields(form) {
	var errors = 'ERREURS:\n';
	with(form) {
		if(brand.value == '') {
			errors += " - Error in your brand\n";
		}
		if(model.value == '') {
			errors += " - Error in your model\n";
		}
		
		if(operator.value == -1) {
			errors += " - Error in your provider\n";
		}
		
		/*if(other_operator.style.display == 'block') {
			if(other_operator.value == '') {
				errors += " - Error in your provider\n";
			}
		}*/
		if(imei.value == '') {
			errors += " - Error in your imei, please enter the first 15 digits of your IMEI number\n";
		} else if(!imei.value.isNumeric()) {
			errors += " - Error in your imei, please enter the first 15 digits of your IMEI number\n";
		} else if(imei.value.length != 15) {
			errors += " - Error in your imei, please enter the first 15 digits of your IMEI number\n";
		}
		if(nom.value == '') {
			errors += " - Error in your lastname\n";
		}
		if(prenom.value == '') {
			errors += " - Error in your firstname\n";
		}
		if(email.value == '') {
			errors += " - You must put a valid email \n";
		} else if(!email.value.isValidEmail()) {
			errors += " - You must put a valid email \n";
		}
		if(email.value.match(/@aol./)) {
			errors += " - We do not accept order with AOL email address, please type another email address. thank you. \n";
		}
		if(!cgv.checked) {
			errors += " - You must accept the general terms of sales to order.\n";
		}
	}
	if(errors != 'ERREURS:\n') {
		alert(errors);
		return false;
	}
	return true;
}
