/*************************************************************************
* Yale University School of Medicine, New Haven, Connecticut, USA        *        
* All contents copyright (C) 1997 Yale University. All rights reserved.  *
* Yale Center for Advanced Instructional Media  carl.jaffe@yale.edu      *
* patrick.lynch@yale.edu  phillip.simon@yale.edu   sean.jackson@yale.edu *
* Yale CAIM, 47 College Street Suite 224, New Haven, CT 06510, USA       *
* URL:http://info.med.yale.edu/caim/                                     *
*************************************************************************/             

/***********************************************************
 **********************************************************
*        HHMI DIRT (Dynamic image rollover thingy)         *
*        Speciffically modified for HHMI                   *
*            08/27/98 Sebastian Rossi                      *
 **********************************************************
***********************************************************/


/***********************************************************
*getImage(image_name): Returns the document.images[] index *
*	for the image with thegiven name. Works around image   *
*	reproduction bug in Netscape 3.0                       *
***********************************************************/
function getImage(image_name)
{
	var lastfind = -1;
	for(var i =0; i < document.images.length;i++)
	{
		if (document.images[i].name == image_name)
			lastfind = i;
	}
	return lastfind;
}

/**********************************************************
*getNum(imageName): Returns the index of imageName from   *
*				    the global array namArray. If         *
*					imageName is not found returns -1     *
**********************************************************/
function getNum(imageName)
{
	for (i=0; i < numImages; i++)
	{
		if (nameArray[i] == imageName)
			break;
	}

	if (i == numImages)
	{
		i = -1;	
	}
	return i;
}

/**********************************************************
*dimimage(imageName): swaps the src of the image named    *
*                     imageName to the src stored in      *
*                     dimArray[] and changes window.status*
*                     to the corresponding blurb if they  *
*					  both exist.                         * 
**********************************************************/
function dimImage(imageName)
{
	bNum = getNum(imageName);
	if (bNum == -1)
	{
		alert("Error: This image has not been initialized");
		return;
	}
	document.images[(getImage(imageName))].src = dimArray[bNum].src;
    window.status = blurbArray[bNum];
}

/**********************************************************
*undimimage(imageName): swaps the src of the image named  *
*                       imageName to the src stored in    *
*                       normalArray[] if it exits.        *
**********************************************************/
function undimImage(imageName)
{
	bNum = getNum(imageName);
	if (bNum == -1)
	{
		return;
	}
	document.images[(getImage(imageName))].src = normalArray[bNum].src;
	window.status = "";
}

