$(document).ready(function(){
	
	$('.slideshow-items').each(function(i){
		
		$(this).next().addClass('nav'+i);
		
		if($(this).children('li').length > 1){
			$(this).cycle({ 
				fx:     'fade', 
				speed:  'normal', 
				timeout: 0, 
				pager:  '.nav'+i, 
				pagerAnchorBuilder: function(idx, slide) { 
					// return selector string for existing anchor 
					return '.nav'+i+' li:eq(' + idx + ') a'; 
				} 
			});
		}
		else{
			$(this).children('li').show();
		}
	});
	
	$('#view-comment-policy').click(function(){
		
		if ($(this).text() == 'Hide Comment Policy')
		{
			$('#close-comment-policy').trigger('click');
		}
		else
		{
			$('#comment-policy').slideDown(300);
			$(this).text('Hide Comment Policy');
		}	
		return false;

	});

	$('#close-comment-policy').click(function(){
		
		$('#comment-policy').slideUp(300);
		$('#view-comment-policy').text('View Comment Policy');
		return false;
		
	});						   
});
