var nuova
function newWindow(bookgif,title,size1,size2) {
	var1=(screen.width-size1)/2;
	var2=(screen.height-size2)/2;
	if (nuova && !nuova.closed) {
			nuova.close()
	}
	nuova = window.open(bookgif, title,'scrollbars=yes,width='+size1+',height='+size2+',left='+var1+',top='+var2+'')
}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function Controllo_EMAil(str,Ammetti_vuoto){
	var lg = str.length;
	var Controllo_EMAil = true;
	var i, contr
	if (parseInt(lg) == 0){
		if (Ammetti_vuoto== true) {
			return true;
		}else{
			return false;
		}
	}
	if (parseInt(lg) < 5){
		return false;
	}
	var ch = str.indexOf('@');
	if (ch == -1) {
		return false;
	}else{
		if ((ch == 0)){
			return false;
		}
	}
	var ch2 = str.indexOf('@',ch+1);
	if ( ch2 !== -1){
		return false;
	}
	var pfine = str.lastIndexOf('.');
	if ((parseInt(lg-1)- pfine)  > 4){
		return false;
	}
	var piniz = str.indexOf('.');
	var pfine = str.lastIndexOf('.',ch);
	if ((piniz == 0)||(pfine == ch-1)) {
		return false;
	}
	var piniz = str.indexOf('.',ch);
	var pfine = str.lastIndexOf('.');
	if ((piniz == ch+1)||(pfine == lg-1)||(pfine == -1)) {
		return false;
	}
	var mem = '0';
	for(i = 0; i < lg; i++){
		contr = str.substr(i, '1');
		if (contr == '.'){
    		if ( mem == '1'){
				return false;
			}else{
				mem = '1';
		}}else{
			mem = '0';	
		}	
  	}
	var piniz = str.indexOf('_');
	var pfine = str.lastIndexOf('_',ch);
	if ((piniz == 0)||(pfine == ch-1)) {
		return false;
	}
	var pfine = str.indexOf('_',ch);
	if (pfine !== -1) {
		return false;
	}
   	for ( i = 0; i < ch; i++){
  		contr = str.substr(i, 1);
		if ((str.charCodeAt(i)>96 && str.charCodeAt(i)<123)||(str.charCodeAt(i)>47 && str.charCodeAt(i)<58)||(str.charCodeAt(i)>64 && str.charCodeAt(i)<91)||(contr == '.')||(contr == '_')){
    		Controllo_EMAil = true
		}else{
			return false;
  		}
  	}
	for ( i = ch+1 ; i < lg-1; i++){
		contr = str.substr(i, 1);
		if ((str.charCodeAt(i)>96 && str.charCodeAt(i)<123)||(str.charCodeAt(i)>47 && str.charCodeAt(i)<58)||(str.charCodeAt(i)>64 && str.charCodeAt(i)<91)||(contr == '.')){
    		Controllo_EMAil = true
		}else{
			return false;
  		}
  	}
	return true
}