// arar.js

function buildAnimalSelectBox(animalArray) {
var animal, animalValue, animalDescription;
var selectBox=document.displayForm.animalIdSelected;
var supported=(document.getElementById || document.all || document.layers);
  if (!supported) { alert("Galleries onLine is not supported by your Internet Browser!"); }
  for (animal=0; animal<animalArray.length; animal++) {
    animalValue=animalArray[animal].substring(0,11);
    animalDescription=animalArray[animal].substring(12);
    selectBox.options[animal]=new Option(animalDescription,animalValue);
  }
  selectBox.options[0].selected='selected';
  selectBox.options.length=animalArray.length;
}

function getAnimalSelected(animal) {
var animalArray=[];
var supported=(document.getElementById || document.all || document.layers);
  if (!supported) { alert("ATVIIR: Animal Risk Assessment and Regulation (ARAR) is not supported by your Internet Browser!"); }
  xmlHTTP.open("GET", "/atarar/getAllSubAnimals.php?animalIdSelected="+animal);
  xmlHTTP.onreadystatechange=function() {
    if (xmlHTTP.readyState===4 && xmlHTTP.status===200) {
      animalArray=xmlHTTP.responseText.split("|");
      buildAnimalSelectBox(animalArray);
    }
  };
  xmlHTTP.send(null);
}

function getElementWithId(name) {
  if (document.getElementById) return(document.getElementById(name));
  if (document.all) return(document.all[name]);
}

function setIframeHeight() { if (getWindowHeight()<715) getElementWithId('iframe').style.height='500px'; else getElementWithId('iframe').style.height=((getWindowHeight()-215)+'px'); }

