function hideElement(id)
{
  if (element = $(id))
  {
    element.select('input', 'select', 'textarea').each(function(formElement) {
        formElement.disable();
    });
    element.hide();
  }
}

function showElement(id)
{
  if (element = $(id))
  {
    element.select('input', 'select', 'textarea').each(function(formElement) {
        formElement.enable();
    });
    element.show();
  }
}

function oc(a)
{
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]] = '';
  }
  return o;
}

function initSelect(elementId, values, selectedValue)
{
  var element = $('order_' + elementId);
  element.options.length = 0;
  values.each(function(value) {
    var index = element.options.length;
    element.options[element.options.length] = new Option(value, value);
    if (value == selectedValue)
    {
      element.selectedIndex = index;
    }
  });
  showElement(elementId + '_row');
}

