function WebSelect(comp)
{
  this.comp=comp;
  this.setValue = WebSelectSetValue;
  this.getValue = WebSelectGetValue;
  this.setContent = WebSelectSetContent;
}

function WebSelectSetValue(value)
{
  //alert(value);
  //var comp = document.getElementById(this.comp);
  if(value==null)
  		value = S_NULL;
  //var comp = eval('window.document.mainForm.'+this.comp);
  var comp = window.document.getElementById(this.comp);

  var l = comp.options.length;
  for(i=0;i<l;i++)
  {
  	//alert(comp.options[i].value+"=="+value);
    if(comp.options[i].value==value)
    {
      //alert(i);
      comp.selectedIndex=i;
      //alert("setted");
      return;
    }
  }
}

function WebSelectGetValue()
{
  var comp = window.document.getElementById(this.comp);
  
  if (comp.options.length>0)
  		var value = comp.options[comp.selectedIndex].value;
  else
  		var value = S_NULL;
  if(value == S_NULL)
		value = null;
		
  return value;
}

function WebSelectSetContent(value)
{
	//var comp1 = eval('window.document.mainForm.'+this.comp);
	var comp1 = window.document.getElementById(this.comp);
	/*
	if(!comp1.options)
	{
		alert(this.comp);
		var x ='';
		for(i in comp1)
			x += ';'+i;
		alert(x);
	}*/
	comp1.options.length = 0;
	var l = value.length;
	for(i=0;i<l;i++)
	{
		if(value[i].id==null)
			var id = S_NULL;
		else
			var id = value[i].id
		comp1.options[i] = new Option(value[i].text,id);
	}		
}


