// FONT
/*
Cufon.replace('#', {fontFamily: '', fontWeight:500,hover: true});
 */
Cufon.replace('.base-mini .head h4,.box .head h4, .aw-base-mini .head h4, .up-sell .head h4, .aw-vidtest-collateral-box .head h4,#block-tag .introduction h1, #block-about .title '); 
var $j = jQuery.noConflict();
$j(document).ready(function() { 

$j('li:last-child').addClass('last');
$j('.language-switcher .lang-selected').click(function(){
		$j(this).next('ul').slideDown('slow');
		$j(this).next('ul').addClass('opened');
	});
	
$j('.language-switcher ul li a').click(function(){
		$j(this).parent().parent().slideUp('fast');
});
$j('.language-switcher').mouseleave(function() {
	$j(this).find('ul').slideUp('slow');	
});


$j('#slider').nivoSlider({
        effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:3000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:true, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        // controlNavThumbsSearch: '.jpg', // Replace this with...
        // controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });


	
/* $j('#slider').nivoSlider({
        effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:3000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:true, // 1,2,3... navigation
        controlNavThumbs:true, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        // controlNavThumbsSearch: '.jpg', // Replace this with...
        // controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    }); */

	$j('.boxgrid.caption').hover(
		function(){
			jQuery(".cover", this).stop().animate({top:'65px'},{queue:false,duration:160});
		},
		function() {
			jQuery(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
		}
	);

    
	
});

/*
 * JCarousel with circular motion
 */
$j = jQuery.noConflict();

function carouselInit(carousel) {
	carousel.clip.hover(
    	function() { carousel.stopAuto(); },
        function() { carousel.startAuto(); }
    );
    carousel.buttonPrev.hover(
        function() { carousel.stopAuto(); },
        function() { carousel.startAuto(); }
   	);
    carousel.buttonNext.hover(
            function() { carousel.stopAuto(); },
            function() { carousel.startAuto(); }
       	);
};

function carouselBeforeAnimation(carousel,element,i,status) {
	var idx = carousel.index(i, carousel.options.size);
	carousel.add(i,carousel.get(idx).html())
}

function carouselAfterAnimation(carousel,element,index,status) {
	var idx = carousel.index(index, carousel.options.size);
	carousel.selected=idx
}

function carouselItemVisibleOut(carousel, item, i, state, evt) {
	if (i>carousel.options.size || i<0){
		carousel.remove(i);
	}
	carousel.startAuto();
};





