function showBulle (){
	var btnsV = $('.list_config div');
	var btnsH = $('.list_config li');
	var bulle = $('#bulle');
	var visu = $('#bulle img');
	var delai = '';
	btnsV.mouseenter(function(){
		if ( bulle.is(':hidden') ) {
			bulle.fadeOut(150);
		}else {
			clearTimeout(delai);
		};
    }).mouseleave(function(){
		delai = setTimeout (function(){
			if ( bulle.is(':visible') ) {
				bulle.fadeOut(500);
			};
		}, 500);
    });
	btnsH.mouseenter(function(){
		$('#bulle').stop();
		var pos = $(this).position();
		var larg = $(this).find('a').width()+15;
		var src = $(this).find('img').attr("src");
		if ( bulle.is(':hidden') ) {
			bulle.css('display', 'block');
		};
		bulle.css('opacity', 1);
		bulle.animate({  
			top: pos.top-44,
			left: pos.left+larg
		}, 150);
		visu.fadeOut(250,function(){
		   $(this).attr("src", src);
		   $(this).fadeIn(125);
		 });
    });
}


function showLB (){
	$('.launcher').click(function(event) {
		$("#lightboxConfigurator, #lightboxConfigurator .layer").css('display', 'block');
		$("#lightboxConfigurator .layer").fadeTo("slow", 0.8);
		$("#lightboxConfigurator .content").fadeIn(700 ,function(){
			initLB();
		});
		return(false);
	});
}
function hideLB (){
	$("#lightboxConfigurator .content").fadeOut(250);
	$("#lightboxConfigurator").fadeOut(1000);
}

function initLB (){
	showBulle();
	/* bouton fermer */
	$('.btn_close, .layer').click(function() { 
		hideLB();
		return(false);
	});
}

$(document).ready(function() {
	showLB();
});

function openCC5 (){
	$('.popupLauncher').click(function(event) {
		var leftpos = (screen.availWidth-800)/2;
		var toppos = (screen.availHeight-650)/2;
		pop=window.open($(this).attr('href'),'CC5','width=800,height=650,left='+leftpos+',top='+toppos+',scrollbars=yes,resizable=yes');
		if (pop){
			pop.focus();
		}else{
			alert('Popup-Blocker!');
		}
		return(false);
	});
}

