﻿var isAccueil = false;

/* menus haut et gauche */
$(document).ready(function() { 
        $('ul#menu_nav').superfish();
		//feedColorbox("a.thickbox");
		if (isAccueil == false) {
			$("#menu_vertical_animate ul").hide();
			$("#menu_vertical_animate > li > a.expanded + ul").show();
			$("#menu_vertical_animate > li > a.hasChild").click(function () {
				$("#menu_vertical_animate > li > a.expanded").not(this).toggleClass("expanded").toggleClass("collapsed").find("+ ul").slideToggle("medium");
				$(this).toggleClass("expanded").toggleClass("collapsed").find("+ ul").slideToggle("medium");
			});
		}

		//menu du haut (le manoir) dernier item aligner a droite
		$("#menu_nav_item_08").siblings("ul").addClass("menu_nav_end");

});


/* section photos/vidéos */
function feedPhotoVideo(playlist) {
	$(document).ready(function() {
		$("#tabs").tabs();
		feedColorbox("a[rel='photos']");
		$("#mycarousel").jcarousel({ scroll: 1, buttonNextHTML: "<a>page suivante</a>", buttonPrevHTML: "<a>page précédente</a>" });
	});
	var flashvars = {
		'file':                playlist,
		'playlist':            'bottom',
		'playlistsize':         '205',
		'skin':					'/medias/videos/william.zip'
	};
	var params = {
		'allowfullscreen':     'true',
		'allowscriptaccess':   'always'
	};
	var attributes = {
		'id':                  'vid_player',
		'name':                'vid_player'
	};
swfobject.embedSWF('/medias/videos/player-licensed.swf', 'video_player', '550', '540', '9', 'false', flashvars, params, attributes);
}

function feedColorbox(selector){
	$(document).ready(function() {
		$(selector).colorbox({ loop: true, overlayAccueil: false });
	});
}

function ReserveIT(){ 
         var google_conversion_id  ="963315053"; 
         var google_conversion_label    ="puAzCOvFzgMQ7YqsywM";
         image =new Image(1,1); 
         image.src ="http://www.googleadservices.com/pagead/conversion/"+google_conversion_id+"/?label="+google_conversion_label +"&script=0";  
 } 

