function getDescription() {
   var abbreviation = document.abbr.abbreviation.value;
   var word;
   var definition;
   var source;
   var notes;

   switch (abbreviation) {
   case "Ad": word = "Ad OR Aurio dextra"; definition = "To, up to OR Right ear"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = "Listed abbreviation for 'Right ear' is a.d."; break;
   case "ad": word = "Ad OR Aurio dextra"; definition = "To, up to OR Right ear"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break;
   case "AD": word = "Ad OR Aurio dextra"; definition = "To, up to OR Right ear"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = "Other definitions possible (Alzheimer's Disease, etc.)"; break;
   case "Ad lib": word = "Ad libitum"; definition = "At pleasure, freely"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "ad lib": word = "Ad libitum"; definition = "At pleasure, freely"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AD LIB": word = "Ad libitum"; definition = "At pleasure, freely"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "Agit": word = "Agita"; definition = "Shake, stir"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "agit": word = "Agita"; definition = "Shake, stir"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AGIT": word = "Agita"; definition = "Shake, stir"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "amp": word = "Ampul"; definition = "Ampul of medication"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break;
   case "AMP": word = "Ampul"; definition = "Ampul of medication"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break;
   case "ac": word = "Ante cibos"; definition = "Before meals"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AC": word = "Ante cibos"; definition = "Before meals"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "am": word = "Ante meridien"; definition = "Before noon, morning"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AM": word = "Ante meridien"; definition = "Before noon, morning"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "aq": word = "Aqua"; definition = "Water"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AQ": word = "Aqua"; definition = "Water"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "atc": word = "Around-the-clock"; definition = "A dosing schedule"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break;
   case "ATC": word = "Around-the-clock"; definition = "A dosing schedule"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break;
   case "au": word = "Auris utrae"; definition = "Each ear"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AU": word = "Auris utrae"; definition = "Each ear"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "al": word = "Aurio laeva"; definition = "Left ear"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AL": word = "Aurio laeva"; definition = "Left ear"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "as": word = "Aurio sinister"; definition = "Left ear"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "AS": word = "Aurio sinister"; definition = "Left ear"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "bid": word = "Bis in die"; definition = "Twice a day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "BID": word = "Bis in die"; definition = "Twice a day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "bm": word = "Bowel movement"; definition = "Bowel movement"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "BM": word = "Bowel movement"; definition = "Bowel movement"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "bp": word = "Blood pressure"; definition = "Blood pressure"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "BP": word = "Blood pressure"; definition = "Blood pressure"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "bs": word = "Blood sugar"; definition = "Blood sugar"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = "numerous other definitions listed"; break;
   case "BS": word = "Blood sugar"; definition = "Blood sugar"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = "numerous other definitions listed"; break;
   case "bsa": word = "Body surface area"; definition = "Used in dosage calculation"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "BSA": word = "Body surface area"; definition = "Used in dosage calculation"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "caps": word = "Capsula"; definition = "Capsule"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "CAPS": word = "Capsula"; definition = "Capsule"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "Chart": word = "Charta"; definition = "Paper"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break;
   case "chart": word = "Charta"; definition = "Paper"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break;
   case "CHART": word = "Charta"; definition = "Paper"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = "Definition listed is 'Continous Hormones as Replacement Therapy'"; break;
   case "collun": word = "Collunarium"; definition = "A nose wash"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break;
   case "COLLUN": word = "Collunarium"; definition = "A nose wash"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break;
   case "collyr": word = "Collyrium"; definition = "An nose wash"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break;
   case "COLLYR": word = "Collyrium"; definition = "An nose wash"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break;
   case "chf": word = "Congestive heart failure"; definition = "Congestive heart failure"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "CHF": word = "Congestive heart failure"; definition = "Congestive heart failure"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "cc": word = "Cubic centimeter"; definition = "Volume approximately equal to 1 mL"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "CC": word = "Cubic centimeter"; definition = "Volume approximately equal to 1 mL"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = "Definition could also be Chief Complaint (among others)"; break;
   case "c": word = "Cum"; definition = "With"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = "Should be a 'c' with a line over it"; break;
   case "C": word = "Cum"; definition = "With"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = "Other definitions possible (i.e. Centrigrade)"; break;
   case "dtd": word = "Dentur tales doses"; definition = "Let such doses be given"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "DTD": word = "Dentur tales doses"; definition = "Let such doses be given"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "dieb": word = "Diebus alternis"; definition = "Every other day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
  case "dieb alt": word = "Diebus alternis"; definition = "Every other day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "DIEB ALT": word = "Diebus alternis"; definition = "Every other day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "dil": word = "Dilutus"; definition = "Dilute, diluted"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "DIL": word = "Dilutus"; definition = "Dilute, diluted"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break;
   case "disc": word = "Discontinue"; definition = "Order to stop medication or treatment"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break;
   case "DISC": word = "Discontinue"; definition = "Order to stop medication or treatment"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break;
   case "dc": word = "Discontinue"; definition = "Order to stop medication or treatment"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break;
   case "DC": word = "Discontinue"; definition = "Order to stop medication or treatment"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "disp": word = "Dispense"; definition = "Dispense"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "DISP": word = "Dispense"; definition = "Dispense"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "div": word = "Divided"; definition = "Divided"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "DIV": word = "Divided"; definition = "Divided"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "elix": word = "Elixir"; definition = "A type of liquid dosage form"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ELIX": word = "Elixir"; definition = "A type of liquid dosage form"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "emuls": word = "Emulsion"; definition = "Emulsion"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break;
   case "EMULS": word = "Emulsion"; definition = "Emulsion"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break;
   case "...": word = "Et"; definition = "no data (in given category)"; source = "Stedman's Abbreviation, Acronyms & Symbols"; notes = " "; break;
   case "f": word = "Fac, fiat, fiant"; definition = "Make, let it be made, let them be made"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "F": word = "Fac, fiat, fiant"; definition = "Make, let it be made, let them be made"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = "numerous other definitions possible (Fahrenheit, Flouride, etc)"; break; 
   case "Ft": word = "Fac, fiat, fiant"; definition = "Make, let it be made, let them be made"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ft": word = "Fac, fiat, fiant"; definition = "Make, let it be made, let them be made"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "FT": word = "Fac, fiat, fiant"; definition = "Make, let it be made, let them be made"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "gi": word = "Gastrointestinal"; definition = "Gastrointestinal"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "GI": word = "Gastrointestinal"; definition = "Gastrointestinal"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "gu": word = "Genitourinary"; definition = "Genitourinary"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "GU": word = "Genitourinary"; definition = "Genitourinary"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "g": word = "Gram"; definition = "Metric unit of weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "G": word = "Gram"; definition = "Metric unit of weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "Gm": word = "Gram"; definition = "Metric unit of weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "gm": word = "Gram"; definition = "Metric unit of weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "GM": word = "Gram"; definition = "Metric unit of weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "gr": word = "Granum"; definition = "Grain (unit of weight)"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "GR": word = "Granum"; definition = "Grain (unit of weight)"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "gtt": word = "Gutta"; definition = "A drop"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "GTT": word = "Gutta"; definition = "A drop"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "hbp": word = "High blood pressure"; definition = "High blood pressure"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "HBP": word = "High blood pressure"; definition = "High blood pressure"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "h": word = "Hora"; definition = "An hour"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "H": word = "Hora"; definition = "An hour"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "hs": word = "Hora somni"; definition = "At bedtime"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "HS": word = "Hora somni"; definition = "At bedtime"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ht": word = "Hypertension"; definition = "Hypertension"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = "numerous other definitions listed, but the common abbreviation for hypertension is 'HTN'"; break; 
   case "HT": word = "Hypertension"; definition = "Hypertension"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = "numerous other definitions listed, but the common abbreviation for hypertension is 'HTN'"; break; 
   case "inj": word = "Injection"; definition = "Injection"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "INJ": word = "Injection"; definition = "Injection"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "iv": word = "Intravenous OR Quattour"; definition = "Intravenous injection OR Four"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "IV": word = "Intravenous OR Quattour"; definition = "Intravenous injection OR Four"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "im": word = "Intramuscular"; definition = "Intramuscular injection"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "IM": word = "Intramuscular"; definition = "Intramuscular injection"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "id": word = "Intradermal"; definition = "Intradermal injection"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ID": word = "Intradermal"; definition = "Intradermal injection"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "lin": word = "Linimentum"; definition = "Liniment"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "LIN": word = "Linimentum"; definition = "Liniment"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "liq": word = "Liquor"; definition = "Solution"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "LIQ": word = "Liquor"; definition = "Solution"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "mcg": word = "Microgram"; definition = "One-millionth of 1 gram"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "MCG": word = "Microgram"; definition = "One-millionth of 1 gram"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "mEq": word = "Milliequivalent"; definition = "One-thousandth gram equivalent weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "meq": word = "Milliequivalent"; definition = "One-thousandth gram equivalent weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "MEQ": word = "Milliequivalent"; definition = "One-thousandth gram equivalent weight"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "mg": word = "Milligram"; definition = "One-thousandth of 1 gram"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "MG": word = "Milligram"; definition = "One-thousandth of 1 gram"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "mg/kg": word = "Mg per kilogram"; definition = "Mg of drug per kg of body weight"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "MG/KG": word = "Mg per kilogram"; definition = "Mg of drug per kg of body weight"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   /*case "mg/m2": word = "Mg per square meter"; definition = "Mg of drug per square meter of body surface area"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "MG/M2": word = "Mg per square meter"; definition = "Mg of drug per square meter of body surface area"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; */
   case "mL": word = "Milliliter"; definition = "One-thousandth of 1 liter"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ml": word = "Milliliter"; definition = "One-thousandth of 1 liter"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ML": word = "Milliliter"; definition = "One-thousandth of 1 liter"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "mOsmol": word = "Milliosmole"; definition = "One-thousandth of an osmole"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "mosmol": word = "Milliosmole"; definition = "One-thousandth of an osmole"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "MOSMOL": word = "Milliosmole"; definition = "One-thousandth of an osmole"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "m": word = "Misce"; definition = "Mix"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = "Other definition listed (SI unit 'meter')"; break; 
   case "M": word = "Misce"; definition = "Mix"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "n&v": word = "Nausea and vomiting"; definition = "Nausea and vomiting"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "N&V": word = "Nausea and vomiting"; definition = "Nausea and vomiting"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "nebula": word = "Nebula"; definition = "A spray"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break; 
   case "NEBULA": word = "Nebula"; definition = "A spray"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break; 
   case "non rep": word = "Non repetatur"; definition = "Do not repeat"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "NON REP": word = "Non repetatur"; definition = "Do not repeat"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "noct": word = "Nocte"; definition = "At night"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break; 
   case "NOCT": word = "Nocte"; definition = "At night"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break; 
   case "no": word = "Numerus"; definition = "Number"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "NO": word = "Numerus"; definition = "Number"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "#": word = "Numerus"; definition = "Number"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "ou": word = "Oculo utro"; definition = "Each eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "OU": word = "Oculo utro"; definition = "Each eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "od": word = "Oculus dexter"; definition = "Right eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "OD": word = "Oculus dexter"; definition = "Right eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ol": word = "Oculus laevus"; definition = "Left eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "OL": word = "Oculus laevus"; definition = "Left eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "os": word = "Oculus sinister"; definition = "Left Eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "OS": word = "Oculus sinister"; definition = "Left Eye"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "po": word = "Per os"; definition = "By mouth"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "PO": word = "Per os"; definition = "By mouth"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "pc": word = "Post cibos"; definition = "After eating"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "PC": word = "Post cibos"; definition = "After eating"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "pm": word = "Post meridiem"; definition = "Afternoon, evening"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "PM": word = "Post meridiem"; definition = "Afternoon, evening"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "prn": word = "Pro re nata"; definition = "When necessary"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "PRN": word = "Pro re nata"; definition = "When necessary"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "pulv": word = "Pulvis"; definition = "A powder"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "PULV": word = "Pulvis"; definition = "A powder"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "qs": word = "Quantum sufficiat"; definition = "As much as is sufficient"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "QS": word = "Quantum sufficiat"; definition = "As much as is sufficient"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "qs ad": word = "Quantum sufficiat ad"; definition = "A sufficient quantity to (prepare)"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "QS AD": word = "Quantum sufficiat ad"; definition = "A sufficient quantity to (prepare)"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "q": word = "Quaque"; definition = "Each, every"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "Q": word = "Quaque"; definition = "Each, every"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "qd": word = "Quaque die"; definition = "Every day"; break
   case "QD": word = "Quaque die"; definition = "Every day"; break
   case "qh": word = "Quaque hora"; definition = "Every hour"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "QH": word = "Quaque hora"; definition = "Every hour"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "qid": word = "Quater in die"; definition = "Four times a day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "QID": word = "Quater in die"; definition = "Four times a day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "Rect": word = "Rectal"; definition = "Use rectally"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "rect": word = "Rectal"; definition = "Use rectally"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "RECT": word = "Rectal"; definition = "Use rectally"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "rept": word = "Repetatur"; definition = "Let it be repeated"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break; 
   case "REPT": word = "Repetatur"; definition = "Let it be repeated"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = " "; break; 
   case "sa": word = "Secundum artem"; definition = "Accordingly to art"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "SA": word = "Secundum artem"; definition = "Accordingly to art"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ss": word = "Semis"; definition = "One half"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "SS": word = "Semis"; definition = "One half"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "sig": word = "Signa"; definition = "(You) wrote"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "SIG": word = "Signa"; definition = "(You) wrote"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "s": word = "Sine"; definition = "Without"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "S": word = "Sine"; definition = "Without"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "sos": word = "Si opus sit"; definition = "If necessary"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "SOS": word = "Si opus sit"; definition = "If necessary"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "sol": word = "Solution"; definition = "Solution"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "SOL": word = "Solution"; definition = "Solution"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "sat sol": word = "Solutio saturata"; definition = "Saturated solution"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "SAT SOL": word = "Solutio saturata"; definition = "Saturated solution"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "sq m": word = "Square meter"; definition = "Square meter - used in calculating dose"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = "abbreviation for square meter is listed as m2 (with the '2' superscripted)"; break; 
   case "SQ M": word = "Square meter"; definition = "Square meter - used in calculating dose"; source = "Logan's Medical and Scientific Abbreviations - Logan & Rice"; notes = "abbreviation could/should be 'sq. m' (notice the period)"; break; 
   case "m2": word = "Square meter"; definition = "Square meter - used in calculating dose"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "M2": word = "Square meter"; definition = "Square meter - used in calculating dose"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "stat": word = "Statim"; definition = "Immediately"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "STAT": word = "Statim"; definition = "Immediately"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "Sub Q": word = "Subcutaneous"; definition = "Subcutaneous injection"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "sub q": word = "Subcutaneous"; definition = "Subcutaneous injection"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "SUB Q": word = "Subcutaneous"; definition = "Subcutaneous injection"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "sq": word = "Subcutaneous"; definition = "Subcutaneous injection"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = "listed definition is also 'square'"; break; 
   case "SQ": word = "Subcutaneous"; definition = "Subcutaneous injection"; source = " "; notes = "The abbreviation for subcutaneous as SQ is not approved by JCAHO"; break; 
   case "supp": word = "Suppositorium"; definition = "Suppository"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "SUPP": word = "Suppositorium"; definition = "Suppository"; source = "Lexi-Drugs Online- Abbreviations, Acronyms, and Symbols"; notes = " "; break; 
   case "Susp": word = "Suspension"; definition = "Suspension"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "susp": word = "Suspension"; definition = "Suspension"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "SUSP": word = "Suspension"; definition = "Suspension"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "syr": word = "Syrupus"; definition = "Syrup"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "SYR": word = "Syrupus"; definition = "Syrup"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "tab": word = "Tabella"; definition = "Tablet"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "TAB": word = "Tabella"; definition = "Tablet"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "tid": word = "Ter in die"; definition = "Three times a day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "TID": word = "Ter in die"; definition = "Three times a day"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "tbsp": word = "Tablespoon"; definition = "Tablespoon"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "TBSP": word = "Tablespoon"; definition = "Tablespoon"; source = "Dictionary of Medical Acronyms & Abbreviations- Jablonski - 5th Ed"; notes = " "; break; 
   case "tsp": word = "Teaspoon"; definition = "Teaspoon"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "TSP": word = "Teaspoon"; definition = "Teaspoon"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "top": word = "Topically"; definition = "(Use) Topically"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "TOP": word = "Topically"; definition = "(Use) Topically"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ung": word = "Unguentum"; definition = "Ointment"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "UNG": word = "Unguentum"; definition = "Ointment"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "ut dict": word = "Ut dictum"; definition = "As directed"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "UT DICT": word = "Ut dictum"; definition = "As directed"; source = "Drug Facts and Comparisons - Standard Medical Abbreviations"; notes = " "; break; 
   case "i": word = "Unus"; definition = "One"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break; 
   case "I": word = "Unus"; definition = "One"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "ii": word = "Duo"; definition = "Two"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "II": word = "Duo"; definition = "Two"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "iii": word = "Tres"; definition = "Three"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "III": word = "Tres"; definition = "Three"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "v": word = "Quinque"; definition = "Five"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "V": word = "Quinque"; definition = "Five"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "vi": word = "Sex"; definition = "Six"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "VI": word = "Sex"; definition = "Six"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "vii": word = "Septem"; definition = "Seven"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "VII": word = "Septem"; definition = "Seven"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "viii": word = "Octo"; definition = "Eight"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "VIII": word = "Octo"; definition = "Eight"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "ix": word = "Novem"; definition = "Nine"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "IX": word = "Novem"; definition = "Nine"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "x": word = "Decem"; definition = "Ten"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "X": word = "Decem"; definition = "Ten"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "XV": word = "Quindecim"; definition = "Fifteen"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "XX": word = "Viginti"; definition = "Twenty"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "XXX": word = "Triginta"; definition = "Thirty"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "L": word = "Quinquaginta"; definition = "Liters"; source = "AMA- Manual of Style (9th Ed.)"; notes = "Definition could also be '50'; should be interpreted as such in the context of roman numerals"; break;
   case "C": word = "Centum"; definition = "One hundred"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "D": word = "Quingenti"; definition = "Five hundred"; source = "AMA- Manual of Style (9th Ed.)"; notes = " "; break;
   case "M": word = "Mille"; definition = "One thousand"; break;
   default: word = "Not found."; definition = "Please try again."; source = "Not found."; notes = "Not found.";
   }

   document.abbr.word.value = word;
   document.abbr.definition.value = definition;
   document.abbr.source.value = source;
   document.abbr.notes.value = notes;
}

