jQuery(document).ready(function($){  
   // all the code goes here! including functions!!!
   
	var imageRotator = $('#frontPageRotator');
	var linkRotator = $('#rotatorLink');
	var rotatorImages = ['/images/rotator/freeShipping40Ad.gif','/images/rotator/newBlogAd.gif','/images/rotator/screenfeeAd.gif']
	var rotatorLinks = ['/shop/','/blog','/custom-screen-printing'];
	var index = 0;
	var updateCSS;
	
	setInterval(function() {
		
		//imageRotator.fadeOut(0);
		updateCSS = "url(" + rotatorImages[index] + ")";
		imageRotator.css('background-image',updateCSS);
		linkRotator.attr('href', rotatorLinks[index]);
		//imageRotator.fadeIn(1000);
		//alert(linkRotator.attr('href'));
		//alert(rotatorImages[index]);
		index++;
		if (index == rotatorImages.length) {
			index = 0;
		}
		
	}, 6000);
	
	//Call the rotator function to run the slideshow, 5000 = change to next image after 5 seconds
	//setInterval('rotate()',2000);
	
});
