//funzione inviaordine
function TrimJS(StrToTrim)
{
    // CONTROLLA CHE IL VALORE IN INPUT SIA DI TIPO STRING
    if (typeof StrToTrim != "string")
    {
        return StrToTrim;
    }

    // CATTURA IL PRIMO CARATTERE DELLA STRINGA PER CONTROLLARE CHE NON SIA UNO SPAZIO VUOTO
    var StrBlank = StrToTrim.substring(0, 1);

    // ELIMINA LO SPAZIO VUOTO DALLA PRIMA POSIZIONE DELLA STRINGA
    while (StrBlank == " ")
    {
        StrToTrim = StrToTrim.substring(1, StrToTrim.length);
        StrBlank = StrToTrim.substring(0, 1);
    }

    // CATTURA L'ULTIMO CARATTERE DELLA STRINGA PER CONTROLLARE CHE NON SIA UNO SPAZIO VUOTO
    StrBlank = StrToTrim.substring(StrToTrim.length - 1, StrToTrim.length);

    // ELIMINA LO SPAZIO VUOTO DALL'ULTIMA POSIZIONE DELLA STRINGA
    while (StrBlank == " ")
    {
        StrToTrim = StrToTrim.substring(0, StrToTrim.length-1);
        StrBlank = StrToTrim.substring(StrToTrim.length-1, StrToTrim.length);
    }

    // ELIMINA POTENZIALI SPAZI VUOTI MULTIPLI ALL'INIZIO ED ALLA FINE DI UNA STRINGA
    while (StrToTrim.indexOf("  ") != -1)
    {
        StrToTrim = StrToTrim.substring(0, StrToTrim.indexOf("  "));
        StrToTrim += StrToTrim.substring(StrToTrim.indexOf("  ") + 1, StrToTrim.length);
    }

    // RESTITUISCE IL VALORE FINALE SENZA SPAZI VUOTI DI CONTORNO
    return StrToTrim;
}