function calcDose() {
   var requiredDose = document.calculate.dose.value;
   var stockVolume = document.calculate.stock_vol.value;
   var stockDose = document.calculate.stock_dose.value;
   var unit1 = document.calculate.dose_unit.options.selectedIndex;
   var unit2 = document.calculate.stock_dose_unit.options.selectedIndex;
   var unit3 = document.calculate.stock_vol_unit.options.selectedIndex;
   var unit1Name;
   var unit2Name;
   var unit3Name;
   var conversionFactor;
   var resultNumber;

   switch (unit1) {
   case 0:
      unit1Name = "gr";
      switch (unit2) {
      case 0: conversionFactor = 1; unit2Name = "gr"; break;
      case 1: conversionFactor = 0.002285; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.0001428; unit2Name = "lbs"; break;
      case 3: conversionFactor = 64.799; unit2Name = "mg"; break;
      case 4: conversionFactor = 0.064799; unit2Name = "g"; break;
      case 5: conversionFactor = 0.000064799; unit2Name = "kg"; break;
      }
      break;
   case 1:
      unit1Name = "oz";
      switch (unit2) {
      case 0: conversionFactor = 437.5; unit2Name = "gr"; break;
      case 1: conversionFactor = 1; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.06250; unit2Name = "lbs"; break;
      case 3: conversionFactor = 28349.4; unit2Name = "mg"; break;
      case 4: conversionFactor = 28.3494; unit2Name = "g"; break;
      case 5: conversionFactor = 0.0283494; unit2Name = "kg"; break;
      }
      break;
   case 2:
      unit1Name = "lbs";
      switch (unit2) {
      case 0: conversionFactor = 7000; unit2Name = "gr"; break;
      case 1: conversionFactor = 16; unit2Name = "oz"; break;
      case 2: conversionFactor = 1; unit2Name = "lbs"; break;
      case 3: conversionFactor = 453590; unit2Name = "mg"; break;
      case 4: conversionFactor = 453.590; unit2Name = "g"; break;
      case 5: conversionFactor = 0.453590; unit2Name = "kg"; break;
      }
      break;
   case 3:
      unit1Name = "mg";
      switch (unit2) {
      case 0: conversionFactor = 0.01540; unit2Name = "gr"; break;
      case 1: conversionFactor = 0.0000352; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.0000022; unit2Name = "lbs"; break;
      case 3: conversionFactor = 1; unit2Name = "mg"; break;
      case 4: conversionFactor = 0.001; unit2Name = "g"; break;
      case 5: conversionFactor = 0.000001; unit2Name = "kg"; break;
      }
      break;
   case 4:
      unit1Name = "g";
      switch (unit2) {
      case 0: conversionFactor = 15.4; unit2Name = "gr"; break;
      case 1: conversionFactor = 0.03520; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.00220; unit2Name = "lbs"; break;
      case 3: conversionFactor = 1000; unit2Name = "mg"; break;
      case 4: conversionFactor = 1; unit2Name = "g"; break;
      case 5: conversionFactor = 0.001; unit2Name = "kg"; break;
      }
      break;
   case 5:
      unit1Name = "kg";
      switch (unit2) {
      case 0: conversionFactor = 15400; unit2Name = "gr"; break;
      case 1: conversionFactor = 35.2; unit2Name = "oz"; break;
      case 2: conversionFactor = 2.2; unit2Name = "lbs"; break;
      case 3: conversionFactor = 1000000; unit2Name = "mg"; break;
      case 4: conversionFactor = 1000; unit2Name = "g"; break;
      case 5: conversionFactor = 1; unit2Name = "kg"; break;
      }
      break;
   }

   switch (unit3) {
   case 0: unit3Name = "minims"; break;
   case 1: unit3Name = "dr"; break;
   case 2: unit3Name = "fl.oz"; break;
   case 3: unit3Name = "pt"; break;
   case 4: unit3Name = "qt"; break;
   case 5: unit3Name = "gal"; break;
   case 6: unit3Name = "mL"; break;
   case 7: unit3Name = "L"; break;
   }

   stockDose = stockDose / conversionFactor;
   resultNumber = requiredDose * stockVolume / stockDose;
   document.calculate.result.value = "To get " + requiredDose + " " + unit1Name + ", administer " + resultNumber + " " + unit3Name + " of the drug.";
}

