// Javascript TOOLS
// VERSIONE 0.4
// by ANDREA CASSA, 3-8 Febbraio 1999
// Compatibile con javascript 1.1


function radiovalue(nomeradio,numform) {
var valore=null;
numform+='';
if (numform=='undefined') {numform==0}
numform*=1;
f=self.document.forms[numform];
el=f.elements;
var num_bot=el[nomeradio].length;
for (i=0;i<num_bot;i++) {
if (el[nomeradio][i].checked=='1'){var valore=el[nomeradio][i].value;break;}}
return valore;
} 


function selectvalue(nomeselect,numform) {
numform+='';
if (numform=='undefined') {numform==0}
numform*=1;
f=self.document.forms[numform];
el=f.elements;
var indice=el[nomeselect].selectedIndex;
var valore=el[nomeselect].options[indice].value;
return valore;
} 

function selecttext(nomeselect,numform) {
numform+='';
if (numform=='undefined') {numform==0}
numform*=1;
f=self.document.forms[numform];
el=f.elements;
var indice=el[nomeselect].selectedIndex;
var valore=el[nomeselect].options[indice].text;
return valore;
} 

function check_range(val,min,max) {
hr=0;
val=parseFloat(val);
min=parseFloat(min);
max=parseFloat(max);
if (val<min || val>max) {hr=21;return hr}
return hr
} 

function radiopos(nomeradio) {

pos=null;
for (i=0;i<self.document.forms[0].elements.length;i++){
if (self.document.forms[0].elements[i].name==nomeradio){if ( self.document.forms[0].elements[i].checked=='1')  {pos=i;break;} }
} 
return pos;
} 

function show_values() {
var w = window.open("",                    
                       "RIASSUNTO",       
                       "resizable,status,scrollbars,menubar"); 

var d = w.document;    


d.write('<HTML><HEAD><TITLE></TITLE></HEAD><BODY bgcolor=white>')
var f=w.opener.document.forms[0];
el=f.elements;
eln=el.length;
d.write('<TABLE WIDTH="90%" border=1>');
for (i=0;i<eln;i++) {
nome=el[i].name;
tipo=el[i].type;
if (tipo=='select-one') {
j=el[i].selectedIndex;valore=el[i][j].value;
cella4='<TD height=3><FONT FACE=ARIAL SIZE=1>SELECTED INDEX= '+j+'</FONT><br></TD>'+"\n";} 
else {valore=el[i].value} 
if (tipo=='radio' || tipo=='checkbox') {
selez=el[i].checked;
cella4='<TD height=3><FONT FACE=ARIAL SIZE=1>CHECKED= '+selez+'</FONT><br></TD>'+"\n";} 
if (tipo!='select-one' && tipo!='radio' && tipo!='checkbox') {
cella4='<TD height=3><font face=arial size=1 color=white>na<br></font></TD>'} 
cella0='<TD height=3><FONT FACE=ARIAL SIZE=1>n. '+i+'</FONT><br></TD>'+"\n";
cella1='<TD height=3><FONT FACE=ARIAL SIZE=1>NOME= '+nome+'</FONT><br></TD>'+"\n";
cella2='<TD height=3><FONT FACE=ARIAL SIZE=1>VALORE= '+valore+'</FONT><br></TD>'+"\n";
cella3='<TD height=3><FONT FACE=ARIAL SIZE=1>TYPE= '+tipo+'</FONT><br></TD>'+"\n";
riga='<TR>'+cella0+cella1+cella2+cella3+cella4+'</TR>'+"\n";
d.write(''+riga);
} 
d.write('</TABLE>'+"\n");
d.write('<form><CENTER><INPUT TYPE=BUTTON VALUE="CHIUDI" onclick="self.close();"></CENTER></form>'+"\n");
d.write('</BODY></HTML>');
d.close();
} 

function open_popup_message(nome,messaggio) {
w = window.open("",                    
                       nome,        
                       'width=480,height=70'); 

var d = w.document;    

d.write('<HTML><HEAD><TITLE></TITLE></HEAD><BODY bgcolor=white>');
d.write('<CENTER><FONT FACE=Arial SIZE=5><BLINK>'+messaggio+'</BLINK></FONT></CENTER>')
d.write('</BODY></HTML>');
d.close();
} 

