var $filename = new Array();
var $header = new Array();
var $caption = new Array();
var $aspect = new Array();
var $framerate = new Array();
var $options = new Array();
var $choice=0;
var $fullwidth=0;
var $myFramerate=1;
$i=0;
$filename[$i]='empty.jpg';
$aspect[$i]=700/1280;
$header[$i]='';
$caption[$i]='';
if (location.search.length>1) 
{
	$choice = location.search.substring(1)
}
else 
{
	$choice = "0"
}
if (document.captureEvents) document.captureEvents(Event.KEYDOWN); //KEYPRESS does not see arrows
document.onkeydown = processKeypresses; 
var $opacity=0; //0.1;   //See also pageYOffset in insertpicture
document.write('
');
document.write('
');
function backward()
{
	$fullwidth=0;
	if ($choice>1) 
	{
		$choice--
	}
	else 
	{
		$choice=$numberoffiles
	}
	insertpicture($choice)
}
function forward()
{
	$fullwidth=0;
	if ($choice<$numberoffiles) 
	{
		$choice++
	}
	else 
	{
		$choice = "1"
	}
	insertpicture($choice)
}
function processKeypresses(e) {
//alert(navigator.appName);
if(navigator.appName == "Netscape") k = e.which; // key's ASCII code (Netscape and Mozilla and Safari)
else k=event.keyCode; // key's ASCII code (IE and Opera)
//alert(k);
if (k==13) forward(); // return
if (k==27) history.back(); // esc
if (k==37) backward(); // arrow left 
//if (k==33) backward(); // clicker page up
//if (k==38) $fullwidth=1; insertpicture($choice); // arrow up CLICK ON PICTURE INSTEAD
//if (k==34) forward(); // clicker page down 
if (k==39) forward(); //  arrow right 
//if (k==40) $fullwidth=0; insertpicture($choice); // arrow down CLICK ON PICTURE INSTEAD
if (k==90) window.parent.frames['contents'].focus(); // z to move focus back to upper frame (needed when thumb show is embedded in regular show
// movie controls
if (k==32) step(0); //  space toggles play
if (k==188) step(-1); //, below <  
if (k==190) step(1); //.  below > 
if (k==191) step(0); //  below ? toggles play
if (k==219) step(-2); // [ 
if (k==221) step(2); //  ] 
if (k==32) return false; // no further action
//if (k==33) return false; // no further action
//if (k==34) return false; // no further action
}
function insertpicture(n)
{
//	window.scrollTo(0,0);  //scroll back to top of page
	$choice=n;  //remember selected file
	if (n>=0)
	{
		if (n>$numberoffiles) {n=$numberoffiles}
		for ($i=1;$i<=$numberoffiles;$i=$i+1) {document.getElementById('thumb'+$i).style.border="";}
 		if (n>0) {document.getElementById('thumb'+$choice).style.border="1px solid blue";} //hilite selected
//		www.geekpedia.com/code100_Get-window-width-and-height.html   
		var $x=0;
		var $y=0;
		
		if (self.innerHeight) // all except Explorer
		{
			$x=self.innerWidth;
			$y=self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight) //Explorer 6 strict mode
		{
			$x=document.documentElement.clientWidth;
			$y=document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			$x=document.body.clientWidth;
			$y=document.body.clientHeight;
		}
		
		$width0= $x-0.08*$x-140;  // 140 pixel left column plus 4 * 2% margins
		$y=.98*$y;
//		if($caption[n]){$y=$y-24*$caption[n].length*5/$y; if($caption[n].match("
")) {$y=$y-24;}} //adjust for text lines
    	if($header[n]) {$y=$y-48;}  //leave space for header and caption
    	if ($filename[n].match(".mp4")) {$y=$y-24;} //leave space for control bar
    	if ($filename[n].match(".mov")) {$y=$y-24;}
		if (!$options[n]) //options not set
		{
			$options[n]="";
		}
		if (!$aspect[n]>0) //aspect value not set
		{
			$aspect[n]=1;
		}
		$width=$width0;
		if ($width*$aspect[n] > $y )
		{
			$width=$y/$aspect[n];
		}
		$code=""
    	if(typeof(window.pageYOffset) == 'number') 
    	{
    		scrolltop = window.pageYOffset; 
    		if(scrolltop>0) {$code='
';}
			$code=$code+'
';
			$code=$code+'
';
    	}
		
 		$code=$code+'
  ';
				$code=$code+'Use  
  or';
				$code=$code+'  
  to change single frames, and';
				$code=$code+'  
 to play/pause.';
				$code=$code+'  
| '+($choice.split('/')[1]).split('_')[0]+' | ';
    	$code=$code+'   ';
		$code=$code+'  Use   to play/pause.';
		$code=$code+'  ![]()  |