var openpulldown = false;

function showPulldown(what) {
  if($(what).style.display == 'block') {
    $(what).style.display = 'none';
    openpulldown = false;
  }
  else {
    $(what).style.display = 'block';
    openpulldown = true;
  }
}

function clearPulldown(what) {
  openpulldown = false;
  setTimeout(function() { hidePulldown(what); }, 1000);
}

function hidePulldown(what) {
  if(openpulldown == false) {
    $(what).style.display = 'none';
  }
}

function hoverPulldown(what) {
  openpulldown = true;
}

function smartPulldown(what, field, value, submit) {
  $(field).value = value;
  if(submit == true) {
    $(what).submit();
  }
}