/* Superfish */
(function (a) { a.fn.superfish = function (c) { var b = a.fn.superfish, h = b.c, n = a(['<span class="', h.arrowClass, '"> &#187;</span>'].join("")), i = function () { var d = a(this), e = j(d); clearTimeout(e.sfTimer); d.showSuperfishUl().siblings().hideSuperfishUl() }, k = function () { var d = a(this), e = j(d), g = b.op; clearTimeout(e.sfTimer); e.sfTimer = setTimeout(function () { g.retainPath = a.inArray(d[0], g.$path) > -1; d.hideSuperfishUl(); g.$path.length && d.parents(["li.", g.hoverClass].join("")).length < 1 && i.call(g.$path) }, g.delay) }, j = function (d) { d = d.parents(["ul.", h.menuClass, ":first"].join(""))[0]; b.op = b.o[d.serial]; return d }; return this.each(function () { var d = this.serial = b.o.length, e = a.extend({}, b.defaults, c); e.$path = a("li." + e.pathClass, this).slice(0, e.pathLevels).each(function () { a(this).addClass([e.hoverClass, h.bcClass].join(" ")).filter("li:has(ul)").removeClass(e.pathClass) }); b.o[d] = b.op = e; a("li:has(ul)", this)[a.fn.hoverIntent && !e.disableHI ? "hoverIntent" : "hover"](i, k).each(function () { e.autoArrows && a(">a:first-child", this).addClass(h.anchorClass).append(n.clone()) }).not("." + h.bcClass).hideSuperfishUl(); var g = a("a", this); g.each(function (l) { var m = g.eq(l).parents("li"); g.eq(l).focus(function () { i.call(m) }).blur(function () { k.call(m) }) }); e.onInit.call(this) }).each(function () { var d = [h.menuClass]; b.op.dropShadows && !(a.browser.msie && a.browser.version < 7) && d.push(h.shadowClass); a(this).addClass(d.join(" ")) }) }; var f = a.fn.superfish; f.o = []; f.op = {}; f.IE7fix = function () { var c = f.op; a.browser.msie && a.browser.version > 6 && c.dropShadows && c.animation.opacity != undefined && this.toggleClass(f.c.shadowClass + "-off") }; f.c = { bcClass: "sf-breadcrumb", menuClass: "sf-js-enabled", anchorClass: "sf-with-ul", arrowClass: "sf-sub-indicator", shadowClass: "sf-shadow" }; f.defaults = { hoverClass: "sfHover", pathClass: "overideThisToUse", pathLevels: 1, delay: 800, animation: { height: "show" }, speed: "fast", autoArrows: false, dropShadows: false, disableHI: true, onInit: function () { }, onBeforeShow: function () { }, onShow: function () { }, onHide: function () { } }; a.fn.extend({ hideSuperfishUl: function () { var c = f.op, b = c.retainPath === true ? c.$path : ""; c.retainPath = false; b = a(["li.", c.hoverClass].join(""), this).add(this).not(b).removeClass(c.hoverClass).find(">ul").hide().css("visibility", "hidden"); c.onHide.call(b); return this }, showSuperfishUl: function () { var c = f.op, b = this.addClass(c.hoverClass).find(">ul:hidden").css("visibility", "visible"); f.IE7fix.call(b); c.onBeforeShow.call(b); b.animate(c.animation, c.speed, function () { f.IE7fix.call(b); c.onShow.call(b) }); return this } }) })(jQuery);


