// JavaScript Routines for Video Assessment Program

/* ----------------------------------------------------------------------------- */

// show-hide DIV layer taken from Justin Barlow's NetLobo site
// http://www.netlobo.com/div_hiding.html

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

// show-hide DIV layer taken from Justin Barlow's NetLobo site
// http://www.netlobo.com/media/examples/div_hiding_test.html

	function elemOn(elem_id){
		if(document.getElementById(elem_id))
			document.getElementById(elem_id).style.display = "block";
	}
	function elemOff(elem_id){
		if(document.getElementById(elem_id))
			document.getElementById(elem_id).style.display = "none";
	}
	function hideAll(){
		document.getElementById('tutorialdirections').style.display = "none";
		for( var i = 1; i <= 8; i++ )
			elemOff( 'focalpoint'+i );
	}
	function showAll(){
		for( var i = 1; i <= 8; i++ )
			elemOn( 'focalpoint'+i );
	}
	function showOne(elem_id){
		hideAll( );
		elemOn( elem_id );
	}

// from support page for Jeroen Wijering's Media Players
// http://home5.inet.tele.dk/nyboe/flash/mediaplayer/linkplaylist.htm

	function createplayer(theFile, go) {
		var s = new SWFObject("../../flvplayer_dutch.swf","thePlayerId","480","360","7");
		s.addParam("allowfullscreen","true");
		s.addVariable("file",theFile);
		s.addVariable("width","480");
		s.addVariable("height","360");
		s.addVariable("shuffle","false");
		s.addVariable("displayheight","320");
		s.addVariable("overstretch","fit"); // original value was 'fit'
		s.addVariable("backcolor","0x000000");
		s.addVariable("frontcolor","0xfdfdf2");
		s.addVariable("lightcolor","0xFF9933");
		s.addVariable("autoscroll","true");
		s.addVariable("showicons","false");
		//s.addVariable("rotatetime","60");
		if (go) { s.addVariable("autostart","false"); }
		s.write("videoframe");
}

/* ----------------------------------------------------------------------------- */
