glow.ready(function() {

	glow.dom.get(".emp-container").css("display", "block");

	// Build carousel, #heroesEpisodes is the id of the containing ul  
	lastchoir_carousel = new Carousel('.carousel', {  
		loop: false // We pass in this option to stop the carousel looping  
	});

	// Build back and forth buttons  
	glow.dom.get('.carousel').before("<a class='caroursel-previous' href='javascript:lastchoir_carousel.move(1)'><span>previous</span></a>");  
	glow.dom.get('.carousel').after("<a class='caroursel-next' href='javascript:lastchoir_carousel.move(-1)'><span>next</span></a>");   			

	glow.events.addListener(lastchoir_carousel, 'canDoPrevious', function () {
		glow.dom.get(".caroursel-previous").removeClass("inactive").css("opacity", 1);
	});  

	glow.events.addListener(lastchoir_carousel, 'canDoNext', function () {
		glow.dom.get(".caroursel-next").removeClass("inactive").css("opacity", 1);
	});                            

	// Can't do Next / Previous add class "incative" to button  
	glow.events.addListener(lastchoir_carousel, 'cantDoPrevious', function () {
		glow.dom.get(".caroursel-previous").addClass("inactive").css("opacity", 0.50);
	});  

	glow.events.addListener(lastchoir_carousel, 'cantDoNext', function () {
		glow.dom.get(".caroursel-next").addClass("inactive").css("opacity", 0.50);
	});  

	// nodeLists for vid
	var vidList = glow.dom.get("ul.carousel > li a");
	var vidThumbList = glow.dom.get("ul.carousel > li img");

	// finds each contestant attaches event to links that switches vid and related description.
	// vidList.each(function (i) { 
		// var vidXML = vidList.slice(i,i+1).attr("rel");
		// var vidDesc = vidThumbList.slice(i,i+1).attr("alt");
		// glow.events.addListener(vidList.slice(i,i+1),'click', function(e) {
			// if (vidXML != null) {
			// 	siteEmp.play({ playlist_url: vidXML + ".xml", domId: "empbox", mode: "standard" });
				// glow.dom.get('#vid-desc').after('<div id="vid-desc"><p><strong>You selected:</strong> ' + vidDesc + '</p></div>').remove();
			// } else {
			 //	alert("Sorry this video is not available as the rel attribute was not set");
			// }
		//	e.preventDefault(); 
		// } );
	// } );		

	// Set up items events mouseout/over  
	var items = lastchoir_carousel.getItems();
	items.each(function(i) {  
		// Set all items opacity to 55%%  
		glow.dom.get(this).css("opacity", "0.55");                            
		glow.events.addListener(glow.dom.get(this), 'mouseout', function() {  
			glow.anim.css(glow.dom.get(this), 0.15, {"opacity" : {to:0.55}}).start();
		}, this );  
		glow.events.addListener( glow.dom.get(this), 'mouseover', function() {
			glow.anim.css(glow.dom.get(this), 0.15, {"opacity" : {to:1}}).start();  
		}, this );                
	}); // end: items each
	
}); // glow.ready