function calcFluid() {
   var startNumber = document.convert.fluid.value;
   var unit1 = document.convert.fluid_unit1.options.selectedIndex;
   var unit2 = document.convert.fluid_unit2.options.selectedIndex;
   var unit1Name;
   var unit2Name;
   var conversionFactor;
   var resultNumber;

   switch (unit1) {
   case 0:
      unit1Name = "minims";
      switch (unit2) {
      case 0: conversionFactor = 1; unit2Name = "minims"; break;
      case 1: conversionFactor = 0.016667; unit2Name = "dr"; break;
      case 2: conversionFactor = 0.0020833; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 0.0001302833; unit2Name = "pt"; break;
      case 4: conversionFactor = 0.000065104167; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.00001627604167; unit2Name = "gal"; break;
      case 6: conversionFactor = 0.0616115; unit2Name = "mL"; break;
      case 7: conversionFactor = 0.0000616115; unit2Name = "L"; break;
      }
      break;
   case 1:
      unit1Name = "dr";
      switch (unit2) {
      case 0: conversionFactor = 60; unit2Name = "minims"; break;
      case 1: conversionFactor = 1; unit2Name = "dr"; break;
      case 2: conversionFactor = 0.12500; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 0.0078125; unit2Name = "pt"; break;
      case 4: conversionFactor = 0.00390625; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.0009765265; unit2Name = "gal"; break;
      case 6: conversionFactor = 3.69669; unit2Name = "mL"; break;
      case 7: conversionFactor = 0.00369669; unit2Name = "L"; break;
      }
      break;
   case 2:
      unit1Name = "fl.oz";
      switch (unit2) {
      case 0: conversionFactor = 480; unit2Name = "minims"; break;
      case 1: conversionFactor = 8; unit2Name = "dr"; break;
      case 2: conversionFactor = 1; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 0.06250; unit2Name = "pt"; break;
      case 4: conversionFactor = 0.03125; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.0078125; unit2Name = "gal"; break;
      case 6: conversionFactor = 29.57352; unit2Name = "mL"; break;
      case 7: conversionFactor = 0.02957352; unit2Name = "L"; break;
      }
      break;
   case 3:
      unit1Name = "pt";
      switch (unit2) {
      case 0: conversionFactor = 7680; unit2Name = "minims"; break;
      case 1: conversionFactor = 128; unit2Name = "dr"; break;
      case 2: conversionFactor = 16; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 1; unit2Name = "pt"; break;
      case 4: conversionFactor = 0.50000; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.12500; unit2Name = "gal"; break;
      case 6: conversionFactor = 473.17632; unit2Name = "mL"; break;
      case 7: conversionFactor = 0.47317632; unit2Name = "L"; break;
      }
      break;
   case 4:
      unit1Name = "qt";
      switch (unit2) {
      case 0: conversionFactor = 15360; unit2Name = "minims"; break;
      case 1: conversionFactor = 256; unit2Name = "dr"; break;
      case 2: conversionFactor = 32; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 2; unit2Name = "pt"; break;
      case 4: conversionFactor = 1; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.25000; unit2Name = "gal"; break;
      case 6: conversionFactor = 946.35264; unit2Name = "mL"; break;
      case 7: conversionFactor = 0.94635264; unit2Name = "L"; break;
      }
      break;
   case 5:
      unit1Name = "gal";
      switch (unit2) {
      case 0: conversionFactor = 61440; unit2Name = "minims"; break;
      case 1: conversionFactor = 1024; unit2Name = "dr"; break;
      case 2: conversionFactor = 128; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 8; unit2Name = "pt"; break;
      case 4: conversionFactor = 4; unit2Name = "qt"; break;
      case 5: conversionFactor = 1; unit2Name = "gal"; break;
      case 6: conversionFactor = 3785.41056; unit2Name = "mL"; break;
      case 7: conversionFactor = 3.78541056 ; unit2Name = "L"; break;
      }
      break;
   case 6:
      unit1Name = "mL";
      switch (unit2) {
      case 0: conversionFactor = 16.230736145; unit2Name = "minims"; break;
      case 1: conversionFactor = 0.2705122691; unit2Name = "dr"; break;
      case 2: conversionFactor = 0.0338140336; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 0.0021133771; unit2Name = "pt"; break;
      case 4: conversionFactor = 0.0010566886; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.0002641721; unit2Name = "gal"; break;
      case 6: conversionFactor = 1; unit2Name = "mL"; break;
      case 7: conversionFactor = 0.00100; unit2Name = "L"; break;
      }
      break;
   case 7:
      unit1Name = "L";
      switch (unit2) {
      case 0: conversionFactor = 16230.736145; unit2Name = "minims"; break;
      case 1: conversionFactor = 270.5122691; unit2Name = "dr"; break;
      case 2: conversionFactor = 33.8140336; unit2Name = "fl.oz"; break;
      case 3: conversionFactor = 2.1133771; unit2Name = "pt"; break;
      case 4: conversionFactor = 1.0566886; unit2Name = "qt"; break;
      case 5: conversionFactor = 0.2641721; unit2Name = "gal"; break;
      case 6: conversionFactor = 1000; unit2Name = "mL"; break;
      case 7: conversionFactor = 1; unit2Name = "L"; break;
      }
      break;
   }

   resultNumber = startNumber * conversionFactor;
   document.convert.result_fluid.value = startNumber + " " + unit1Name + " = " + resultNumber + " " + unit2Name;
}

