// JavaScript Document
var defaultIndex = 0;
var procedureIndex = defaultIndex;
var regular_font_size = 10;
var selected_font_size = 10;
var current_status = "start";

function changePicture( index, url )
{
	var myIndex = 0;
	var str;
	for( j = 0 ; j < parent.procFrame.document.images.length; j++ )
	{
	
		str = parent.procFrame.document.images[j].src;
		if( 
			( str.indexOf("blank.gif") > 0 )
			||
			( str.indexOf("arrow.gif") > 0 )
		)
		{
			if( myIndex == index )
			{
				parent.procFrame.document.images[j].src = url;
				//return;
			}
			myIndex++;			
		}
	}
}



function setIndex2( index )
{
	// set the new index
	procedureIndex = index;
	//if( this.Target.document.links != null )
	try
	{
		
		parent.procFrame.focus();
		if(parent.procFrame.document.links.length > 0 )
		{
			// reset the link colors for the procedure list page
			for( i = 0; i < parent.procFrame.document.links.length; i++ )
			{
			  //this.Target.document.links[i].style.color = 0x0066CC;
			  parent.procFrame.document.links[i].style.fontSize = regular_font_size;
			  parent.procFrame.document.links[i].style.fontWeight = "normal"; 
			  //this.Target.document.links[i].style.fontWeight = "normal";
			  if( parent.procFrame.document.images.length >  0)
			  {
				//this.Target.document.images[i].src = "../../../graphics/procedure-arrows/blank.gif";
				changePicture( i, "../images/arrows/blank.gif");
			  }
			}
			// set the highlight
			//this.Target.document.links[procedureIndex-defaultIndex].style.color = selColor;
			parent.procFrame.document.links[procedureIndex-defaultIndex-1].style.fontSize = selected_font_size ;
			parent.procFrame.document.links[procedureIndex-defaultIndex-1].style.fontWeight = "bold"; 
			parent.procFrame.document.links[procedureIndex-defaultIndex-1].blur();
			if( parent.procFrame.document.images.length >  0)
			{
			  //this.Target.document.images[procedureIndex-defaultIndex].src = "../../../graphics/procedure-arrows/arrow.gif";
			  changePicture( [procedureIndex-defaultIndex-1], "../images/arrows/arrow.gif");
			}
			
			// go to the anchor
	  		//this.window.location = "#" + procedureIndex;
		}
		parent.appFrame.focus();

	}
	catch(error)
	{
	}
}

function update_status(status_string)
{
	var str1 = status_string.substring(0, 4);
	var str2 = status_string.substring(5);
	if (status_string == "applet initialized") {
		setIndex2(0);
	}

	if (status_string == "guided mode"){

	}
	if (status_string == "practice mode"){

		setIndex2(8);
	}
	
	if (str1 == "step") {

		setIndex2(str2);
	}	
}