/* Colorbox */
(function (c, ka) { function g(b, e) { b = b ? ' id="' + k + b + '"' : ""; e = e ? ' style="' + e + '"' : ""; return c("<div" + b + e + "/>") } function r(b, e) { e = e === "x" ? q.width() : q.height(); return typeof b === "string" ? Math.round(/%/.test(b) ? e / 100 * parseInt(b, 10) : parseInt(b, 10)) : b } function S(b) { return a.photo || /\.(gif|png|jpg|jpeg|bmp|ashx)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b) } function ca(b) { for (var e in b) if (c.isFunction(b[e]) && e.substring(0, 2) !== "on") b[e] = b[e].call(m); b.rel = b.rel || m.rel || "nofollow"; b.href = b.href || c(m).attr("href"); b.title = b.title || m.title; b.desc = b.desc || c(m).find("img").attr("title") || ""; return b } function x(b, e) { e && e.call(m); c.event.trigger(b) } function la() { var b, e = k + "Slideshow_", d = "click." + k, i, p; if (a.slideshow && j[1]) { i = function () { H.text(a.slideshowStop).unbind(d).bind(T, function () { if (h < j.length - 1 || a.loop) b = setTimeout(f.next, a.slideshowSpeed) }).bind(U, function () { clearTimeout(b) }).one(d + " " + O, p); l.removeClass(e + "off").addClass(e + "on"); b = setTimeout(f.next, a.slideshowSpeed) }; p = function () { clearTimeout(b); H.text(a.slideshowStart).unbind([T, U, O, d].join(" ")).one(d, i); l.removeClass(e + "on").addClass(e + "off") }; a.slideshowAuto ? i() : p() } } function da(b) { if (!P) { m = b; a = ca(c.extend({}, c.data(m, t))); j = c(m); h = 0; if (a.rel !== "nofollow") { j = c("." + I).filter(function () { return (c.data(this, t).rel || this.rel) === a.rel }); h = j.index(m); if (h === -1) { j = j.add(m); h = j.length - 1 } } if (!v) { v = E = true; l.show(); if (a.returnFocus) try { m.blur(); c(m).one(ea, function () { try { this.focus() } catch (d) { } }) } catch (e) { } a.overlayAccueil && w.html("<div><h2>" + arrLangTxtOver[0] + "</h2><h1>" + arrLangTxtOver[1] + "</h1></div>"); w.css({ opacity: +a.opacity, cursor: a.overlayClose ? "pointer" : "auto" }).show(); a.w = r(a.initialWidth, "x"); a.h = r(a.initialHeight, "y"); f.position(0); V && q.bind("resize." + Q + " scroll." + Q, function () { w.css({ width: q.width(), height: q.height(), top: q.scrollTop(), left: q.scrollLeft() }) }).trigger("scroll." + Q); x(fa, a.onOpen); W.add(J).add(K).add(H).add(X).hide(); Y.html(a.close).show() } f.load(true) } } var ga = { transition: "elastic", speed: 300, width: false, initialWidth: "600", innerWidth: false, maxWidth: false, height: false, initialHeight: "450", innerHeight: false, maxHeight: false, scalePhotos: true, scrolling: true, inline: false, html: false, iframe: false, photo: false, href: false, title: false, rel: false, opacity: 0.78, preloading: true, current: "{current} / {total}", previous: "previous", next: "next", close: "close", open: false, returnFocus: true, loop: true, slideshow: false, slideshowAuto: true, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: false, onLoad: false, onComplete: false, onCleanup: false, onClosed: false, overlayClose: true, overlayAccueil: true, escKey: true, arrowKey: true }, t = "colorbox", k = "cbox", fa = k + "_open", U = k + "_load", T = k + "_complete", O = k + "_cleanup", ea = k + "_closed", R = k + "_purge", ha = k + "_loaded", z = c.browser.msie && !c.support.opacity, V = z && c.browser.version < 7, Q = k + "_IE6", w, l, A, u, Z, $, aa, ba, j, q, n, L, M, X, ia, W, H, K, J, Y, F, B, C, y, m, h, a, v, E, P = false, f, I = k + "Element"; f = c.fn[t] = c[t] = function (b, e) { var d = this, i; if (!d[0] && d.selector) return d; b = b || {}; if (e) b.onComplete = e; if (!d[0] || d.selector === undefined) { d = c("<a/>"); b.open = true } d.each(function () { c.data(this, t, c.extend({}, c.data(this, t) || ga, b)); c(this).addClass(I) }); i = b.open; if (c.isFunction(i)) i = i.call(d); i && da(d[0]); return d }; f.init = function () { q = c(ka); l = g().attr({ id: t, "class": z ? k + "IE" : "" }); w = g("Overlay", V ? "position:absolute" : "").hide(); A = g("Wrapper"); u = g("Content").append(ia = g("Desc"), n = g("LoadedContent", "width:0; height:0; overflow:hidden"), M = g("LoadingOverlay").add(g("LoadingGraphic")), X = g("Title"), W = g("Current"), K = g("Next"), J = g("Previous"), H = g("Slideshow").bind(fa, la), Y = g("Close")); A.append(g().append(g("TopLeft"), Z = g("TopCenter"), g("TopRight")), g(false, "clear:left").append($ = g("MiddleLeft"), u, aa = g("MiddleRight")), g(false, "clear:left").append(g("BottomLeft"), ba = g("BottomCenter"), g("BottomRight"))).children().children().css({ "float": "left" }); L = g(false, "position:absolute; width:9999px; visibility:hidden; display:none"); c("body").prepend(w, l.append(A, L)); u.children().hover(function () { c(this).addClass("hover") }, function () { c(this).removeClass("hover") }).addClass("hover"); F = Z.height() + ba.height() + u.outerHeight(true) - u.height(); B = $.width() + aa.width() + u.outerWidth(true) - u.width(); C = n.outerHeight(true); y = n.outerWidth(true); l.css({ "padding-bottom": F, "padding-right": B }).hide(); K.click(f.next); J.click(f.prev); Y.click(f.close); u.children().removeClass("hover"); c("." + I).live("click", function (b) { if (!(b.button !== 0 && typeof b.button !== "undefined" || b.ctrlKey || b.shiftKey || b.altKey)) { b.preventDefault(); da(this) } }); w.click(function () { a.overlayClose && f.close() }); c(document).bind("keydown", function (b) { if (v && a.escKey && b.keyCode === 27) { b.preventDefault(); f.close() } if (v && a.arrowKey && !E && j[1]) if (b.keyCode === 37 && (h || a.loop)) { b.preventDefault(); J.click() } else if (b.keyCode === 39 && (h < j.length - 1 || a.loop)) { b.preventDefault(); K.click() } }) }; f.remove = function () { l.add(w).remove(); c("." + I).die("click").removeData(t).removeClass(I) }; f.position = function (b, e) { function d(s) { Z[0].style.width = ba[0].style.width = u[0].style.width = s.style.width; M[0].style.height = M[1].style.height = u[0].style.height = $[0].style.height = aa[0].style.height = s.style.height } var i, p = "10%", o = Math.max(q.width() - a.w - y - B, 0) / 2 + q.scrollLeft(); if (a.overlayAccueil) p = 0; i = l.width() === a.w + y && l.height() === a.h + C ? 0 : b; A[0].style.width = A[0].style.height = "9999px"; l.dequeue().animate({ width: a.w + y, height: a.h + C, top: p, left: o }, { duration: i, complete: function () { d(this); E = false; A[0].style.width = a.w + y + B + "px"; A[0].style.height = a.h + C + F + "px"; e && e() }, step: function () { d(this) } }) }; f.resize = function (b) { if (v) { b = b || {}; if (b.width) a.w = r(b.width, "x") - y - B; if (b.innerWidth) a.w = r(b.innerWidth, "x"); n.css({ width: a.w }); if (b.height) a.h = r(b.height, "y") - C - F; if (b.innerHeight) a.h = r(b.innerHeight, "y"); if (!b.innerHeight && !b.height) { b = n.wrapInner("<div style='overflow:auto'></div>").children(); a.h = b.height(); b.replaceWith(b.children()) } n.css({ height: a.h }); f.position(a.transition === "none" ? 0 : a.speed) } }; f.prep = function (b) { function e(p) { var o, s, G, D, N = j.length, ja = a.loop; f.position(p, function () { if (v) { z && d && n.fadeIn(100); n.show(); x(ha); X.show().html(a.title); ia.show().html(a.desc); if (N > 1) { typeof a.current === "string" && W.html(a.current.replace(/\{current\}/, h + 1).replace(/\{total\}/, N)).show(); K[ja || h < N - 1 ? "show" : "hide"]().html(a.next); J[ja || h ? "show" : "hide"]().html(a.previous); o = h ? j[h - 1] : j[N - 1]; G = h < N - 1 ? j[h + 1] : j[0]; a.slideshow && H.show(); if (a.preloading) { D = c.data(G, t).href || G.href; s = c.data(o, t).href || o.href; D = c.isFunction(D) ? D.call(G) : D; s = c.isFunction(s) ? s.call(o) : s; if (S(D)) c("<img/>")[0].src = D; if (S(s)) c("<img/>")[0].src = s } } M.hide(); if (a.transition === "fade") l.fadeTo(i, 1, function () { if (z) l[0].style.filter = false }); else if (z) l[0].style.filter = false; q.bind("resize." + k, function () { f.position(0) }); x(T, a.onComplete) } }) } if (v) { var d, i = a.transition === "none" ? 0 : a.speed; q.unbind("resize." + k); n.remove(); n = g("LoadedContent").html(b); n.hide().appendTo(L.show()).css({ width: function () { a.w = a.w || n.width(); a.w = a.mw && a.mw < a.w ? a.mw : a.w; return a.w } (), overflow: a.scrolling ? "auto" : "hidden" }).css({ height: function () { a.h = a.h || n.height(); a.h = a.mh && a.mh < a.h ? a.mh : a.h; return a.h } () }).prependTo(u); L.hide(); c("#" + k + "Photo").css({ cssFloat: "none", marginLeft: "auto", marginRight: "auto" }); V && c("select").not(l.find("select")).filter(function () { return this.style.visibility !== "hidden" }).css({ visibility: "hidden" }).one(O, function () { this.style.visibility = "inherit" }); a.transition === "fade" ? l.fadeTo(i, 0, function () { e(0) }) : e(i) } }; f.load = function (b) { var e, d, i, p = f.prep; E = true; m = j[h]; b || (a = ca(c.extend({}, c.data(m, t)))); x(R); x(U, a.onLoad); a.h = a.height ? r(a.height, "y") - C - F : a.innerHeight && r(a.innerHeight, "y"); a.w = a.width ? r(a.width, "x") - y - B : a.innerWidth && r(a.innerWidth, "x"); a.mw = a.w; a.mh = a.h; if (a.maxWidth) { a.mw = r(a.maxWidth, "x") - y - B; a.mw = a.w && a.w < a.mw ? a.w : a.mw } if (a.maxHeight) { a.mh = r(a.maxHeight, "y") - C - F; a.mh = a.h && a.h < a.mh ? a.h : a.mh } e = a.href; M.show(); if (a.inline) { g().hide().insertBefore(c(e)[0]).one(R, function () { c(this).replaceWith(n.children()) }); p(c(e)) } else if (a.iframe) { l.one(ha, function () { var o = c("<iframe name='" + (new Date).getTime() + "' frameborder=0" + (a.scrolling ? "" : " scrolling='no'") + (z ? " allowtransparency='true'" : "") + " style='width:100%; height:100%; border:0; display:block;'/>"); o[0].src = a.href; o.appendTo(n).one(R, function () { o[0].src = "//about:blank" }) }); p(" ") } else if (a.html) p(a.html); else if (S(e)) { d = new Image; d.onload = function () { var o; d.onload = null; d.id = k + "Photo"; c(d).css({ border: "none", display: "block", cssFloat: "left" }); if (a.scalePhotos) { i = function () { d.height -= d.height * o; d.width -= d.width * o }; if (a.mw && d.width > a.mw) { o = (d.width - a.mw) / d.width; i() } if (a.mh && d.height > a.mh) { o = (d.height - a.mh) / d.height; i() } } if (a.h) d.style.marginTop = Math.max(a.h - d.height, 0) / 2 + "px"; if (j[1] && (h < j.length - 1 || a.loop)) c(d).css({ cursor: "pointer" }).click(f.next); if (z) d.style.msInterpolationMode = "bicubic"; setTimeout(function () { p(d) }, 1) }; setTimeout(function () { d.src = e }, 1) } else e && L.load(e, function (o, s, G) { p(s === "error" ? "Request unsuccessful: " + G.statusText : c(this).children()) }) }; f.next = function () { if (!E) { h = h < j.length - 1 ? h + 1 : 0; f.load() } }; f.prev = function () { if (!E) { h = h ? h - 1 : j.length - 1; f.load() } }; f.close = function () { if (v && !P) { P = true; v = false; x(O, a.onCleanup); q.unbind("." + k + " ." + Q); w.fadeTo("fast", 0); l.stop().fadeTo("fast", 0, function () { x(R); n.remove(); l.add(w).css({ opacity: 1, cursor: "auto" }).hide(); var b = c('link[title="mainCss"]'); b[0].href = b[0].href; setTimeout(function () { P = false; x(ea, a.onClosed) }, 1) }) } }; f.element = function () { return c(m) }; f.settings = ga; c(f.init) })(jQuery, this);
