glow.ready(function(){
	// create an instance of Carousel	
	myCarousel = new Carousel("#carousel", {loop: true});
	
	// add the next and back buttons
	glow.dom.get('#carousel').before("<a id='previous' href='javascript:myCarousel.move(1)' title='previous'><span>previous</span></a>");
	glow.dom.get('#carousel').after("<a id='next' href='javascript:myCarousel.move(-1)' title='next'><span>next</span></a>");							
	
	// hightlight an item and move it to the start
	function showSelected(pos){
		myCarousel.addClass(pos , "highlight");
		myCarousel.moveTo(pos , 0, {anim:false});
	}
	
	// check the url and show the relevent item
	var url = window.location.href;		
	if (url.indexOf("/nancy/index.shtml")>0){
		showSelected(0)
	}
	else if (url.indexOf("/nancy/amy.shtml")>0){
		showSelected(1)
	}
	else if (url.indexOf("/nancy/ashley.shtml")>0){
		showSelected(2)
	}
	else if (url.indexOf("/nancy/cleopatra.shtml")>0){
		showSelected(3)
	}
	else if (url.indexOf("/nancy/francesca.shtml")>0){
		showSelected(4)
	}
	else if (url.indexOf("/nancy/jessie.shtml")>0){
		showSelected(5)
	}
	else if (url.indexOf("/nancy/jodie.shtml")>0){
		showSelected(6)
	}
	else if (url.indexOf("/nancy/keisha.shtml")>0){
		showSelected(7)
	}
	else if (url.indexOf("/nancy/niamh.shtml")>0){
		showSelected(8)
	}
	else if (url.indexOf("/nancy/rachel.shtml")>0){
		showSelected(9)
	}
	else if (url.indexOf("/nancy/samantha.shtml")>0){
		showSelected(10)
	}
	else if (url.indexOf("/nancy/sarah.shtml")>0){
		showSelected(11)
	}
	else if (url.indexOf("/nancy/tara.shtml")>0){
		showSelected(12)
	}	
		
});