function addMeal(){
  var temp = document.getElementById('meals')
  temp.innerHTML = temp.innerHTML + '<br /><div class="mealdiv"><strong>Name:</strong>&nbsp;<input type="text" name="meal[]" value="" size="30"> &nbsp;&nbsp;&nbsp;<strong>Price:</strong>&nbsp;$<input type="text" name="mealprice[]" size="10" value="0.00">&nbsp;<a href=\"#\" class=\"tooltip\"><img src=\"/images/search.gif\" style=\"vertical-align:top;\" alt=\"tooltip icon\"><b><em class=\"inner\"></em>Enter the name of the meal (e.g. Thursday Lunch or Friday Breakfast) and the price of this meal.</b></a><br /></div>';
}

function addReg(){
  var temp = document.getElementById('reg_types')
  temp.innerHTML = temp.innerHTML + '<br /><div class="regdiv"><strong>Name:</strong>&nbsp;<input type="text" name="reg[]" value="" size="30"> &nbsp;&nbsp;&nbsp;<strong>Price:</strong>&nbsp;$<input type="text" name="regprice[]" size="10" value="0.00">&nbsp;<a href=\"#\" class=\"tooltip\"><img src=\"/images/search.gif\" style=\"vertical-align:top;\" alt=\"tooltip icon\"><b><em class=\"inner\"></em>Enter the name of the registration type (e.g. Current MASFAA Member or Sponsor) and the price of the registration for this type.</b></a><br /></div>';
}

function isSet(field){
  return(typeof(field) != 'undefined');
}

function AddField(field_type){

  // It would be much simpler to use the getElementsByName
  // but IE doesn't seem to like that. So we have to use this
  // horrible hack to get IE to grab all divs with a similar
  // id/name

  var trs = new Array();
  var x = document.getElementsByTagName('div');
  for(var i=0; i<x.length; i++){
    if(x[i].id.substring(0, field_type.length) == field_type){
      trs.push(x[i]);
    }
  }

  for(var w=0;w<trs.length;w++){
    if(trs[w].style.display == "none"){
      trs[w].style.display="block";
      var control = document.getElementById(trs[w].id);

      try{
	    control.focus();
      }
      catch(e){
      }
      break;
    }
  }
}


function RemoveField(fieldId){
  var d1=document.getElementById(fieldId).parentNode;
  var d2=document.getElementById(fieldId);
  d1.removeChild(d2);
}
