﻿
 function prev()
 {
 	$sid = getSid();
 	$tid = getTid();
 	$location = getLocation();
 	
 	if ($sid == 1) {
 	
		$newsid = 51; $newtid = 51;
		$('.thumbs ul').css('margin-left',endReel+'px');
	}
	else {
		
		$newsid = $sid-1;$newtid = $tid-1;
		
		if ( $location <= -thumbNavWidth) {
			
			$new_location = $location + thumbNavWidth ;
			$('.thumbs ul').css('margin-left',$new_location+'px');
			
		} else {/* do nothing */}
	}
 }
 
 function next()
 {
 	
 	$sid = getSid();
 	$tid = getTid();
 	$location = getLocation();

 	if ($sid == 51) {
		$newsid = 1; $newtid = 1;
		$('.thumbs ul').css('margin-left','0px');
	} 
	else {
		$newsid = $sid+1; $newtid = $tid+1;
		
		if ( $location > endReel) {
			$new_location = $location - thumbNavWidth ;
			$('.thumbs ul').css('margin-left',$new_location+'px');
		
		} else {/* do nothing */}
	}
 }
 
 // obsolete, since next is the same, and more refined ?
 function slide()
 {
 	$sid = getSid();
 	$tid = getTid();
 	$location = getLocation();
 	
 	$newsid = $sid + 1;
	$newtid = $tid + 1;
	
	if ($location > endReel) {
				
		//alert('pos not -1344 yet');
				
		$new_location = $location - thumbNavWidth ;
		$('.thumbs ul').css('margin-left',$new_location+'px');
	}
	
	else {
		
		if ($location == endReel) {
		
			if ($newsid < 52) {
				
			}
		
			else {
				
				//alert ('time to reset');
				
				$new_location = 0 ;
				$newsid = 1;
				$newtid = 1;
				$('.thumbs ul').css('margin-left',$new_location+'px');
			}
		}
	}
 }
 
 function update()
 {
 	$('.slide').parent('li').removeClass('on').removeAttr('style'); // remove style attr because the slide show's opacity adds in some bad display properties
	$('#s'+$newsid).parent('li').addClass('on');
		
	$('.thumb').removeClass('on');
	$('#t'+$newtid).addClass('on');
 }

