//Javascript for Xylem Homepage SlideShow


var SlideShow = 
{
	
 init: function()
 {
	SlideShow.timer = 5; //This is the time in seconds between each slide

	SlideShow.slideFrame = document.getElementById("slide-frame");

	SlideShow.imageInfo = [ 

["xylem-custom-bass-collage-2", "Xylem custom basses and guitars with exotic designs, woods and pickups"],

["custom-bass-shishido-index", "Xylem short scale bass with Xylem signature ball scroll"],

["custom-bass-borysthenis-index-2", "Ebony fretboard with fall leaf inlays of a 5 string custom bass guitar"],

["custom-bass-sanjuro-index", "6 string Xylem custom bass with dual scrolls and blood wood top"],

["custom-guitar-aurelia-index", "Xylem mahogany custom guitar with a flamed maple top"],

["custom-guitar-vera-index", "Brazilian cherry custom guitar body with Seymour Duncan pickups"],

["custom-bass-odessa-index", "A Xylem lefty custom bass guitar from the bottom showing Nordstrand pickups, East UK preamp and bridge from a low angle"],

["custom-bass-borysthenis-index", "Scroll, fretboard inlays and ebony-covered neck pickup of a custom bass guitar"], 

["custom-guitar-cephisso-index", "Highlight of a black limba 7 string custom guitar's contour"],

["custom-guitar-cephisso-index-2", "Upper bout of a black limba 7 string guitar with Hipshot bridge in the background"] ];

	SlideShow.counter = 0;

	SlideShow.startSlides();

	
 },


startSlides: function()

	{
	  setTimeout("SlideShow.advanceSlide()", SlideShow.timer * 1000);
	 	    

	},

advanceSlide: function()
  {	

	if (SlideShow.counter < SlideShow.imageInfo.length - 1)
		 {
	        SlideShow.counter++;	
		  SlideShow.nextSlide = new Image();
		  SlideShow.nextSlide.src = SlideShow.imageInfo[SlideShow.counter][0] + ".jpg";
		  SlideShow.nextSlide.alt = SlideShow.imageInfo[SlideShow.counter][1];	

		  Core.addEventListener(SlideShow.nextSlide, "load", SlideShow.slideTimer);
	
		
		 }

	else  
		 {

		  SlideShow.advanceSlideLoaded();
		  SlideShow.counter = 0;
		  
		 }

	
	
			
  },

slideTimer: function ()
	{

	  SlideShow.slideFrame.src = SlideShow.nextSlide.src;
	  SlideShow.slideFrame.alt = SlideShow.nextSlide.alt;
	  setTimeout("SlideShow.advanceSlide()", SlideShow.timer * 1000);

	},

advanceSlideLoaded: function ()
	{
	  if (SlideShow.counter < SlideShow.imageInfo.length - 1)
		 {
	        SlideShow.counter++;			  
			
		 }

	else  
		 {
		  
		  SlideShow.counter = 0;
		  
		 }

	 SlideShow.nextSlide = new Image();
	 SlideShow.nextSlide.src = SlideShow.imageInfo[SlideShow.counter][0] + ".jpg";
	 SlideShow.nextSlide.alt = SlideShow.imageInfo[SlideShow.counter][1];	

	 SlideShow.slideTimerLoaded();

	},

slideTimerLoaded: function ()
	{

	  SlideShow.slideFrame.src = SlideShow.nextSlide.src;
	  SlideShow.slideFrame.alt = SlideShow.nextSlide.alt;
	  setTimeout("SlideShow.advanceSlideLoaded()", SlideShow.timer * 1000);

	}

	

};

Core.start(SlideShow);
