// Menu configuration
var strNavMainPrefix = "nav-main-";
var strNavSubPrefix = "nav-sub-";
var strNavOverSuffix = "_o";
// Set global scope variables
var strActiveMenu = strMenu == "" ? "" : strNavSubPrefix + strMenu;
var strActiveImg = strMenu == "" ? "" : strNavMainPrefix + strMenu;
// Displays a secondary menu
function showMenu(strID) {
	if($(strActiveMenu)) hideMenu();
	Element.show($(strNavSubPrefix + strID));
	var strImgSrc = $(strNavMainPrefix + strID).src;
	strImgSrc = strImgSrc.substring(0, strImgSrc.lastIndexOf("\.")) + strNavOverSuffix + strImgSrc.substring(strImgSrc.lastIndexOf("\."));
	$(strNavMainPrefix + strID).src = strImgSrc;
	strActiveMenu = strNavSubPrefix + strID;
	strActiveImg = strNavMainPrefix + strID;
}
// Hides the active menu
function hideMenu() {
	Element.hide($(strActiveMenu));
	var strImgSrc = $(strActiveImg).src;
	strImgSrc = strImgSrc.substring(0, strImgSrc.lastIndexOf(strNavOverSuffix + "\.")) + strImgSrc.substring(strImgSrc.lastIndexOf("\."));
	$(strActiveImg).src = strImgSrc;
	strActiveMenu = "";
	strActiveImg = "";
}

var rslt;
var loaded = false; // Declares that images have not been loaded.

function newImg(img_src){ // Creates new image objects and loads the urls imto the browser's memory cache. Called by the loadImg function.
	if (document.images){ // Checks for the existence of the images[] array (JavaScript 1.1 and higher).
		rslt = new Image(); // Creates the image object.
		rslt.src = img_src; // Assigns the image source url to the new image object.
		return rslt; // Returns the result to the loadImg funtion.
	}
}

function loadImg(){ // Passes the urls to the newImg function. Called from the <BODY> tag: <BODY ONLOAD="loadImg();">
	if (document.images){ // Checks for the existence of the images[] array (JavaScript 1.1 and higher).

		// Begin Images Sources
		var img1 = newImg("images/nav_main_about_o.gif");
		var img2 = newImg("images/nav_main_team_o.gif");
		var img3 = newImg("images/nav_main_patient_o.gif");
		var img4 = newImg("images/nav_main_contact_o.gif");
		var img5 = newImg("images/nav_sub_welcome_greetings_o.gif");
		var img6 = newImg("images/nav_sub_welcome_vision_o.gif");
		var img7 = newImg("images/nav_sub_welcome_research_o.gif");
		var img8 = newImg("images/nav_sub_welcome_help_o.gif");
		var img9 = newImg("images/nav_sub_welcome_blog_o.gif");
		var img10 = newImg("images/nav_sub_team_physicians_o.gif");
		var img11 = newImg("images/nav_sub_team_staff_o.gif");
		var img12 = newImg("images/nav_sub_team_programs_o.gif");
		var img13 = newImg("images/nav_sub_patient_common_o.gif");
		var img14 = newImg("images/nav_sub_patient_cancer_o.gif");
		var img15 = newImg("images/nav_sub_patient_men_o.gif");
		var img16 = newImg("images/nav_sub_patient_pelvic_o.gif");
		var img17 = newImg("images/nav_sub_patient_pediatrics_o.gif");
		var img18 = newImg("images/nav_sub_patient_robots_o.gif");
		var img19 = newImg("images/nav_sub_contact_visit_o.gif");
		var img20 = newImg("images/nav_sub_contact_directions_o.gif");
		var img21 = newImg("images/header_logo_o.jpg");
		var img22 = newImg("images/footer_logo_o.gif");
		var img23 = newImg("images/search_go_o.gif");
		// End Images Sources

		loaded = true; // Lets the swapImg funtion know the images are loaded.
	}
}

