/* 
Robert Penner's original easing equations modified for JQuery animate method, Jamie Lemon 2009 lemonsanver.com

Below are easing equations based on Robert Penner's work, modified for JQuery
The "In" part of an animation is the start of it, the "Out" part is the end of it
If you apply "easing" at the "In" or the "Out" then the supplied animation curve is most apparent at that point
Enjoy the animation curves!

usage: $(".myImageID").animate({"left": "+=100"},{queue:false, duration:500, easing:"bounceEaseOut"});

function list:
back 
bounce
circ
cubic
elastic
expo
quad
quart
quint
sine


Note in JQuey's native animate function the supplied parameters are supplied as follows:

easingAlgorythmEaseType: function( p, n, firstNum, diff )

@param p The time phase between 0 and 1
@param n Not sure what this is :), in any case its not used
@param firstNum The first number in the transform
@param diff The difference in in pixels required

*/

/*
Disclaimer for Robert Penner's Easing Equations license:

TERMS OF USE - EASING EQUATIONS

Open source under the BSD License.

Copyright © 2001 Robert Penner
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

jQuery.extend({

    easing:
    {
        swing: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            var s = 1.70158; // default overshoot value, can be adjusted to suit
            return c * (p /= 1) * p * ((s + 1) * p - s) + firstNum;
        },

        // ******* back
        backEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            var s = 1.70158; // default overshoot value, can be adjusted to suit
            return c * (p /= 1) * p * ((s + 1) * p - s) + firstNum;
        },

        backEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            var s = 1.70158; // default overshoot value, can be adjusted to suit
            return c * ((p = p / 1 - 1) * p * ((s + 1) * p + s) + 1) + firstNum;
        },

        backEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            var s = 1.70158; // default overshoot value, can be adjusted to suit
            if ((p /= 0.5) < 1)
                return c / 2 * (p * p * (((s *= (1.525)) + 1) * p - s)) + firstNum;
            else
                return c / 2 * ((p -= 2) * p * (((s *= (1.525)) + 1) * p + s) + 2) + firstNum;
        },

        // ******* bounce
        bounceEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;
            var inv = this.bounceEaseOut(1 - p, 1, 0, diff);
            return c - inv + firstNum;
        },

        bounceEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if (p < (1 / 2.75)) {
                return c * (7.5625 * p * p) + firstNum;
            }
            else if (p < (2 / 2.75)) {
                return c * (7.5625 * (p -= (1.5 / 2.75)) * p + .75) + firstNum;
            }
            else if (p < (2.5 / 2.75)) {
                return c * (7.5625 * (p -= (2.25 / 2.75)) * p + .9375) + firstNum;
            }
            else {
                return c * (7.5625 * (p -= (2.625 / 2.75)) * p + .984375) + firstNum;
            }
        },


        // ******* circ
        circEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return -c * (Math.sqrt(1 - (p /= 1) * p) - 1) + firstNum;
        },

        circEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * Math.sqrt(1 - (p = p / 1 - 1) * p) + firstNum;
        },

        circEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if ((p /= 0.5) < 1)
                return -c / 2 * (Math.sqrt(1 - p * p) - 1) + firstNum;
            else
                return c / 2 * (Math.sqrt(1 - (p -= 2) * p) + 1) + firstNum;
        },

        // ******* cubic
        cubicEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * (p /= 1) * p * p + firstNum;
        },

        cubicEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * ((p = p / 1 - 1) * p * p + 1) + firstNum;
        },

        cubicEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if ((p /= 0.5) < 1)
                return c / 2 * p * p * p + firstNum;
            else
                return c / 2 * ((p -= 2) * p * p + 2) + firstNum;
        },

        // ******* elastic
        elasticEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if (p == 0) return firstNum;
            if (p == 1) return c;


            var peroid = 0.25;
            var s;
            var amplitude = c;

            if (amplitude < Math.abs(c)) {
                amplitude = c;
                s = peroid / 4;
            }
            else {
                s = peroid / (2 * Math.PI) * Math.asin(c / amplitude);
            }

            return -(amplitude * Math.pow(2, 10 * (p -= 1)) * Math.sin((p * 1 - s) * (2 * Math.PI) / peroid)) + firstNum;
        },

        elasticEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if (p == 0) return firstNum;
            if (p == 1) return c;

            var peroid = 0.25;
            var s;
            var amplitude = c;

            if (amplitude < Math.abs(c)) {
                amplitude = c;
                s = peroid / 4;
            }
            else {
                s = peroid / (2 * Math.PI) * Math.asin(c / amplitude);
            }

            return -(amplitude * Math.pow(2, -10 * p) * Math.sin((p * 1 - s) * (2 * Math.PI) / peroid)) + c;
        },

        // ******* expo
        expoEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return (p == 0) ? firstNum : c * Math.pow(2, 10 * (p - 1)) + firstNum - c * 0.001;
        },

        expoEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return (p == 1) ? c : diff * 1.001 * (-Math.pow(2, -10 * p) + 1) + firstNum;
        },

        expoEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if (p == 0) return firstNum;
            if (p == 1) return c;

            if ((p /= 0.5) < 1)
                return c / 2 * Math.pow(2, 10 * (p - 1)) + firstNum - c * 0.0005;
            else
                return c / 2 * 1.0005 * (-Math.pow(2, -10 * --p) + 2) + firstNum;
        },

        // ******* quad
        quadEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * (p /= 1) * p + firstNum;
        },

        quadEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return -c * (p /= 1) * (p - 2) + firstNum;
        },

        quadEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if ((p /= 0.5) < 1)
                return c / 2 * p * p + firstNum;
            else
                return -c / 2 * ((--p) * (p - 2) - 1) + firstNum;
        },

        // ******* quart
        quartEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * (p /= 1) * p * p * p + firstNum;
        },

        quartEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return -c * ((p = p / 1 - 1) * p * p * p - 1) + firstNum;
        },

        quartEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if ((p /= 0.5) < 1)
                return c / 2 * p * p * p * p + firstNum;
            else
                return -c / 2 * ((p -= 2) * p * p * p - 2) + firstNum;
        },

        // ******* quint
        quintEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * (p /= 1) * p * p * p * p + firstNum;
        },

        quintEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            return c * ((p = p / 1 - 1) * p * p * p * p + 1) + firstNum;
        },

        quintEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;

            if ((p /= 0.5) < 1)
                return c / 2 * p * p * p * p * p + firstNum;
            else
                return c / 2 * ((p -= 2) * p * p * p * p + 2) + firstNum;
        },

        // *******  sine
        sineEaseIn: function(p, n, firstNum, diff) {

            var c = firstNum + diff;
            return -c * Math.cos(p * (Math.PI / 2)) + c + firstNum;
        },

        sineEaseOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;
            return c * Math.sin(p * (Math.PI / 2)) + firstNum;
        },

        sineEaseInOut: function(p, n, firstNum, diff) {

            var c = firstNum + diff;
            return -c / 2 * (Math.cos(Math.PI * p) - 1) + firstNum;
        }
    }
});
/* ------------------------------------------------------------------------
Class: prettyPhoto
Use: Lightbox clone for jQuery
Author: Stephane Caron (http://www.no-margin-for-errors.com)
Version: 2.4.3
------------------------------------------------------------------------- */

