	/** 
	* olkw2947288910013.js
	* This script is generated by 'wkfPlugin.JSFormParser'
	* as part of WerkofenCMS v1.0.12, (c) 2004-2005 ./ERREWF 
	*/
	
	//Define some array (properties)
	var txtElements=Array('nome', 'cognome', 'email');
	var radElements=Array();
	var chkElements=Array('privacypolicy');
	var selElements=Array();
	var errElements=Array();	

	//Verify some properties of form elements
	var elemToCheck=Array("nome|0|0|0","cognome|0|0|0", "email|EMAIL|0|0","privacypolicy");				  

	//Define some variables (properties)
	var cFormName;
	var errCount;
	var totChecked;

	//Replace blank space at margins
	function trim(theString) {
        theString=theString.replace(/^\s*|\s*$/g, "");
        return theString;
    }
	
	//Convert to CL the first letter of a single word (PRIVATE)
	function UCWords(word) {
		if (!word) {
			return
		} else {
			var tmpLenWord=word.length;
			var finUCWord="";
			for (t=0; t<=tmpLenWord; t++) {
				finUCWord+=(t==0) ? word.charAt(t).toUpperCase() : word.charAt(t);
			}
			return finUCWord;
		}
	}
	//Verify some kind of data (PRIVATE)
	function vrfLength(theString, maxLength, controlParam) {
		if (!theString || !controlParam)
			return
		else {
			var tmpStringLength=theString.length;
			switch(controlParam) {
				case "EQU" : if (tmpStringLength==maxLength)
								return false;
							 else
							 	return true;
							break;
				case "MIN" : if (tmpStringLength<maxLength)
								return false;
							 else
							 	return true;
							break;
				case "MAJ" : if (tmpStringLength>maxLength)
								return false;
							 else
							 	return true;
							break;
				default    : 
							break;
			}
		}
	}
	function vfrEmail(theString) {
		if (!theString)
			return;
		else {
			validEmailPattern=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
			if (validEmailPattern.test(theString)==true) {
				return;
			} else {
				return false;
			}
		}
	}
	function vrfInteger(theString, controlParam) {
		if (!theString)
			return
		else {
			switch(controlParam) {
				case "ISNAN"    : if (isNaN(theString))		//Alfanumerico
									return true;
							      else
							   		return false;
							      break;	
				case "NOTISNAN" : if (!isNaN(theString))	//Numerico
									return true;
							      else
							   		return false;
							      break;
			}
		}	
	}
	
	//Block input button to avoid multiple submit
	function blockButton() {
		if (!this.cFormName) {
			return
		} else {
			var submitButton=this.cFormName.elements('vai').name;
			this.cFormName.eval("submitButton").disabled=true;
			this.cFormName.submitButton.value="Attendere...";			
			return false;
		}
	}	

	//Show errors
	function strokeError(errElements) {
		if (errElements.length==0) {
			return false;
		} else {
			strError="ATTENZIONE!\nSono state rilevate alcune anomalie nella compilazione del form:\n";
			strError+="______________________________________\n\n";
			for (errEl=0; errEl<=errElements.length-1; errEl++)
				strError+="- "+errElements[errEl]+"\n";					 
			strError+="______________________________________\n\n"+
					  "Si prega di correggere gli errori segnalati.";
			alert(strError);
		}
	}
	
	//Retrieve raw data from the specified form (this function is constructor)
	function getFormData(formName) {
		this.formName=formName;
		this.errCount=0;
		this.totChecked=0;
		this.errElements=Array();
		this.vrfyProperties=vfrProp;

		//Checking text elements
		for (txtE=0; txtE<=txtElements.length-1; txtE++) {
			if (trim(eval("formName."+txtElements[txtE]+".value"))=="") {
				this.errElements.push("Inserire un valore per il campo \""+UCWords(txtElements[txtE])+"\".");
				this.errCount++;
			}
		}

		//Checking radiobutton elements with inner choice
		for (radE=0; radE<=radElements.length-1; radE++) {
			this.totChecked=0;
			var currElementTotalCases=eval("formName."+radElements[radE]+".length");
			for (radCE=0; radCE<=currElementTotalCases-1; radCE++) {
				if (eval("formName."+radElements[radE]+"("+radCE+").checked")==false) {
					this.totChecked++;
				}
				if (this.totChecked==currElementTotalCases) {
					this.errElements.push("Scegliere un\'opzione per la voce \""+UCWords(radElements[radE])+"\".");
					this.errCount++;
				}
			}
		}
		
		//Checking checkbox elements
		for (chkE=0; chkE<=chkElements.length-1; chkE++) {
			this.totChecked=0;
			var currElementTotalCases=eval("formName."+chkElements[chkE]+".length");
			for (chkCE=0; chkCE<=currElementTotalCases-1; chkCE++) {
				if (eval("formName."+chkElements[chkE]+"("+chkCE+").checked")==false) {
					this.totChecked++;
				}
				if (this.totChecked==currElementTotalCases) {
					this.errElements.push("Scegliere un\'opzione per la voce \""+UCWords(chkElements[chkE])+"\".");
					this.errCount++;
				}
			}
		}
		//Checking dropdown menu(s)
		for (selE=0; selE<=selElements.length-1; selE++) {
			if (eval("formName."+selElements[selE]+".options[formName."+selElements[selE]+".selectedIndex].value")=="") {
				this.errElements.push("Scegliere un elemento per la voce \""+UCWords(selElements[selE])+"\".");
				this.errCount++;
			}		
		}
		return false;
	}
	
	//We verify some properties of elements using array with multiple value
	function vfrProp() {
		if (!elemToCheck)
			return
		else {
			for (elTC=0; elTC<=elemToCheck.length-1; elTC++) {
				var tmpSplittedArray=elemToCheck[elTC].split("|");
				if (tmpSplittedArray.length==4) {
					//Now we check the elements
					switch(tmpSplittedArray[1]) {
						case 0 		 : return;
								 	   break;
						case "EMAIL" : vrfMail=vfrEmail(eval("this.formName."+tmpSplittedArray[0]+".value"));
									   if (vrfMail==false) {
 					   				   	   this.errElements.push("Inserire un\'indirizzo e-mail valido (es. nome@dominio.com) per il campo \""+UCWords(tmpSplittedArray[0])+"\".");
					  				   	   this.errCount++;
									   }
									   break;
					}
					switch(tmpSplittedArray[2]) {
						case 0 		 	: return;
								 	      break;
						case "ALFA" 	: vrfInt=vrfInteger(eval("this.formName."+tmpSplittedArray[0]+".value"), "ISNAN");
									   	  if (vrfInt==false) {
 					   				   	  	 this.errElements.push("Il campo \""+UCWords(tmpSplittedArray[0])+"\" non puņ contenere cifre.");
					  				   	     this.errCount++;
									      }
									      break;
						case "NUM"      : vrfInt=vrfInteger(eval("this.formName."+tmpSplittedArray[0]+".value"), "NOTISNAN");
									   	  if (vrfInt==false) {
 					   				   	  	 this.errElements.push("Il campo \""+UCWords(tmpSplittedArray[0])+"\" deve contenere solo cifre.");
					  				   	     this.errCount++;
									      }
									      break;
					}
					switch(tmpSplittedArray[3]) {
						case 0 		  : return;
								 	    break;
						default       : tmpSplittedArrayAgain=tmpSplittedArray[3].split(";");
										if (tmpSplittedArrayAgain.length==2) {
											//Switch of inner operation
											switch(tmpSplittedArrayAgain[0]) {
												case "MIN" : vrfLenStr=vrfLength(eval("this.formName."+tmpSplittedArray[0]+".value"),tmpSplittedArrayAgain[1],"MIN");
															 if (vrfLenStr==false) {
															 	 this.errElements.push("La stringa del campo \""+UCWords(tmpSplittedArray[0])+"\" deve essere lunga minimo "+tmpSplittedArrayAgain[1]+" caratteri.");
																 this.errCount++;
															 }
															 break;
												case "MAJ" : vrfLenStr=vrfLength(eval("this.formName."+tmpSplittedArray[0]+".value"),tmpSplittedArrayAgain[1],"MAJ");
															 if (vrfLenStr==false) {
															 	 this.errElements.push("La stringa del campo \""+UCWords(tmpSplittedArray[0])+"\" deve essere lunga massimo "+tmpSplittedArrayAgain[1]+" caratteri.");
																 this.errCount++;
															 }
															 break;
												case "EQU" : vrfLenStr=vrfLength(eval("this.formName."+tmpSplittedArray[0]+".value"),tmpSplittedArrayAgain[1],"EQU");
															 if (vrfLenStr==false) {
															 	 this.errElements.push("La stringa del campo \""+UCWords(tmpSplittedArray[0])+"\" deve essere di "+tmpSplittedArrayAgain[1]+" caratteri.");
																 this.errCount++;
															 }
															 break;
												default    : return;
															 break;
											}
										}										
									    break;
					}
				}
			}
		}
	}	

	//Main function
	function parseForm(formName) {
		this.cFormName=formName;
		formName.sent.value=1;
		currForm=new getFormData(formName);
		currForm.vrfyProperties();
		if (currForm.errCount!=0) {
			strokeError(currForm.errElements);
			return false;
		} else {
			return;
		}
	}
