
/* === Smooth Scroll === */

$(function(){
    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            }
        }
    });
});

/* === Home Quotes === */

function slideSwitch() {
	var $active = $('blockquote p.active');

	if ( $active.length == 0 ) $active = $('blockquote p:last');

	var $next =  $active.next().length ? $active.next()
		: $('blockquote p:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
		});
}

/* === Navigation === */

/* $(function(){
	$("nav a").hover(function() {
		$(this).find("span").stop(true,true).animate({opacity: "show", top: "-38"}, "slow");
	}, function() {
		$(this).find("span").stop(true,true).animate({opacity: "hide", top: "-28"}, "fast");
	});
});*/

$(function(){
	$("nav a span").css({opacity:0});
	$("nav a").hover(function() {
		$(this).parent().addClass("nav-hover");
		$(this).find("span").stop().animate({opacity: 1}, "fast");
	}, function() {
		$(this).find("span").stop().animate({opacity: 0}, "normal");
	});
 });
$(function(){
	$("nav .active a span").css({opacity:1});
	$("nav .active a").hover(function() {
		$(this).find("span").stop();
	});
});

/* === Speaker links === */

$(function(){
	$("#speaker-header a").hover(function() {
		$(this).find("img").stop(true,true).animate({opacity: "hide"}, "fast");
	}, function() {
		$(this).find("img").stop(true,true).animate({opacity: "show"}, "slow");
	});
});

/* === Infographic pulsers === */

$(function(){
	$("#infographic div span").css({
		WebkitBorderRadius: 200,
		MozBorderRadius: 200,
		BorderRadius: 200,
		opacity:0.7
	});
	$("#infographic div em").stop(true,true).animate({opacity: "hide"}, "fast");
	$("#infographic div span").hover(function() {
		$(this).find("strong").stop(true,true).animate({opacity: "hide"}, "fast");
		$(this).find("em").stop(true,true).animate({opacity: "show"}, "fast");
		$(this).stop(true,true).animate({
			width: "120%",
			height: "120%",
			marginLeft: "-10%",
			marginTop: "-10%",
			backgroundColor:"#497384",
			fontSize:"80%"
		}, "fast");
	}, function() {
		$(this).find("strong").stop(true,true).animate({opacity: "show"}, "fast");
		$(this).find("em").stop(true,true).animate({opacity: "hide"}, "fast");
		$(this).stop(true,true).animate({
			width: "100%",
			height: "100%",
			marginLeft: "0",
			marginTop: "0",
			backgroundColor:"#6f94a3",
			fontSize:"70%"
		}, "normal");
	});
});

/* === Sponsors === */

$(function(){
	$(".sponsors ul li img").css({
		opacity:0.7
	});
	$(".sponsors ul li img").hover(function() {
		$(this).stop(true,true).animate({
			opacity:1
		}, "fast");
	}, function() {
		$(this).stop(true,true).animate({
			opacity:0.7
		}, "normal");
	});
});

/* === Banner Slider === */

$(function(){
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Banner Slider Small
	$('.banner.peek').hover(function(){
		$(".cover", this).stop().animate({top:'130px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0'},{queue:false,duration:300});
	});
	//Banner Slider Wide
	$('.banner-wide.peek').hover(function(){
		$(".cover-wide", this).stop().animate({top:'60px'},{queue:false,duration:300});
	}, function() {
		$(".cover-wide", this).stop().animate({top:'0'},{queue:false,duration:300});
	});


});

/* === Moi === */


$(document).ready(function() {
$('.ensavoirplus').hide();
$('.ensavoirplusbouton').click(function() {

    $('.ensavoirplus').slideDown();
    $('.ensavoirplusbouton').hide();
    
    $('.ensavoirmoinsbouton').show();

});



$('.ensavoirmoinsbouton').click(function() {

    $('.ensavoirplus').slideUp();
    $('.ensavoirplusbouton').show();

});



$('.compact').hide();
$('.menu').click(function() {

    $(this).next('.compact').slideToggle();

});

$('div#newsletter_art').hide();
$('div.newsletter_torn').hide();
 $('div.tabs_boutique > div:not(.revetements_naturels)').hide();
 
$('.product_cate').click(function() {
    id = $(this).attr('data-id');
    $('div.result').fadeOut('',function() {
    $.get('/jason/boutique_produits.php?id=' + id, function(data) {$('div.result').html(data);$('div.result').fadeIn('slow');} );
    });
    
});
 
$('ul.menu_boutique_ul li').click(function() {
    
    $('ul.menu_boutique_ul li').removeClass('active');
    
    class_li = $(this).attr('class');
    class_div = '.tabs_boutique > div.' + class_li;
    

    $(this).addClass('active');
    
    $('.tabs_boutique > div').hide();
    $(class_div).fadeIn();





    
});

$('.newsletter').click(function() {
    $('div#newsletter_art').slideDown(1000);
    $('div.newsletter_torn').slideDown(1000);
});

$('#newsletter_form').submit(function() {

   var email = $('#email_newsletter').val();


          $('div.newsletter').html('<div class="loader"></div>');
          $('div.newsletter').slideDown(500);

            $.ajax({
              type: 'GET',
              url: 'newsletter.php',
              data: 'email='+ email,

              beforeSend:function(){
                $('.loader').fadeIn();
              },

              success: function(data){
          $('.loader').fadeOut();
                $('div.newsletter').html(data);
              }
            });



   return false;
});




});