var $pp_pic_holder;
var $ppt;
(function(A) {

    A.fn.prettyPhoto = function(W) {
        var E = true; var K = false; var O = [];
        var D = 0; var R; var S; var V; var Y; var F = "image";
        var Z; var M = G();
        A(window).scroll(function() { M = G(); C() });
        A(window).resize(function() { C(); U() });
        A(document).keypress(function(c) {
            switch (c.keyCode) {
                case 37: if (D == 1) { return } N("previous"); break; case 39: if (D == setCount) { return }
                    N("next"); break; case 27: L(); break
            }
        }); //normal
        W = jQuery.extend({ animationSpeed: "normal", padding: 40, opacity: 0.8, showTitle: true, allowresize: true, counter_separator_label: "/", theme: "light_rounded",
            callback: function() { }
        }, W);

        if (A.browser.msie && A.browser.version == 6) { W.theme = "light_square" }
        A(this).each(function() {
            var e = false; var d = false; var f = 0; var c = 0; O[O.length] = this;
            A(this).bind("click", function() { J(this); return false })
        });
        function J(c) {
            Z = A(c); theRel = Z.attr("rel");
            galleryRegExp = /\[(?:.*)\]/; theGallery = galleryRegExp.exec(theRel); isSet = false; setCount = 0; b();
            for (i = 0; i < O.length; i++) { if (A(O[i]).attr("rel").indexOf(theGallery) != -1) { setCount++; if (setCount > 1) { isSet = true } if (A(O[i]).attr("href") == Z.attr("href")) { D = setCount; arrayPosition = i } } } X(); $pp_pic_holder.find("p.currentTextHolder").text(D + W.counter_separator_label + setCount);
            C();
            A("#pp_full_res").hide();
            $pp_pic_holder.find(".pp_loaderIcon").show()
        } showimage = function(f, c, j, h, g, d, e) {
            //action a effectue avant ouverture
            //$("#Menu").css("top", "-200px");
            A(".pp_loaderIcon").hide();
            if (A.browser.opera) { windowHeight = window.innerHeight; windowWidth = window.innerWidth } else { windowHeight = A(window).height(); windowWidth = A(window).width() } $pp_pic_holder.find(".pp_content").animate({ height: g }, W.animationSpeed); projectedTop = M.scrollTop + ((windowHeight / 2) - (h / 2)); if (projectedTop < 0) { projectedTop = 0 + $pp_pic_holder.find(".ppt").height() } $pp_pic_holder.animate({ top: projectedTop, left: ((windowWidth / 2) - (j / 2)), width: j }, W.animationSpeed, function() { $pp_pic_holder.width(j); $pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(c).width(f); $pp_pic_holder.find("#pp_full_res").fadeIn(W.animationSpeed, function() { A(this).find("object,embed").css("visibility", "visible") }); I(); if (e) { A("a.pp_expand,a.pp_contract").fadeIn(W.animationSpeed) } })
            //avec easing
            //if (A.browser.opera) { windowHeight = window.innerHeight; windowWidth = window.innerWidth } else { windowHeight = A(window).height(); windowWidth = A(window).width() } $pp_pic_holder.find(".pp_content").animate({ height: g }, { queue: false, duration: 500, easing: "bounceEaseOut" }); projectedTop = M.scrollTop + ((windowHeight / 2) - (h / 2)); if (projectedTop < 0) { projectedTop = 0 + $pp_pic_holder.find(".ppt").height() } $pp_pic_holder.animate({ top: projectedTop, left: ((windowWidth / 2) - (j / 2)), width: j }, W.animationSpeed, "bounceEaseOut", function() { $pp_pic_holder.width(j); $pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(c).width(f); $pp_pic_holder.find("#pp_full_res").fadeIn(W.animationSpeed, function() { A(this).find("object,embed").css("visibility", "visible") }); I(); if (e) { A("a.pp_expand,a.pp_contract").fadeIn(W.animationSpeed) } })
        }; function I() { if (isSet && F == "image") { $pp_pic_holder.find(".pp_hoverContainer").fadeIn(W.animationSpeed) } else { $pp_pic_holder.find(".pp_hoverContainer").hide() } $pp_pic_holder.find(".pp_details").fadeIn(W.animationSpeed); if (W.showTitle && hasTitle) { $ppt.css({ top: $pp_pic_holder.offset().top - 22, left: $pp_pic_holder.offset().left + (W.padding / 2), display: "none" }); $ppt.fadeIn(W.animationSpeed) } } function Q() { $pp_pic_holder.find(".pp_hoverContainer,.pp_details").fadeOut(W.animationSpeed); $pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility", "hidden"); $pp_pic_holder.find("#pp_full_res").fadeOut(W.animationSpeed, function() { A(".pp_loaderIcon").show(); a() }); $ppt.fadeOut(W.animationSpeed) } function N(c) { if (c == "previous") { arrayPosition--; D-- } else { arrayPosition++; D++ } if (!E) { E = true } Q(); A("a.pp_expand,a.pp_contract").fadeOut(W.animationSpeed, function() { A(this).removeClass("pp_contract").addClass("pp_expand") }) } function L() { $pp_pic_holder.find("object,embed").css("visibility", "hidden"); A("div.pp_pic_holder,div.ppt").fadeOut(W.animationSpeed); A("div.pp_overlay").fadeOut(W.animationSpeed, function() { A("div.pp_overlay,div.pp_pic_holder,div.ppt").remove(); if (A.browser.msie && A.browser.version == 6) { A("select").css("visibility", "visible") } W.callback() }); E = true } function H() { if (D == setCount) { $pp_pic_holder.find("a.pp_next").css("visibility", "hidden"); $pp_pic_holder.find("a.pp_arrow_next").addClass("disabled").unbind("click") } else { $pp_pic_holder.find("a.pp_next").css("visibility", "visible"); $pp_pic_holder.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click", function() { N("next"); return false }) } if (D == 1) { $pp_pic_holder.find("a.pp_previous").css("visibility", "hidden"); $pp_pic_holder.find("a.pp_arrow_previous").addClass("disabled").unbind("click") } else { $pp_pic_holder.find("a.pp_previous").css("visibility", "visible"); $pp_pic_holder.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click", function() { N("previous"); return false }) } $pp_pic_holder.find("p.currentTextHolder").text(D + W.counter_separator_label + setCount); Z = (isSet) ? A(O[arrayPosition]) : Z; b(); if (Z.attr("title")) { $pp_pic_holder.find(".pp_description").show().html(unescape(Z.attr("title"))) } else { $pp_pic_holder.find(".pp_description").hide().text("") } if (Z.find("img").attr("alt") && W.showTitle) { hasTitle = true; $ppt.html(unescape(Z.find("img").attr("alt"))) } else { hasTitle = false } } function P(d, c) { hasBeenResized = false; T(d, c); imageWidth = d; imageHeight = c; windowHeight = A(window).height(); windowWidth = A(window).width(); if (((Y > windowWidth) || (V > windowHeight)) && E && W.allowresize && !K) { hasBeenResized = true; notFitting = true; while (notFitting) { if ((Y > windowWidth)) { imageWidth = (windowWidth - 200); imageHeight = (c / d) * imageWidth } else { if ((V > windowHeight)) { imageHeight = (windowHeight - 200); imageWidth = (d / c) * imageHeight } else { notFitting = false } } V = imageHeight; Y = imageWidth } T(imageWidth, imageHeight) } return { width: imageWidth, height: imageHeight, containerHeight: V, containerWidth: Y, contentHeight: R, contentWidth: S, resized: hasBeenResized} } function T(d, c) { $pp_pic_holder.find(".pp_details").width(d).find(".pp_description").width(d - parseFloat($pp_pic_holder.find("a.pp_close").css("width"))); R = c + $pp_pic_holder.find(".pp_details").height() + parseFloat($pp_pic_holder.find(".pp_details").css("marginTop")) + parseFloat($pp_pic_holder.find(".pp_details").css("marginBottom")); S = d; V = R + $pp_pic_holder.find(".ppt").height() + $pp_pic_holder.find(".pp_top").height() + $pp_pic_holder.find(".pp_bottom").height(); Y = d + W.padding } function b() { if (Z.attr("href").match(/youtube\.com\/watch/i)) { F = "youtube" } else { if (Z.attr("href").indexOf(".mov") != -1) { F = "quicktime" } else { if (Z.attr("href").indexOf(".swf") != -1) { F = "flash" } else { if (Z.attr("href").indexOf("iframe") != -1) { F = "iframe" } else { F = "image" } } } } } function C() { if ($pp_pic_holder) { if ($pp_pic_holder.size() == 0) { return } } else { return } if (A.browser.opera) { windowHeight = window.innerHeight; windowWidth = window.innerWidth } else { windowHeight = A(window).height(); windowWidth = A(window).width() } if (E) { $pHeight = $pp_pic_holder.height(); $pWidth = $pp_pic_holder.width(); $tHeight = $ppt.height(); projectedTop = (windowHeight / 2) + M.scrollTop - ($pHeight / 2); if (projectedTop < 0) { projectedTop = 0 + $tHeight } $pp_pic_holder.css({ top: projectedTop, left: (windowWidth / 2) + M.scrollLeft - ($pWidth / 2) }); $ppt.css({ top: projectedTop - $tHeight, left: (windowWidth / 2) + M.scrollLeft - ($pWidth / 2) + (W.padding / 2) }) } } function a() { H(); if (F == "image") { imgPreloader = new Image(); nextImage = new Image(); if (isSet && D > setCount) { nextImage.src = A(O[arrayPosition + 1]).attr("href") } prevImage = new Image(); if (isSet && O[arrayPosition - 1]) { prevImage.src = A(O[arrayPosition - 1]).attr("href") } pp_typeMarkup = '<img id="fullResImage" src="" />'; $pp_pic_holder.find("#pp_full_res")[0].innerHTML = pp_typeMarkup; $pp_pic_holder.find(".pp_content").css("overflow", "hidden"); $pp_pic_holder.find("#fullResImage").attr("src", Z.attr("href")); imgPreloader.onload = function() { var c = P(imgPreloader.width, imgPreloader.height); imgPreloader.width = c.width; imgPreloader.height = c.height; showimage(imgPreloader.width, imgPreloader.height, c.containerWidth, c.containerHeight, c.contentHeight, c.contentWidth, c.resized) }; imgPreloader.src = Z.attr("href") } else { movie_width = (parseFloat(B("width", Z.attr("href")))) ? B("width", Z.attr("href")) : "425"; movie_height = (parseFloat(B("height", Z.attr("href")))) ? B("height", Z.attr("href")) : "344"; if (movie_width.indexOf("%") != -1 || movie_height.indexOf("%") != -1) { movie_height = (A(window).height() * parseFloat(movie_height) / 100) - 100; movie_width = (A(window).width() * parseFloat(movie_width) / 100) - 100; parsentBased = true } else { movie_height = parseFloat(movie_height); movie_width = parseFloat(movie_width) } if (F == "quicktime") { movie_height += 13 } correctSizes = P(movie_width, movie_height); if (F == "youtube") { pp_typeMarkup = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + correctSizes.width + '" height="' + correctSizes.height + '"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.youtube.com/v/' + B("v", Z.attr("href")) + '" /><embed src="http://www.youtube.com/v/' + B("v", Z.attr("href")) + '" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + correctSizes.width + '" height="' + correctSizes.height + '"></embed></object>' } else { if (F == "quicktime") { pp_typeMarkup = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="' + correctSizes.height + '" width="' + correctSizes.width + '"><param name="src" value="' + Z.attr("href") + '"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="' + Z.attr("href") + '" height="' + correctSizes.height + '" width="' + correctSizes.width + '" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>' } else { if (F == "flash") { flash_vars = Z.attr("href"); flash_vars = flash_vars.substring(Z.attr("href").indexOf("flashvars") + 10, Z.attr("href").length); filename = Z.attr("href"); filename = filename.substring(0, filename.indexOf("?")); pp_typeMarkup = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + correctSizes.width + '" height="' + correctSizes.height + '"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="' + filename + "?" + flash_vars + '" /><embed src="' + filename + "?" + flash_vars + '" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + correctSizes.width + '" height="' + correctSizes.height + '"></embed></object>' } else { if (F == "iframe") { movie_url = Z.attr("href"); movie_url = movie_url.substr(0, movie_url.indexOf("iframe") - 1); pp_typeMarkup = '<iframe src ="' + movie_url + '" width="' + (correctSizes.width - 10) + '" height="' + (correctSizes.height - 10) + '" frameborder="no"></iframe>' } } } } $pp_pic_holder.find("#pp_full_res")[0].innerHTML = pp_typeMarkup; showimage(correctSizes.width, correctSizes.height, correctSizes.containerWidth, correctSizes.containerHeight, correctSizes.contentHeight, correctSizes.contentWidth, correctSizes.resized) } } function G() { if (self.pageYOffset) { scrollTop = self.pageYOffset; scrollLeft = self.pageXOffset } else { if (document.documentElement && document.documentElement.scrollTop) { scrollTop = document.documentElement.scrollTop; scrollLeft = document.documentElement.scrollLeft } else { if (document.body) { scrollTop = document.body.scrollTop; scrollLeft = document.body.scrollLeft } } } return { scrollTop: scrollTop, scrollLeft: scrollLeft} } function U() { A("div.pp_overlay").css({ height: A(document).height(), width: A(window).width() }) } function X() {
            toInject = ""; toInject += "<div class='pp_overlay'></div>"; if (F == "image") { pp_typeMarkup = '<img id="fullResImage" src="" />' } else { pp_typeMarkup = "" } toInject += '<div class="pp_pic_holder"><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_loaderIcon"></div><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res">' + pp_typeMarkup + '</div><div class="pp_details clearfix"><a class="pp_close" href="#">Close</a><p class="pp_description"></p><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0' + W.counter_separator_label + '0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div>'; toInject += '<div class="ppt"></div>'; A("body").append(toInject); $pp_pic_holder = A(".pp_pic_holder"); $ppt = A(".ppt"); A("div.pp_overlay").css("height", A(document).height()).bind("click", function() { L() }); $pp_pic_holder.css({ opacity: 0 }).addClass(W.theme);
            A("a.pp_close").bind("click", function() {
                //action a effectue apres fermeture
                //$("#Menu").css("top", "250px");
                L(); return false
            });
            A("a.pp_expand").bind("click", function() { $this = A(this); if ($this.hasClass("pp_expand")) { $this.removeClass("pp_expand").addClass("pp_contract"); E = false } else { $this.removeClass("pp_contract").addClass("pp_expand"); E = true } Q(); $pp_pic_holder.find(".pp_hoverContainer, #pp_full_res, .pp_details").fadeOut(W.animationSpeed, function() { a() }); return false }); $pp_pic_holder.find(".pp_previous, .pp_arrow_previous").bind("click", function() { N("previous"); return false }); $pp_pic_holder.find(".pp_next, .pp_arrow_next").bind("click", function() { N("next"); return false }); $pp_pic_holder.find(".pp_hoverContainer").css({ "margin-left": W.padding / 2 }); if (!isSet) { $pp_pic_holder.find(".pp_hoverContainer,.pp_nav").hide() } if (A.browser.msie && A.browser.version == 6) { A("body").addClass("ie6"); A("select").css("visibility", "hidden") } A("div.pp_overlay").css("opacity", 0).fadeTo(W.animationSpeed, W.opacity, function() { $pp_pic_holder.css("opacity", 0).fadeIn(W.animationSpeed, function() { $pp_pic_holder.attr("style", "left:" + $pp_pic_holder.css("left") + ";top:" + $pp_pic_holder.css("top") + ";"); a() }) })
        }
    };
    function B(E, D) {
        E = E.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var C = "[\\?&]" + E + "=([^&#]*)";
        var G = new RegExp(C); var F = G.exec(D); if (F == null) { return "" } else { return F[1] }
    }
})(jQuery);
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/


jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};/**
 * Boxy 0.1.4 - Facebook-style dialog, with frills
 *
 * (c) 2008 Jason Frame
 * Licensed under the MIT License (LICENSE)
 */
 
/*
 * jQuery plugin
 *
 * Options:
 *   message: confirmation message for form submit hook (default: "Please confirm:")
 * 
 * Any other options - e.g. 'clone' - will be passed onto the boxy constructor (or
 * Boxy.load for AJAX operations)
 */
jQuery.fn.boxy = function(options) {
    options = options || {};
    return this.each(function() {      
        var node = this.nodeName.toLowerCase(), self = this;
        if (node == 'a') {
            jQuery(this).click(function() {
                var active = Boxy.linkedTo(this),
                    href = this.getAttribute('href'),
                    localOptions = jQuery.extend({actuator: this, title: this.title}, options);
                    
                if (active) {
                    active.show();
                } else if (href.indexOf('#') >= 0) {
                    var content = jQuery(href.substr(href.indexOf('#'))),
                        newContent = content.clone(true);
                    content.remove();
                    localOptions.unloadOnHide = false;
                    new Boxy(newContent, localOptions);
                } else { // fall back to AJAX; could do with a same-origin check
                    if (!localOptions.cache) localOptions.unloadOnHide = true;
                    Boxy.load(this.href, localOptions);
                }
                
                return false;
            });
        } else if (node == 'form') {
            jQuery(this).bind('submit.boxy', function() {
                Boxy.confirm(options.message || 'Please confirm:', function() {
                    jQuery(self).unbind('submit.boxy').submit();
                });
                return false;
            });
        }
    });
};

