/*************************************************************************
* 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/labels/contents_gray.gif"
		dimArray[0] = new Image
		dimArray[0].src = "../resources/labels/contents_yellow.gif"
		blurbArray[0] = "Go to Contents listings."

	//VIEWS LABEL
		nameArray[1] = "views" 
		normalArray[1] = new Image
		normalArray[1].src = "../resources/labels/views_gray.gif"
		dimArray[1] = new Image
		dimArray[1].src = "../resources/labels/views_yellow.gif"
		blurbArray[1] = "Normal view planes and anatomy."
		
	//ENTITIES LABEL
		nameArray[2] = "entities" 
		normalArray[2] = new Image
		normalArray[2].src = "../resources/labels/entities_gray.gif"
		dimArray[2] = new Image
		dimArray[2].src = "../resources/labels/entities_yellow.gif"
		blurbArray[2] = "Go to Disease entities section."
		
	//REFERENCES LABEL
		nameArray[3] = "references" 
		normalArray[3] = new Image
		normalArray[3].src = "../resources/labels/references_gray.gif"
		dimArray[3] = new Image
		dimArray[3].src = "../resources/labels/references_yellow.gif"
		blurbArray[3] = "Go to the References section."
	

	//PREV BUTTON
		nameArray[4] = "prev" 
		normalArray[4] = new Image
		normalArray[4].src = "../resources/buttons/prev.gif"
		dimArray[4] = new Image
		dimArray[4].src = "../resources/buttons/prev_highlite.gif"
		blurbArray[4] = "Click here to move to the previous page."

	//NEXT BUTTON
		nameArray[5] = "next" 
		normalArray[5] = new Image
		normalArray[5].src = "../resources/buttons/next.gif"
		dimArray[5] = new Image
		dimArray[5].src = "../resources/buttons/next_highlite.gif"
		blurbArray[5] = "Click here to move to the next page."
		
		
		
	//FOOTER CONTENTS LABEL
		nameArray[6] = "contents_footer" 
		normalArray[6] = new Image
		normalArray[6].src = "../resources/footers/contents_footer.gif"
		dimArray[6] = new Image
		dimArray[6].src = "../resources/footers/contents_footer_h.gif"
		blurbArray[6] = "Go to the Contents listings."

	//FOOTER VIEWS LABEL
		nameArray[7] = "views_footer" 
		normalArray[7] = new Image
		normalArray[7].src = "../resources/footers/views_footer.gif"
		dimArray[7] = new Image
		dimArray[7].src = "../resources/footers/views_footer_h.gif"
		blurbArray[7] = "Normal view planes and anatomy."
		
	//FOOTER ENTITIES LABEL
		nameArray[8] = "entities_footer" 
		normalArray[8] = new Image
		normalArray[8].src = "../resources/footers/entities_footer.gif"
		dimArray[8] = new Image
		dimArray[8].src = "../resources/footers/entities_footer_h.gif"
		blurbArray[8] = "Go to the Disease entities section."
		
	//FOOTER REFERENCES LABEL
		nameArray[9] = "references_footer" 
		normalArray[9] = new Image
		normalArray[9].src = "../resources/footers/references_footer.gif"
		dimArray[9] = new Image
		dimArray[9].src = "../resources/footers/references_footer_h.gif"
		blurbArray[9] = "Go to the References section."
	

	//FOOTER PREV BUTTON
		nameArray[10] = "prev_footer" 
		normalArray[10] = new Image
		normalArray[10].src = "../resources/footers/prev.gif"
		dimArray[10] = new Image
		dimArray[10].src = "../resources/footers/prev_highlite.gif"
		blurbArray[10] = "Click here to move to the previous page."

	//FOOTER NEXT BUTTON
		nameArray[11] = "next_footer" 
		normalArray[11] = new Image
		normalArray[11].src = "../resources/footers/next.gif"
		dimArray[11] = new Image
		dimArray[11].src = "../resources/footers/next_highlite.gif"
		blurbArray[11] = "Click here to move to the next page."

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



	//VIDEO EXAMPLE ONE BUTTON
		nameArray[13] = "exampleButton1" 
		normalArray[13] = new Image
		normalArray[13].src = "../resources/buttons/btn_view_example_1.gif"
		dimArray[13] = new Image
		dimArray[13].src = "../resources/buttons/btn_view_example_1h.gif"
		blurbArray[13] = "Play the first example video."
	

	//VIDEO EXAMPLE TWO BUTTON
		nameArray[14] = "exampleButton2" 
		normalArray[14] = new Image
		normalArray[14].src = "../resources/buttons/btn_view_example_2.gif"
		dimArray[14] = new Image
		dimArray[14].src = "../resources/buttons/btn_view_example_2h.gif"
		blurbArray[14] = "Play the second example video."

	//ANIMATION BUTTON
		nameArray[15] = "animationButton" 
		normalArray[15] = new Image
		normalArray[15].src = "../resources/buttons/btn_animation.gif"
		dimArray[15] = new Image
		dimArray[15].src = "../resources/buttons/btn_animation_h.gif"
		blurbArray[15] = "Play an animation video."

	//3D VIEW BUTTON
		nameArray[16] = "3dButton" 
		normalArray[16] = new Image
		normalArray[16].src = "../resources/buttons/btn_3d_viewplane.gif"
		dimArray[16] = new Image
		dimArray[16].src = "../resources/buttons/btn_3d_viewplane_h.gif"
		blurbArray[16] = "Show a 3D model of the echo view plane."	
			
	//VIDEO EXAMPLE THREE BUTTON
		nameArray[17] = "exampleButton3" 
		normalArray[17] = new Image
		normalArray[17].src = "../resources/buttons/btn_view_example_3.gif"
		dimArray[17] = new Image
		dimArray[17].src = "../resources/buttons/btn_view_example_3h.gif"
		blurbArray[17] = "Play the third example video."

}



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

initImages();