function calcFluid2() {
  var unit1, unit2, unit1Name, unit2Name, FromVal, ToVal, v1, Factor;

   unit1 = document.convert.fluid_unit1.options.selectedIndex;
   unit2 = document.convert.fluid_unit2.options.selectedIndex;

   switch (unit1) {
	  case 0: FromVal = (0.0037854118/128)/480; unit1Name = "minims"; break;
	  case 1: FromVal = (0.0037854118/128)/8; unit1Name = "dr"; break;
	  case 2: FromVal = 0.0037854118/128; unit1Name = "fl.oz"; break;
	  case 3: FromVal = 0.0037854118/8; unit1Name = "pt"; break;
	  case 4: FromVal = 0.0037854118/4; unit1Name = "qt"; break;
	  case 5: FromVal = 0.0037854118; unit1Name = "gal"; break;
	  case 6: FromVal = 0.000001; unit1Name = "mL"; break;
	  case 7: FromVal = 0.001; unit1Name = "L"; break;
   }
   
   switch (unit2) {
	  case 0: ToVal = (0.0037854118/128)/480; unit2Name = "minims"; break;
	  case 1: ToVal =(0.0037854118/128)/8; unit2Name = "dr"; break;
	  case 2: ToVal = 0.0037854118/128; unit2Name = "fl.oz"; break;
	  case 3: ToVal = 0.0037854118/8; unit2Name = "pt"; break;
	  case 4: ToVal = 0.0037854118/4; unit2Name = "qt"; break;
	  case 5: ToVal = 0.0037854118; unit2Name = "gal"; break;
	  case 6: ToVal = 0.000001; unit2Name = "mL"; break;
	  case 7: ToVal = 0.001; unit2Name = "L"; break;
   }
  v1 = document.convert.fluid.value;;
  v1 = stripBad(v1);
  eval('v1 = parseFloat(' + v1 + ');');
  if (isNaN(v1)) v1 = 1;
  v1 = Math.abs(v1);
  document.convert.fluid.value = v1;
  
  Factor = eval("(" + FromVal + ")/(" + ToVal + ")");
  document.convert.result_fluid.value = space(v1) + " " + unit1Name + " = " + space(get_result(v1, Factor)) + " " + unit2Name;

}