//
// Boxy Class

function Boxy(element, options) {
    
    this.boxy = jQuery(Boxy.WRAPPER);
    jQuery.data(this.boxy[0], 'boxy', this);
    
    this.visible = false;
    this.options = jQuery.extend({}, Boxy.DEFAULTS, options || {});
    
    if (this.options.modal) {
        this.options = jQuery.extend(this.options, {center: true, draggable: false});
    }
    
    // options.actuator == DOM element that opened this boxy
    // association will be automatically deleted when this boxy is remove()d
    if (this.options.actuator) {
        jQuery.data(this.options.actuator, 'active.boxy', this);
    }
    
    this.setContent(element || "<div></div>");
    this._setupTitleBar();
    
    this.boxy.css('display', 'none').appendTo(document.body);
    this.toTop();

    if (this.options.fixed) {
        if (jQuery.browser.msie && jQuery.browser.version < 7) {
            this.options.fixed = false; // IE6 doesn't support fixed positioning
        } else {
            this.boxy.addClass('fixed');
        }
    }
    
    if (this.options.center && Boxy._u(this.options.x, this.options.y)) {
        this.center();
    } else {
        this.moveTo(
            Boxy._u(this.options.x) ? this.options.x : Boxy.DEFAULT_X,
            Boxy._u(this.options.y) ? this.options.y : Boxy.DEFAULT_Y
        );
    }
    
    if (this.options.show) this.show();

};

Boxy.EF = function() {};

jQuery.extend(Boxy, {
    
    WRAPPER:    "<table cellspacing='0' cellpadding='0' border='0' class='boxy-wrapper'>" +
                "<tr><td class='top-left'></td><td class='top'></td><td class='top-right'></td></tr>" +
                "<tr><td class='left'></td><td class='boxy-inner'></td><td class='right'></td></tr>" +
                "<tr><td class='bottom-left'></td><td class='bottom'></td><td class='bottom-right'></td></tr>" +
                "</table>",
    
    DEFAULTS: {
        title:                  null,           // titlebar text. titlebar will not be visible if not set.
        closeable:              true,           // display close link in titlebar?
        draggable:              true,           // can this dialog be dragged?
        clone:                  false,          // clone content prior to insertion into dialog?
        actuator:               null,           // element which opened this dialog
        center:                 true,           // center dialog in viewport?
        show:                   true,           // show dialog immediately?
        modal:                  false,          // make dialog modal?
        fixed:                  true,           // use fixed positioning, if supported? absolute positioning used otherwise
        closeText:              '[close]',      // text to use for default close link
        unloadOnHide:           false,          // should this dialog be removed from the DOM after being hidden?
        clickToFront:           false,          // bring dialog to foreground on any click (not just titlebar)?
        behaviours:             Boxy.EF,        // function used to apply behaviours to all content embedded in dialog.
        afterDrop:              Boxy.EF,        // callback fired after dialog is dropped. executes in context of Boxy instance.
        afterShow:              Boxy.EF,        // callback fired after dialog becomes visible. executes in context of Boxy instance.
        afterHide:              Boxy.EF,        // callback fired after dialog is hidden. executed in context of Boxy instance.
        beforeUnload:           Boxy.EF         // callback fired after dialog is unloaded. executed in context of Boxy instance.
    },
    
    DEFAULT_X:          50,
    DEFAULT_Y:          50,
    zIndex:             1337,
    dragConfigured:     false, // only set up one drag handler for all boxys
    resizeConfigured:   false,
    dragging:           null,
    
    // load a URL and display in boxy
    // url - url to load
    // options keys (any not listed below are passed to boxy constructor)
    //   type: HTTP method, default: GET
    //   cache: cache retrieved content? default: false
    //   filter: jQuery selector used to filter remote content
    load: function(url, options) {
        
        options = options || {};
        
        var ajax = {
            url: url, type: 'GET', dataType: 'html', cache: false, success: function(html) {
                html = jQuery(html);
                if (options.filter) html = jQuery(options.filter, html);
                new Boxy(html, options);
            }
        };
        
        jQuery.each(['type', 'cache'], function() {
            if (this in options) {
                ajax[this] = options[this];
                delete options[this];
            }
        });
        
        jQuery.ajax(ajax);
        
    },
    
    // allows you to get a handle to the containing boxy instance of any element
    // e.g. <a href='#' onclick='alert(Boxy.get(this));'>inspect!</a>.
    // this returns the actual instance of the boxy 'class', not just a DOM element.
    // Boxy.get(this).hide() would be valid, for instance.
    get: function(ele) {
        var p = jQuery(ele).parents('.boxy-wrapper');
        return p.length ? jQuery.data(p[0], 'boxy') : null;
    },
    
    // returns the boxy instance which has been linked to a given element via the
    // 'actuator' constructor option.
    linkedTo: function(ele) {
        return jQuery.data(ele, 'active.boxy');
    },
    
    // displays an alert box with a given message, calling optional callback
    // after dismissal.
    alert: function(message, callback, options) {
        return Boxy.ask(message, ['OK'], callback, options);
    },
    
    // displays an alert box with a given message, calling after callback iff
    // user selects OK.
    confirm: function(message, after, options) {
        return Boxy.ask(message, ['OK', 'Cancel'], function(response) {
            if (response == 'OK') after();
        }, options);
    },
    
    // asks a question with multiple responses presented as buttons
    // selected item is returned to a callback method.
    // answers may be either an array or a hash. if it's an array, the
    // the callback will received the selected value. if it's a hash,
    // you'll get the corresponding key.
    ask: function(question, answers, callback, options) {
        
        options = jQuery.extend({modal: true, closeable: false},
                                options || {},
                                {show: true, unloadOnHide: true});
        
        var body = jQuery('<div></div>').append(jQuery('<div class="question"></div>').html(question));
        
        // ick
        var map = {}, answerStrings = [];
        if (answers instanceof Array) {
            for (var i = 0; i < answers.length; i++) {
                map[answers[i]] = answers[i];
                answerStrings.push(answers[i]);
            }
        } else {
            for (var k in answers) {
                map[answers[k]] = k;
                answerStrings.push(answers[k]);
            }
        }
        
        var buttons = jQuery('<form class="answers"></form>');
        buttons.html(jQuery.map(answerStrings, function(v) {
            return "<input type='button' value='" + v + "' />";
        }).join(' '));
        
        jQuery('input[type=button]', buttons).click(function() {
            var clicked = this;
            Boxy.get(this).hide(function() {
                if (callback) callback(map[clicked.value]);
            });
        });
        
        body.append(buttons);
        
        new Boxy(body, options);
        
    },
    
    // returns true if a modal boxy is visible, false otherwise
    isModalVisible: function() {
        return jQuery('.boxy-modal-blackout').length > 0;
    },
    
    _u: function() {
        for (var i = 0; i < arguments.length; i++)
            if (typeof arguments[i] != 'undefined') return false;
        return true;
    },
    
    _handleResize: function(evt) {
        var d = jQuery(document);
        jQuery('.boxy-modal-blackout').css('display', 'none').css({
            width: d.width(), height: d.height()
        }).css('display', 'block');
    },
    
    _handleDrag: function(evt) {
        var d;
        if (d = Boxy.dragging) {
            d[0].boxy.css({left: evt.pageX - d[1], top: evt.pageY - d[2]});
        }
    },
    
    _nextZ: function() {
        return Boxy.zIndex++;
    },
    
    _viewport: function() {
        var d = document.documentElement, b = document.body, w = window;
        return jQuery.extend(
            jQuery.browser.msie ?
                { left: b.scrollLeft || d.scrollLeft, top: b.scrollTop || d.scrollTop } :
                { left: w.pageXOffset, top: w.pageYOffset },
            !Boxy._u(w.innerWidth) ?
                { width: w.innerWidth, height: w.innerHeight } :
                (!Boxy._u(d) && !Boxy._u(d.clientWidth) && d.clientWidth != 0 ?
                    { width: d.clientWidth, height: d.clientHeight } :
                    { width: b.clientWidth, height: b.clientHeight }) );
    }

});

