// Funzioni per Franco e Myriam.it

function popup(a, x, y) {
	var win = window.open('popup.php?immagine='+a, "", 'width='+(x+40)+', height='+(y+75)+', scrollbars=no, statusbar=no');
}

function send(a) {
	
	err = 0;
	errtxt = "";
	
	if (!a) {
		if (document.sendFranco.nome.value == "") { err = 1; errtxt += "- Il nome\n"; }
		if (document.sendFranco.email.value == "") { err = 1; errtxt += "- L\'indirizzo di posta\n"; }
		if (document.sendFranco.oggetto.value == "") { err = 1; errtxt += "- L\'oggetto\n"; }
		if (document.sendFranco.commento.value == "") { err = 1; errtxt += "- Il Messaggio\n"; }
		
		if (err) {
			alert("ATTENZIONE!!\n\nDevi inserire almeno:\n"+errtxt);
		} else {
			document.sendFranco.submit();
		}
		
	} else {
		if (document.sendMyriam.nome.value == "") { err = 1; errtxt += "- Il nome\n"; }
		if (document.sendMyriam.email.value == "") { err = 1; errtxt += "- L\'indirizzo di posta\n"; }
		if (document.sendMyriam.oggetto.value == "") { err = 1; errtxt += "- L\'oggetto\n"; }
		if (document.sendMyriam.commento.value == "") { err = 1; errtxt += "- Il Messaggio\n"; }
		
		if (err) {
			alert("ATTENZIONE!!\n\nDevi inserire almeno:\n"+errtxt);
		} else {
			document.sendMyriam.submit();
		}
		
	}
	
}

function sendC() {
	
	err = 0;
	errtxt = "";
	

	if (document.sendComment.nome.value == "") { err = 1; errtxt += "- Il nome\n"; }
	if (document.sendComment.email.value == "") { err = 1; errtxt += "- L\'indirizzo di posta\n"; }
	if (document.sendComment.commento.value == "") { err = 1; errtxt += "- Il Commento\n"; }
	
	if (err) {
		alert("ATTENZIONE!!\n\nDevi inserire almeno:\n"+errtxt);
	} else {
		document.sendComment.submit();
	}

	
}

function PrevFoto(img){

  foto1= new Image();

  foto1.src=(img);

  Controlla(img);

}

function Controlla(img){

  if((foto1.width!=0)&&(foto1.height!=0)){

    viewFoto(img);

  }

  else{

    funzione="Controlla('"+img+"')";

    intervallo=setTimeout(funzione,20);

  }

}

function viewFoto(img){

  largh=foto1.width+50;

  altez=foto1.height+50;

  stringa="width="+largh+",height="+altez+",top="+0+",left="+0;

  finestra=window.open("popup.php?immagine="+img,"",stringa);

  finestra.focus()

}