$(document).ready(function() {
	var index = 0, hash = window.location.hash;
	if (hash) {
		index = hash.split("#cs")[1];
		index = parseInt(index) - 1; // slides are zero-based
	}
	$('#csSlideshow').cycle({ 
	    fx:     'scrollHorz', 
	    speed:  500, 
	    timeout: 0,
	    pager:  '#csNav', 
	    startingSlide:index,
		pagerAnchorBuilder: function(idx, slide) { 
	        // return selector string for existing anchor 
	        return '#csNav li:eq(' + idx + ') a'; 
	    }
	});

	$('#csNav li').eq(index).attr("id","csActive");
	
	$('#csNav li a').click(function() {
		$('#csNav li[id*="csActive"]').removeAttr("id");
		$(this).parent().attr("id","csActive");
    });
});