function calcWeight() {
   var startNumber = document.convert.weight.value;
   var unit1 = document.convert.weight_unit1.options.selectedIndex;
   var unit2 = document.convert.weight_unit2.options.selectedIndex;
   var unit1Name;
   var unit2Name;
   var conversionFactor;
   var resultNumber;

   switch (unit1) {
   case 0:
      unit1Name = "gr";
      switch (unit2) {
      case 0: conversionFactor = 1; unit2Name = "gr"; break;
      case 1: conversionFactor = 0.002285; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.0001428; unit2Name = "lbs"; break;
      case 3: conversionFactor = 64.799; unit2Name = "mg"; break;
      case 4: conversionFactor = 0.064799; unit2Name = "g"; break;
      case 5: conversionFactor = 0.000064799; unit2Name = "kg"; break;
      }
      break;
   case 1:
      unit1Name = "oz";
      switch (unit2) {
      case 0: conversionFactor = 437.5; unit2Name = "gr"; break;
      case 1: conversionFactor = 1; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.06250; unit2Name = "lbs"; break;
      case 3: conversionFactor = 28349.4; unit2Name = "mg"; break;
      case 4: conversionFactor = 28.3494; unit2Name = "g"; break;
      case 5: conversionFactor = 0.0283494; unit2Name = "kg"; break;
      }
      break;
   case 2:
      unit1Name = "lbs";
      switch (unit2) {
      case 0: conversionFactor = 7000; unit2Name = "gr"; break;
      case 1: conversionFactor = 16; unit2Name = "oz"; break;
      case 2: conversionFactor = 1; unit2Name = "lbs"; break;
      case 3: conversionFactor = 453590; unit2Name = "mg"; break;
      case 4: conversionFactor = 453.590; unit2Name = "g"; break;
      case 5: conversionFactor = 0.453590; unit2Name = "kg"; break;
      }
      break;
   case 3:
      unit1Name = "mg";
      switch (unit2) {
      case 0: conversionFactor = 0.01540; unit2Name = "gr"; break;
      case 1: conversionFactor = 0.0000352; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.0000022; unit2Name = "lbs"; break;
      case 3: conversionFactor = 1; unit2Name = "mg"; break;
      case 4: conversionFactor = 0.001; unit2Name = "g"; break;
      case 5: conversionFactor = 0.000001; unit2Name = "kg"; break;
      }
      break;
   case 4:
      unit1Name = "g";
      switch (unit2) {
      case 0: conversionFactor = 15.4; unit2Name = "gr"; break;
      case 1: conversionFactor = 0.03520; unit2Name = "oz"; break;
      case 2: conversionFactor = 0.00220; unit2Name = "lbs"; break;
      case 3: conversionFactor = 1000; unit2Name = "mg"; break;
      case 4: conversionFactor = 1; unit2Name = "g"; break;
      case 5: conversionFactor = 0.001; unit2Name = "kg"; break;
      }
      break;
   case 5:
      unit1Name = "kg";
      switch (unit2) {
      case 0: conversionFactor = 15400; unit2Name = "gr"; break;
      case 1: conversionFactor = 35.2; unit2Name = "oz"; break;
      case 2: conversionFactor = 2.2; unit2Name = "lbs"; break;
      case 3: conversionFactor = 1000000; unit2Name = "mg"; break;
      case 4: conversionFactor = 1000; unit2Name = "g"; break;
      case 5: conversionFactor = 1; unit2Name = "kg"; break;
      }
      break;
   }

   resultNumber = startNumber * conversionFactor;
   document.convert.result_weight.value = startNumber + " " + unit1Name + " = " + resultNumber + " " + unit2Name;
}

