// ROLL OVER FUNCTIONS
		function rollOver(image, sfx) {
			var active = image.parentNode.getAttribute("activelink");
			if (active=="" || active==null) {
				var imgSrc = image.src;
				var imgFile = new Array();
				var imgFile = imgSrc.split("/");
				var ix = imgFile.length-1;
				var myRegExp = new RegExp("\\..+", "gi");
				var imgExt = myRegExp.exec(imgFile[ix]);
				var newImgSrc = imgSrc.replace(imgExt, sfx+imgExt);
				image.src = newImgSrc;
			} else {
				image.parentNode.removeAttribute("href");
			}
		}

		function rollOut(image, sfx) {
			var active = image.parentNode.getAttribute("activelink");
			if (active=="" || active==null) {
				var imgSrc = image.src;
				var imgFile = new Array();
				var imgFile = imgSrc.split("/");
				var ix = imgFile.length-1;
				var myRegExp = new RegExp("\\..+", "gi");
				var imgExt = myRegExp.exec(imgFile[ix]);
				var newImgSrc = imgSrc.replace(sfx+imgExt, imgExt);
				image.src = newImgSrc;
			} else {
				image.parentNode.removeAttribute("href");
			}
		}
////////////

		function okMessage(testo){
			Shadowbox.open({
				player:     'html',
				content:    '<div style="background-color: #fff; height: 160px; width: 300px; text-align:center;"><br \/><br \/>'+testo+'<\/div>',
				height:     160,
				width:      300
			});
		}

		function pleaseWait(wait_msg,wx,hx){
			Shadowbox.open({
				player:     'html',
				content:    '<div style="background-color: #fff; height: '+(hx-2)+'px; width: '+(wx-2)+'px; text-align:center; font-size: 12px; color: #047391; text-transform: uppercase; border: 1px solid #047391;"><br \/><br \/>'+wait_msg+'<br \/><br \/><img src="img\/loader_wheel.gif" \/></div>',
				height: hx,
				width: wx,
				options: {
					modal: true,
					displayNav: false
				} 
			});
		}
		
		function ShadowPost(tform,ww,hh){
			var getAction = tform.getAttribute('action');
			var params = '';
			for ( i = 0; i < tform.length; i++ ) {
				if (tform[i].name != undefined && tform[i].name != '') {
					params = params + ((params!='') ? "&" : "") + tform[i].name + "=" + tform[i].value;
				}
			}
			Shadowbox.open({
				player:     'iframe',
				content:    getAction+'?'+params,
				width:	ww,
				height:	hh
			});
			return false;
		}

		function validEmail(email){
			invalidChars=" /:,;"
			if (email==""){return false}
			for(i=0;i<invalidChars.length;i++)
				{badChar=invalidChars.charAt(i)
				 if (email.indexOf(badChar,0)>-1){return false}
			}
			atPos=email.indexOf("@",1)
			if (atPos==-1) {return false}
			if (email.indexOf("@",atPos+1)!=-1){return false}
			periodPos=email.indexOf(".",atPos)
			if(periodPos==-1) {return false}
			if(periodPos+3>email.length) {return false}
			return true
		  } 	
		  
		function checkForm(theForm) {
			var msg = "ATTENZIONE:\n";
			var err = false;
			for(f=0; f<theForm.length-1; f++) {
				if (theForm[f].getAttribute("msg")!=null && theForm[f].disabled==false) {
					if (theForm[f].value=="") {
						msg = msg+"- "+theForm[f].getAttribute("msg")+"\n";
						theForm[f].style.borderColor="#2E3090";
			//			theForm[f].style.backgroundColor="#E5F5F6";
						err = true;
					}
					else if(theForm[f].disabled==false) {
						theForm[f].style.borderColor="#999";
				//		theForm[f].style.backgroundColor="#FFFFFF";
					}
				}
			}
			if (theForm.email) {
				if (validEmail(theForm.email.value)==false && theForm.email.value != "") {
					if (theForm.email.getAttribute("msg")!=null) {
						msg = msg+"- "+theForm.email.getAttribute("msg")+"\n";
						theForm.email.style.borderColor="#2E3090";
			//			theForm.email.style.backgroundColor="#E5F5F6";
						err = true;
					}
				}
			}
			if (theForm.email && theForm.confemail) {
				if(theForm.email.value!=null && theForm.confemail.value!=null && theForm.email.value!=theForm.confemail.value) {
					msg = msg+"- "+"Verificare che l\'email inserita sia corretta"+"\n";
					theForm.email.style.borderColor="#2E3090";
		//			theForm.email.style.backgroundColor="#E5F5F6";
					theForm.confemail.style.borderColor="#2E3090";
		//			theForm.confemail.style.backgroundColor="#E5F5F6";
					err = true;
				}
			}
				if(theForm.privacy.checked==false) {
					msg = msg+"- "+"Esprimere il consenso al trattamento dei dati"+"\n";
		//			theForm.trattamento_dati.style.borderColor="#874D63";
		//			theForm.trattamento_dati.style.backgroundColor="#E5F5F6";
					err = true;
				} else {
		//			theForm.trattamento_dati.style.borderColor="#666";
		//			theForm.trattamento_dati.style.backgroundColor="#E5F5F6";
				}
			if (err) {
				alert(msg);
				return false;
			}
			else return true;
		}