// Swap images
var swapped = false; // Declares that no images are currently swapped.
var active_extension = "_o"; // Sets the filename extension for image active states.
var restore_info = new Array(); // Holds the image object names and urls for swapped images.
function swapImg(){ // Swaps and restores single or multiple images. Called by any event handler, usually onMouseOver.
	if (document.images && loaded == true && swapped == false){ // Performs if the images[] array (JavaScript 1.1 and higher) exists and if the loadImg function has completed.
		for (var i = 0; i < swapImg.arguments.length; i++){ // Loops for each set of two arguments (image name and url) passed by the event handler.
			restore_info[i * 2] = swapImg.arguments[i]; // Assigns the image name to the restore_info[] array.
			restore_info[i * 2 + 1] = document[swapImg.arguments[i]].src; // Assigns the original url to the restore_info[] array.
			document[swapImg.arguments[i]].src = document[swapImg.arguments[i]].src.substring(0, document[swapImg.arguments[i]].src.lastIndexOf('\.')) + active_extension + document[swapImg.arguments[i]].src.substring(document[swapImg.arguments[i]].src.lastIndexOf('\.')); // Assigns the new url to the image object.
		}
	} else if (document.images && loaded == true && swapped == true){ // Restores all swapped but non-locked images to their original urls. Called by any event handler, usually onMouseOut.
		for (var i = 0; i < restore_info.length; i += 2) document[restore_info[i]].src = restore_info[i + 1]; // Assigns the original url to the image object.
		restore_info = new Array(); // Resets the saved restore information.
	}
	swapped = !swapped; // Flips the swapped flag between swap and restore functionality.
}

window.onload = function(){loadImg();initDefinitions()};

function clearSearchVal() {
	if (document.searchform.terms.value == "Search") document.searchform.terms.value = "";
}
function setSearchVal() {
	if (document.searchform.terms.value == "") document.searchform.terms.value = "Search";
}

