//Set up the product carousel
function runCarousel(index, el1) {
	hCarousel = new UI.Carousel("products", {container:".products_show"});
	$(el1).className = "section_button_selected section_button";
	hCarousel.scrollTo(index);
}
Event.observe('s1', 'click', function(event) {sectionSwitch(0, 's1', 's2');});
Event.observe('s2', 'click', function(event) {sectionSwitch(3, 's2', 's1');});
			
document.observe('carousel:scroll:ended', function(event) {
	if (hCarousel.currentIndex() >= 0 && hCarousel.currentIndex() <= 2) {
		sectionSwitch(hCarousel.currentIndex(), "s1", "s2");
	} else if (hCarousel.currentIndex() >= 3 && hCarousel.currentIndex() <= 5) {
		sectionSwitch(hCarousel.currentIndex, "s2", "s1");
	}
});
function sectionSwitch(index, el1, el2) {
	hCarousel.scrollTo(index);
	$(el1).className = "section_button_selected section_button";
	$(el2).className = "section_button";
}


