$(document).ready(function(){
	
	$("a[rel='external']").each(function(i){$(this).attr("target","_blank");});
	
	// init Cufon
	Cufon.replace('b', { fontFamily: 'DIN' });
	Cufon.replace('#conversionSteps .stepNumber', { fontFamily: 'ARIAL', fontWeight: '700'});
	Cufon.replace('#conversionSteps .stepLabel', { fontFamily: 'ARIAL'});
	
	//Cufon.replace('#conversionSteps .stepNumber', { fontFamily: 'DIN'});
	//Cufon.replace('#conversionSteps .stepLabel', { fontFamily: 'DIN-REGULAR'});
	
	// sliding panel
	/*
	$(".fullPage .btn-slide").click(function(){
		$("#panel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	*/
	
	// pngFix
	// $('.thumb').pngfix();
	
	// Carousel fiche produit
	//Front page Carousel - Initial Setup
	$('div#slideshow-carousel a img').css({'opacity': '0.5'});
	$('div#slideshow-carousel a img:first').css({'opacity': '1.0'});
	$('div#slideshow-carousel li a:first').append('<span class="arrow"></span>');

	//Combine jCarousel with Image Display
	$('div#slideshow-carousel li a').hover(
		function () {
				
			if (!$(this).has('span').length) {
				$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
				$(this).stop(true, true).children('img').css({'opacity': '1.0'});
			}		
		},
		function () {
				
			$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
			$('div#slideshow-carousel li a').each(function () {

				if ($(this).has('span').length) $(this).children('img').css({'opacity': '1.0'});

			});
				
		}
	).click(function () {

		$('span.arrow').remove();        
		$(this).append('<span class="arrow"></span>');
		$('div#slideshow-main li').removeClass('active');        
		$('div#slideshow-main li.' + $(this).attr('rel')).addClass('active');	
			
		return false;
	});
	
});

function mycarousel_initCallback(carousel) {	
	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
}

function addOrRemoveClass(objectJquery,css,refreshPage){

	if (objectJquery.hasClass(css)){
		objectJquery.removeClass(css);	
	}else{
		objectJquery.addClass(css);
	}
}
