function GetDettaglio( oggetto, contenuto) { str = window.location.toString(); if (str.indexOf("?") > 0) { str = str + "&ogg=" + oggetto + "&id=" + contenuto; } else { str = str + "?ogg=" + oggetto + "&id=" + contenuto; } window.location.href = str; } function apriFinestra (x, y, nome, url) { nome = nome.toUpperCase(); if(x > (screen.width - 100)) x = (screen.width - 150); if(y > (screen.height - 100)) y = (screen.height - 150); var w = x; var h = y; var l,t; l = Math.round((screen.width / 2) - (w / 2)); t = Math.round((screen.height / 2) - (h / 2)) - 10; eval("WIN_" + nome + " = window.open(url,nome,\"resizable=yes,scrollbars=yes,width=\"+w+\",height=\"+h+\",left=\"+ l +\",top=\"+ t);"); try { eval("WIN_" + nome + ".focus()"); } catch(err) { setTimeout("WIN_" + nome + ".focus()", 2000); } } function apriDialog (x, y, nome, url) { nome = nome.toUpperCase() if(x > (screen.width - 100)) x = (screen.width - 150) if(y > (screen.height - 100)) y = (screen.height - 150) var w = x var h = y var l,t; l = Math.round((screen.width / 2) - (w / 2)); t = Math.round((screen.height / 2) - (h / 2)) - 10; eval("WIN_" + nome + " = window.open(url,nome,\"menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes,width=\"+w+\",height=\"+h+\",left=\"+ l +\",top=\"+ t);") try { eval("WIN_" + nome + ".focus()") } catch(err) { setTimeout("WIN_" + nome + ".focus()", 2000) } } // verifica se una stringa è un indirizzo email corretto function apriDoc(id){ apriFinestra(450,500,"docdett"+id,"/doc/dettaglio.asp?i_documentoID=" + id); } function apriDocDett(id){ apriFinestra(450,500,"docdett"+id,"/doc/dettaglio.asp?i_documentoID=" + id); } //apre direttamente il pop up di download del documento function apriDocDownload(id){ //apriFinestra(50,50,"docdownload"+id,"/doc/scaricaDoc.asp?iDocumentoID=" + id + "&iAllegatoID=0"); document.location.href="/doc/scaricaDoc.asp?iDocumentoID=" + id + "&iAllegatoID=0"; } //apre direttamente il pop up di dettaglio degli allgeati di un documento function apriDocAllegati(id){ apriFinestra(450,500,"docALLdownload"+id,"/doc/dettaglioAllegati.asp?i_documentoID=" + id + "&iAllegatoID=0"); } function apriMappa(tipo, id) { apriFinestra(470,470,"GoogleMap","/google/preview_map.asp?t=" + tipo + "&i=" + id); } // verifica se una stringa è un indirizzo email corretto function isEmail(email){ var isEmail_re = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/; return String(email).search (isEmail_re) != -1; } // verifica se una stringa è un numero di telefono corretto function isTel(testo){ return (/^(?:(\+\d+|\+\s+\d+|\d{3,5}|)*\s*[\/\-\s{1}]*\s*\d+)$/i.test(testo)); } // verifica se una stringa è un alfanumerico function isAlfanumerico(testo){ return (/^[A-Za-z0-9]+$/i.test(testo)); } function isDateS(data){ data = Trim(data); if(data == "")return true; var re=/(0?[1-9]|[12][0-9]|3[01])\/(0?[1-9]|1[012])\/((19|20)\d\d)/; //var re = /(0[1-9]|[12][0-9]|3[01])[\- \/.](0[1-9]|1[012])[\- \/.](19|20)\d{2}/i; var match = re.exec(data); if (match != null) { gg = match[1]; mm = match[2]; aaaa = match[3]; if(isDate(gg,mm,aaaa)) return true; } return false; } // Vanno passate tre stringhe function isDate(gg,mm,aaaa){ gg = Number(gg); mm = Number(mm); if(aaaa.length<4){ return false; }else{ dataInput = new Date(); dataInput.setDate(gg); dataInput.setMonth(mm-1); dataInput.setFullYear(aaaa); if (dataInput.getDate() == gg && dataInput.getMonth() == (mm - 1) && dataInput.getFullYear() == aaaa) return true; else return false; } } // Va passata la stringa unica in formato "gg/mm/aaaa hh.mm"; function isDateTime(datetime){ if(datetime == "") return false; data = datetime.substring(0,10); if (!isDateS(data)) return false; ora = datetime.substring(10,16); if(ora.substring(0,1) == ' ') ora = ora.substring(1, 6); else return false; hh = ora.split(".")[0]; mm = ora.split(".")[1]; if(isNaN(hh) || isNaN(mm)) return false; if ( hh.length != 2 || mm.length != 2) return false; if(hh < 0 || hh > 23) return false; if(mm < 0 || mm > 59) return false; return true; } // Apre i sondaggi function sondaggi(iMenu) { apriFinestra(300, 300, "SOND" + iMenu, "../sondaggi/default.asp?i_menuID=" + iMenu); } // Apre i questionari function questionari(iMenu) { apriFinestra(500, 400, "QUEST" + iMenu, "../questionari/default.asp?i_menuID=" + iMenu); } /****************** funzioni controllo codice fiscale ******************/ function controllaCF(nomeForm){ var alrtMsg = "ATTENZIONE!"; var msg1 = "\rIl campo "; var msg2 = "\rI campi "; var mbMsg1 = " non e' stato compilato"; var mbMsg2 = " non sono stati compilati"; var vmMsg1 = " contiene dati non validi"; var vmMsg2 = " contengono dati non validi"; var oiMsg1 = " puo' contenere solo numeri"; var oiMsg2 = " possono contenere solo numeri"; mustBeList = ""; mustBeNameList = ""; validMailList = ""; validMailNameList = ""; onlyIntegerList = ""; onlyIntegerNameList = ""; validCFList = ""; validCFNameList = ""; validCFList = "txtCodFiscale,txtCf"; validCFNameList = "Codice Fiscale"; if (validCFList != "") { validCFArray = validCFList.split(","); validCFNameArray = validCFNameList.split(","); tempArray = new Array(); tempNameArray = new Array(); var e = 0; var n = 0; for (i = 0; i < nomeForm.length; i++) { if((nomeForm[i].name!="")&&(nomeForm[i].value!="")&&(validCFList.indexOf(nomeForm[i].name)!=-1)){ tempArray[e]=i; e= e+1; } } for (e = 0; e < tempArray.length; e++) { i=tempArray[e]; for (k = 0; k < validCFArray.length; k++) { if (validCFArray[k]==nomeForm[i].name) { j=k; } } var validate = true; if (nomeForm[i].value.length!=16) { validate = false; }else if (isNaN(nomeForm[i].value.substring(6,8))) { validate = false; }else{ var alfa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var numb = "0123456789"; var disp = "1,0,5,7,9,13,15,17,19,21,2,4,18,20,11,3,6,8,12,14,16,10,22,25,24,23"; var cc=0; for (c=0; c<(nomeForm[i].value.length-1); c++) { mod2 = (c%2); isAlfa = (isNaN(nomeForm[i].value.charAt(c))); cfChar= nomeForm[i].value.charAt(c).toUpperCase(); switch (mod2) { case 0: switch (isAlfa) { case true: cc+=parseInt(disp.split(",")[alfa.indexOf(cfChar)]); break; case false: cc+=parseInt(disp.split(",")[numb.indexOf(cfChar)]); break; }; break; case 1: switch (isAlfa) { case true: cc+=parseInt(alfa.indexOf(cfChar)); break; case false: cc+=parseInt(numb.indexOf(cfChar)); break; }; break; } } if (cc%26 != alfa.indexOf(nomeForm[i].value.charAt(15).toUpperCase())){ validate = false; } } if (validate==false){ tempNameArray[n] = validCFNameArray[j];n+=1; } } if (tempNameArray.length!=0){ if(tempNameArray.length==1) { alrtMsg += (msg1 + tempNameArray.join(", ") + vmMsg1); } else { alrtMsg += (msg2 + tempNameArray.join(", ") + vmMsg2); } } } if (alrtMsg!="ATTENZIONE!") { return false; } else { return true; } } var consonanti = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"; function CalcolaCognome(Cognome){ var code = ""; code = GetConsonanti(Cognome); if (code.length >= 3){ code = code.substring(0, 3); }else{ code += GetVocali(Cognome).substring(0, 3 - code.length); if (code.length < 3); for (i = code.length; i < 3; i++); code += "X"; } return code; } function CalcolaNome(Nome){ var code = ""; cons = GetConsonanti(Nome); if (cons.length > 3) code = cons.substring(0, 1) + cons.substring(2, 3) + cons.substring(3, 4); else if (cons.length == 3) code = cons; else{ code = cons + GetVocali(Nome).substring(0, 3 - cons.length); if (code.length < 3){ for (i = code.length; i < 3; i++) code += "X"; } } return code; } function GetConsonanti(Stringa){ var cns = ""; for (i = 0; i < Stringa.length; i++) if (consonanti.indexOf(Stringa.substring(i, i + 1)) != -1) cns += Stringa.substring(i, i + 1); return cns.toUpperCase(); } function GetVocali(Stringa){ var voc = ""; for (i = 0; i < Stringa.length; i++) if (consonanti.indexOf(Stringa.substring(i, i + 1)) == -1 && Stringa.substring(i, i + 1) != " ") voc += Stringa.substring(i, i + 1); return voc.toUpperCase(); } function CalcolaK(Stringa){ var somma = 0, k; var arrPari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var arrDispari = new Array( Array(0,1), Array(1,0), Array(2,5), Array(3,7), Array(4,9), Array(5,13), Array(6,15), Array(7,17), Array(8,19), Array(9,21), Array("A",1), Array("B",0), Array("C",5), Array("D",7), Array("E",9), Array("F",13), Array("G",15), Array("H",17), Array("I",19), Array("J",21), Array("K",2), Array("L",4), Array("M",18), Array("N",20), Array("O",11), Array("P",3), Array("Q",6), Array("R",8), Array("S",12), Array("T",14), Array("U",16), Array("V",10), Array("W",22), Array("X",25), Array("Y",24), Array("Z",23) ); for (i = 0; i < Stringa.length; i += 2) { for (j = 0; j < arrDispari.length; j++) { if (Stringa.substring(i, i + 1).toUpperCase() == arrDispari[j][0]) { somma += parseInt(arrDispari[j][1]); break; } } } for (i = 1; i < Stringa.length; i += 2) { if (isNaN(Stringa.substring(i, i + 1))) somma += parseInt(arrPari.indexOf(Stringa.substring(i, i + 1))); else somma += parseInt(Stringa.substring(i, i + 1)); } k = somma % 26; k = arrPari.charAt(k); return k; } /****************** funzioni controllo codice fiscale ******************/ function modalita_anteprima() { alert("Attezione !!\n\nIn modalità anteprima la navigazione dei menu è disattivata."); } function non_registrato() { alert("Attezione !!\n\nDevi inserire userID e password prima di poter accedere al sito."); } function Trim(orgString){ return LTrim(RTrim(orgString)); } function LTrim(orgString){ return orgString.replace(/^\s+/,''); } function RTrim(orgString){ return orgString.replace(/\s+$/,''); } // ritorna il valore del radio button selezionato // o null se non è checkato nessuno function radioVal(objRadio){ try{ if(isNaN(objRadio.length)){ if(objRadio.checked){ return objRadio.value; }else{ return null; } }else{ iOut = null; for (i = 0; i < objRadio.length; ++ i){ if (objRadio[i].checked){ iOut = objRadio[i].value; } } return iOut; } }catch(e){ return null; } } // ritorna il valore del checkbox // o null se non è checkato nessuno function checkVal(objCheck){ try{ if(isNaN(objCheck.length)){ if(objCheck.checked){ return objCheck.value; }else{ return null; } }else{ iOut = null; for (i = 0; i < objCheck.length; ++ i){ if (objCheck[i].checked){ if(iOut == null) iOut = objCheck[i].value; else iOut += ', ' + objCheck[i].value; } } return iOut; } }catch(e){ return null; } } function LoginPage(formL) { if(formL.txtUser.value == "") { alert("Inserire la UserId."); formL.txtUser.focus(); return false; }else if (!isAlfanumerico(formL.txtUser.value)) { alert("La UserId può assumere solamente valori alfanumerici."); formL.txtUser.focus() return false; }else if (formL.txtPassword.value == "") { alert("Inserire la password."); formL.txtPassword.focus() return false; }else if (!isAlfanumerico(formL.txtPassword.value)) { alert("La password può assumere solamente valori alfanumerici."); formL.txtPassword.focus() return false; } else { return true; } } // se la data1 è maggiore o = ritorna 1 // se la data2 è maggiore o = ritorna 2 // in caso di errore ritorna 0 function confrontaDate(sData1, sData2){ try { if(isDateTime(sData1) && isDateTime(sData2)){ sOra = sData1.substring(10, 16); if(sOra.substring(0,1) == ' ') sOra = sOra.substring(1, 6); sData = sData1.substring(0, 10); hh = sOra.split(".")[0]; pp = sOra.split(".")[1]; gg = sData.split("/")[0]; mm = sData.split("/")[1]; aaaa = sData.split("/")[2]; dData1 = new Date(aaaa, mm, gg, hh, pp); sOra = sData2.substring(10, 16); if(sOra.substring(0,1) == ' ') sOra = sOra.substring(1, 6); sData = sData2.substring(0, 10); hh = sOra.split(".")[0]; pp = sOra.split(".")[1]; gg = sData.split("/")[0]; mm = sData.split("/")[1]; aaaa = sData.split("/")[2]; dData2 = new Date(aaaa, mm, gg, hh, pp); if(dData1 >= dData2){ return 1; }else{ return 2; } } return 0; }catch( e ) { return 0; } } // Gestisce l'esplorazione di un sottomenu function esplodiSottomenu(menuID) { newAction = document.FRM_RELOAD.action; startChar = newAction.indexOf("menuEsp"); endChar = newAction.lastIndexOf("&"); if (startChar >= 0 && endChar >= 0) { // Caso di navigazione da un menu if (startChar > endChar) { // E' l'ultimo parametro passato in query string // Caso di navigazione da un sottomenu newAction = newAction.substring(0, startChar); newAction += "menuEsp=" + menuID; } else newAction = newAction.substring(0, startChar) + "menuEsp=" + menuID + newAction.substring(endChar, newAction.lenght); } else if (endChar > 0) // Caso di navigazione da un menu con parametri in qs newAction += "&menuEsp=" + menuID; else if (startChar > 0) // Caso di navigazione da un sottomenu esploso newAction = newAction.substring(0, startChar) + "menuEsp=" + menuID; else { if (newAction.substring(newAction.indexOf("?"), newAction.length) == "?" ) newAction += "menuEsp=" + menuID; else if (newAction.indexOf("?") > 0) newAction += "&menuEsp=" + menuID; else newAction += "?menuEsp=" + menuID; } document.FRM_RELOAD.action = newAction; document.FRM_RELOAD.submit(); } // Gestione calendario colonna di lancio function gotoMonth(newDate) { newAction = document.FRM_RELOAD.action; if (newAction.indexOf("?") > 0) { if (newAction.indexOf("dCalend") > 0) { startChar = newAction.indexOf("dCalend"); endChar = newAction.indexOf("&", startChar); if (endChar > 0) { newAction = newAction.substring(0, startChar) + "dCalend=" + newDate + newAction.substring(endChar, newAction.lenght); } else { newAction = newAction.substring(0, startChar) + "dCalend=" + newDate } } else { if (newAction.indexOf("&") > 0 || newAction.indexOf("?") < (newAction.length - 1)) { newAction += "&dCalend=" + newDate } else { newAction += "dCalend=" + newDate } } } else { newAction += "?dCalend=" + newDate } document.FRM_RELOAD.action = newAction; document.FRM_RELOAD.submit(); } function RedirectToRelaxBanking(abi,width, height){ if(width==null) width = 300; if (height==null) height = 400; window.resizeTo(width, height); window.moveTo((screen.availWidth-width)/2, (screen.availHeight-height)/2); document.location.href="https://www.isideonline.it/relaxbanking/sso.Login?codAbi=" + abi; }