/* Negrean Media main js file */

jQuery.noConflict();
jQuery(document).ready(function(){

//	jQuery(".comparisonTable tr:odd").addClass("darkRow");
//	jQuery(function(){jQuery("#headerLogo, .communityToolsList").pngfix();});

	jQuery(document).ready(function() {
		jQuery("#mycarousel").jcarousel({
			scroll: 1,
			initCallback: mycarousel_initCallback,
			// This tells jCarousel NOT to autobuild prev/next buttons
			buttonNextHTML: null,
			buttonPrevHTML: null,
			wrap: 'both',
			auto: 5,
			itemVisibleInCallback: {
				onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation
			}
		});
	});
	
	jQuery('ul.consultanta-it').hover(
		function () {
			jQuery(this).addClass('consultanta-it-hover');
		},
		function () {
			jQuery(this).removeClass('consultanta-it-hover');
		}
	);



});


/**
 * We use the initCallback callback
 * to assign functionality to the controls
 */
function mycarousel_initCallback(carousel) {
	jQuery('.jcarousel-control a').bind('click', function() {
		carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
		return false;
	});

	jQuery('#mycarousel-next').bind('click', function() {
		carousel.next();
		return false;
	});

	jQuery('#mycarousel-prev').bind('click', function() {
		carousel.prev();
		return false;
	});
};

/**
 * This is the callback function which receives notification
 * when an item becomes the first one in the visible range.
 * Triggered after animation.
 */
function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) {
	display(idx + '/' + carousel.options.size);
	jQuery('.jcarousel-control a').removeClass('dot-hover');
	jQuery('.jcarousel-control a:nth-child(' + idx + ')').addClass('dot-hover');
};

function display(s) {
	jQuery('#current-item').html(s);
}