var ssSrc = [
	'gallery/001.jpg',
	'gallery/002.jpg',
	'gallery/003.jpg',
	'gallery/004.jpg',
	'gallery/005.jpg',
	'gallery/006.jpg',
	'gallery/007.jpg',
	'gallery/008.jpg',
	'gallery/009.jpg',
	'gallery/010.jpg',
	'gallery/011.jpg',
	'gallery/012.jpg',
	'gallery/013.jpg',
	'gallery/014.jpg'


];

var ss = {
	cp  : 0,
	len : ssSrc.length - 1,
	n : function() {
		this.cp = (this.cp >= this.len) ? 0 : this.cp + 1;
		this.l(1);
	},	
	p : function() {
		this.cp = (this.cp == 0) ? this.len : this.cp - 1;
		this.l(0);
	},
	l : function (d) {
		
		document.getElementById('ssfullsize').href = ssSrc[this.cp];
		document.getElementById('ssimg').src = ssSrc[this.cp];
		document.getElementById('ssimg').alt = 'Tough Angels ' + (this.cp + 1);		
		document.getElementById('sspos').innerHTML = (this.cp + 1) + '/' + (this.len + 1);
		/* Preload the next image */
		if(d === 1 && this.cp < this.len) {
			img = new Image();
			img.src = ssSrc[this.cp + 1];
		} else if(d === 0 && this.cp > 0) {
			img = new Image();
			img.src = ssSrc[this.cp - 1];
		}
		showimage (ssSrc[this.cp]);
	}
}
	   
document.onkeydown  = KeyCheck;       
function KeyCheck(e)
{
   switch(e.keyCode)
   {
      case 37:
      ss.p();
      break;
      case 39:
      ss.n();
      break;
   }
}