/**********************************************************
*initImages(imageString)                                  *
**********************************************************/
function initImages(imageString)
{
	//CONTENTS LABEL
		nameArray[0] = "contents" 
		normalArray[0] = new Image
		normalArray[0].src = "../../resources/headers/contents_g.gif"
		dimArray[0] = new Image
		dimArray[0].src = "../../resources/headers/contents_y.gif"
		blurbArray[0] = "Go to Contents listings."

	//ANATOMY LABEL
		nameArray[1] = "anatomy" 
		normalArray[1] = new Image
		normalArray[1].src = "../../resources/headers/anatomy_g.gif"
		dimArray[1] = new Image
		dimArray[1].src = "../../resources/headers/anatomy_y.gif"
		blurbArray[1] = "First page of anatomy section."
		
	//TECHNIQUES LABEL
		nameArray[2] = "techniques" 
		normalArray[2] = new Image
		normalArray[2].src = "../../resources/headers/techniques_g.gif"
		dimArray[2] = new Image
		dimArray[2].src = "../../resources/headers/techniques_y.gif"
		blurbArray[2] = "First page of techniques section."
		
	//FINDINGS LABEL
		nameArray[3] = "findings" 
		normalArray[3] = new Image
		normalArray[3].src = "../../resources/headers/findings_g.gif"
		dimArray[3] = new Image
		dimArray[3].src = "../../resources/headers/findings_y.gif"
		blurbArray[3] = "First page, image findings section."
	
	//CASES BUTTON
		nameArray[4] = "cases" 
		normalArray[4] = new Image
		normalArray[4].src = "../../resources/headers/cases_g.gif"
		dimArray[4] = new Image
		dimArray[4].src = "../../resources/headers/cases_y.gif"
		blurbArray[4] = "First page, cases section."

	//REFERENCES BUTTON
		nameArray[5] = "references" 
		normalArray[5] = new Image
		normalArray[5].src = "../../resources/headers/references_g.gif"
		dimArray[5] = new Image
		dimArray[5].src = "../../resources/headers/references_y.gif"
		blurbArray[5] = "Go to References section."
		
	//HEADER PREV BUTTON
		nameArray[6] = "prev_header" 
		normalArray[6] = new Image
		normalArray[6].src = "../../resources/headers/prev.gif"
		dimArray[6] = new Image
		dimArray[6].src = "../../resources/headers/prev_highlite.gif"
		blurbArray[6] = "Click here to move to the previous page."

	//HEADER NEXT BUTTON
		nameArray[7] = "next_header" 
		normalArray[7] = new Image
		normalArray[7].src = "../../resources/headers/next.gif"
		dimArray[7] = new Image
		dimArray[7].src = "../../resources/headers/next_highlite.gif"
		blurbArray[7] = "Click here to move to the next page."
		
		
	//FOOTER PREV BUTTON
		nameArray[8] = "prev_footer" 
		normalArray[8] = new Image
		normalArray[8].src = "../../resources/headers/prev.gif"
		dimArray[8] = new Image
		dimArray[8].src = "../../resources/headers/prev_highlite.gif"
		blurbArray[8] = "Click here to move to the previous page."
		
	//FOOTER NEXT BUTTON
		nameArray[9] = "next_footer" 
		normalArray[9] = new Image
		normalArray[9].src = "../../resources/headers/next.gif"
		dimArray[9] = new Image
		dimArray[9].src = "../../resources/headers/next_highlite.gif"
		blurbArray[9] = "Click here to move to the next page."
	

	//JUMP TO TOP BUTTON
		nameArray[10] = "jumpButton" 
		normalArray[10] = new Image
		normalArray[10].src = "../../resources/footers/jump.gif"
		dimArray[10] = new Image
		dimArray[10].src = "../../resources/footers/jump_highlite.gif"
		blurbArray[10] = "Jump to the top of the page."


	//ZOOM BUTTON
		nameArray[11] = "zoomButton" 
		normalArray[11] = new Image
		normalArray[11].src = "../../resources/buttons/zoom_btn.gif"
		dimArray[11] = new Image
		dimArray[11].src = "../../resources/buttons/zoom_btn_highlite.gif"
		blurbArray[11] = "Open an enlarged view of the main chest radiograph."

	//NOTES BUTTON
		nameArray[12] = "notesButton" 
		normalArray[12] = new Image
		normalArray[12].src = "../../resources/buttons/notes_btn.gif"
		dimArray[12] = new Image
		dimArray[12].src = "../../resources/buttons/notes_btn_highlite.gif"
		blurbArray[12] = "Open notes or comments on this case."



	//LATERAL RADIOGRAPHS
		nameArray[13] = "lateralRadiograph" 
		normalArray[13] = new Image
		normalArray[13].src = "../../resources/buttons/lateral_radiograph.gif"
		dimArray[13] = new Image
		dimArray[13].src = "../../resources/buttons/lateral_radiograph_h.gif"
		blurbArray[13] = "Show additional radiograph for this case."
	

	//COMPUTED TOMOGRAPHY
		nameArray[14] = "computedTomography" 
		normalArray[14] = new Image
		normalArray[14].src = "../../resources/buttons/comp_tomography.gif"
		dimArray[14] = new Image
		dimArray[14].src = "../../resources/buttons/comp_tomography_h.gif"
		blurbArray[14] = "Show CT images for this case."

	//MAGNETIC RESONANCE
		nameArray[15] = "magneticResonance" 
		normalArray[15] = new Image
		normalArray[15].src = "../../resources/buttons/magnetic_resonance.gif"
		dimArray[15] = new Image
		dimArray[15].src = "../../resources/buttons/magnetic_resonance_h.gif"
		blurbArray[15] = "Show MRI images for this case."

	//ECHO_LPLA
		nameArray[16] = "echoLPLA" 
		normalArray[16] = new Image
		normalArray[16].src = "../../resources/buttons/echo_lpla.gif"
		dimArray[16] = new Image
		dimArray[16].src = "../../resources/buttons/echo_lpla_h.gif"
		blurbArray[16] = "Play left parasternal long axis echocardiogram."
		
	//ECHO_SA
		nameArray[17] = "echoSA" 
		normalArray[17] = new Image
		normalArray[17].src = "../../resources/buttons/echo_sa.gif"
		dimArray[17] = new Image
		dimArray[17].src = "../../resources/buttons/echo_sa_h.gif"
		blurbArray[17] = "Play LV short axis echocardiogram."
		
	//RADIOGRAPH - NORMAL FEMALE 1
		nameArray[18] = "normalFemale1" 
		normalArray[18] = new Image
		normalArray[18].src = "radiographs/normal_female_1.gif"
		dimArray[18] = new Image
		dimArray[18].src = "radiographs/normal_female_1L.gif"
		blurbArray[18] = "Click to open zoom window."
		
	//BREAST ANATOMY
		nameArray[19] = "breast_anatomy" 
		normalArray[19] = new Image
		normalArray[19].src = "graphics/breast_anatomy.gif"
		dimArray[19] = new Image
		dimArray[19].src = "graphics/breast_anatomy_lab.gif"
		blurbArray[19] = "Normal anatomy of the breast."
		
	//BREAST ANATOMY
		nameArray[20] = "mammogram" 
		normalArray[20] = new Image
		normalArray[20].src = "../../resources/buttons/mammogram.gif"
		dimArray[20] = new Image
		dimArray[20].src = "../../resources/buttons/mammogram_h.gif"
		blurbArray[20] = "Normal anatomy of the breast."
		
	//REFERENCE IMAGE
		nameArray[21] = "referenceImage" 
		normalArray[21] = new Image
		normalArray[21].src = "../../resources/buttons/reference_image.gif"
		dimArray[21] = new Image
		dimArray[21].src = "../../resources/buttons/reference_image_h.gif"
		blurbArray[21] = "Opens a reference image window."
		
	//	OBLIQUE VIEW OF HEART ANATOMY
		nameArray[22] = "oblique_heart_anatomy" 
		normalArray[22] = new Image
		normalArray[22].src = "graphics/oblique_heart.gif"
		dimArray[22] = new Image
		dimArray[22].src = "graphics/oblique_heart_labelled.gif"
		blurbArray[22] = "Gross anatomy of the heart, oblique view."
		
	//	CORONAL SECTION OF THE CHEST
		nameArray[23] = "coronal_anatomy" 
		normalArray[23] = new Image
		normalArray[23].src = "graphics/coronal_section.jpg"
		dimArray[23] = new Image
		dimArray[23].src = "graphics/coronal_section_labelled.jpg"
		blurbArray[23] = "Gross anatomy of the chest, coronal section."
		
	//	GROSS ANATOMY OF THE CHEST
		nameArray[24] = "heart_and_lungs" 
		normalArray[24] = new Image
		normalArray[24].src = "graphics/heart_and_lungs.jpg"
		dimArray[24] = new Image
		dimArray[24].src = "graphics/heart_and_lungs_labelled.jpg"
		blurbArray[24] = "Gross anatomy of the thorax and mediastinum."
		
	//	GROSS ANATOMY OF THE HEART
		nameArray[25] = "heart_anatomy" 
		normalArray[25] = new Image
		normalArray[25].src = "graphics/heart_anatomy.jpg"
		dimArray[25] = new Image
		dimArray[25].src = "graphics/heart_anatomy_labelled.jpg"
		blurbArray[25] = "Gross anatomy of the heart."
		
	//	GROSS ANATOMY OF THE HEART
		nameArray[26] = "coronary_territories" 
		normalArray[26] = new Image
		normalArray[26].src = "graphics/coronary_territories.jpg"
		dimArray[26] = new Image
		dimArray[26].src = "graphics/coronary_terr_labelled.jpg"
		blurbArray[26] = "Coronary territories of the left ventricle."
		
	//	HEART IN RADIOGRAPHS
		nameArray[27] = "heart_in_radiograph" 
		normalArray[27] = new Image
		normalArray[27].src = "graphics/heart_in_radiographs.gif"
		dimArray[27] = new Image
		dimArray[27].src = "graphics/heart_in_radiographs_label.gif"
		blurbArray[27] = "The cardiac silhouette in radiographs."
		
	//	CASE MAIN RADIOGRAPH ROLL-OVER
		nameArray[28] = "caseImage" 
		normalArray[28] = new Image
		normalArray[28].src = "graphics/rad1.gif"
		dimArray[28] = new Image
		dimArray[28].src = "graphics/rad2.gif"
		blurbArray[28] = ""
		
	//	ANATOMY MAIN GRAPHIC ROLL-OVER
		nameArray[29] = "mainImage" 
		normalArray[29] = new Image
		normalArray[29].src = "graphics/unlabelled.gif"
		dimArray[29] = new Image
		dimArray[29].src = "graphics/labelled.gif"
		blurbArray[29] = ""
		
	//	BUTTON ROLL-OVER
		nameArray[30] = "cardiacAnatomy" 
		normalArray[30] = new Image
		normalArray[30].src = "../../resources/buttons/cardiac_anatomy.gif"
		dimArray[30] = new Image
		dimArray[30].src = "../../resources/buttons/cardiac_anatomy_h.gif"
		blurbArray[30] = "Open 3D heart model animation."
		
	//	BUTTON ROLL-OVER
		nameArray[31] = "coronaryTerritories" 
		normalArray[31] = new Image
		normalArray[31].src = "../../resources/buttons/coronary_territories.gif"
		dimArray[31] = new Image
		dimArray[31].src = "../../resources/buttons/coronary_territories_h.gif"
		blurbArray[31] = "Open 3D heart model animation."
		
	//LATERAL RADIOGRAPH 2
		nameArray[32] = "lateralRadiograph2" 
		normalArray[32] = new Image
		normalArray[32].src = "../../resources/buttons/lateral_radiograph.gif"
		dimArray[32] = new Image
		dimArray[32].src = "../../resources/buttons/lateral_radiograph_h.gif"
		blurbArray[32] = "Show additional radiograph for this case."
		
	//PA RADIOGRAPH
		nameArray[33] = "paRadiograph" 
		normalArray[33] = new Image
		normalArray[33].src = "../../resources/buttons/pa_radiograph.gif"
		dimArray[33] = new Image
		dimArray[33].src = "../../resources/buttons/pa_radiograph_h.gif"
		blurbArray[33] = "Show PA radiograph for this case."
		
	//POST RADIOGRAPH
		nameArray[34] = "postRadiograph" 
		normalArray[34] = new Image
		normalArray[34].src = "../../resources/buttons/radiograph_post.gif"
		dimArray[34] = new Image
		dimArray[34].src = "../../resources/buttons/radiograph_post_h.gif"
		blurbArray[34] = "Show follow-up radiograph for this case."
		
	//ANGIOGRAM
		nameArray[35] = "angiogram" 
		normalArray[35] = new Image
		normalArray[35].src = "../../resources/buttons/angiogram.gif"
		dimArray[35] = new Image
		dimArray[35].src = "../../resources/buttons/angiogram_h.gif"
		blurbArray[35] = "Show angiogram for this case."
		
	//NUCLEAR PLANAR
		nameArray[36] = "planar" 
		normalArray[36] = new Image
		normalArray[36].src = "../../resources/buttons/nuclear_planar.gif"
		dimArray[36] = new Image
		dimArray[36].src = "../../resources/buttons/nuclear_planar_h.gif"
		blurbArray[36] = "Show planar nuclear study for this case."
		
	//VENTILATION
		nameArray[37] = "ventilation" 
		normalArray[37] = new Image
		normalArray[37].src = "../../resources/buttons/nuclear_ventilation.gif"
		dimArray[37] = new Image
		dimArray[37].src = "../../resources/buttons/nuclear_ventilation_h.gif"
		blurbArray[37] = "Show ventilation nuclear study for this case."
		
	//PERFUSION, LUNG
		nameArray[38] = "perfusion" 
		normalArray[38] = new Image
		normalArray[38].src = "../../resources/buttons/nuclear_perfusion.gif"
		dimArray[38] = new Image
		dimArray[38].src = "../../resources/buttons/nuclear_perfusion_h.gif"
		blurbArray[38] = "Show nuclear lung perfusion study for this case."
		
	//NUCLEAR ANGIOGRAM (ERNA)
		nameArray[39] = "erna" 
		normalArray[39] = new Image
		normalArray[39].src = "../../resources/buttons/erna.gif"
		dimArray[39] = new Image
		dimArray[39].src = "../../resources/buttons/erna_h.gif"
		blurbArray[39] = "Show nuclear angiography study for this case."
		
	//MOTION MRI
		nameArray[40] = "motion_mri" 
		normalArray[40] = new Image
		normalArray[40].src = "../../resources/buttons/motion_mri.gif"
		dimArray[40] = new Image
		dimArray[40].src = "../../resources/buttons/motion_mri_h.gif"
		blurbArray[40] = "Show motion MRI study for this case."
		
	//ECHO APICAL 2 CHAMBER
		nameArray[41] = "echo_a2c" 
		normalArray[41] = new Image
		normalArray[41].src = "../../resources/buttons/echo_a2c.gif"
		dimArray[41] = new Image
		dimArray[41].src = "../../resources/buttons/echo_a2c_h.gif"
		blurbArray[41] = "Show motion MRI study for this case."
		
	//MOTION MRI 2
		nameArray[42] = "motion_mri2" 
		normalArray[42] = new Image
		normalArray[42].src = "../../resources/buttons/motion_mri.gif"
		dimArray[42] = new Image
		dimArray[42].src = "../../resources/buttons/motion_mri_h.gif"
		blurbArray[42] = "Show motion MRI study for this case."
		
	//MOTION MRI 3
		nameArray[43] = "motion_mri3" 
		normalArray[43] = new Image
		normalArray[43].src = "../../resources/buttons/motion_mri.gif"
		dimArray[43] = new Image
		dimArray[43].src = "../../resources/buttons/motion_mri_h.gif"
		blurbArray[43] = "Show motion MRI study for this case."
		
	//NORMAL PA FILM
		nameArray[44] = "normalPAfilm" 
		normalArray[44] = new Image
		normalArray[44].src = "../../resources/buttons/normal_pa_film.gif"
		dimArray[44] = new Image
		dimArray[44].src = "../../resources/buttons/normal_pa_film_h.gif"
		blurbArray[44] = "Show normal PA film as a reference."
		
	//HEART SPECIMEN SCREENS
		nameArray[45] = "cardiacSpecimen" 
		normalArray[45] = new Image
		normalArray[45].src = "graphics/plainImage.jpg"
		dimArray[45] = new Image
		dimArray[45].src = "graphics/labelledImage.jpg"
		blurbArray[45] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[46] = "lca_pa_angiogram" 
		normalArray[46] = new Image
		normalArray[46].src = "../../resources/buttons/lca_pa_angiogram.gif"
		dimArray[46] = new Image
		dimArray[46].src = "../../resources/buttons/lca_pa_angiogram_h.gif"
		blurbArray[46] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[47] = "rca_pa_angiogram" 
		normalArray[47] = new Image
		normalArray[47].src = "../../resources/buttons/rca_pa_angiogram.gif"
		dimArray[47] = new Image
		dimArray[47].src = "../../resources/buttons/rca_pa_angiogram_h.gif"
		blurbArray[47] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[48] = "lca_lao_angiogram" 
		normalArray[48] = new Image
		normalArray[48].src = "../../resources/buttons/lca_lao_angiogram.gif"
		dimArray[48] = new Image
		dimArray[48].src = "../../resources/buttons/lca_lao_angiogram_h.gif"
		blurbArray[48] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[49] = "rca_rao_angiogram" 
		normalArray[49] = new Image
		normalArray[49].src = "../../resources/buttons/rca_rao_angiogram.gif"
		dimArray[49] = new Image
		dimArray[49].src = "../../resources/buttons/rca_rao_angiogram_h.gif"
		blurbArray[49] = ""
		
	//VENTRICULOGRAM BUTTON
		nameArray[50] = "left_ventriculogram" 
		normalArray[50] = new Image
		normalArray[50].src = "../../resources/buttons/left_ventriculogram.gif"
		dimArray[50] = new Image
		dimArray[50].src = "../../resources/buttons/left_ventriculogram_h.gif"
		blurbArray[50] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[51] = "pre_angiogram" 
		normalArray[51] = new Image
		normalArray[51].src = "../../resources/buttons/pre_angiogram.gif"
		dimArray[51] = new Image
		dimArray[51].src = "../../resources/buttons/pre_angiogram_h.gif"
		blurbArray[51] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[52] = "post_angiogram" 
		normalArray[52] = new Image
		normalArray[52].src = "../../resources/buttons/post_angiogram.gif"
		dimArray[52] = new Image
		dimArray[52].src = "../../resources/buttons/post_angiogram_h.gif"
		blurbArray[52] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[53] = "rca_clot_angio1" 
		normalArray[53] = new Image
		normalArray[53].src = "../../resources/buttons/rca_clot_angio1.gif"
		dimArray[53] = new Image
		dimArray[53].src = "../../resources/buttons/rca_clot_angio1_h.gif"
		blurbArray[53] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[54] = "rca_clot_angio2" 
		normalArray[54] = new Image
		normalArray[54].src = "../../resources/buttons/rca_clot_angio2.gif"
		dimArray[54] = new Image
		dimArray[54].src = "../../resources/buttons/rca_clot_angio2_h.gif"
		blurbArray[54] = ""
		
	//ANGIOGRAPHY BUTTON
		nameArray[55] = "rca_clot_angio3" 
		normalArray[55] = new Image
		normalArray[55].src = "../../resources/buttons/rca_clot_angio3.gif"
		dimArray[55] = new Image
		dimArray[55].src = "../../resources/buttons/rca_clot_angio3_h.gif"
		blurbArray[55] = ""
		
	//ANIMATION BUTTON
		nameArray[56] = "animation" 
		normalArray[56] = new Image
		normalArray[56].src = "../../resources/buttons/animation.gif"
		dimArray[56] = new Image
		dimArray[56].src = "../../resources/buttons/animation_h.gif"
		blurbArray[56] = ""
		
}

var numImages = 57;
var normalArray = new Array();
var dimArray = new Array();
var blurbArray = new Array();
var nameArray = new Array();

initImages();