Boxy.prototype = {
    
    // Returns the size of this boxy instance without displaying it.
    // Do not use this method if boxy is already visible, use getSize() instead.
    estimateSize: function() {
        this.boxy.css({visibility: 'hidden', display: 'block'});
        var dims = this.getSize();
        this.boxy.css('display', 'none').css('visibility', 'visible');
        return dims;
    },
                
    // Returns the dimensions of the entire boxy dialog as [width,height]
    getSize: function() {
        return [this.boxy.width(), this.boxy.height()];
    },
    
    // Returns the dimensions of the content region as [width,height]
    getContentSize: function() {
        var c = this.getContent();
        return [c.width(), c.height()];
    },
    
    // Returns the position of this dialog as [x,y]
    getPosition: function() {
        var b = this.boxy[0];
        return [b.offsetLeft, b.offsetTop];
    },
    
    // Returns the center point of this dialog as [x,y]
    getCenter: function() {
        var p = this.getPosition();
        var s = this.getSize();
        return [Math.floor(p[0] + s[0] / 2), Math.floor(p[1] + s[1] / 2)];
    },
                
    // Returns a jQuery object wrapping the inner boxy region.
    // Not much reason to use this, you're probably more interested in getContent()
    getInner: function() {
        return jQuery('.boxy-inner', this.boxy);
    },
    
    // Returns a jQuery object wrapping the boxy content region.
    // This is the user-editable content area (i.e. excludes titlebar)
    getContent: function() {
        return jQuery('.boxy-content', this.boxy);
    },
    
    // Replace dialog content
    setContent: function(newContent) {
        newContent = jQuery(newContent).css({display: 'block'}).addClass('boxy-content');
        if (this.options.clone) newContent = newContent.clone(true);
        this.getContent().remove();
        this.getInner().append(newContent);
        this._setupDefaultBehaviours(newContent);
        this.options.behaviours.call(this, newContent);
        return this;
    },
    
    // Move this dialog to some position, funnily enough
    moveTo: function(x, y) {
        this.moveToX(x).moveToY(y);
        return this;
    },
    
    // Move this dialog (x-coord only)
    moveToX: function(x) {
        if (typeof x == 'number') this.boxy.css({left: x});
        else this.centerX();
        return this;
    },
    
    // Move this dialog (y-coord only)
    moveToY: function(y) {
        if (typeof y == 'number') this.boxy.css({top: y});
        else this.centerY();
        return this;
    },
    
    // Move this dialog so that it is centered at (x,y)
    centerAt: function(x, y) {
        var s = this[this.visible ? 'getSize' : 'estimateSize']();
        if (typeof x == 'number') this.moveToX(x - s[0] / 2);
        if (typeof y == 'number') this.moveToY(y - s[1] / 2);
        return this;
    },
    
    centerAtX: function(x) {
        return this.centerAt(x, null);
    },
    
    centerAtY: function(y) {
        return this.centerAt(null, y);
    },
    
    // Center this dialog in the viewport
    // axis is optional, can be 'x', 'y'.
    center: function(axis) {
        var v = Boxy._viewport();
        var o = this.options.fixed ? [0, 0] : [v.left, v.top];
        if (!axis || axis == 'x') this.centerAt(o[0] + v.width / 2, null);
        if (!axis || axis == 'y') this.centerAt(null, o[1] + v.height / 2);
        return this;
    },
    
    // Center this dialog in the viewport (x-coord only)
    centerX: function() {
        return this.center('x');
    },
    
    // Center this dialog in the viewport (y-coord only)
    centerY: function() {
        return this.center('y');
    },
    
    // Resize the content region to a specific size
    resize: function(width, height, after) {
        if (!this.visible) return;
        var bounds = this._getBoundsForResize(width, height);
        this.boxy.css({left: bounds[0], top: bounds[1]});
        this.getContent().css({width: bounds[2], height: bounds[3]});
        if (after) after(this);
        return this;
    },
    
    // Tween the content region to a specific size
    tween: function(width, height, after) {
        if (!this.visible) return;
        var bounds = this._getBoundsForResize(width, height);
        var self = this;
        this.boxy.stop().animate({left: bounds[0], top: bounds[1]});
        this.getContent().stop().animate({width: bounds[2], height: bounds[3]}, function() {
            if (after) after(self);
        });
        return this;
    },
    
    // Returns true if this dialog is visible, false otherwise
    isVisible: function() {
        return this.visible;    
    },
    
    // Make this boxy instance visible
    show: function() {
        if (this.visible) return;
        if (this.options.modal) {
            var self = this;
            if (!Boxy.resizeConfigured) {
                Boxy.resizeConfigured = true;
                jQuery(window).resize(function() { Boxy._handleResize(); });
            }
            this.modalBlackout = jQuery('<div class="boxy-modal-blackout"></div>')
                .css({zIndex: Boxy._nextZ(),
                      opacity: 0.7,
                      width: jQuery(document).width(),
                      height: jQuery(document).height()})
                .appendTo(document.body);
            this.toTop();
            if (this.options.closeable) {
                jQuery(document.body).bind('keypress.boxy', function(evt) {
                    var key = evt.which || evt.keyCode;
                    if (key == 27) {
                        self.hide();
                        jQuery(document.body).unbind('keypress.boxy');
                    }
                });
            }
        }
        this.boxy.stop().css({opacity: 1}).show();
        this.visible = true;
        this._fire('afterShow');
        return this;
    },
    
    // Hide this boxy instance
    hide: function(after) {
        if (!this.visible) return;
        var self = this;
        if (this.options.modal) {
            jQuery(document.body).unbind('keypress.boxy');
            this.modalBlackout.animate({opacity: 0}, function() {
                jQuery(this).remove();
            });
        }
        this.boxy.stop().animate({opacity: 0}, 300, function() {
            self.boxy.css({display: 'none'});
            self.visible = false;
            self._fire('afterHide');
            if (after) after(self);
            if (self.options.unloadOnHide) self.unload();
        });
        return this;
    },
    
    toggle: function() {
        this[this.visible ? 'hide' : 'show']();
        return this;
    },
    
    hideAndUnload: function(after) {
        this.options.unloadOnHide = true;
        this.hide(after);
        return this;
    },
    
    unload: function() {
        this._fire('beforeUnload');
        this.boxy.remove();
        if (this.options.actuator) {
            jQuery.data(this.options.actuator, 'active.boxy', false);
        }
    },
    
    // Move this dialog box above all other boxy instances
    toTop: function() {
        this.boxy.css({zIndex: Boxy._nextZ()});
        return this;
    },
    
    // Returns the title of this dialog
    getTitle: function() {
        return jQuery('> .title-bar h2', this.getInner()).html();
    },
    
    // Sets the title of this dialog
    setTitle: function(t) {
        jQuery('> .title-bar h2', this.getInner()).html(t);
        return this;
    },
    
    //
    // Don't touch these privates
    
    _getBoundsForResize: function(width, height) {
        var csize = this.getContentSize();
        var delta = [width - csize[0], height - csize[1]];
        var p = this.getPosition();
        return [Math.max(p[0] - delta[0] / 2, 0),
                Math.max(p[1] - delta[1] / 2, 0), width, height];
    },
    
    _setupTitleBar: function() {
        if (this.options.title) {
            var self = this;
            var tb = jQuery("<div class='title-bar'></div>").html("<h2>" + this.options.title + "</h2>");
            if (this.options.closeable) {
                tb.append(jQuery("<a href='#' class='close'></a>").html(this.options.closeText));
            }
            if (this.options.draggable) {
                tb[0].onselectstart = function() { return false; }
                tb[0].unselectable = 'on';
                tb[0].style.MozUserSelect = 'none';
                if (!Boxy.dragConfigured) {
                    jQuery(document).mousemove(Boxy._handleDrag);
                    Boxy.dragConfigured = true;
                }
                tb.mousedown(function(evt) {
                    self.toTop();
                    Boxy.dragging = [self, evt.pageX - self.boxy[0].offsetLeft, evt.pageY - self.boxy[0].offsetTop];
                    jQuery(this).addClass('dragging');
                }).mouseup(function() {
                    jQuery(this).removeClass('dragging');
                    Boxy.dragging = null;
                    self._fire('afterDrop');
                });
            }
            this.getInner().prepend(tb);
            this._setupDefaultBehaviours(tb);
        }
    },
    
    _setupDefaultBehaviours: function(root) {
        var self = this;
        if (this.options.clickToFront) {
            root.click(function() { self.toTop(); });
        }
        jQuery('.close', root).click(function() {
            self.hide();
            return false;
        }).mousedown(function(evt) { evt.stopPropagation(); });
    },
    
    _fire: function(event) {
        this.options[event].call(this);
    }
    
};