(function($){$.fn.verticaltabs=function(options){var defaults={speed:500,slideShow:true,slideShowSpeed:1000,activeIndex:0,playPausePos:"bottomRight",pauseOnHover:true};var options=$.extend(defaults,options);return this.each(function(){var verticaltabs=$(this);var tabs=$(verticaltabs).children(".verticalslider_tabs").children('li');var contents=$(verticaltabs).children(".verticalslider_contents").children('li');var sliderInterval;var arrowBlock="<div class=\"arrow\">&nbsp;</div>";var activeIndex=defaults.activeIndex;var slideShow=options.slideShow;var timeout;var totalHeight;$(contents[defaults.activeIndex]).addClass("activeContent");$(tabs[activeIndex]).addClass("activeTab").append(arrowBlock);totalHeight=$(tabs).length*$(".verticalslider_tabs a").outerHeight();$(".verticalslider_contents > li",verticaltabs).css({height:totalHeight+"px"});if(options.slideShow){$(verticaltabs).children(".verticalslider_contents >li").append("<div class=\"playPause\"><div class=\"play\"><a href=\"#\"></a></div><div class=\"pause\"><a href=\"#\"></a></div></div>");switch(options.playPausePos){case"topRight":$(".verticalslider .playPause").css({marginTop:"0px",marginLeft:$(".verticalslider_contents").width()-$(".verticalslider .playPause a").width()});break;case"topLeft":$(".verticalslider .playPause").css({marginTop:"0px",marginLeft:"0px"});break;case"bottomRight":$(".verticalslider .playPause").css({marginTop:totalHeight-$(".verticalslider .playPause a").height(),marginLeft:$(".verticalslider_contents").width()-$(".verticalslider .playPause a").width()});break;case"bottomLeft":$(".verticalslider .playPause").css({marginTop:totalHeight-$(".verticalslider .playPause a").height(),marginLeft:"0px"});break}}$(".verticalslider_tabs a",verticaltabs).click(function(){if(!$(this).parent().hasClass("activeTab")){activeIndex=$(this).parent().prevAll().length;switchContents();if(slideShow){clearTimeout(timeout);slideShow=false;$(".pause a",verticaltabs).css("display","none");$(".play a",verticaltabs).css("display","block")}}return false});$(".play, .pause",verticaltabs).click(function(){slideShow=!slideShow;$(".play a, .pause a",verticaltabs).toggle();if(slideShow){startSlideShow()}return false});$(tabs).add(contents).hover(function(){if(options.pauseOnHover&&slideShow){slideShow=!slideShow}},function(){if(options.pauseOnHover&&!slideShow&&$(".pause a",verticaltabs).is(":visible")){startSlideShow()}});function switchContents(){$(".activeTab",verticaltabs).removeClass("activeTab");$('.arrow',verticaltabs).remove();$(tabs[activeIndex],verticaltabs).addClass("activeTab").append(arrowBlock);$(".activeContent",verticaltabs).fadeOut(options.speed).removeClass("activeContent");$(contents[activeIndex],verticaltabs).fadeIn(options.speed).addClass("activeContent")};function startSlideShow(){slideShow=true;clearTimeout(timeout);timeout=setTimeout(function(){autoUpdate()},options.speed+options.slideShowSpeed)}function autoUpdate(){if(slideShow){activeIndex++;if(activeIndex==contents.length){activeIndex=0}switchContents();startSlideShow()}};if(slideShow){timeout=setTimeout(function(){autoUpdate()},options.speed+options.slideShowSpeed)}})}})(jQuery);
                
                var scr=document.getElementsByTagName('script');
var zoombox_path = scr[scr.length-1].getAttribute("src").replace('zoombox.js','');

