<!-- FUNZIONI COMUNI -->

function ritornaMenu(MENU,notifica) {
    if(MENU == 'PRINCIPALE') { 
        if (notifica == 1) {
            if (confirm("Tornando al menù principale si perdono le selezioni in corso\nContinuare?")) {       
                document.location.href="/gol/jsp/menu.jsp";
            }
        }
        else {
            document.location.href="/gol/jsp/menu.jsp";
        }
    }   
    if(MENU == 'LISTE') { 
        if (notifica == 1) {
            if (confirm("Tornando al menù liste si perdono le selezioni in corso\nContinuare?")) {       
                document.location.href="/gol/jsp/menuPrincipale.jsp";
            }
        }
        else {
            document.location.href="/gol/jsp/menuPrincipale.jsp";
        }
    }   
    if(MENU == 'MAIL') { 
        if (notifica == 1) {
            if (confirm("Tornando al menù mailing si perdono le selezioni in corso\nContinuare?")) {       
                document.location.href="/gol/jsp/menuPrincipaleMailing.jsp";
            }
        }
        else {
            document.location.href="/gol/jsp/menuPrincipaleMailing.jsp";
        }
    }   
}

function move(path){
//alert (path);
 document.location.href = path;
}

function apriKaleidos() {
w=window.open("/gol/jsp/privati/kaleidos2.jsp","SELEZIONE_KALEIDOS","width=786,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}
function clickaleidos() {
  w=window.open("/gol/jsp/privati/kaleidosVisualizza.jsp","SELEZIONE_KALEIDOS","width=696,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}

function apriForma() {
w=window.open("/gol/jsp/affari/formeGiuridiche2.jsp","SELEZIONE_FORME_GIURIDICHE","width=786,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}
function clickForma() {
  w=window.open("/gol/jsp/affari/formeGiuridicheVisualizza.jsp","SELEZIONE_FORME_GIURIDICHE","width=696,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}

// spedizione
function assegnaPriceMail(tipo) 
{
	var memo = document.modulo.memo.value;
	//alert(memo);
	if (tipo == 1) 
	{
		//alert("tipo1");
		if(memo == 1){
			document.modulo.totale.value=document.modulo.tot1.value;
			document.modulo.priceMailText.value=document.modulo.tot1.value;	
		}
		else{
			document.modulo.totale.value=document.modulo.prezzo1.value;
			document.modulo.priceMailText.value=document.modulo.prezzo1.value;
		}
		document.modulo.tipoSped.value="1";
	}
	else 
	{
		//alert("tipo2");
		if(memo == 1){
			document.modulo.totale.value=document.modulo.tot2.value;
			document.modulo.priceMailText.value=document.modulo.tot2.value;	
		}
		else{
			document.modulo.totale.value=document.modulo.prezzo2.value;
			document.modulo.priceMailText.value=document.modulo.prezzo2.value;
		}
		document.modulo.tipoSped.value="2";		
	}	
	//alert("totale ---> "+document.modulo.totale.value);
}

//funzione di selezione territorio comune a tutti i rami liste e mailing
function apriTerritorio(profilo,marchio)  
{
	document.criteriForm.cliccato_territorio.value="SI";
	if( profilo == "RV" || (profilo == "GC" && eval(marchio) > 0 ) )
	{ 
		w=window.open("/gol/jsp/territorio/competenzaFiliale.jsp?iniziale=SI","SELEZIONE_TERRITORIO","width=742,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");	
	}
	else
	{ 
		w=window.open("/gol/jsp/territorio/territorioRegioni.jsp?iniziale=SI","SELEZIONE_TERRITORIO","width=742,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");	
	}
}
function viewTerr(profilo)  { 
	if(profilo == "RV") w=window.open("/gol/jsp/territorio/competenzaVisualizza.jsp","VISUALIZZA_TERRITORIO","width=696,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
	else w=window.open("/gol/jsp/territorio/territorioVisualizza.jsp","VISUALIZZA_TERRITORIO","width=696,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}

<!-- -->

//#####################################  RETE VENDITA  ########################################
<!-- LISTA AFFILIATI -->
function vai(path){
    document.location.href = path+"&indicePagina="+document.affiliatoForm.indicePag.value;
}
<!-- -->

<!-- INSERIMENTO AFFILIATI -->
function cambiaRegione(path,dest)
{
	//alert(document.affiliatoForm.reg.value);	
	document.affiliatoForm.action=path;
	//alert(document.affiliatoForm.action);
	document.affiliatoForm.loadType.value="P";	
	document.affiliatoForm.submit();
	return;
}

function cambiaProvincia(path)
{
	//alert(document.affiliatoForm.reg.value);	
	document.affiliatoForm.action=path;
	//alert(document.affiliatoForm.action);
	document.affiliatoForm.loadType.value="C";
	document.affiliatoForm.submit();
	return;
}

function cambiaComune()
{
	document.affiliatoForm.comuni.value=document.affiliatoForm.com.value;
	//alert(document.affiliatoForm.com.value);
	return;	
}
<!-- vecchio -->
function caricaCombo(path, tipo)
{
	alert(tipo);
	alert(document.affiliatoForm.prov.value);	
	document.affiliatoForm.action=path;
	//alert(document.affiliatoForm.action);
	document.affiliatoForm.loadType.value=tipo;		
	document.affiliatoForm.submit();
	return;
}



function controlloAffiliato(path)
{
    var syntax_email = "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@((([a-zA-Z0-9])|([a-zA-Z0-9]+([a-zA-Z0-9-])*[a-zA-Z0-9]+))\.)*([a-zA-Z0-9]+([a-zA-Z0-9-])*[a-zA-Z0-9]+)\.[a-zA-Z0-9]{2,}$";
    var syntax_zip = "^([0-9]){5}$";
    var syntax_phone = "^[0-9 \\+-\.()]{6,15}$";

 	document.affiliatoForm.action=path;
 	var login = document.affiliatoForm.login.value
 	var ragsoc = document.affiliatoForm.ragsoc.value
 	var ind = document.affiliatoForm.ind.value
 	var cap = document.affiliatoForm.cap.value
 	var tel = document.affiliatoForm.tel.value
 	var email = document.affiliatoForm.email.value
 	var idr = document.affiliatoForm.reg.value
 	var idp = document.affiliatoForm.prov.value
 	var idc = document.affiliatoForm.com.value
 	/*
 	alert("login --> "+login);
 	alert("ragsoc --> "+ragsoc);
 	alert("ind --> "+ind);
 	alert("cap --> "+cap);
 	alert("tel --> "+tel);
 	alert("email --> "+email);
 	alert("idr --> "+idr);
 	alert("idp --> "+idp);
 	alert("idc --> "+idc);*/
 	// Controllo campi
 	if(login == undefined || login == ""){
 		alert("Il campo Login è obbligatorio");
 		document.affiliatoForm.login.focus();
 		return;
 	}
 	if(ragsoc == undefined || ragsoc == ""){
 		alert("Il campo Ragione Sociale è obbligatorio");
 		document.affiliatoForm.ragsoc.focus();
 		return;
 	}
 	if(ind == undefined || ind == ""){
 		alert("Il campo Indirizzo è obbligatorio");
 		document.affiliatoForm.ind.focus();
 		return;
 	}
 	if(cap == undefined || cap == ""){
 		alert("Il campo Cap è obbligatorio");
 		document.affiliatoForm.cap.focus();
 		return;
 	}
 	if(tel == undefined || tel == ""){
 		alert("Il campo Telefono è obbligatorio");
 		document.affiliatoForm.tel.focus();
 		return;
 	}
 	if(email == undefined || email == ""){
 		alert("Il campo Email è obbligatorio");
 		document.affiliatoForm.email.focus();
 		return;
 	}
 	
 	if(idr == undefined || idr == "" || idr == "0"){
 		alert("Selezionare la Regione");
 		document.affiliatoForm.reg.focus();
 		return;	
 	}
 	if(idp == undefined || idp == "" || idp == "0"){
 		alert("Selezionare la Provincia");
 		document.affiliatoForm.prov.focus();
 		return;	
 	}
 	if(idc == undefined || idc == "" || idc == "0"){
 		alert("Selezionare il Comune");
 		document.affiliatoForm.com.focus();
 		return;	
 	}
        re = new RegExp(syntax_zip);
        if(!document.affiliatoForm.cap.value.match(re)) {
            alert("Attenzione: il campo CAP non ha un formato valido!");
            document.affiliatoForm.cap.focus();
            return;
 	}
        re = new RegExp(syntax_phone);
        if(!document.affiliatoForm.tel.value.match(re)) {
            alert("Attenzione: il campo TELEFONO non ha un formato valido!");
            document.affiliatoForm.tel.focus();
            return;
 	}
        re = new RegExp(syntax_email);
        if(!document.affiliatoForm.email.value.match(re)) {
            alert("Attenzione: il campo EMAIL non ha un formato valido!");
            document.affiliatoForm.email.focus();
            return;
 	}
        document.affiliatoForm.submit();
}
<!-- -->
 
<!-- DETTAGLIO AFFILIATO -->
function apri() {
w=window.open("/gol/jsp/territorio/competenzaRegioni.jsp?iniziale=SI","SELEZIONE_TERRITORIO","width=742,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}
function apri2() {
w=window.open("/gol/jsp/territorio/competenzaVisualizza.jsp","SELEZIONE_TERRITORIO","width=742,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}
function apri3() {
w=window.open("/gol/jsp/territorio/competenzaFiliale.jsp?iniziale=SI","SELEZIONE_TERRITORIO","width=742,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
}
function ConfigLogo() {
    w=window.open("/gol/jsp/servizi/GalleriaHeader.jsp","GALLERIA_HEADER","width=540,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
    }
function ViewLogo() {
    window.open("/gol/jsp/servizi/ViewHeader.jsp","GALLERIA_HEADER","width=540,height=564,menubar=no,scrollbars=yes,statusbar=no,resizable=yes");
    }    

function vaiSpendibilita()
{
var syntax_spendibilita = "^[0-9\.]{1,}$";
	if(document.ModificaSpendibilita.spendibilita.value == ""){
		alert("Inserire spendibilità");
		return false;
	}
        re = new RegExp(syntax_spendibilita);
	if(!document.ModificaSpendibilita.spendibilita.value.match(re)){
		alert("Attenzione!\n\nLa spendibilità va inserita rispettando la seguente sintassi:\n\n- Inserire solo valori numerici;\n- Non utilizzare separatori di migliaia;\n- Utilizzare il \'.\' come separatore parte decimale.\n\nAd esempio inserire 2500.50\nper impostare la spendibilità a\nduemilacinquecento euro e cinquanta centesimi.\n\n");
		return false;
	}

	var spend = document.ModificaSpendibilita.spendibilita.value;
        var punti = 0;
        for(i = 0; i < spend.length; i++)
	{
	    if(spend.charAt(i)=='.'){
                punti++;
	    }
	}
        if(punti>1) {
		alert("1Attenzione!\n\nLa spendibilità va inserita rispettando la seguente sintassi:\n\n- Inserire solo valori numerici;\n- Non utilizzare separatori di migliaia;\n- Utilizzare il \'.\' come separatore parte decimale.\n\nAd esempio inserire 2500.50\nper impostare la spendibilità a\nduemilacinquecento euro e cinquanta centesimi.\n\n");
		return false;
	}
	return true;
}
<!-- -->

<!-- FORZA PASS-WORD -->
function checkpass() 
{
	var messaggio = "";
 	if (!(document.cambioPasswordForm.password_cliente.value == document.cambioPasswordForm.password_conferma.value)) {
   		messaggio = "Le password inserite non corrispondono!";
 	}else if (document.cambioPasswordForm.password_cliente.value.length < 4) {
   		messaggio = "La password deve essere composta da almeno 4 caratteri!";
 	}else if (document.cambioPasswordForm.password_cliente.value == "<%=cliente.getLogin()%>") {
   		messaggio = "La password non può essere uguale alla login!";
 	}else messaggio = "";

 	if (messaggio != "") {
   		avviso(messaggio,200,300);
   		document.cambioPasswordForm.password_cliente.value = "";
   		document.cambioPasswordForm.password_conferma.value = "";
   		document.cambioPasswordForm.password_cliente.focus();
 	}
 	else {
 		document.cambioPasswordForm.submit();     
 	}
}
<!-- -->
//###################################  FINE RETE VENDITA  ######################################


