/**/
function mOver(obj, sopra, i )
{
	obj.style.cursor = 'hand';
	if (obj.className)
	{
		obj.className = sopra ;
	}
	Immagine = GetObject( 'img' + i );
	Immagine.src = 'img/staz_logomenuR.gif';

}


/**/
function mOut(obj, flag, i)
{
	obj.style.cursor = 'default';
	if (obj.className)
	{
		obj.className = flag;
	}
	Immagine = GetObject( 'img' + i );
	Immagine.src = 'img/staz_logomenuW.gif';
}


/**/
function GetObject( ObjID )
{
	if( navigator.appName.indexOf( 'Explorer' ) > 0 )
	{
		Oggetto = document.all[ObjID];
	}
	else
	{
		Oggetto = document.getElementById( ObjID );
	}
return Oggetto;
}


/**/
function invia(tipo)
{
	/* manca la gestione della lingua sugli alert */
	if( document.staz.guest.value	== '' )
	{
		alert( 'Specificare il proprio nome.' );
		return false;
	}
	if( document.staz.address.value	== '' )
	{
		alert( 'Specificare il proprio indirizzo di posta.' );
		return false;
	}
	if( document.staz.testo.value	== '' )
	{
		alert( 'Scrivere qualcosa nel messaggio.' );
		return false;
	}
	Email = document.staz.address.value;
	//alert( Email );
	if( Email.indexOf( '@' ) == -1 )
	{
		alert( 'Indirizzo di posta non valido (1)' );
		return;
	}
	if( Email.indexOf( '.' ) == -1 )
	{
		alert( 'Indirizzo di posta non valido (2)' );
		return;
	}
	at = Email.indexOf( '@' );
	dot = Email.lastIndexOf( '.' );
	if( dot - at  <= 3 )
	{
		alert( 'Indirizzo di posta non valido (3)' );
		return;
	}
	if( Email.length - dot < 3 )
	{
		alert( 'Indirizzo di posta non valido (4)' );
		return;
	}

	switch( tipo )
	{
	case 'MAIL':
		window.location.href='mailto:'+document.staz.email.value+'@lastazione.org?Subject=messaggio inviato da '+document.staz.guest.value+'&body='+document.staz.testo.value;
		break;
	case 'GUESTBOOK':
		document.staz.submit();
		break;
	}
}
