
//funzione per l'higlight di un pusante costruito da img-butt-img
function evtButt(id_suff,evt) {
	
	var img_L=document.getElementById('next_L_'+id_suff);
	var butt=document.getElementById('butt_'+id_suff);
	var img_R=document.getElementById('next_R_'+id_suff);
	
	if(evt=="over") {
		img_L.className='NFButtonLeft NFh';
		butt.className='NFButton NFh';
		img_R.className='NFButtonRight NFh';
	}
	else {
		img_L.className='NFButtonLeft';
		butt.className='NFButton';
		img_R.className='NFButtonRight';
	}
	
}

//funzione per il resize "al volo" dell'ul per simulare le select (il +15 è per explorer...)
function resize_sel_option(id_option_list) {
														
	var el_ul=document.getElementById(id_option_list);
															
	if(!el_ul.style.minWidth)
		el_ul.style.minWidth=(el_ul.offsetWidth+15)+"px";
	
}

//funzione per il controllo numero, tipo e range
function checkQt(obj2,min,max,type,msg) {
					   
	if (!min)
		min="0";
	if (!max)
		max="";
	if (!type)
		type="int";
	if (!msg)
		msg="non e' un valore valido";		
	err_msg="";
	
	if(obj2.value=='') 
		return false;
	
	var point_counter=0;
		
						
	for(var i=0; i<obj2.value.length; i++) {
		
	
		if(obj2.value.charAt(i)=='.')
			point_counter++;
			
		if(
			(
				(type=="int") && (
					((obj2.value.charAt(i)<'0') || (obj2.value.charAt(i)>'9')) || 
					(obj2.value.charAt(i)=='.')  && 
					((obj2.value.charAt(i)!='-') || ((obj2.value.charAt(i)=='-')  && i>0 )) 
				)
			)
			 
			||
			
			(
				(type=="dec") && (
					(((obj2.value.charAt(i)<'0') || (obj2.value.charAt(i)>'9')) && (obj2.value.charAt(i)!='.')) && 
					(obj2.value.charAt(i)!=',')  && 
					((obj2.value.charAt(i)!='-') || ((obj2.value.charAt(i)=='-')  && i>0 )) 
				)
			)
											
			||
			
			(point_counter>1)
			
		  ) {
		 	  alert("Attenzione\n   '"+obj2.value+"':   "+msg);
			  obj2.value=obj2.value.substring(0,i);
			  obj2.focus();
		   	  return false;
			  break;
		}
	}
	
	if(min && (parseFloat(obj2.value)<min)) {
		err_msg=" &egrave; inferiore al valore minimo consentito ("+min+")\n"+msg;
	}
	if(max && (parseFloat(obj2.value)>max)) {
		err_msg=" &egrave; superiore al valore massimo consentito ("+max+")\n"+msg;
	}	
	
	if(err_msg) {
	    alert("Attenzione\n   '"+obj2.value+"':   "+err_msg);
		obj2.value=obj2.value.substring(0,i);
		obj2.focus();
	   	return false;
		
	}
	return true;
	}
