function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		    return false
		 }

 		 return true					
	}


function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Perfavore, controllate di aver inserito correttamente il vostro indirizzo email!")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function doPopUp(quale,nome,w,h) {
		mywidth = w;
		myheight = h;
    	myleft = (screen.width - w) / 2;
		mytop = (screen.height - h) / 2;
		window.focus()
		window.open(quale, nome,'width='+mywidth+',height='+myheight+',scrollbars=0,resizable=1,menubar=0,toolbar=0,status=1,location=0,directories=0,left='+myleft+',top='+mytop);
	}