$(document).ready(function() {
    //lightbox
    $("a[rel^='prettyPhoto']").prettyPhoto();

    /*click menu*/
    $("#nav li").click(function() {
        location.href = $(this).find('a').attr('href');
    });

    /*affichage liste élément*/
    var line = "";
    var i = 0;
    var ajout = 0;
    var chaine = "";


    // autre essai
    $("#listeD h2:not(:first)").each(function(i) {
        if (line == "") {
            line = "<ul><li class='lienautre'><a class='lienautre2' style='font-size:11px; font-weight: normal;' rel=" + (i + 1) + ">" + $(this).html() + "</a></li>";
        } else {
            line = "<li class='lienautre'><a class='lienautre2' style='font-size:11px; font-weight: normal' rel=" + (i + 1) + ">" + $(this).html() + "</a></li>";
        }
        chaine += line;
    });
    if (chaine != "") {
        $("#menupagecourant").after(chaine);
        $("#menupagecourant").after('</ul>');
    };

    var indice = 0;
    var conteneur = $("#listeD div:eq(" + indice + ")");
    $("#imgautre").attr("src", conteneur.find("img").attr("src"));
    $("#h2autre").html(conteneur.find("h2").html());
    $("#pautre").html(conteneur.find("p").html());
    $("#listeD").hide();
    $(".lienautre2").live("click", function() {
        var indice = $(this).attr("rel");
        var conteneur = $("#listeD div:eq(" + indice + ")");
        $("#imgautre").attr("src", conteneur.find("img").attr("src"));
        $("#h2autre").html(conteneur.find("h2").html());
        $("#pautre").html(conteneur.find("p").html());
    });

    /*Diaporama*/
    var offsetSlider = 0;
    var nbli = $("#sliderdiapo > li").length;
    var bplay = true;
    var timeout = 6500;
    var tempsEffet = 2000;

    $("#btnext").click(function() {
        if (offsetSlider > -((nbli - 1) * 935)) {
            offsetSlider -= 935;
            $("#sliderdiapo").animate({ marginLeft: offsetSlider }, tempsEffet, "cubicEaseInOut", function() { });
        }
    });

    //
    var play = function() {
        //        
        setTimeout(function() {
            if (offsetSlider <= -(nbli - 1) * 935 && bplay) {
                offsetSlider += 935;
                $("#sliderdiapo").append($("#sliderdiapo li:first-child").clone());
                $("#sliderdiapo li:first").remove();
                $("#sliderdiapo").css("margin-left", offsetSlider);
            }
            if (bplay) {
                $("#btnext").click();
                play();
            }
        }, timeout);
    }
    //départ auto
    $("#btplay").click();

    /*animation rollover boutique*/

    //mise a jour des opacites 
    $('#divpains').css({ opacity: 0 });
    $('#divsucres').css({ opacity: 0 });
    $('#divsucres2').css({ opacity: 0 });
    $('#divaperos').css({ opacity: 0 });

    $('#divpains').hover(function() {
        $(this).css({ opacity: 0.5 });
        tooltip.show('Les Pains', 100);
    }, function() {
        $(this).css({ opacity: 0 });
        tooltip.hide();
    });
    $('#divsucres').hover(function() {
        $(this).css({ opacity: 0.5 });
        $('#divsucres2').css({ opacity: 0.5 });
        tooltip.show('Les Sal&#233;s', 100);
    }, function() {
        $(this).css({ opacity: 0 });
        $('#divsucres2').css({ opacity: 0 });
        tooltip.hide();
    });
    $('#divsucres2').hover(function() {
        $(this).css({ opacity: 0.5 });
        $('#divsucres').css({ opacity: 0.5 });
        tooltip.show('Les Sal&#233;s', 100);
    }, function() {
        $(this).css({ opacity: 0 });
        $('#divsucres').css({ opacity: 0 });
        tooltip.hide();
    });
    $('#divsucres3').hover(function() {
        $('#divsucres').css({ opacity: 0.5 });
        $('#divsucres2').css({ opacity: 0.5 });
        tooltip.show('Les Sal&#233;s', 100);
    }, function() {
        $('#divsucres').css({ opacity: 0 });
        $('#divsucres2').css({ opacity: 0 });
        tooltip.hide();
    });
    $('#divaperos').hover(function() {
        $(this).css({ opacity: 0.5 });
        tooltip.show('Les Sucr&#233;s', 100);
    }, function() {
        $(this).css({ opacity: 0 });
        tooltip.hide();
    });

    var tooltip = function() {
        var id = 'tt';
        var top = 3;
        var left = 3;
        var maxw = 300;
        var speed = 10;
        var timer = 20;
        var endalpha = 95;
        var alpha = 0;
        var tt, t, c, b, h;
        var ie = document.all ? true : false;
        return {
            show: function(v, w) {
                if (tt == null) {
                    tt = document.createElement('div');
                    tt.setAttribute('id', id);
                    t = document.createElement('div');
                    t.setAttribute('id', id + 'top');
                    c = document.createElement('div');
                    c.setAttribute('id', id + 'cont');
                    b = document.createElement('div');
                    b.setAttribute('id', id + 'bot');
                    tt.appendChild(t);
                    tt.appendChild(c);
                    tt.appendChild(b);
                    document.body.appendChild(tt);
                    tt.style.opacity = 0;
                    tt.style.filter = 'alpha(opacity=0)';
                    document.onmousemove = this.pos;
                }
                tt.style.display = 'block';
                c.innerHTML = v;
                tt.style.width = w ? w + 'px' : 'auto';
                if (!w && ie) {
                    t.style.display = 'none';
                    b.style.display = 'none';
                    tt.style.width = tt.offsetWidth;
                    t.style.display = 'block';
                    b.style.display = 'block';
                }
                if (tt.offsetWidth > maxw) { tt.style.width = maxw + 'px' }
                h = parseInt(tt.offsetHeight) + top;
                clearInterval(tt.timer);
                tt.timer = setInterval(function() { tooltip.fade(1) }, timer);
            },
            pos: function(e) {
                var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
                var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
                tt.style.top = (u - h) + 'px';
                tt.style.left = (l + left) + 'px';
            },
            fade: function(d) {
                var a = alpha;
                if ((a != endalpha && d == 1) || (a != 0 && d == -1)) {
                    var i = speed;
                    if (endalpha - a < speed && d == 1) {
                        i = endalpha - a;
                    } else if (alpha < speed && d == -1) {
                        i = a;
                    }
                    alpha = a + (i * d);
                    tt.style.opacity = alpha * .01;
                    tt.style.filter = 'alpha(opacity=' + alpha + ')';
                } else {
                    clearInterval(tt.timer);
                    if (d == -1) { tt.style.display = 'none' }
                }
            },
            hide: function() {
                clearInterval(tt.timer);
                tt.timer = setInterval(function() { tooltip.fade(-1) }, timer);
            }
        };
    } ();


    $('.itemCatProd').hover(function() {
        var couleur = $(this).children().first().val();
        var rgb = couleur.split(",");
        $(this).css("background-color", "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")");
    }, function() {
        $(this).css("background-color", "#ffffff");
    });
    //    $('.itemCatProd').hover(function() {
    //        var couleur = $(this).children().first().val();
    //        var rgb = couleur.split(",")
    //        $(this).css("background-color", "rgba(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + ", 0.3)");
    //    });
    //    $('.itemCatProd').mouseleave(function() {
    //        $(this).css("background-color", "#ffffff");
    //    });

    /*click sur element dans accueil boutique*/
    $("#divpains").click(function() {
        window.location = $(this).children().first().attr("href");
    });
    $("#divsucres").click(function() {
        window.location = $(this).children().first().attr("href");
    });
    $("#divsucres2").click(function() {
        window.location = $(this).children().first().attr("href");
    });
    $("#divsucres3").click(function() {
        window.location = $(this).children().first().attr("href");
    });
    $("#divaperos").click(function() {
        window.location = $(this).children().first().attr("href");
    });

    /*click sur element dans repeater*/
    $(".itemCat").click(function() {
        window.location = $(this).children().first().children().first().attr("href");
    });

    $(".itemCatProd").click(function() {
        window.location = $(this).children().last().children().first().children().first().attr('href');
    });

    /*modification des quantites*/
    $(".bt_moins").click(function() {
        var nb = parseInt($("#quantite_produit").html());
        if (nb != 1) {
            nb--;
        }
        $("#quantite_produit").html(nb);
        var id = $("#ctl00_ContentPlaceHolder1_hidIdProduit").val();
        var qte = nb;
        var url = "/AjoutAchat.aspx?id=" + id + "&qte=" + qte;
        $("#ctl00_ContentPlaceHolder1_addPanier").attr("href", url);
        return false;
    });
    $(".bt_plus").click(function() {
        var nb = parseInt($("#quantite_produit").html());
        $("#quantite_produit").html(++nb);
        var id = $("#ctl00_ContentPlaceHolder1_hidIdProduit").val();
        var qte = nb;
        var url = "/AjoutAchat.aspx?id=" + id + "&qte=" + qte;
        $("#ctl00_ContentPlaceHolder1_addPanier").attr("href", url);
        return false;
    });
    /*modification des quantites depuis les catégories*/
    $(".bt_moins_cat").click(function() {
        var nb = parseInt($(this).parent().parent().parent().find("span").html());
        if (nb != 1) {
            nb--;
        }
        $(this).parent().parent().parent().find("span").html(nb);
        var id = parseInt($(this).parent().find("input").val());
        var url = "/AjoutAchat.aspx?id=" + id + "&qte=" + nb;
        $(this).parent().parent().parent().parent().parent().parent().find("a").attr("href", url);
        return false;
    });
    $(".bt_plus_cat").click(function() {
        var nb = parseInt($(this).parent().parent().parent().find("span").html());
        nb++;
        $(this).parent().parent().parent().find("span").html(nb);
        var id = parseInt($(this).parent().find("input").val());
        var url = "/AjoutAchat.aspx?id=" + id + "&qte=" + nb;
        $(this).parent().parent().parent().parent().parent().parent().find("a").attr("href", url);
        return false;
    });
    /*modifications des quantités dans le panier*/
    $(".bt_moins_panier").click(function() {
        var produit = $(this).parent().find("input").val();
        var nb = $("#ctl00_ContentPlaceHolder1_tbQte_" + produit).val();
        if (nb != 1) {
            nb--;
        }
        $("#ctl00_ContentPlaceHolder1_tbQte_" + produit).val(nb);
        return false;
    });
    $(".bt_plus_panier").click(function() {
        var produit = $(this).parent().find("input").val();
        var nb = $("#ctl00_ContentPlaceHolder1_tbQte_" + produit).val();
        nb++;
        $("#ctl00_ContentPlaceHolder1_tbQte_" + produit).val(nb);
        return false;
    });

    function Rafraichissement(produit, nb) {
        $.ajax({
            type: "POST",
            url: "/MonPanier.aspx",
            data: {
                hidProduit: produit,
                hquantite: nb
            },
            success: function(msg) {
                location.href = "MonPanier.aspx";
            },
            error: function(request, settings) {
                alert(settings.url);
            }
        });
        return false;
    }

    /*validation achat*/
    $("a[rel^='prettyPhoto']").prettyPhoto();
    //edition
    $("#ctl00_ContentPlaceHolder1_addPanier").boxy();
    //mise à jour url pour quantit&#233;
    $("#ctl00_ContentPlaceHolder1_ddlQte").change(function() {
        var id = $("#ctl00_ContentPlaceHolder1_hidIdProduit").val();
        var qte = $(".quantite_produit").html();
        var url = "/AjoutAchat.aspx?id=" + id + "&qte=" + qte;
        $("#ctl00_ContentPlaceHolder1_hlAddCart").attr("href", url);
    });

    /*page pop-up*/
    $(".boxy").boxy();

    /*pop up recette*/
    $("#ctl00_ContentPlaceHolder1_openRecette").boxy();

    /*pop up categorie*/
    $(".addproduit").boxy();

    /*login*/
    $("#ctl00_ContentPlaceHolder1_LoginLinkButton").click(function() {
        if ($("#ctl00_ContentPlaceHolder1_UserName").val() == "") {
            buildPrompt("#ctl00_ContentPlaceHolder1_UserName", "Un nom d'utilisateur est requis.", true);
            return false;
        }
        if ($("#ctl00_ContentPlaceHolder1_Password").val() == "") {
            buildPrompt("#ctl00_ContentPlaceHolder1_Password", "Un mot de passe est requis.", true);
            return false;
        }
        return true;
    });
    //perso
    $("#submitPerso").live("click", function() {
        if ($("#tbNom").val() == "") {
            buildPrompt("#tbNom", "Un nom est obligatoire", true);
            return false;
        }
        if ($("#tbPrenom").val() == "") {
            buildPrompt("#tbPrenom", "Un Pr&#233;nom est obligatoire", true);
            return false;
        }
        if ($("#tbTel").val() == "") {
            buildPrompt("#tbTel", "Un t&#233;l&#233;phone est obligatoire", true);
            return false;
        }
        if ($("#tbEmail").val() == "") {
            buildPrompt("#tbEmail", "Un email est obligatoire", true);
            return false;
        }
        var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
        if (!filter.test($("#tbEmail").val())) {
            buildPrompt("#tbEmail", "l'adresse email doit &#234;tre valide", true);
            return false;
        }
        //requete
        $.ajax({
            type: "POST",
            url: "/Client/EditionInformationsPersonnelles.aspx",
            data: {
                tbNom: $("#tbNom").val(),
                tbPrenom: $("#tbPrenom").val(),
                tbTel: $("#tbTel").val(),
                tbPortable: $("#tbPortable").val(),
                tbFax: $("#tbFax").val(),
                tbEmail: $("#tbEmail").val()
            },
            success: function(msg) {
                location.href = "/Client/MesInformations.aspx";
            },
            error: function(request, settings) {
                alert(settings.url);
            }
        });
        return false;

    });
    //adresse
    $("#submitAdresse").live("click", function() {
        if (!($("#tbSociete").val() != "" || ($("#tbNom").val() != "" && $("#tbPrenom").val() != ""))) {
            buildPrompt("#tbSociete", "Une soci&#233;t&#233; ou un nom et pr&#233;nom sont obligatoires", true);
            return false;
        }

        if ($("#tbAdresse").val() == "") {
            buildPrompt("#tbAdresse", "Une adresse est obligatoire", true);
            return false;
        }
        if ($("#tbCp").val() == "") {
            buildPrompt("#tbCp", "Un code postal est obligatoire", true);
            return false;
        }
        if ($("#tbVille").val() == "") {
            buildPrompt("#tbVille", "Une ville est obligatoire", true);
            return false;
        }
        //requete
        $.ajax({
            type: "POST",
            url: "/Client/EditionAdresse.aspx",
            data: {
                tbTitreAdresse: $("#tbTitreAdresse").val(),
                tbSociete: $("#tbSociete").val(),
                tbNom: $("#tbNom").val(),
                tbPrenom: $("#tbPrenom").val(),
                tbAdresse: $("#tbAdresse").val(),
                tbAdresse2: $("#tbAdresse2").val(),
                tbCp: $("#tbCp").val(),
                tbVille: $("#tbVille").val(),
                ddlPays: $("#ddlPays").val(),
                cbParDefaut: $("#cbParDefaut").attr("checked"),
                tbID: $("#tbID").val(),
                tbFacture: $("#tbFacture").val()
            },
            success: function(msg) {
                location.href = "/Client/MesInformations.aspx";
            },
            error: function(request, settings) {
                alert(settings.url);
            }
        });
        return false;
    });

    //validation cgv
    $("#ctl00_ContentPlaceHolder1_btValider").click(function() {
        var cb = $("#ctl00_ContentPlaceHolder1_cbCGV").attr("checked");
        if (cb == false) {
            alert($("#ctl00_ContentPlaceHolder1_messageCGV").val());
            return false;
        }

    });
    $("#print").live("click", function() {
        try {
            oWindow = window.open();
            oDoc = oWindow.document;
            var oContent = document.getElementById("divToPrint").innerHTML;
            oDoc.write("<head><title>Marlette Gourmet</title>");
            oDoc.write("<link rel='stylesheet' href='/css/reset.css' type='text/css' />");
            oDoc.write("<link rel='stylesheet' href='/css/marlette.css' type='text/css' />");
            oDoc.write("<link rel='stylesheet' href='/css/print.css' type='text/css' />");
            oDoc.write("</head><body style='width:650px;margin:10px;' onload='this.focus(); this.print();'>");
            oDoc.write(oContent + "</body>");
            oDoc.close();
        }
        catch (e) {
            //self.print();
        }
    });


    function buildPrompt(caller, promptText, showTriangle) {			// ERROR PROMPT CREATION AND DISPLAY WHEN AN ERROR OCCUR
        var divFormError = document.createElement('div');
        var formErrorContent = document.createElement('div');
        var arrow = document.createElement('div');

        $(divFormError).addClass("formError");
        $(divFormError).addClass($(caller).attr("id"));
        $(formErrorContent).addClass("formErrorContent");
        $(arrow).addClass("formErrorArrow");

        $("body").append(divFormError);
        $(divFormError).append(arrow);
        $(divFormError).append(formErrorContent);

        if (showTriangle == true) {		// NO TRIANGLE ON MAX CHECKBOX AND RADIO
            $(arrow).html('<div class="line10"></div><div class="line9"></div><div class="line8"></div><div class="line7"></div><div class="line6"></div><div class="line5"></div><div class="line4"></div><div class="line3"></div><div class="line2"></div><div class="line1"></div>');
        }
        $(formErrorContent).html(promptText);

        callerTopPosition = $(caller).offset().top;
        callerleftPosition = $(caller).offset().left;
        callerWidth = 200; //$(caller).width()
        callerHeight = 30; $(caller).height()
        inputHeight = $(divFormError).height();

        callerleftPosition = callerleftPosition + callerWidth - 30;
        callerTopPosition = callerTopPosition - inputHeight - 10;

        $(divFormError).css({
            top: callerTopPosition,
            left: callerleftPosition,
            opacity: 1
        });
        //$(divFormError).fadeTo("fast", 0.8);
    };
});