	//apre la pagina dei crediti
	function openCredits(w, h)
	{
  	var w = (w == null) ? '320' : w;
  	var h = (h == null) ? '240' : h;
  	var left = ( (screen.width-w) / 2);
  	left = (left > 0) ? left : 0;
  	var top = ( (screen.height-h) / 2);
  	top = (top > 0) ? top : 0;
    var res = window.open('/credits.php', 'credits_popup', 'left='+left+', top='+top+', width='+w+', height='+h+' ,toolbar=no, location=no, status=yes, menubar=no, scrollbars=no, resizable=no');
    res.focus();
    return res;
	}
	
	//funzione per controllare la lunghezza di una textarea
	function maxChars(ogg,maxchars)
	{
		if (ogg.value.length > maxchars){
		  ogg.value=ogg.value.substr(0,maxchars);
		}
	}
	
	//funzione per controllare il valore con una regexp
	function campoRegExp(campo,exp,messaggio)
	{
		var reg = exp
		if(!reg.test(campo.value)){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	function campoBol(campo,val,messaggio){
		if(! val){
			alert(messaggio)
			campo.focus();
			return (0);
		}
	}								
	
	function campoNotBol(campo,val,messaggio){
		if(val){
			alert(messaggio)
			campo.focus();
			return (0);
		}
	}								
	
	function campoBlank(campo,val,messaggio){
		if(val.length == 0){
			alert(messaggio)
			return (0);
		}
	}					
			
	//funzione per il redirect temporizzato
	function redirect(url,secondi)
	{
		if(url!=''){
			if(secondi==''||isNaN(secondi)) secondi = 5;
			window.setTimeout("window.location='"+url+"'",secondi*1000);}
	}
	
	//funzioni per iscrizione newsletter infomail
	function setDefaultValues(){
		var fname = document.subscribe.firstName.value;
		var lname = document.subscribe.lastName.value;
		if(!checkEmptyString(fname)) document.subscribe.firstName.value=' ';
		if(!checkEmptyString(lname)) document.subscribe.lastName.value=' ';
		document.subscribe.submit();
	}
	function checkEmptyString(str) {
		for(var i=0; i<str.length; i++){
			if(str.charAt(i)!=' '){
				return 1;		// exits as soon as it finds non spaces
			}
		}
		return 0;		// if it gets as far as here it was all spaces
	}

