var MODULE; var idPost; //---Segue l'id nei menu sdopppiati.... idPost = "__2"; idDiv = "__TXT"; //---Chiede il logout function Logout(force) { if (!force) { if (window.confirm("Do you really want logout from console?")) // document.location = "default.asp"; window.close(); } else { // document.location = "default.asp"; window.close(); } } //---Visualizza un errore function ShowError(Form,Nome,strErrore) { window.alert("Error:\n" + strErrore); try { if (Form != "") { if (Nome != "") { document.forms[Form].elements[Nome].focus(); } } } catch(e) { } return false } //---Verifica se una select contiene almeno x selezioni function CheckSelect(Form, Nome, Min, ForceDifferent, strErrore) { var i,Tot; Tot=0; for(i=0;i 0) return true; return ShowError(Form,Nome,strErrore); } //---Verifica se un campo radio e' stato selezionato function CheckRadio(Form, Nome, ForceDifferent, strErrore) { var sw; var i; var x; var Lunghezza; x = document.forms[Form].elements[Nome]; Lunghezza = x.length; sw = false; for (i=0;i < Lunghezza; i++) { if (x[i].value != ForceDifferent) if (x[i].checked) sw = true; } if (sw) return true; window.alert("Error:\n" + strErrore); return false; } //---Verifica se un CheckBox e' flaggato function CheckCheckBox(Form, Nome, NeededWhat, strErrore) { if (NeededWhat) { if (document.forms[Form].elements[Nome].checked) return true; } else { if (!document.forms[Form].elements[Nome].checked) return true; } return ShowError(Form,Nome,strErrore); } //---Verifica se un campo di testo non e' vuoto function CheckString(Form, Nome, strErrore) { if (document.forms[Form].elements[Nome].value != '') return true; return ShowError(Form,Nome,strErrore); } //---Verifica se un campo di testo non e' vuoto function CheckMaxLengthString(Form, Nome, maxlength, strErrore) { if (document.forms[Form].elements[Nome].value.length < maxlength) return true; return ShowError(Form,Nome,strErrore); } //---Verifica se un campo di testo continene un numero function CheckNumber(Form, Nome, strErrore, Needed, LimitedMin, Min,LimitedMax, Max) { var n; var err; if (document.forms[Form].elements[Nome].value != '') { n = parseInt(document.forms[Form].elements[Nome].value); if (!isNaN(n)) { err = false; if (LimitedMin) if (n < Min) err = true; if (LimitedMax) if (n > Max) err = true; if (!err) return true; else return ShowError(Form,Nome,strErrore); } else { return ShowError(Form,Nome,strErrore); } } if (!Needed) return true; else return ShowError(Form,Nome,strErrore); } //---Verifica se un campo di testo contiene un indirizzo di email valido function CheckEMail(Form,Nome, strErrore) { var p,p2; var NewP; var OldP; p=document.forms[Form].elements[Nome].value.indexOf(' '); if (p>0) return ShowError(Form,Nome,strErrore); p=document.forms[Form].elements[Nome].value.indexOf('@'); if (p<1) return ShowError(Form,Nome,strErrore); p2=document.forms[Form].elements[Nome].value.indexOf('@',p+1); if (p2>0) return ShowError(Form,Nome,strErrore); if (p>(document.forms[Form].elements[Nome].value.length-5)) return ShowError(Form,Nome,strErrore); OldP = -1; NewP =document.forms[Form].elements[Nome].value.indexOf('.',p+1); if (NewP == (p+1)) return ShowError(Form,Nome,strErrore); while (NewP > 0) { OldP = NewP; NewP = document.forms[Form].elements[Nome].value.indexOf('.',NewP+1); } if (OldP < 0) return ShowError(Form,Nome,strErrore); if (OldP < (document.forms[Form].elements[Nome].value.length-4)) return ShowError(Form,Nome,strErrore); if (OldP > (document.forms[Form].elements[Nome].value.length-3)) return ShowError(Form,Nome,strErrore); return true; } //---Riposiziona il menu laterale destro function RiposizionaMenuRight() { var h; h = document.body.clientHeight - menu.offsetHeight - 10 - 20; if (h > 0) document.all['MenuRight'].style.height = h; document.all['MenuRight'].style.top = 3 + document.all['outerDiv'].scrollTop; } //---Apre una pagina di un modulo function OpenPage(pagina) { document.location ="Modules/" + MODULE + "/" + pagina; }; //---Abilita un menu principale function EnableMenu(id) { if (document.all[id]) document.all[id].className = document.all[id].title; if (document.all[id + idPost]) document.all[id + idPost].className = document.all[id + idPost].title; } //---Disabilita un menu function DisableMenu(id) { if (document.all[id]) document.all[id].className = "menudisabled"; if (document.all[id + idPost]) document.all[id + idPost].className = "menudisabled"; } //---Setta il testo di un menu function SetMenu(id,Text) { if (document.all[id]) if (document.all[id].className != "root2") { if (document.all[id + idDiv]) document.all[id + idDiv].innerHTML = Text; if (document.all[id + idDiv+ idPost]) document.all[id + idDiv + idPost].innerHTML = Text; } else { if (document.all[id]) document.all[id].innerHTML = Text; if (document.all[id + idPost]) document.all[id + idPost].innerHTML = Text; } } //---Cambia il colore di una riga ON function SwapMenuOn(el,i) { if (i==0) el.style.background = "#FFEFEF"; else el.style.background = "#F8DEDE"; } //---Cambia il colore di una riga OFF function SwapMenuOff(el,i) { if (i==0) el.style.background = "#FEFEFE"; else el.style.background = "#E8E8E8"; } //---Svuota un campo di testo function ClearText(Form,Nome) { document.forms[Form].elements[Nome].value = ""; } //---Svuota una CheckBox function ClearCheckBox(Form,Nome) { document.forms[Form].elements[Nome].checked = false; } //---Svuota una RadioButton function ClearRadio(Form,Nome) { var i; for (i=0;i < document.forms[Form].elements[Nome].length; i++) document.forms[Form].elements[Nome][i].checked = false; } //---Svuota una RadioButton function ClearSelect(Form,Nome) { var i; if (document.forms[Form].elements[Nome].type == "select-multiple") { for (i=0;i < document.forms[Form].elements[Nome].options.length; i++) document.forms[Form].elements[Nome].options[i].selected = false; } else { document.forms[Form].elements[Nome].selectedIndex = 0; } } //---Svuota un form function ClearForm(Form) { var i; for (i=0;i 0) document.forms[Form].elements[Nome + "_To2"].disabled = false; else document.forms[Form].elements[Nome + "_To2"].disabled = true; if (n==0) document.forms[Form].elements[Nome + "_1_Nessuno"].disabled = true; else document.forms[Form].elements[Nome + "_1_Nessuno"].disabled = false; if (n==document.forms[Form].elements[Nome + "_1"].options.length) document.forms[Form].elements[Nome + "_1_Tutti"].disabled = true; else document.forms[Form].elements[Nome + "_1_Tutti"].disabled = false; } function DoubleSelect_Change2(Form,Nome) { var n; n = SelectTot(Form,Nome + "_2"); if (n > 0) document.forms[Form].elements[Nome + "_To1"].disabled = false; else document.forms[Form].elements[Nome + "_To1"].disabled = true; if (n==0) document.forms[Form].elements[Nome + "_2_Nessuno"].disabled = true; else document.forms[Form].elements[Nome + "_2_Nessuno"].disabled = false; if (n==document.forms[Form].elements[Nome + "_2"].options.length) document.forms[Form].elements[Nome + "_2_Tutti"].disabled = true; else document.forms[Form].elements[Nome + "_2_Tutti"].disabled = false; } //---Verifica se un certo valore e' in una form function CheckInSelect(Form,Nome,Valore) { var i; for (i=0;i