jQuery.noConflict();     
jQuery(document).ready(function($){

	var adminView = $('#adminbar #toolbar').length;
	if (adminView) {

		// Top Tabbing Feature Admin View
		$("#arrow").hide();
		$('#featuredControls').removeClass('activeFeature');
		$('#featuredImageWrapper').before('<div id="adminFeaturedNav">').cycle({
			fx: 'scrollHorz',
			timeout: 4500,
			speed: 500,
			pager: '#adminFeaturedNav',
			cleartypeNoBg: true,
			pause: true,
		    pauseOnPagerHover: true,
			activePagerClass: 'activeFeature',				
			fastOnEvent: 250
		});
	
		// Corrections on CSS when veiwing in Admin Mode
		$('.featureController').css({
			'padding-top':'0px',
			'height':'67px',
			'overflow':'hidden'
		});
	
	}
	else {
		
		// Top Tabbing Feature		
		function currentPosition() { 
			var activePosition = $(".activeFeature").position();
			activePosition = activePosition.top + 26
			$("span#arrow").stop(true,true).animate({'top' : activePosition}, 200);
		}

		$('#featuredImageWrapper').cycle({
			fx: 'scrollHorz',
			timeout: 4500,
			speed: 500,
			pager: '#featuredControls',
			cleartypeNoBg: true,
			pause: true,
		    pauseOnPagerHover: true,
			fastOnEvent: 250,
			after: currentPosition,
			activePagerClass: 'activeFeature',
			pagerAnchorBuilder: function(idx, slide) { 
				return '#featuredControls .featureController:eq(' + idx + ')'; 
			}
		});
		
	}
	
});