function calcWeight2() {
  var unit1, unit2, unit1Name, unit2Name, FromVal, ToVal, v1, Factor;

   unit1 = document.convert.weight_unit1.options.selectedIndex;
   unit2 = document.convert.weight_unit2.options.selectedIndex;

   switch (unit1) {
	case 0: FromVal = 0.00006479891; unit1Name = "gr"; break;
	case 1: FromVal = 0.45359237/16; unit1Name = "oz"; break;
	case 2: FromVal = 0.45359237; unit1Name = "lbs";break;
	case 3: FromVal = 0.000001; unit1Name = "mg"; break;
	case 4: FromVal = 0.001; unit1Name = "g"; break;
	case 5: FromVal = 1; unit1Name = "kg"; break;
   }
   
   switch (unit2) {
    case 0: ToVal = 0.00006479891; unit2Name = "gr"; break;
    case 1: ToVal = 0.45359237/16; unit2Name = "oz"; break;
    case 2: ToVal = 0.45359237; unit2Name = "lbs"; break;
    case 3: ToVal = 0.000001; unit2Name = "mg"; break;
    case 4: ToVal = 0.001; unit2Name = "g"; break;
    case 5: ToVal = 1; unit2Name = "kg"; break;
   }

  v1 = document.convert.weight.value;;
  v1 = stripBad(v1);
  eval('v1 = parseFloat(' + v1 + ');');
  if (isNaN(v1)) v1 = 1;
  v1 = Math.abs(v1);
  document.convert.weight.value = v1;
  
  Factor = eval("(" + FromVal + ")/(" + ToVal + ")");

  document.convert.result_weight.value = space(v1) + " " + unit1Name + " = " + space(get_result(v1, Factor)) + " " + unit2Name;

}

