// JavaScript Document

// CONFIGURAZIONE
// DESTINATARIO PRINCIPALE
var destinatario 	= 'info@intertraco.it';
// CC
var copia 			= 'davide.fava@intertraco.it';
var copianascosta	= '';

// SUBJECT
var subject = new Object();
subject['it']			= 'Modulo di richiesta informazioni ad Intertraco SpA';
subject['en']			= 'Modulo di richiesta informazioni ad Intertraco SpA - EN';
subject['fr']			= 'Modulo di richiesta informazioni ad Intertraco SpA - FR';
subject['de']			= 'Modulo di richiesta informazioni ad Intertraco SpA - DE';
subject['es']			= 'Modulo di richiesta informazioni ad Intertraco SpA - ES';
// INTESTAZIONE
var intestazione = new Object();
intestazione['it']	= 'Modulo di richiesta informazioni ad Intertraco SpA.<br>Si possono inserire in questo punto commenti ed informazioni ';
intestazione['it']	+= 'aggiuntive a quelle fornite nel modulo del sito web<br><br><br><br><br>';

intestazione['en']	= 'Request for information - module. <br>You can add here more comments and any other particular request.<br><br><br><br><br>';
intestazione['fr']	= 'Request for information - module. <br>You can add here more comments and any other particular request.<br><br><br><br><br>';
intestazione['de']	= 'Request for information - module. <br>You can add here more comments and any other particular request.<br><br><br><br><br>';
intestazione['es']	= 'Request for information - module. <br>You can add here more comments and any other particular request.<br><br><br><br><br>';

// DISCLAIMER
var disclaimer = new Object();
disclaimer['it'] 		= 'Le informazioni di seguito non devono esssere cancellate.<br>Intertraco si riserva la possibilità, a suo insindacabile giudizio,';
disclaimer['it'] 			+= 'di non prendere in considerazione richieste ritenute non complete o non conformi.';

disclaimer['en']	= 'Following info should not be modified. Any incomplete or not well formed information will be treated by Intertraco as wrong information';
disclaimer['fr'] 		= 'Le informazioni di seguito non devono esssere cancellate.<br>Intertraco si riserva la possibilità, a suo insindacabile giudizio,';
disclaimer['fr'] 			+= 'di non prendere in considerazione richieste ritenute non complete o non conformi.';
disclaimer['de'] 		= 'Le informazioni di seguito non devono esssere cancellate.<br>Intertraco si riserva la possibilità, a suo insindacabile giudizio,';
disclaimer['de'] 			+= 'di non prendere in considerazione richieste ritenute non complete o non conformi.';
disclaimer['es'] 		= 'Le informazioni di seguito non devono esssere cancellate.<br>Intertraco si riserva la possibilità, a suo insindacabile giudizio,';
disclaimer['es'] 			+= 'di non prendere in considerazione richieste ritenute non complete o non conformi.';
// SALUTI
var saluti = new Object();
saluti['it'] 	='<br>Cordiali saluti, grazie per aver utilizzato gli strumenti di comunicazione disponibili sul nostro sito web<br>Intertraco SpA<br><br>';
saluti['en']	= '<br>Thank you for using our web-site communication facilities.<br>Intertraco SpA <br><br>';
saluti['fr']		= '<br>Thank you for using our web-site communication facilities.<br>Intertraco SpA <br><br>';
saluti['de']	= '<br>Thank you for using our web-site communication facilities.<br>Intertraco SpA <br><br>';
saluti['es']	= '<br>Thank you for using our web-site communication facilities.<br>Intertraco SpA <br><br>';
// BODYMSG
var bodymsg = new Object();
bodymsg['it']  = intestazione['it'] + disclaimer['it'] + saluti['it'];
bodymsg['it']	+= '<br>Seguono i dati forniti mediante il modulo di richiesta:<br>------------------------------------------------<br>';

bodymsg['en']	= intestazione['en'] + disclaimer['en'] + saluti['en'];
bodymsg['en']	+= '<br>Data collected from request module, follow:<br>------------------------------------------------<br>';
bodymsg['fr']	= intestazione['fr'] + disclaimer['fr'] + saluti['fr'];
bodymsg['fr']	+= '<br>Data collected from request module, follow:<br>------------------------------------------------<br>';
bodymsg['de']	= intestazione['de'] + disclaimer['de'] + saluti['de'];
bodymsg['de']	+= '<br>Data collected from request module, follow:<br>------------------------------------------------<br>';
bodymsg['es']	= intestazione['es'] + disclaimer['es'] + saluti['es'];
bodymsg['es']	+= '<br>Data collected from request module, follow:<br>------------------------------------------------<br>';

var msgprivacy = new Object();

msgprivacy['it'] = 'Si può inviare modulo compilato solo dopo aver accettato le norme relative al trattamento dei dati. Grazie.';
msgprivacy['en'] = 'Form can be sent when data processing policy has been approved and checkbox has been checked. Thanks.';
msgprivacy['fr'] = 'accetta la privacy FR';
msgprivacy['de'] = 'accetta la privacy DE';
msgprivacy['es'] = 'accetta la privacy ES';


// ---------------------------------------
function check_send ( frm, lang, privacy )
// ---------------------------------------
{
	if( privacy == true )
	{
		// RACCOGLI I DATI -----------------------------------------------------------
		var els = frm.elements;
		var l = els.length;
		idati = '';
		for( i=0; i < l; i++ )
		{
			t = els[i].type;
			n = els[i].name;
			v = els[i].value;
			if( t == 'text' || t == 'textarea')
			{	
				idati += n + ': ' + v + "<br>\n";
			}
		}
		
		// ASSEMBLA MESSAGGIO ---------------------------------------------------------
		str = 'mailto:' + destinatario + '?' ;
		if( copia != '' ){ str += '&cc' + copia; }
		if( copianascosta != '' ){ str += '&bcc' + copianascosta; }
		str += '&subject=' + subject[lang];
		
		bodymsg[lang] += idati;
		str += '&body=' + bodymsg[lang];
				
		// APRI CLIENT di POSTA ELETTRONICA -------------------------------------------
		document.location.href= str;

	} else {
		// VISUALIZZA MESSAGGIO DI ERRORE SE NON E' STATO VISTATO il CHECBOX ----------
		alert ( msgprivacy[lang] );
	}
	
}
