function WebText(comp,emptyToNull)
{
  this.comp=comp;
  this.emptyToNull = emptyToNull;
  this.setValue = WebTextSetValue;
  this.getValue = WebTextGetValue;
}

function WebTextSetValue(value)
{
  //var comp = eval('window.document.mainForm.'+this.comp);
  var comp = window.document.getElementById(this.comp);
  if(!comp)
  	alert(this.comp);
//  var comp = window.document.getElementById(this.comp);
  //alert('metto '+value+' in '+JSON.stringify(this.comp));
	// se mi arriva un null metto sempre la stringa vuota
  if( (value==null) /*&& (this.emptyToNull)*/ )
		value = '';
  
  comp.value = value;
}

function WebTextGetValue()
{
  //var comp = eval('window.document.mainForm.'+this.comp);
  var comp = window.document.getElementById(this.comp);
  var value = comp.value;
  if( (value=='') && (this.emptyToNull) )
		value = null;
  return value;
}