(function($){

var options = {
    theme       : 'zoombox',      //available themes : zoombox,lightbox, prettyphoto, darkprettyphoto, simple
    opacity     : 0.8,                  // Black overlay opacity
    duration    : 800,                // Animation duration
    animation   : true,             // Do we have to animate the box ?
    width       : 800,                  // Default width
    height      : 640,                  // Default height
    gallery     : true,                 // Allow gallery thumb view
    autoplay : false,                // Autoplay for video
    overflow  : false               // Allow images bigger than screen ?
}
var images = new Array();         // Gallery Array [gallery name][link]
var elem;           // HTML element currently used to display box
var isOpen = false; // Zoombox already opened ?
var link;           // Shortcut for the link
var width;
var height;
var timer;          // Timing for img loading
var i = 0;          // iteration variable
var content;        // The content of the box
var type = 'multimedia'; // Content type
var position = false;
var imageset = false;
var state = 'closed';

/**
* You can edit the html code generated by zoombox for specific reasons.
* */
var html = '<div id="zoombox"> \
            <div class="mask"></div>\
            <div class="container">\
                <div class="content"></div>\
                <div class="title"></div>\
                <div class="next"></div>\
                <div class="prev"></div>\
                <div class="close"></div>\
                <div class="gallery"></div>\
            </div>\
        </div>';
// Regular expressions needed for the content
var filtreImg=                  /(\.jpg)|(\.jpeg)|(\.bmp)|(\.gif)|(\.png)/i;
var filtreMP3=			/(\.mp3)/i;
var filtreFLV=			/(\.flv)/i;
var filtreSWF=			/(\.swf)/i;
var filtreQuicktime=	/(\.mov)|(\.mp4)/i;
var filtreWMV=			/(\.wmv)|(\.avi)/i;
var filtreDailymotion=	/(http:\/\/www.dailymotion)|(http:\/\/dailymotion)/i;
var filtreVimeo=		/(http:\/\/www.vimeo)|(http:\/\/vimeo)/i;
var filtreYoutube=		/(youtube\.)/i;
var filtreKoreus=		/(http:\/\/www\.koreus)|(http:\/\/koreus)/i;


$.zoombox = function(el,options) {

}
$.zoombox.options = options;
$.zoombox.close = function() {
    close();
}
$.zoombox.open = function(tmplink,opts){
    elem = null;
    link = tmplink;
    options = $.extend({},$.zoombox.options,opts);
    load();
}
$.zoombox.html = function(cont,opts){
    content = cont;
    options = $.extend({},$.zoombox.options,opts);
    width = options.width;
    height = options.height;
    elem = null;
    open();
}
$.fn.zoombox = function(opts){    
    /**
     * Bind the behaviour on every Elements
     */
    return this.each(function(){
        // No zoombox for IE6
        if($.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest){
            return false;
        }
        var obj = this;
        var galleryRegExp =  /zgallery([0-9A-Za-z]+)/;
        var gallery = galleryRegExp.exec($(this).attr("class"));
        var tmpimageset = false;
        if(gallery != null){
            if(!images[gallery[1]]){
                images[gallery[1]]=new Array();
            }
            images[gallery[1]].push($(this));
            var pos = images[gallery[1]].length-1;
            tmpimageset = images[gallery[1]];
        }
        $(this).unbind('click');
        $(this).click(function(){
            options = $.extend({},$.zoombox.options,opts);
            if(state!='closed') return false;
            elem = $(obj);
            link = elem.attr('href');
            imageset = tmpimageset;
            position = pos;
            load();
            return false;
        });
    });
}

/**
 * Load the content (with or without loader) and call open()
 * */
function load(){
    if(state=='closed') isOpen = false;
    state = 'load';
    setDim();
    if(filtreImg.test(link)){
        img=new Image();
        img.src=link;
        $("body").append('<div id="zoombox_loader"></div>');
        $("#zoombox_loader").css("marginTop",scrollY());
        timer = window.setInterval(function(){loadImg(img);},100);
    }else{
        setContent();
        open();
    }
}

/**
 * Build the HTML Structure of the box
 * */
function build(){
    // We add the HTML Code on our page
    $('body').append(html);
    $(window).keydown(function(event){
        shortcut(event.which);
    });
    $(window).resize(function(){
        resize();
    });
    $('#zoombox .mask').hide();
    $('#zoombox .gallery').hide();
    // We add a specific class to define the box theme
    $('#zoombox').addClass(options.theme);
    // We bind the close behaviour (click on the mask / click on the close button)
    $('#zoombox .close,#zoombox .mask,.zoombox_close').click(function(){
        close();
        return false;
    });
    $('#zoombox .mask').mouseover(function(){
        $('#zoombox .gallery').stop().fadeTo(500,0);
    });
    $('#zoombox .mask').mouseout(function(){
        $('#zoombox .gallery').stop().fadeTo(500,0.9);
    });
    // Next/Prev button
    if(imageset == false){
        $('#zoombox .next,#zoombox .prev').remove();
    }else{
        $('#zoombox .next').click(function(){
            next();
        });
        $('#zoombox .prev').click(function(){
            prev();
        });
        if(options.gallery){
            for(var i in imageset){
                var img = $('<img src="'+zoombox_path+'img/blank.png'+'" class="video gallery'+(i*1)+'"/>');
                if(filtreImg.test(imageset[i].attr('href'))){
                   img = $('<img src="'+imageset[i].attr('href')+'" class="gallery'+(i*1)+'"/>');
                }
                img.appendTo('#zoombox .gallery');
                img.click(function(){
                   gotoSlide($(this).attr('class').replace('gallery',''));
                   $('#zoombox .gallery img').removeClass('current');
                   $(this).addClass('current');
                });
                if(i==position){img.addClass('current');}
            }
        }
    }
}
/**
 * Open the box
 **/
function open(){
    if(isOpen == false){
        build();
    }else{
        $('#zoombox .title').empty();
    }
    $('#zoombox .close').hide();
    $('#zoombox .container').removeClass('multimedia').removeClass('img');
    $('#zoombox .container').addClass(type);

    // We add a title if we find one on the link
    if(elem != null && elem.attr('title')){
        $('#zoombox .title').append(elem.attr('title'));
    }



    // And after... Animation or not depending of preferences
    // We empty the content
    $('#zoombox .content').empty();
    // If it's an image we load the content now (to get a good animation)
    if(type=='img' && isOpen == false && options.animation == true){
        $('#zoombox .content').append(content);
    }
    // Default position/size of the box to make the "zoom effect"
    if(elem != null && elem.find('img').length != 0 && isOpen == false){
        var min = elem.find('img');
        $('#zoombox .container').css({
            width : min.width(),
            height: min.height(),
            top : min.offset().top,
            left : min.offset().left,
            opacity:0,
            marginTop : min.css('marginTop')
        });
    }else if(elem != null && isOpen == false){
        $('#zoombox .container').css({
           width:   elem.width(),
           height:  elem.height(),
           top:elem.offset().top,
           left:elem.offset().left
        });
    }else if(isOpen == false){
        $('#zoombox .container').css({
            width: 100,
            height: 100,
            top:windowH()/2-50,
            left:windowW()/2-50
        })
    }
    // Final position/size of the box after the animation
    var css = {
        width : width,
        height: height,
        left  : (windowW() - width) / 2,
        top   : (windowH() - height) / 2,
        marginTop : scrollY(),
        opacity:1
    };
    // Do we animate or not ?
    if(options.animation == true){
        $('#zoombox .title').hide();
        $('#zoombox .container').animate(css,options.duration,function(){
            if(type == 'multimedia' || isOpen == true){
                $('#zoombox .content').append(content);
            }
            if(type == 'image' || isOpen == true){
                $('#zoombox .content img').css('opacity',0).fadeTo(300,1);
            }
            $('#zoombox .close').fadeIn();
            $('#zoombox .gallery').fadeIn();
            $('#zoombox .title').fadeIn(300);
            state = 'opened';
            isOpen = true;
        });
        $('#zoombox .mask').fadeTo(200,options.opacity);
    }else{
        $('#zoombox .content').append(content);
        $('#zoombox .close').show();
        $('#zoombox .gallery').show();
        $('#zoombox .container').css(css);
        $('#zoombox .mask').show();
        $('#zoombox .mask').css('opacity',options.opacity);
        isOpen = true;
        state = 'opened';
    }
}
/**
 * Close the box
 * **/
function close(){
    state = 'closing';
    window.clearInterval(timer);
    $(window).unbind('keydown');
    $(window).unbind('resize'); 
    if(type == 'multimedia'){
        $('#zoombox .container').empty();
    }
    var css = {};
    if(elem != null && elem.find('img').length != 0){
        var min = elem.find('img');
        css ={
            width : min.width(),
            height: min.height(),
            top : min.offset().top,
            left : min.offset().left,
            opacity:0,
            marginTop : min.css('marginTop')
        };
    }else if(elem!=null){
        css = {
           width:   elem.width(),
           height:  elem.height(),
           top:elem.offset().top,
           left:elem.offset().left,
           opacity:0
        };
    }else{
        css = {
            width: 100,
            height: 100,
            top:windowH()/2-50,
            left:windowW()/2-50,
            opacity : 0
        };
    }
    if(options.animation == true){
        $('#zoombox .mask').fadeOut(200);
        $('#zoombox .container').animate(css,options.duration,function(){
            $('#zoombox').remove();
            state = 'closed';
			isOpen = false; 
        });
    }else{
        $('#zoombox').remove();
        state = 'closed';
		isOpen = false; 
    }
}

/**
 * Set the HTML Content of the box
 * */
function setContent(){
    // Overtflow
    if(options.overflow == false){
        if(width*1 + 50 > windowW()){
            height = (windowW() - 50) * height / width;
            width = windowW() - 50;
        }
        if(height*1 + 50 > windowH()){
            width = (windowH()-50) * width / height; 
            height = windowH() - 50;
        }
    }
    var url = link;
    type = 'multimedia';
    if(filtreImg.test(url)){
        type = 'img';
        content='<img src="'+link+'" width="'+width+'" height="'+height+'"/>';
    }else if(filtreMP3.test(url)){
        width=300;
        height=40;
        content ='<object type="application/x-shockwave-flash" data="'+MP3Player+'?son='+url+'" width="'+width+'" height="'+height+'">';
        content+='<param name="movie" value="'+MP3Player+'?son='+url+'" /></object>';
    }else if(filtreFLV.test(url)){
        var autostart = 0;
        if(options.autoplay==true){autostart = 1;} 
        content='<object type="application/x-shockwave-flash" data="'+zoombox_path+'FLVPlayer.swf" width="'+width+'" height="'+height+'">\
<param name="allowFullScreen" value="true">\
<param name="scale" value="noscale">\
<param name="wmode" value="transparent">\
<param name="flashvars" value="flv='+url+'&autoplay='+autostart+'">\
<embed src="'+zoombox_path+'FLVPlayer.swf" width="'+width+'" height="'+height+'" allowscriptaccess="always" allowfullscreen="true" flashvars="flv='+url+'" wmode="transparent" />\
</object>';
    }else if(filtreSWF.test(url)){
        content='<object width="'+width+'" height="'+height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+url+'" /><embed src="'+url+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+width+'" height="'+height+'" wmode="transparent"></embed></object>';
    }else if(filtreQuicktime.test(url)){
        content='<embed src="'+url+'" width="'+width+'" height="'+height+'" controller="true" cache="true" autoplay="true"/>';
        // HTML5 Code
        //content='<video controls src="'+url+'" width="'+width+'" height="'+height+'">Your browser does not support this format</video>'
    }else if(filtreWMV.test(url)){
        content='<embed src="'+url+'" width="'+width+'" height="'+height+'" controller="true" cache="true" autoplay="true" wmode="transparent" />';
    }else if(filtreDailymotion.test(url)){
        var id=url.split('_');
        id=id[0].split('/');
        id=id[id.length-1];
        if(options.autoplay==true){
            id = id + '&autostart=1';
        }
        content='<object width="'+width+'" height="'+height+'"><param name="movie" value="http://www.dailymotion.com/swf/'+id+'&colors=background:000000;glow:000000;foreground:FFFFFF;special:000000;&related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/'+id+'&colors=background:000000;glow:000000;foreground:FFFFFF;special:000000;&related=0" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" allowFullScreen="true" allowScriptAccess="always" wmode="transparent" ></embed></object>';
    }else if(filtreVimeo.test(url)){
        var id=url.split('/');
        id=id[3];
        if(options.autoplay==true){
            id = id + '&autoplay=1';
        }
        content='<object width="'+width+'" height="'+height+'"><param name="allowfullscreen" value="true" />	<param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id='+id+'&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00AAEB&amp;fullscreen=1" />	<embed src="http://www.vimeo.com/moogaloop.swf?clip_id='+id+'&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00AAEB&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+width+'" height="'+height+'" wmode="transparent" ></embed></object>';
    }else if(filtreYoutube.test(url)){
        var id=url.split('watch?v=');
        id=id[1].split('&');
        id=id[0];
        if(options.autoplay==true){
            id = id + '&autoplay=1';
        }
        content='<object width="'+width+'" height="'+height+'"><param name="movie" value="http://www.youtube.com/v/'+id+'&hl=fr&rel=0&color1=0xFFFFFF&color2=0xFFFFFF&hd=1"></param><embed src="http://www.youtube.com/v/'+id+'&hl=fr&rel=0&color1=0xFFFFFF&color2=0xFFFFFF&hd=1" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent"></embed></object>';
    }else if(filtreKoreus.test(url)){
        url=url.split('.html');
        url=url[0];
        content='<object type="application/x-shockwave-flash" data="'+url+'" width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'"><embed src="'+url+'" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"  wmode="transparent"></embed></object>';
    }else{
        content='<iframe src="'+url+'" width="'+width+'" height="'+height+'" border="0"></iframe>';
    }
    return content;
}
/**
 *  Handle Image loading
 **/
function loadImg(img){
    if(img.complete){
            i=0;
            window.clearInterval(timer);
            width=img.width;
            height=img.height;
            $('#zoombox_loader').remove();
            setContent();
            open();
    }
    // On anim le loader
    $('#zoombox_loader').css({'background-position': "0px "+i+"px"});
    i=i-40;
    if(i<(-440)){i=0;}
}

function gotoSlide(i){
    if(state != 'opened'){return false;}
    position = i;
    elem = imageset[position];
    link = elem.attr('href');
    if($('#zoombox .gallery img').length > 0){
        $('#zoombox .gallery img').removeClass('current');
        $('#zoombox .gallery img:eq('+i+')').addClass('current');
    }
    load();
    return false;
}

function next(){
    i = position+1;
    if(i  > imageset.length-1){
        i = 0;
    }
    gotoSlide(i);
}

function prev(){
    i = position-1;
    if(i < 0){
        i = imageset.length-1;
    }
    gotoSlide(i);
}

/**
 * GENERAL FUNCTIONS
 * */
/**
 * Resize
 **/
function resize(){
    $('#zoombox .container').css({
        top : (windowH() - $('#zoombox .container').height()) / 2,
        left : (windowW() - $('#zoombox .container').width()) / 2
    });
}
/**
 * Keyboard Shortcut
 **/
function shortcut(key){
    if(key == 37){
        prev();
    }
    if(key == 39){
        next();
    }
    if(key == 27){
        close();
    }

}
/**
 * Parse Width/Height of a link and insert it in the width and height variables
 * */
function setDim(){
    width = options.width;
    height = options.height;
    if(elem!=null){
        var widthReg = /w([0-9]+)/;
        var w = widthReg.exec(elem.attr("class"));
        if(w != null){
            if(w[1]){
                width = w[1];
            }
        }
        var heightReg = /h([0-9]+)/;
        var h = heightReg.exec(elem.attr("class"));
        if(h != null){
            if(h[1]){
                height = h[1];
            }
        }
    }
    return false;
}
/**
* Return the window height
* */
function windowH(){
        if (window.innerHeight) return window.innerHeight  ;
        else{return $(window).height();}
}

/**
 * Return the window width
 * */
function windowW(){
        if (window.innerWidth) return window.innerWidth  ;
        else{return $(window).width();}
}

/**
 *  Return the position of the top
 *  */
function scrollY() {
        scrOfY = 0;
        if( typeof( window.pageYOffset ) == 'number' ) {
                //Netscape compliant
                scrOfY = window.pageYOffset;
        } else if( document.body && ( document.body.scrollTop ) ) {
                //DOM compliant
                scrOfY = document.body.scrollTop;
        } else if( document.documentElement && ( document.documentElement.scrollTop ) ) {
                //IE6 standards compliant mode
                scrOfY = document.documentElement.scrollTop;
        }
        return scrOfY;
}

/**
 *  Return the position of the left scroll
 *  */
function scrollX(){
        scrOfX = 0;
        if( typeof( window.pageXOffset ) == 'number' ) {
                //Netscape compliant
                scrOfX = window.pageXOffset;
        } else if( document.body && ( document.body.scrollLeft ) ) {
                //DOM compliant
                scrOfX = document.body.scrollLeft;
        } else if( document.documentElement && ( document.documentElement.scrollLeft ) ) {
                //IE6 standards compliant mode
                scrOfX = document.documentElement.scrollLeft;
        }
         return scrOfX;
}

})(jQuery);

