// JavaScript Document

			var r={
			'special':/[\W]/g,
			'quotes':/['\''&'\"']/g,
			'notnumbers':/[^\d]/g
			}
			
			function valid(o,w){
			  o.value = o.value.replace(r[w],'');
			}
			
			function Popup(theURL) { //v2.0
  				window.open(theURL,'Scheda','resizable=no,fullscreen=yes,menubar=no,toolbar=no,location=no,scrollbars=yes,status=no');
			}
			var win = null;
			function NewWindow(mypage,myname,w,h,scroll){
			LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
			TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
			settings =
			'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
			win = window.open(mypage,myname,settings)
			if(win.window.focus){win.window.focus();}
			}
			
			function Fullscreen(){
				self.moveTo(0,0);
				self.resizeTo(screen.availWidth,screen.availHeight);
			}
			

			function redirect()
				{
					var importo_paypal=document.getElementById("importo_paypal");
					var importo = importo_paypal.options[importo_paypal.selectedIndex].value;
					var idutente = document.getElementById("id_utente").value;
					var url = "pppaypal.php?importo="+importo+"&idutente="+idutente;
					NewWindow(url,'paypal2','300','300','no');
				}
			function date(){

				var data = new Date()
				var gg, mm, aaaa;
				aaaa = data.getYear() + "-";
				mm = data.getMonth() + "-";
				gg = data.getDate();
				document.write(aaaa+mm+gg);
				return data;
			}
			
			function focus(campo){
	
				document.getElementById(campo).focus();

			}
			
			function ControllaCF(cf)
				{
					var validi, i, s, set1, set2, setpari, setdisp;
					if( cf == '' )  return '';
					cf = cf.toUpperCase();
					if( cf.length != 16 )
						return "La lunghezza del codice fiscale non ?"
						+"corretta: il codice fiscale dovrebbe essere lungo\n"
						+"esattamente 16 caratteri.\n";
					validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
					for( i = 0; i < 16; i++ ){
						if( validi.indexOf( cf.charAt(i) ) == -1 )
							return "Il codice fiscale contiene un carattere non valido `" +
								cf.charAt(i) +
								"'.\nI caratteri validi sono le lettere e le cifre.\n";
					}
					set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
					set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
					setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
					setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
					s = 0;
					for( i = 1; i <= 13; i += 2 )
						s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
					for( i = 0; i <= 14; i += 2 )
						s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
					if( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )
						return "Il codice fiscale non ?orretto:\n"+
							"il codice di controllo non corrisponde.\n";
					return "";
				}
	/*function countdown(){		
		alert("test");
		var days = 2; 
  		var hours = 22;  
  		var minutes = 33; 
  		var seconds = 4; 
		alert (seconds); 
		function setCountDown()
					{
					  seconds--;
					  if (seconds < 0){
						  minutes--;
						  seconds = 59
					  }
					  if (minutes < 0){
						  hours--;
						  minutes = 59
					  }
					  if (hours < 0){
						  days--;
						  hours = 23
					  }
					  document.getElementById("remain").innerHTML = days+" days, "+hours+" hours, "+minutes+" minutes, "+seconds+" seconds";
					  setTimeout ( "setCountDown()", 1000 );
					}
		}*/
		
		