// Toggle and position the display of definition box
function showDefinition(e, strTerm) {
	if (!$("definition-holder")) {
		$("content").innerHTML += '<div id="definition-holder" style="display: none;"><div id="definition">&nbsp;</div></div>';
	}
	Element.show($("definition-holder"));
	Element.update($("definition"), "<h1>" + strTerm + "</h1><p>" + arrDefinitions[strTerm] + "</p>");
	if (!e) var e = window.onmouseover;
	if (e.pageX || e.pageY) {
		$("definition-holder").style.left = (e.pageX + 10) + "px";
		$("definition-holder").style.top = (e.pageY + 10) + "px";
	}
	else if (e.clientX || e.clientY) {
		$("definition-holder").style.left = (e.clientX + document.documentElement.scrollLeft + 10) + "px";
		$("definition-holder").style.top = (e.clientY + document.documentElement.scrollTop + 10) + "px";
	}
}
function hideDefinition() {
	Element.hide($("definition-holder"));
}
function initDefinitions() {
	var linkNodes = document.getElementsByClassName("definition-link");
	for (i = 0; i < linkNodes.length; i++) {
		linkNodes[i].setAttribute("onmouseout", "hideDefinition();");
		linkNodes[i].setAttribute("onclick", "return false;");
	}
}
var arrDefinitions = new Array();
arrDefinitions["aldosterone"] = "mineralocorticoid";
arrDefinitions["auto transplantation"] = "removal and transplanting of your own kidney";
arrDefinitions["benign"] = "non-cancerous";
arrDefinitions["beta-blocker"] = "Beta blockers (sometimes written as &beta;-blockers) are a class of drugs used for various indications, but particularly for the management of cardiac arrhythmias and cardioprotection after myocardial infarction.";
arrDefinitions["bladder diverticulum"] = "A bladder diverticulum represents an area of weakness in the bladder wall through which some of the lining of the bladder is forced out.";
arrDefinitions["blood in the urine"] = "hematuria";
arrDefinitions["CAT"] = "Computerized Axial Tomography";
arrDefinitions["catheter"] = "A catheter is a soft, small tube which allows drainage or injection of fluids or access by surgical instruments.";
arrDefinitions["CBC"] = "A complete blood count (CBC) is a comprehensive type of blood test which measures hemoglobin and white and red blood cell qualities, among other things.";
arrDefinitions["circumcision"] = "removal of the extra skin";
arrDefinitions["Conn's syndrome"] = "Conn's syndrome develops if the tumor produces excess aldosterone.";
arrDefinitions["cortisol"] = "glucocorticoid";
arrDefinitions["CT scan"] = "Computed tomography (CT), also known as Computed Axial Tomography (CAT), is a painless, sophisticated x-ray procedure.";
arrDefinitions["Cushing's syndrome"] = "Cushing's syndrome develops if an adrenal tumor produces excess cortisol hormone.";
arrDefinitions["cystoscope"] = "a special \"telescope\" that is used to inspect the bladder wall";
arrDefinitions["cystoscopy"] = "Cystoscopy is the use of a scope (cystoscope) to examine the bladder.";
arrDefinitions["Cytotoxic"] = "a substance (as a toxin or antibody) having a toxic effect on cells";
arrDefinitions["decreased libido"] = "decreased sex drive";
arrDefinitions["DHEA"] = "androgens, a form of testosterone";
arrDefinitions["DNA"] = "material within cells that make up the genetic information";
arrDefinitions["early childhood"] = "95% of cases are diagnosed in children under the age of 10 years old";
arrDefinitions["echogenicity"] = "Ability to create an echo, i.e. return a signal in ultrasound examinations.";
arrDefinitions["Echocardiogram"] = "An echocardiogram is a type of ultrasound test that uses high-pitched sound waves to pick up echoes of the sound waves as they bounce off the different parts of your heart. These echoes are turned into moving pictures of your heart that can be seen on a video screen.";
arrDefinitions["EKG"] = "An electrocardiogram (EKG or ECG) is a test that checks for problems with the electrical activity of the heart.";
arrDefinitions["elevation in a blood test"] = "alkaline phosphatase";
arrDefinitions["electrolyte abnormalities"] = "low blood potassium";
arrDefinitions["epididymis"] = "The epididymis is a coiled segment of the spermatic ducts that serves to store, mature and transport spermatozoa between the testis and the vas deferens";
arrDefinitions["exstrophy of the bladder"] = "a condition where the bladder may appear to be inside out and the abdominal wall is partially open leaving the bladder exposed to the exterior of the body";
arrDefinitions["\"Foley\" catheter"] = "a narrow, hollow tube inserted into the urinary passage to drain your bladder";
arrDefinitions["fusion"] = "joining";
arrDefinitions["glans penis"] = "head of the penis";
arrDefinitions["glucose"] = "sugar";
arrDefinitions["gynecomastia"] = "enlargement of breast tissue";
arrDefinitions["hematuria"] = "blood in the urine";
arrDefinitions["hirsuitism"] = "excessive facial and body hair growth";
arrDefinitions["hormones"] = "proteins in the blood that regulate normal bodily functions";
arrDefinitions["Hypertrophy"] = "enlargement";
arrDefinitions["ICSI"] = "intracytoplasmic sperm injection";
arrDefinitions["infertility"] = "inability to father one's own child";
arrDefinitions["intravenous catheter"] = "An IV is a small tube placed into your vein so that you can receive necessary fluids and stay well hydrated; in addition it provides a way to receive medication.";
arrDefinitions["IVF"] = "in vitro fertilization";
arrDefinitions["IVU"] = "intravenous urogram";
arrDefinitions["Klinefelter's syndrome"] = "an abnormal condition in which at least one extra X chromosome is present in a male";
arrDefinitions["labia majora"] = "female vaginal lips";
arrDefinitions["lymph nodes"] = "packets of tissue that are part of the immune system and help fight infection";
arrDefinitions["malignancy"] = "Tumor that has risk of spread to other organs";
arrDefinitions["malignant"] = "cancerous";
arrDefinitions["metastasis"] = "spread of the tumor to other organs";
arrDefinitions["metastatic"] = "cancer that has spread to other organs";
arrDefinitions["MRI"] = "magnetic resonance imaging";
arrDefinitions["Multiple Endocrine Neoplasia syndrome"] = "Multiple endocrine neoplasia type 1 (MEN1), sometimes called multiple endocrine adenomatosis or Wermer's syndrome, is an extremely rare (3 to 20 persons out of 100,000) inherited disorder that affects the endocrine glands.";
arrDefinitions["nephrectomy"] = "removal of kidney";
arrDefinitions["Nephrostomy"] = "A nephrostomy is an artificial opening created between the kidney and the skin which allows for the drainage of urine directly from the upper part of the urinary system";
arrDefinitions["neurogenic bladder"] = "In a neurogenic bladder, the nerves that carry messages from the bladder to the brain and from the brain to the muscles of the bladder telling them either to tighten or release do not work properly.";
arrDefinitions["nocturia"] = "having to urinate multiple times at night";
arrDefinitions["Nuclear Medicine stress test"] = "A Nuclear Medicine stress test involves the injection of a small, safe amount of radioactive 'tracer' that allows the heart muscle to be seen on special x-rays";
arrDefinitions["Orchalgia"] = "testicular pain";
arrDefinitions["pain upon urination"] = "dysuria";
arrDefinitions["palpitations"] = "feeling of your heart racing";
arrDefinitions["Perineal"] = "the region between your scrotum and anus";
arrDefinitions["polydipsia"] = "excessive thirst";
arrDefinitions["prostatitis"] = "inflammation of the prostate";
arrDefinitions["PT / PTT"] = "Prothrombin time (PT) and partial thromboplastin time (PTT) tests are used to evaluate the blood coagulation system.";
arrDefinitions["radioactive contrast dye"] = "radioactive contrast dye is a very safe procedure";
arrDefinitions["retract"] = "pull back";
arrDefinitions["schistosoma haematobium"] = "a parasitic organism";
arrDefinitions["spermatozoa"] = "a mature sperm cell";
arrDefinitions["spread outside the adrenal gland"] = "metastasis";
arrDefinitions["symptoms"] = "abdominal fullness, pain";
arrDefinitions["symptoms"] = "abdominal fullness, pain";
arrDefinitions["testicular dysgenesis"] = "condition in which the testis develops abnormally";
arrDefinitions["ultrasound"] = "diagnostic imaging technique utilizing high-frequency sound waves to examine internal body structures or organs";
arrDefinitions["ureter"] = "The ureters are funnel-shaped tubes that carry urine from the kidneys.";
arrDefinitions["ureteral"] = "internal";
arrDefinitions["ureteral stent"] = "a thin, flexible tube placed into the ureter to help urine drain from the kidney to the bladder";
arrDefinitions["urethra"] = "the channel through which urine flows out of the bladder";
arrDefinitions["urinary catheter"] = "a thin, hollow tube that drains urine from the bladder";
arrDefinitions["urodynamics"] = "Urodynamics is the investigation of functional disorders of the lower urinary tract, i.e. the bladder and the urethra.";
arrDefinitions["vas deferens"] = "the tube that brings the sperm from the testes to the ejaculate";
arrDefinitions["vasectomy"] = "cutting the tubes that bring the sperm from the testes to the urethra";
arrDefinitions["voiding cystourethrograms"] = "x-rays of the bladder and urethra";
arrDefinitions["von Hippel Lindau syndrome"] = "Von Hippel-Lindau syndrome is an inherited multi-system disorder characterized by abnormal growth of blood vessels.";