jQuery(function($){

    
        $('a.zoombox').zoombox({
        theme       : 'zoombox',
        width       : 550,  
        height      : 330,
    gallery       : 'true'});
    
       $('a.zoomboxblog').zoombox({
        theme       : 'zoombox'});


  $(' a.ou_acheter_zoombox').zoombox({
      theme       : 'lightbox',
        width       : 550,  
        height      : 330});
    
    
  
     $('a.photo_galerie_produit').zoombox({
        theme       : 'zoombox',
        width       : 550,  
        height      : 330});
});

  


$(function(){
   $('.hover_produits').hover(function () {
   $('.menu_produits').removeClass("menu_hide");
   $('.menu_hover:not(.menu_produits)').addClass("menu_hide");
  }, function () {   
  });
  
  $('.hover_univers').hover(function () {
   $('.menu_univers').removeClass("menu_hide");
      $('.menu_hover:not(.menu_univers)').addClass("menu_hide");
  }, function () {   
  });
  
 $('.hover_decouvrir').hover(function () {
   $('.menu_decouvrir').removeClass("menu_hide");
      $('.menu_hover:not(.menu_decouvrir)').addClass("menu_hide");
  }, function () {   
  });

  $('.hover_boutique').hover(function () {
   $('.menu_boutique').removeClass("menu_hide");
      $('.menu_hover:not(.menu_boutique)').addClass("menu_hide");
  }, function () {   
  });
  
     $('.hover_blog').hover(function () {
   $('.menu_blog').removeClass("menu_hide");
      $('.menu_hover:not(.menu_blog)').addClass("menu_hide");
  }, function () {   
  });
  
  $('.hover_contact').hover(function () {
   $('.menu_contact').removeClass("menu_hide");
         $('.menu_hover:not(.menu_contact)').addClass("menu_hide");
  }, function () {   
  });

  
    $('#content').hover(function () {
   $('.menu_hover').addClass("menu_hide");
  }, function () {});
  
      $('.masquer_menu').hover(function () {
   $('.menu_hover').addClass("menu_hide");
  }, function () {});
  
       $('.fade_footer').hide();
             $('.plan_toggle2').hide();
             $('#ou_acheter2').hide();	
             $('#ou_acheter3').hide();	
             
             $('#espace_part').hide();	
             $('#espace_part_bt2').hide();
             
             $('#espace_pro').hide();	
             $('#espace_pro_bt2').hide();
             
             $('#espace_presse').hide();	
             $('#espace_presse_bt2').hide();
              
                
               $('#ou_acheter1').click(function() {
              
              $('#ou_acheter3').slideDown();	
               $('#ou_acheter1').hide();
                $('#ou_acheter2').show();
                
                
              });
              
             $('#ou_acheter2').click(function() {
              
              $('#ou_acheter3').slideUp();	
               $('#ou_acheter2').hide();
                $('#ou_acheter1').show();
              });
              
              
              
              
             $('#espace_part_bt').click(function() {
              
              $('#espace_part').slideDown();	
               $('#espace_part_bt').hide();
                $('#espace_part_bt2').show();
                
                $('#espace_presse').slideUp();
                $('#espace_pro').slideUp();
                
                
              });
              
             $('#espace_part_bt2').click(function() {
              
              $('#espace_part').slideUp();	
               $('#espace_part_bt2').hide();
                $('#espace_part_bt').show();
              });



$('#espace_pro_bt').click(function() {
              
              $('#espace_pro').slideDown();	
               $('#espace_pro_bt').hide();
                $('#espace_pro_bt2').show();
                
                $('#espace_presse').slideUp();
                
                $('#espace_part').slideUp();
              });
              
             $('#espace_pro_bt2').click(function() {
              
              $('#espace_pro').slideUp();	
               $('#espace_pro_bt2').hide();
                $('#espace_pro_bt').show();
              });



$('#espace_presse_bt').click(function() {
              
              $('#espace_presse').slideDown();	
               $('#espace_presse_bt').hide();
                $('#espace_presse_bt2').show();
                
               	
                $('#espace_pro').slideUp();
                $('#espace_part').slideUp();
                
              });
              
             $('#espace_presse_bt2').click(function() {
            
              
              $('#espace_presse').slideUp();	
               $('#espace_presse_bt2').hide();
                $('#espace_presse_bt').show();
              });
              
               $('.plan_toggle').click(function() {
               $('.fade_footer').show(); 
                $('.plan_toggle').hide();
                $('.plan_toggle2').show();

               
               });
               
               $('.plan_toggle2').click(function() {
               $('.fade_footer').hide(); 
                $('.plan_toggle2').hide();
                $('.plan_toggle').show();

               
               });
             
             $('.commentaire_hide').hide();
             $('.commentaire_show').click(function() {
               $('.commentaire_hide').fadeToggle(); 

               
               });
             
   $('.fiches_photos:not(div)').click(function () {
     classe = '.fiches_photos';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  

   $('.fiches_technique:not(div)').click(function () {
     classe = '.fiches_technique';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  


   $('.fiches_decription:not(div)').click(function () {
     classe = '.fiches_decription';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  

   $('.fiches_similaires:not(div)').click(function () {
     classe = '.fiches_similaires';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  

   $('.fiches_commentaires:not(div)').click(function () {
     classe = '.fiches_commentaires';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  


   $('.fiches_acheter:not(div)').click(function () {
     classe = '.fiches_acheter';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  

   $('.fiches_documentation:not(div)').click(function () {
     classe = '.fiches_documentation';
    $('div.fiche_center').fadeOut();
    $('div.fiche_center').hide();
    $('div' + classe).fadeIn();
    $('div' + classe).removeClass("fiches_hide");
    $('.fiche_center:not(div' + classe + ')').addClass("fiches_hide");});  




  
});


/*
    CARROUSEL JS
*/


var carrousel = {
    
    nbSlide : 0,
    nbCurrent : 1,
    elemCurrent : null,
    elem : null,
    timer : null,
    
    init : function(elem){
        this.nbSlide = elem.find(".slide").length;
        
        // CrÃ©er la pagination
        elem.append('<div class="navigation"></div>');
        for(var i=1;i<=this.nbSlide;i++){
            elem.find(".navigation").append("<span>"+ i +"</span>");
        }
        elem.find(".navigation span").click(function(){carrousel.gotoSlide($(this).text());})
        
        // Initialisation du carrousel
        this.elem=elem;
        elem.find(".slide").hide();
        elem.find(".slide:first").show();
        this.elemCurrent = elem.find(".slide:first");
        this.elem.find(".navigation").css("opacity",0.6);   // On rend la navigation opaque
        this.elem.find(".navigation span:first").addClass("active");
        
        // On crÃ© le timer
        carrousel.play();
        // Stop quand on passe dessus
        elem.mouseover(carrousel.stop);
        elem.mouseout(carrousel.play);
    },
    
    gotoSlide : function(num){
        if(num==this.nbCurrent){return false;}
        
        /* Animation en fadeIn/fadeOut 
        this.elemCurrent.fadeOut();
        this.elem.find("#slide"+num).fadeIn();
        */
        /* Animation en slide 
        var sens = 1;
        if(num<this.nbCurrent){ sens = -1;}
        var cssDeb = { "left" : sens*this.elem.width() };
        var cssFin = { "left" : -sens*this.elem.width() };
        this.elem.find("#slide"+num).show().css(cssDeb);
        this.elem.find("#slide"+num).animate({"top":0,"left":0},500);
        this.elemCurrent.animate(cssFin,500);
     
        /*
        Animation Titre + Fadein/Out sur la div visu
        */
        this.elemCurrent.find(".visu").fadeOut();
        this.elem.find("#slide"+num).show();
        this.elem.find("#slide"+num+" .visu").hide().fadeIn();
        var titleHeight = this.elemCurrent.find(".title").height();
        this.elemCurrent.find(".title").animate({"bottom": -titleHeight},500);
        this.elem.find("#slide"+num+" .title").css("bottom",-titleHeight).animate({"bottom": 0},500);
        //*/
		
        
        
        this.elem.find(".navigation span").removeClass("active");
        this.elem.find(".navigation span:eq("+(num-1)+")").addClass("active");
        this.nbCurrent = num;
        this.elemCurrent = this.elem.find("#slide"+num);
    },
    
    next : function(){
        var num  = this.nbCurrent+1;
        if(num  >this.nbSlide){
            num  = 1;
        }
        this.gotoSlide(num);
    },
    prev : function(){
        var num  = this.nbCurrent-1;
        if(num< 1){
            num= this.nbSlide;
        }
        this.gotoSlide(num);
    },
    stop : function(){
        window.clearInterval(carrousel.timer);
    },
    play : function(){
        window.clearInterval(carrousel.timer);
        carrousel.timer = window.setInterval("carrousel.next()",2000);
    }

}

$(function(){
    carrousel.init($("#carrousel"));
});

$(function(){
    $('.commentaire_form').submit(function() {
        nom = $('#nom').val();
        mail = $('#mail').val();
        site = $('#site').val();
        contenu = $('#contenu').val();
        page = $('#page').val();
        
        data_t = 'nom=' + nom + '&mail=' + mail + '&site=' + site + '&contenu=' + contenu + '&page=' + page;
        commentaire_form = '/jason/commentaire_form.php';
        
        $.ajax({
   type: "POST",
   url: commentaire_form,
   data: data_t,
   success: function(data){
       $('#commentaire_form').fadeOut();
       $('#form_ajax').html('<h3 class="valid">Merci! Votre avis a bien Ã©tÃ© ajoutÃ©.</h3>'); 
       $('.liste_commentaires').hide().prepend(data).fadeIn("slow");
     }
    });
        return false;
    });
});

$(function($){
$.ouvrir = function(name) {
    
    $.get('/jason/decouvrir-art-unic.php', {'name' : name}, function(data) {
        
        if(name== '/le-show-room.html') {
            $('li.le-show-room').html(data);
        }
            if(name== '/partenaires.html') {
            $('li.partenaires').html(data);
        }
            if(name== '/selectionne-par.html') {
            $('li.selectionne-par').html(data);
        }
           if(name== '/agenda.html') {
            $('li.evenements_tab').html(data);
        }
        
        
    });
    
}



$('.fiche_left ul.menu_fiches li a').removeAttr('href');
$('.fiche_left ul.menu_fiches li a').attr('href' , '#');


$('.hide').hide();
$('.ensavoirplus_table').click(function() {
    marque = $(this).attr('data-marque');
    $('.hide.'+marque).slideToggle();
});
       



});

(function(a){function l(){var a=window.outerWidth||b.clientWidth;b.className=b.className.replace(/ (w|lt)-\d+/g,""),f("w-"+Math.round(a/100)*100),h(c.screens,function(b){a<=b&&f("lt-"+b)}),i.feature()}function h(a,b){for(var c=0,d=a.length;c<d;c++)b.call(a,a[c],c)}function g(a){var c=new RegExp("\\b"+a+"\\b");b.className=b.className.replace(c,"")}function f(a){d[d.length]=a}var b=a.documentElement,c={screens:[320,480,640,768,1024,1280,1440,1680,1920],section:"-section",page:"-page",head:"head"},d=[];if(window.head_conf)for(var e in head_conf)head_conf[e]!==undefined&&(c[e]=head_conf[e]);var i=window[c.head]=function(){i.ready.apply(null,arguments)};i.feature=function(a,c,e){if(!a)b.className+=" "+d.join(" "),d=[];else{Object.prototype.toString.call(c)=="[object Function]"&&(c=c.call()),f((c?"":"no-")+a),i[a]=!!c,e||(g("no-"+a),g(a),i.feature());return i}};var j=navigator.userAgent.toLowerCase();j=/(webkit)[ \/]([\w.]+)/.exec(j)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(j)||/(msie) ([\w.]+)/.exec(j)||!/compatible/.test(j)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(j)||[],j[1]=="msie"&&(j[1]="ie",j[2]=document.documentMode||j[2]),f(j[1]),i.browser={version:j[2]},i.browser[j[1]]=!0;if(i.browser.ie){f("ie"+parseFloat(j[2]));for(var k=3;k<11;k++)parseFloat(j[2])<k&&f("lt-ie"+k);h("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(b){a.createElement(b)})}h(location.pathname.split("/"),function(a,d){if(this.length>2&&this[d+1]!==undefined)d&&f(this.slice(1,d+1).join("-")+c.section);else{var e=a||"index",g=e.indexOf(".");g>0&&(e=e.substring(0,g)),b.id=e+c.page,d||f("root"+c.section)}}),l(),window.onresize=l,i.feature("js",!0).feature()})(document),function(){function h(a){var b=a.charAt(0).toUpperCase()+a.substr(1),c=(a+" "+d.join(b+" ")+b).split(" ");return!!g(c)}function g(a){for(var c in a)if(b[a[c]]!==undefined)return!0}var a=document.createElement("i"),b=a.style,c=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),d="Webkit Moz O ms Khtml".split(" "),e=window.head_conf&&head_conf.head||"head",f=window[e],i={gradient:function(){var a="background-image:",d="gradient(linear,left top,right bottom,from(#9f9),to(#fff));",e="linear-gradient(left top,#eee,#fff);";b.cssText=(a+c.join(d+a)+c.join(e+a)).slice(0,-a.length);return!!b.backgroundImage},rgba:function(){b.cssText="background-color:rgba(0,0,0,0.5)";return!!b.backgroundColor},opacity:function(){return a.style.opacity===""},textshadow:function(){return b.textShadow===""},multiplebgs:function(){b.cssText="background:url(//:),url(//:),red url(//:)";return(new RegExp("(url\\s*\\(.*?){3}")).test(b.background)},boxshadow:function(){return h("boxShadow")},borderimage:function(){return h("borderImage")},borderradius:function(){return h("borderRadius")},cssreflections:function(){return h("boxReflect")},csstransforms:function(){return h("transform")},csstransitions:function(){return h("transition")},fontface:function(){var a=navigator.userAgent,b;if(0)return!0;if(b=a.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/))return b[1]>="4.0.249.4"||1*b[1].split(".")[0]>5;if((b=a.match(/Safari\/(\d+\.\d+)/))&&!/iPhone/.test(a))return b[1]>="525.13";if(/Opera/.test({}.toString.call(window.opera)))return opera.version()>="10.00";if(b=a.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//))return b[1]>="1.9.1";return!1}};for(var j in i)i[j]&&f.feature(j,i[j].call(),!0);f.feature()}(),function(a){function z(){d||(d=!0,s(e,function(a){p(a)}))}function y(c,d){var e=a.createElement("script");e.type="text/"+(c.type||"javascript"),e.src=c.src||c,e.async=!1,e.onreadystatechange=e.onload=function(){var a=e.readyState;!d.done&&(!a||/loaded|complete/.test(a))&&(d.done=!0,d())},(a.body||b).appendChild(e)}function x(a,b){if(a.state==o)return b&&b();if(a.state==n)return k.ready(a.name,b);if(a.state==m)return a.onpreload.push(function(){x(a,b)});a.state=n,y(a.url,function(){a.state=o,b&&b(),s(g[a.name],function(a){p(a)}),u()&&d&&s(g.ALL,function(a){p(a)})})}function w(a,b){a.state===undefined&&(a.state=m,a.onpreload=[],y({src:a.url,type:"cache"},function(){v(a)}))}function v(a){a.state=l,s(a.onpreload,function(a){a.call()})}function u(a){a=a||h;var b;for(var c in a){if(a.hasOwnProperty(c)&&a[c].state!=o)return!1;b=!0}return b}function t(a){return Object.prototype.toString.call(a)=="[object Function]"}function s(a,b){if(!!a){typeof a=="object"&&(a=[].slice.call(a));for(var c=0;c<a.length;c++)b.call(a,a[c],c)}}function r(a){var b;if(typeof a=="object")for(var c in a)a[c]&&(b={name:c,url:a[c]});else b={name:q(a),url:a};var d=h[b.name];if(d&&d.url===b.url)return d;h[b.name]=b;return b}function q(a){var b=a.split("/"),c=b[b.length-1],d=c.indexOf("?");return d!=-1?c.substring(0,d):c}function p(a){a._done||(a(),a._done=1)}var b=a.documentElement,c,d,e=[],f=[],g={},h={},i=a.createElement("script").async===!0||"MozAppearance"in a.documentElement.style||window.opera,j=window.head_conf&&head_conf.head||"head",k=window[j]=window[j]||function(){k.ready.apply(null,arguments)},l=1,m=2,n=3,o=4;i?k.js=function(){var a=arguments,b=a[a.length-1],c={};t(b)||(b=null),s(a,function(d,e){d!=b&&(d=r(d),c[d.name]=d,x(d,b&&e==a.length-2?function(){u(c)&&p(b)}:null))});return k}:k.js=function(){var a=arguments,b=[].slice.call(a,1),d=b[0];if(!c){f.push(function(){k.js.apply(null,a)});return k}d?(s(b,function(a){t(a)||w(r(a))}),x(r(a[0]),t(d)?d:function(){k.js.apply(null,b)})):x(r(a[0]));return k},k.ready=function(b,c){if(b==a){d?p(c):e.push(c);return k}t(b)&&(c=b,b="ALL");if(typeof b!="string"||!t(c))return k;var f=h[b];if(f&&f.state==o||b=="ALL"&&u()&&d){p(c);return k}var i=g[b];i?i.push(c):i=g[b]=[c];return k},k.ready(a,function(){u()&&s(g.ALL,function(a){p(a)}),k.feature&&k.feature("domloaded",!0)});if(window.addEventListener)a.addEventListener("DOMContentLoaded",z,!1),window.addEventListener("load",z,!1);else if(window.attachEvent){a.attachEvent("onreadystatechange",function(){a.readyState==="complete"&&z()});var A=1;try{A=window.frameElement}catch(B){}!A&&b.doScroll&&function(){try{b.doScroll("left"),z()}catch(a){setTimeout(arguments.callee,1);return}}(),window.attachEvent("onload",z)}!a.readyState&&a.addEventListener&&(a.readyState="loading",a.addEventListener("DOMContentLoaded",handler=function(){a.removeEventListener("DOMContentLoaded",handler,!1),a.readyState="complete"},!1)),setTimeout(function(){c=!0,s(f,function(a){a()})},300)}(document)
