// Javascript for joshuadnelson.com
//
// By Joshua David Nelson, Copyright 2001 to Present
//
// All code not by Joshua David Nelson
// Is subject to open source copyrights
// Some of this code has been gathered
// from the internet over a long period
// and the original authors lost
// my apologies to them
// I do not take credit for any of it
// and many thanks!
//
 
// Random Image/Slideshow Code

var imgnum = 5 ;
var randnum = Math.random() ;
var random1 = Math.round( (imgnum-1) * randnum) + 1 ;
var i = random1
images = new Array
images[1] = "http://joshuadnelson.com/files/images/1.jpg"
images[2] = "http://joshuadnelson.com/files/images/2.jpg"
images[3] = "http://joshuadnelson.com/files/images/5.jpg"
images[4] = "http://joshuadnelson.com/files/images/6.jpg"
images[5] = "http://joshuadnelson.com/files/images/11.jpg"
 
alttext = new Array
alttext[1] = "NYC Central Park"
alttext[2] = "Breitenbush Forest"
alttext[3] = "Alaska"
alttext[4] = "Alaska"
alttext[5] = "Breitenbush"
 
function imgset(){
  document.image1.src = images[i]
  document.image1.alt = alttext[i]
};
 
function previmg(){
	if (i != 1){
		document.image1.src = images[i-1]
		document.image1.alt = alttext[i-1]
		i--
	} else
	if (i = 1){
  i = imgnum
	 document.image1.src = images[i]
  document.image1.alt = alttext[i]
 }
};
 
function nextimg(){
 if (i != imgnum){
		document.image1.src = images[i+1]
		document.image1.alt = alttext[i+1]
		i++
	} else
	if (i = imgnum){
  i = 1
  document.image1.src = images[i]
  document.image1.alt = alttext[i]
 }
};
 
function randimg(){
  var rannum = Math.random() ;
  var random2 = Math.round( (imgnum-1) * rannum) + 1 ;
  document.image1.src = images[random2]
  document.image1.alt = alttext[random2]
};