function get_result(ff,factor){
 ff *= factor;

 var s = ff.toString(), first, last = '';
 var i = s.indexOf('e');
 if (i != -1)
 {
	 first = perRound(s.substring(0, i));
	 last = parseInt(s.substring(i + 1));
	 while (first >= 10)
	 {
		 first /= 10;
		 last++;
	 }
	 if (last > 0)
		 last = '+' + last;
	 last = 'e' + last;
	 if (first.toString().indexOf('.') == -1)
		first += '.0';
 }
 else
	 first = perRound(s);

 return first + last;
}

function perRound(num, precision) {
	var precision = 9; //default value if not passed from caller, change if desired
	// remark if passed from caller
	precision = parseInt(precision); // make certain the decimal precision is an integer
	var result1 = num * Math.pow(10, precision);
	var result2 = Math.round(result1);
	var result3 = result2 / Math.pow(10, precision);
	return result3;
}


function stripBad(string) {
    for (var i=0, output='', valid="eE+/*-0123456789.()"; i<string.length; i++)
       if (valid.indexOf(string.charAt(i)) != -1)
          output += string.charAt(i)
    return output;
} 

function space (num)
{
	num = num + '';
	// exit if scientific notation
	if (num.indexOf('e') > -1){ return num; }

	var dec = num.indexOf('.');

	var left, right = '';
	if (dec >= 0)
	{
		left = num.substring(0, dec);
		right = num.substring(dec + 1);
	}
	else
		left = num;

	var new_left = '', new_right = '';
	for (var i = 0; i < right.length; i++)
	{
		new_right += right.charAt(i);
		if (i % 3 == 2 && i != right.length - 1)
			new_right += ' ';
	}
	for (var i = left.length - 1; i >= 0; i--)
	{
		new_left = left.charAt(i) + new_left;
		if ((left.length - 1 - i) % 3 == 2 && i != 0)
			new_left = ' ' + new_left;
	}

	return (dec >= 0) ? new_left + '.' + new_right : new_left;
}


function calcTemp() {
   var startTemp = document.convert.temperature.value;
   var converter = document.convert.temp_converter.selectedIndex;
   var endTemp;
   var origScale;
   var newScale;

   switch (converter) {
   case 0: endTemp = Math.round((startTemp - 32) * 5 * 100 / 9) / 100; origScale = "F"; newScale = "C"; break;
   case 1: endTemp = Math.round((startTemp * 9 / 5 + 32) * 100) / 100; origScale = "C"; newScale = "F"; break;
   }
   
   document.convert.result_temp.value = startTemp + " degrees " + origScale + " = " + endTemp + " degrees " + newScale;
}
