Changer = function(images, container){
	this.images = images
	this.container = container
	this.currentIndex = 0
	this.change()
}
Changer.prototype.change = function(){
	
	makeSwitch = function(s){
		return function(){
			s.currentIndex++
			$("a", s.container).attr("href", s.images[s.currentIndex % s.images.length].href)
			$("img", s.container).attr("src", s.images[s.currentIndex % s.images.length].src)
			s.container.fadeTo(200, 1)
		}
	}
	this.container.fadeTo(200, .1, makeSwitch(this))
}
$(document).ready(function(){
	//switcher1 = new Changer([
			//{
			//	src: "images/product/ads/M20_platinum.png",
			//	href: "products/m20-airwave-suspension"
			//}
		//],
		//$("#ad_switcher_1")
	//)
	//setInterval(function(){switcher1.change()}, 7500)
	switcher2a = new Changer([
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/airwave.jpg",
				href: "products/m20-airwave-suspension"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/M10_SS.sale.png",
				href: "documents/M-10%20SS%20RELEASE%20BLACK.pdf"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/RAV-TEK.jpg",
				href: "documents/RAV-TEK%20Kits%20%20PRODUCTS%20WEB%20.%20091410BLKNEW.pdf"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/spyder.jpg",
				href: "products/spyder-airwave-suspension"
			}
		],
		$("#ad_switcher_2a")
	)
	setInterval(function(){switcher2a.change()}, 8000)
	
	switcher2b = new Changer([
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/airwave.jpg",
				href: "products/m20-airwave-suspension"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/dive_tek_1_2012.jpg",
				href: "products/divetek"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/M10_SS.sale.png",
				href: "documents/M-10%20SS%20RELEASE%20BLACK.pdf"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/RAV-TEK.jpg",
				href: "documents/RAV-TEK%20Kits%20%20PRODUCTS%20WEB%20.%20091410BLKNEW.pdf"
			},
			{
				src: "images/product/ads/air_shock_sale.jpg",
				href: "store"
			},
			{
				src: "images/product/ads/spyder_left_ad.jpg",
				href: "products/spyder-airwave-suspension"
			}
		],
		$("#ad_switcher_2b")
	)
	setInterval(function(){switcher2b.change()}, 8000)
	
		switcher3 = new Changer([
			{
				src: "images/product/ads/bumptrack/susp_comp.jpg",
				href: "news/suspension-comparison-videos"
			},
		
			{
				src: "images/product/ads/m-20.jpg",
				href: "products/m20-platinum-spec"
			},

			{
				src: "images/product/ads/dive-tek.jpg",
				href: "products/divetek"
			}

		],
	 $("#ad_switcher_3")
	)
	setInterval(function(){switcher3.change()}, 8000)
});