function InviaOrdine() {
	mancanti=''
	errore=0
	if (TrimJS(document.frmordine.txtDES_DEN_UTE.value)==''){
		mancanti+='Nome e Cognome;'
	}
	if (TrimJS(document.frmordine.txtDES_IND_EML.value)==''){
		mancanti+='Email;'
	}
	if (TrimJS(document.frmordine.OGG.value)==''){
		mancanti+='Oggetto Richista;'
	}
	
	
	if (mancanti!='') {
		strtmp='Campi Obbligatori Mancanti: ';
		campi = mancanti.split(';')
		i=0;
		while (i<campi.length) {
			if (i>0 && campi[i]!='') {
				strtmp=strtmp+' - ';
			}
			strtmp=strtmp+campi[i];
			
			i++;
		}
		alert(strtmp);
		errore=1
	}
	else
	{
		 		 
		//**************************************
		//   Controllo mail
		//**************************************
		 var stringa = document.frmordine.txtDES_IND_EML.value;
		
		 
		 if (stringa.indexOf("@") > 0 && stringa.indexOf(".") > 0) {
		 }
		 else
		 {
			errore=1
			alert ("Inserire un indirizzo mail corretto");
		 }
	
		if (errore=='0') {
			//document.frmordine.azione.value="Invia";
			document.frmordine.submit();
		}
	}
	errore=errore+'';
	
}
function AcquistaBrani() {
	mancanti=''
	errore=0
	if (TrimJS(document.frmAcquista.txtDES_DEN_UTE.value)==''){
		mancanti+='Ragione Sociale;'
	}
	if (TrimJS(document.frmAcquista.txtDES_IND_EML.value)==''){
		mancanti+='Email;'
	}
	if (TrimJS(document.frmAcquista.opt100.value)==''){
		mancanti+='100;'
	}
	
	
	if (mancanti!='') {
		strtmp='Campi Obbligatori Mancanti: ';
		campi = mancanti.split(';')
		i=0;
		while (i<campi.length) {
			if (i>0 && campi[i]!='') {
				strtmp=strtmp+' - ';
			}
			strtmp=strtmp+campi[i];
			
			i++;
		}
		alert(strtmp);
		errore=1
	}
	else
	{
		 		 
		//**************************************
		//   Controllo mail
		//**************************************
		 var stringa = document.frmAcquista.txtDES_IND_EML.value;
		
		 
		 if (stringa.indexOf("@") > 0 && stringa.indexOf(".") > 0) {
		 }
		 else
		 {
			errore=1
			alert ("Inserire un indirizzo mail corretto");
		 }
	
		if (errore=='0') {
			//document.frmordine.azione.value="Invia";
			//document.frmordine.submit();
		}
	}
	errore=errore+'';
	
}
function InviaInformazioni() {
	mancanti=''
	errore=0
	if (TrimJS(document.frmordine.txtDES_DEN_UTE.value)==''){
		mancanti+='Nome e Cognome;'
	}
	if (TrimJS(document.frmordine.txtDES_IND_EML.value)==''){
		mancanti+='Email;'
	}
	if (TrimJS(document.frmordine.OGG.value)==''){
		mancanti+='Oggetto Richista;'
	}
	
	
	if (mancanti!='') {
		strtmp='Campi Obbligatori Mancanti: ';
		campi = mancanti.split(';')
		i=0;
		while (i<campi.length) {
			if (i>0 && campi[i]!='') {
				strtmp=strtmp+' - ';
			}
			strtmp=strtmp+campi[i];
			
			i++;
		}
		alert(strtmp);
		errore=1
	}
	else
	{
		 		 
		//**************************************
		//   Controllo mail
		//**************************************
		 var stringa = document.frmordine.txtDES_IND_EML.value;
		
		 
		 if (stringa.indexOf("@") > 0 && stringa.indexOf(".") > 0) {
		 }
		 else
		 {
			errore=1
			alert ("Inserire un indirizzo mail corretto");
		 }
	
		if (errore=='0') {
			//document.frmordine.azione.value="Invia";
			document.frmordine.submit();
		}
	}
	errore=errore+'';
	
}
function InviaRich_Info() {
	mancanti=''
	errore=0

	if (TrimJS(document.frmRich.txtEmail_Richiesta.value)==''){
		mancanti+='Email;'
	}
	if (TrimJS(document.frmRich.txtOgg_Richiesta.value)==''){
		mancanti+='Oggetto Richiesta;'
	}
	
	
	if (mancanti!='') {
		strtmp='Campi Obbligatori Mancanti: ';
		campi = mancanti.split(';')
		i=0;
		while (i<campi.length) {
			if (i>0 && campi[i]!='') {
				strtmp=strtmp+' - ';
			}
			strtmp=strtmp+campi[i];
			
			i++;
		}
		alert(strtmp);
		errore=1
	}
	else
	{
		 		 
		//**************************************
		//   Controllo mail
		//**************************************
		 var stringa = document.frmRich.txtEmail_Richiesta.value;
		
		 
		 if (stringa.indexOf("@") > 0 && stringa.indexOf(".") > 0) {
		 }
		 else
		 {
			errore=1
			alert ("Inserire un indirizzo mail corretto");
		 }
	
		if (errore=='0') {
			document.frmRich.txtControllo.value="ProPie";
			document.frmRich.submit();
		}
	}
	errore=errore+'';
	
}
function InviaRichBIG_Info() {
	mancanti=''
	errore=0
	
	if (TrimJS(document.frmContatti.txtNome_RichBig.value)==''){
		mancanti+='Nome e Cognome;'
	}
	if (TrimJS(document.frmContatti.txtMail_RichBig.value)==''){
		mancanti+='Email;'
	}	
	if (TrimJS(document.frmContatti.txtInfo_RichBig.value)==''){
		mancanti+='Oggetto Richiesta;'
	}
	
	
	if (mancanti!='') {
		strtmp='Campi Obbligatori Mancanti: ';
		campi = mancanti.split(';')
		i=0;
		while (i<campi.length) {
			if (i>0 && campi[i]!='') {
				strtmp=strtmp+' - ';
			}
			strtmp=strtmp+campi[i];
			
			i++;
		}
		alert(strtmp);
		errore=1
	}
	else
	{
		 		 
		//**************************************
		//   Controllo mail
		//**************************************
		 var stringa = document.frmContatti.txtMail_RichBig.value;
		
		 
		 if (stringa.indexOf("@") > 0 && stringa.indexOf(".") > 0) {
		 }
		 else
		 {
			errore=1
			alert ("Inserire un indirizzo mail corretto");
		 }
	
		if (errore=='0') {
			document.frmContatti.txtControllo_RichBig.value="ProPie";
			document.frmContatti.submit();
		}
	}
	errore=errore+'';
	
}
//	return '';	
//
//}