

	function contactus_Validator(theForm) {
	var re_not_isAlphaNum = new RegExp("[^a-zA-Z0-9 ]");

		if (theForm.privacy_accepted[1].checked) {
			alert("PLEASE NOTE!\n\nTo send your message is necessary to read and approve the privacy statement.");
			//Aggwin = window.open('../company/privacy.php','Privacy','toolbar=no,width=520,height=400,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no'); 
			theForm.submit.focus();
			return (false);
		}
		
		if (theForm.elements['site'].value == "biuk" && theForm.elements['firstName'].value == "") {
			alert("Missing FIRSTNAME");
			theForm.elements['firstName'].focus();
			return (false);
		}

		if (theForm.elements['lastName'].value == "") {
			alert("Missing SURNAME");
			theForm.elements['lastName'].focus();
			return (false);
		}


		//if (re_not_isAlphaNum.test(theForm.elements['firstName'].value)) {
		//	alert("first name must be only a char or a number(a..z, A..Z, _, 0..9)");
		//	theForm.elements['firstName'].focus();
		//	return false;
		//}

		//if (re_not_isAlphaNum.test(theForm.elements['lastName'].value)) {
		//	alert("last name must be only a char or a number(a..z, A..Z, _, 0..9)");
		//	theForm.elements['lastName'].focus();
		//	return false;
		//}


		if ((!(theForm.elements['email'].value.search(/^\w+((\+\w+)|(-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.([A-Za-z0-9])([A-Za-z0-9]?)([A-Za-z0-9]?)$/)!= -1)) || (theForm.elements['email'].value=="")) {  
			alert("E-MAIL ADDRESS not valid");
			theForm.elements['email'].focus();
			return (false);
		}
		if (theForm.elements['comments'].value == "") {
			alert("Missing COMMENTS");
			theForm.elements['comments'].focus();
			return (false);
		}
				
		if ( !controllaBrand() ) return (false);
		
		return (true);
	}

	
	
	

function controllaBrand(){
	var retCode = true;

	lenArrayBrand = brandArray.length;
	
	atLeastOneBrandSelected = false;
	for (i=0; i<lenArrayBrand ; i++) { 
		var brandValue = document.getElementById(brandArray[i]).checked;
		if ( brandValue ) atLeastOneBrandSelected = true;
	}

	var VDOchecked = document.getElementById("VDO").checked;
	var PHOchecked = document.getElementById("PHO").checked;
	var LHTchecked = document.getElementById("LHT").checked;

	// se selezionato almeno brand, deve essere selezionato almeno un topic
	if ( atLeastOneBrandSelected ){
		if (!VDOchecked && !PHOchecked && !LHTchecked){
			alert("Please check almost one topic!");
			retCode = false;
		}		
	}

	// se selezionato almeno topic, deve essere selezionato almeno un brand
	if ( !atLeastOneBrandSelected ){
		if (VDOchecked || PHOchecked || LHTchecked){
			alert("Please check almost one brand!");
			retCode = false;			
		}		
	}
	
	return retCode;

}	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
// businarolo 03,09,2007
function myProfile_Validator(theForm) {
	var re_not_isAlphaNum = new RegExp("[^a-zA-Z0-9 ]");

		if (theForm.elements['lastName'].value == "") {
			alert("Missing Last name");
			theForm.elements['lastName'].focus();
			return false;
		}
		
		if ( theForm.elements['stateCombo'].selectedIndex <= 0 && theForm.elements['stateTesto'].value.length <= 0 ) {
			alert("Missing State");
			return false;
		}

		if ( theForm.elements['newUser_password1'].value.length > 0 ) {
			if (re_not_isAlphaNum.test(theForm.elements['newUser_password1'].value)) {
				alert("New password not valid");
				theForm.elements['newUser_password1'].focus();
				return (false);
			}
		}
				
		if ( theForm.elements['newUser_password1_confirmation'].value.length > 0 ) {
			if (re_not_isAlphaNum.test(theForm.elements['newUser_password1_confirmation'].value)) {
				alert("Confirm New password not valid");
				theForm.elements['newUser_password1_confirmation'].focus();
				return (false);
			}
		}

		if (theForm.elements['newUser_password1'].value != theForm.elements['newUser_password1_confirmation'].value  ) {
			alert("Confirm New password not valid");
			theForm.elements['newUser_password1_confirmation'].focus();
			return (false);
		}
				
	    return (true);
	}


function selezionaSelect(objSelect,valore){

	var mValore = valore;
	for (var i=0;i<objSelect.length;i++){
		if (objSelect[i].value.toUpperCase()==mValore.toUpperCase()){		
			objSelect.selectedIndex = i;
			break;
		}
	}
}

