﻿
//$j = jQuery;

/*
* jQuery UI 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
jQuery.ui || (function (c) { var i = c.fn.remove, d = c.browser.mozilla && (parseFloat(c.browser.version) < 1.9); c.ui = { version: "1.7.2", plugin: { add: function (k, l, n) { var m = c.ui[k].prototype; for (var j in n) { m.plugins[j] = m.plugins[j] || []; m.plugins[j].push([l, n[j]]) } }, call: function (j, l, k) { var n = j.plugins[l]; if (!n || !j.element[0].parentNode) { return } for (var m = 0; m < n.length; m++) { if (j.options[n[m][0]]) { n[m][1].apply(j.element, k) } } } }, contains: function (k, j) { return document.compareDocumentPosition ? k.compareDocumentPosition(j) & 16 : k !== j && k.contains(j) }, hasScroll: function (m, k) { if (c(m).css("overflow") == "hidden") { return false } var j = (k && k == "left") ? "scrollLeft" : "scrollTop", l = false; if (m[j] > 0) { return true } m[j] = 1; l = (m[j] > 0); m[j] = 0; return l }, isOverAxis: function (k, j, l) { return (k > j) && (k < (j + l)) }, isOver: function (o, k, n, m, j, l) { return c.ui.isOverAxis(o, n, j) && c.ui.isOverAxis(k, m, l) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38} }; if (d) { var f = c.attr, e = c.fn.removeAttr, h = "http://www.w3.org/2005/07/aaa", a = /^aria-/, b = /^wairole:/; c.attr = function (k, j, l) { var m = l !== undefined; return (j == "role" ? (m ? f.call(this, k, j, "wairole:" + l) : (f.apply(this, arguments) || "").replace(b, "")) : (a.test(j) ? (m ? k.setAttributeNS(h, j.replace(a, "aaa:"), l) : f.call(this, k, j.replace(a, "aaa:"))) : f.apply(this, arguments))) }; c.fn.removeAttr = function (j) { return (a.test(j) ? this.each(function () { this.removeAttributeNS(h, j.replace(a, "")) }) : e.call(this, j)) } } c.fn.extend({ remove: function () { c("*", this).add(this).each(function () { c(this).triggerHandler("remove") }); return i.apply(this, arguments) }, enableSelection: function () { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui") }, disableSelection: function () { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function () { return false }) }, scrollParent: function () { var j; if ((c.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { j = this.parents().filter(function () { return (/(relative|absolute|fixed)/).test(c.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } else { j = this.parents().filter(function () { return (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } return (/fixed/).test(this.css("position")) || !j.length ? c(document) : j } }); c.extend(c.expr[":"], { data: function (l, k, j) { return !!c.data(l, j[3]) }, focusable: function (k) { var l = k.nodeName.toLowerCase(), j = c.attr(k, "tabindex"); return (/input|select|textarea|button|object/.test(l) ? !k.disabled : "a" == l || "area" == l ? k.href || !isNaN(j) : !isNaN(j)) && !c(k)["area" == l ? "parents" : "closest"](":hidden").length }, tabbable: function (k) { var j = c.attr(k, "tabindex"); return (isNaN(j) || j >= 0) && c(k).is(":focusable") } }); function g(m, n, o, l) { function k(q) { var p = c[m][n][q] || []; return (typeof p == "string" ? p.split(/,?\s+/) : p) } var j = k("getter"); if (l.length == 1 && typeof l[0] == "string") { j = j.concat(k("getterSetter")) } return (c.inArray(o, j) != -1) } c.widget = function (k, j) { var l = k.split(".")[0]; k = k.split(".")[1]; c.fn[k] = function (p) { var n = (typeof p == "string"), o = Array.prototype.slice.call(arguments, 1); if (n && p.substring(0, 1) == "_") { return this } if (n && g(l, k, p, o)) { var m = c.data(this[0], k); return (m ? m[p].apply(m, o) : undefined) } return this.each(function () { var q = c.data(this, k); (!q && !n && c.data(this, k, new c[l][k](this, p))._init()); (q && n && c.isFunction(q[p]) && q[p].apply(q, o)) }) }; c[l] = c[l] || {}; c[l][k] = function (o, n) { var m = this; this.namespace = l; this.widgetName = k; this.widgetEventPrefix = c[l][k].eventPrefix || k; this.widgetBaseClass = l + "-" + k; this.options = c.extend({}, c.widget.defaults, c[l][k].defaults, c.metadata && c.metadata.get(o)[k], n); this.element = c(o).bind("setData." + k, function (q, p, r) { if (q.target == o) { return m._setData(p, r) } }).bind("getData." + k, function (q, p) { if (q.target == o) { return m._getData(p) } }).bind("remove", function () { return m.destroy() }) }; c[l][k].prototype = c.extend({}, c.widget.prototype, j); c[l][k].getterSetter = "option" }; c.widget.prototype = { _init: function () { }, destroy: function () { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").removeAttr("aria-disabled") }, option: function (l, m) { var k = l, j = this; if (typeof l == "string") { if (m === undefined) { return this._getData(l) } k = {}; k[l] = m } c.each(k, function (n, o) { j._setData(n, o) }) }, _getData: function (j) { return this.options[j] }, _setData: function (j, k) { this.options[j] = k; if (j == "disabled") { this.element[k ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", k) } }, enable: function () { this._setData("disabled", false) }, disable: function () { this._setData("disabled", true) }, _trigger: function (l, m, n) { var p = this.options[l], j = (l == this.widgetEventPrefix ? l : this.widgetEventPrefix + l); m = c.Event(m); m.type = j; if (m.originalEvent) { for (var k = c.event.props.length, o; k; ) { o = c.event.props[--k]; m[o] = m.originalEvent[o] } } this.element.trigger(m, n); return !(c.isFunction(p) && p.call(this.element[0], m, n) === false || m.isDefaultPrevented()) } }; c.widget.defaults = { disabled: false }; c.ui.mouse = { _mouseInit: function () { var j = this; this.element.bind("mousedown." + this.widgetName, function (k) { return j._mouseDown(k) }).bind("click." + this.widgetName, function (k) { if (j._preventClickEvent) { j._preventClickEvent = false; k.stopImmediatePropagation(); return false } }); if (c.browser.msie) { this._mouseUnselectable = this.element.attr("unselectable"); this.element.attr("unselectable", "on") } this.started = false }, _mouseDestroy: function () { this.element.unbind("." + this.widgetName); (c.browser.msie && this.element.attr("unselectable", this._mouseUnselectable)) }, _mouseDown: function (l) { l.originalEvent = l.originalEvent || {}; if (l.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(l)); this._mouseDownEvent = l; var k = this, m = (l.which == 1), j = (typeof this.options.cancel == "string" ? c(l.target).parents().add(l.target).filter(this.options.cancel).length : false); if (!m || j || !this._mouseCapture(l)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function () { k.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(l) && this._mouseDelayMet(l)) { this._mouseStarted = (this._mouseStart(l) !== false); if (!this._mouseStarted) { l.preventDefault(); return true } } this._mouseMoveDelegate = function (n) { return k._mouseMove(n) }; this._mouseUpDelegate = function (n) { return k._mouseUp(n) }; c(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (c.browser.safari || l.preventDefault()); l.originalEvent.mouseHandled = true; return true }, _mouseMove: function (j) { if (c.browser.msie && !j.button) { return this._mouseUp(j) } if (this._mouseStarted) { this._mouseDrag(j); return j.preventDefault() } if (this._mouseDistanceMet(j) && this._mouseDelayMet(j)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, j) !== false); (this._mouseStarted ? this._mouseDrag(j) : this._mouseUp(j)) } return !this._mouseStarted }, _mouseUp: function (j) { c(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (j.target == this._mouseDownEvent.target); this._mouseStop(j) } return false }, _mouseDistanceMet: function (j) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - j.pageX), Math.abs(this._mouseDownEvent.pageY - j.pageY)) >= this.options.distance) }, _mouseDelayMet: function (j) { return this.mouseDelayMet }, _mouseStart: function (j) { }, _mouseDrag: function (j) { }, _mouseStop: function (j) { }, _mouseCapture: function (j) { return true } }; c.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery); ; /*
 * jQuery UI Dialog 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Dialog
 *
 * Depends:
 *	ui.core.js
 *	ui.draggable.js
 *	ui.resizable.js
 */
(function (c) { var b = { dragStart: "start.draggable", drag: "drag.draggable", dragStop: "stop.draggable", maxHeight: "maxHeight.resizable", minHeight: "minHeight.resizable", maxWidth: "maxWidth.resizable", minWidth: "minWidth.resizable", resizeStart: "start.resizable", resize: "drag.resizable", resizeStop: "stop.resizable" }, a = "ui-dialog ui-widget ui-widget-content ui-corner-all "; c.widget("ui.dialog", { _init: function () { this.originalTitle = this.element.attr("title"); var l = this, m = this.options, j = m.title || this.originalTitle || "&nbsp;", e = c.ui.dialog.getTitleId(this.element), k = (this.uiDialog = c("<div/>")).appendTo(document.body).hide().addClass(a + m.dialogClass).css({ position: "absolute", overflow: "hidden", zIndex: m.zIndex }).attr("tabIndex", -1).css("outline", 0).keydown(function (n) { (m.closeOnEscape && n.keyCode && n.keyCode == c.ui.keyCode.ESCAPE && l.close(n)) }).attr({ role: "dialog", "aria-labelledby": e }).mousedown(function (n) { l.moveToTop(false, n) }), g = this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k), f = (this.uiDialogTitlebar = c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k), i = c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role", "button").hover(function () { i.addClass("ui-state-hover") }, function () { i.removeClass("ui-state-hover") }).focus(function () { i.addClass("ui-state-focus") }).blur(function () { i.removeClass("ui-state-focus") }).mousedown(function (n) { n.stopPropagation() }).click(function (n) { l.close(n); return false }).appendTo(f), h = (this.uiDialogTitlebarCloseText = c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i), d = c("<span/>").addClass("ui-dialog-title").attr("id", e).html(j).prependTo(f); f.find("*").add(f).disableSelection(); (m.draggable && c.fn.draggable && this._makeDraggable()); (m.resizable && c.fn.resizable && this._makeResizable()); this._createButtons(m.buttons); this._isOpen = false; (m.bgiframe && c.fn.bgiframe && k.bgiframe()); (m.autoOpen && this.open()) }, destroy: function () { (this.overlay && this.overlay.destroy()); this.uiDialog.hide(); this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); this.uiDialog.remove(); (this.originalTitle && this.element.attr("title", this.originalTitle)) }, close: function (f) { var d = this; if (false === d._trigger("beforeclose", f)) { return } (d.overlay && d.overlay.destroy()); d.uiDialog.unbind("keypress.ui-dialog"); (d.options.hide ? d.uiDialog.hide(d.options.hide, function () { d._trigger("close", f) }) : d.uiDialog.hide() && d._trigger("close", f)); c.ui.dialog.overlay.resize(); d._isOpen = false; if (d.options.modal) { var e = 0; c(".ui-dialog").each(function () { if (this != d.uiDialog[0]) { e = Math.max(e, c(this).css("z-index")) } }); c.ui.dialog.maxZ = e } }, isOpen: function () { return this._isOpen }, moveToTop: function (f, e) { if ((this.options.modal && !f) || (!this.options.stack && !this.options.modal)) { return this._trigger("focus", e) } if (this.options.zIndex > c.ui.dialog.maxZ) { c.ui.dialog.maxZ = this.options.zIndex } (this.overlay && this.overlay.$el.css("z-index", c.ui.dialog.overlay.maxZ = ++c.ui.dialog.maxZ)); var d = { scrollTop: this.element.attr("scrollTop"), scrollLeft: this.element.attr("scrollLeft") }; this.uiDialog.css("z-index", ++c.ui.dialog.maxZ); this.element.attr(d); this._trigger("focus", e) }, open: function () { if (this._isOpen) { return } var e = this.options, d = this.uiDialog; this.overlay = e.modal ? new c.ui.dialog.overlay(this) : null; (d.next().length && d.appendTo("body")); this._size(); this._position(e.position); d.show(e.show); this.moveToTop(true); (e.modal && d.bind("keypress.ui-dialog", function (h) { if (h.keyCode != c.ui.keyCode.TAB) { return } var g = c(":tabbable", this), i = g.filter(":first")[0], f = g.filter(":last")[0]; if (h.target == f && !h.shiftKey) { setTimeout(function () { i.focus() }, 1) } else { if (h.target == i && h.shiftKey) { setTimeout(function () { f.focus() }, 1) } } })); c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus(); this._trigger("open"); this._isOpen = true }, _createButtons: function (g) { var f = this, d = false, e = c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"); this.uiDialog.find(".ui-dialog-buttonpane").remove(); (typeof g == "object" && g !== null && c.each(g, function () { return !(d = true) })); if (d) { c.each(g, function (h, i) { c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function () { i.apply(f.element[0], arguments) }).hover(function () { c(this).addClass("ui-state-hover") }, function () { c(this).removeClass("ui-state-hover") }).focus(function () { c(this).addClass("ui-state-focus") }).blur(function () { c(this).removeClass("ui-state-focus") }).appendTo(e) }); e.appendTo(this.uiDialog) } }, _makeDraggable: function () { var d = this, f = this.options, e; this.uiDialog.draggable({ cancel: ".ui-dialog-content", handle: ".ui-dialog-titlebar", containment: "document", start: function () { e = f.height; c(this).height(c(this).height()).addClass("ui-dialog-dragging"); (f.dragStart && f.dragStart.apply(d.element[0], arguments)) }, drag: function () { (f.drag && f.drag.apply(d.element[0], arguments)) }, stop: function () { c(this).removeClass("ui-dialog-dragging").height(e); (f.dragStop && f.dragStop.apply(d.element[0], arguments)); c.ui.dialog.overlay.resize() } }) }, _makeResizable: function (g) { g = (g === undefined ? this.options.resizable : g); var d = this, f = this.options, e = typeof g == "string" ? g : "n,e,s,w,se,sw,ne,nw"; this.uiDialog.resizable({ cancel: ".ui-dialog-content", alsoResize: this.element, maxWidth: f.maxWidth, maxHeight: f.maxHeight, minWidth: f.minWidth, minHeight: f.minHeight, start: function () { c(this).addClass("ui-dialog-resizing"); (f.resizeStart && f.resizeStart.apply(d.element[0], arguments)) }, resize: function () { (f.resize && f.resize.apply(d.element[0], arguments)) }, handles: e, stop: function () { c(this).removeClass("ui-dialog-resizing"); f.height = c(this).height(); f.width = c(this).width(); (f.resizeStop && f.resizeStop.apply(d.element[0], arguments)); c.ui.dialog.overlay.resize() } }).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se") }, _position: function (i) { var e = c(window), f = c(document), g = f.scrollTop(), d = f.scrollLeft(), h = g; if (c.inArray(i, ["center", "top", "right", "bottom", "left"]) >= 0) { i = [i == "right" || i == "left" ? i : "center", i == "top" || i == "bottom" ? i : "middle"] } if (i.constructor != Array) { i = ["center", "middle"] } if (i[0].constructor == Number) { d += i[0] } else { switch (i[0]) { case "left": d += 0; break; case "right": d += e.width() - this.uiDialog.outerWidth(); break; default: case "center": d += (e.width() - this.uiDialog.outerWidth()) / 2 } } if (i[1].constructor == Number) { g += i[1] } else { switch (i[1]) { case "top": g += 0; break; case "bottom": g += e.height() - this.uiDialog.outerHeight(); break; default: case "middle": g += (e.height() - this.uiDialog.outerHeight()) / 2 } } g = Math.max(g, h); this.uiDialog.css({ top: g, left: d }) }, _setData: function (e, f) { (b[e] && this.uiDialog.data(b[e], f)); switch (e) { case "buttons": this._createButtons(f); break; case "closeText": this.uiDialogTitlebarCloseText.text(f); break; case "dialogClass": this.uiDialog.removeClass(this.options.dialogClass).addClass(a + f); break; case "draggable": (f ? this._makeDraggable() : this.uiDialog.draggable("destroy")); break; case "height": this.uiDialog.height(f); break; case "position": this._position(f); break; case "resizable": var d = this.uiDialog, g = this.uiDialog.is(":data(resizable)"); (g && !f && d.resizable("destroy")); (g && typeof f == "string" && d.resizable("option", "handles", f)); (g || this._makeResizable(f)); break; case "title": c(".ui-dialog-title", this.uiDialogTitlebar).html(f || "&nbsp;"); break; case "width": this.uiDialog.width(f); break } c.widget.prototype._setData.apply(this, arguments) }, _size: function () { var e = this.options; this.element.css({ height: 0, minHeight: 0, width: "auto" }); var d = this.uiDialog.css({ height: "auto", width: e.width }).height(); this.element.css({ minHeight: Math.max(e.minHeight - d, 0), height: e.height == "auto" ? "auto" : Math.max(e.height - d, 0) }) } }); c.extend(c.ui.dialog, { version: "1.7.2", defaults: { autoOpen: true, bgiframe: false, buttons: {}, closeOnEscape: true, closeText: "close", dialogClass: "", draggable: true, hide: null, height: "auto", maxHeight: false, maxWidth: false, minHeight: 150, minWidth: 150, modal: false, position: "center", resizable: true, show: null, stack: true, title: "", width: 300, zIndex: 1000 }, getter: "isOpen", uuid: 0, maxZ: 0, getTitleId: function (d) { return "ui-dialog-title-" + (d.attr("id") || ++this.uuid) }, overlay: function (d) { this.$el = c.ui.dialog.overlay.create(d) } }); c.extend(c.ui.dialog.overlay, { instances: [], maxZ: 0, events: c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","), function (d) { return d + ".dialog-overlay" }).join(" "), create: function (e) { if (this.instances.length === 0) { setTimeout(function () { if (c.ui.dialog.overlay.instances.length) { c(document).bind(c.ui.dialog.overlay.events, function (f) { var g = c(f.target).parents(".ui-dialog").css("zIndex") || 0; return (g > c.ui.dialog.overlay.maxZ) }) } }, 1); c(document).bind("keydown.dialog-overlay", function (f) { (e.options.closeOnEscape && f.keyCode && f.keyCode == c.ui.keyCode.ESCAPE && e.close(f)) }); c(window).bind("resize.dialog-overlay", c.ui.dialog.overlay.resize) } var d = c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({ width: this.width(), height: this.height() }); (e.options.bgiframe && c.fn.bgiframe && d.bgiframe()); this.instances.push(d); return d }, destroy: function (d) { this.instances.splice(c.inArray(this.instances, d), 1); if (this.instances.length === 0) { c([document, window]).unbind(".dialog-overlay") } d.remove(); var e = 0; c.each(this.instances, function () { e = Math.max(e, this.css("z-index")) }); this.maxZ = e }, height: function () { if (c.browser.msie && c.browser.version < 7) { var e = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight); var d = Math.max(document.documentElement.offsetHeight, document.body.offsetHeight); if (e < d) { return c(window).height() + "px" } else { return e + "px" } } else { return c(document).height() + "px" } }, width: function () { if (c.browser.msie && c.browser.version < 7) { var d = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth); var e = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); if (d < e) { return c(window).width() + "px" } else { return d + "px" } } else { return c(document).width() + "px" } }, resize: function () { var d = c([]); c.each(c.ui.dialog.overlay.instances, function () { d = d.add(this) }); d.css({ width: 0, height: 0 }).css({ width: c.ui.dialog.overlay.width(), height: c.ui.dialog.overlay.height() }) } }); c.extend(c.ui.dialog.overlay.prototype, { destroy: function () { c.ui.dialog.overlay.destroy(this.$el) } }) })(jQuery); ; /*
 * jQuery UI Tabs 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	ui.core.js
 */
(function (a) { a.widget("ui.tabs", { _init: function () { if (this.options.deselectable !== undefined) { this.options.collapsible = this.options.deselectable } this._tabify(true) }, _setData: function (b, c) { if (b == "selected") { if (this.options.collapsible && c == this.options.selected) { return } this.select(c) } else { this.options[b] = c; if (b == "deselectable") { this.options.collapsible = c } this._tabify() } }, _tabId: function (b) { return b.title && b.title.replace(/\s/g, "_").replace(/[^A-Za-z0-9\-_:\.]/g, "") || this.options.idPrefix + a.data(b) }, _sanitizeSelector: function (b) { return b.replace(/:/g, "\\:") }, _cookie: function () { var b = this.cookie || (this.cookie = this.options.cookie.name || "ui-tabs-" + a.data(this.list[0])); return a.cookie.apply(null, [b].concat(a.makeArray(arguments))) }, _ui: function (c, b) { return { tab: c, panel: b, index: this.anchors.index(c)} }, _cleanup: function () { this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function () { var b = a(this); b.html(b.data("label.tabs")).removeData("label.tabs") }) }, _tabify: function (n) { this.list = this.element.children("ul:first"); this.lis = a("li:has(a[href])", this.list); this.anchors = this.lis.map(function () { return a("a", this)[0] }); this.panels = a([]); var p = this, d = this.options; var c = /^#.+/; this.anchors.each(function (r, o) { var q = a(o).attr("href"); var s = q.split("#")[0], u; if (s && (s === location.toString().split("#")[0] || (u = a("base")[0]) && s === u.href)) { q = o.hash; o.href = q } if (c.test(q)) { p.panels = p.panels.add(p._sanitizeSelector(q)) } else { if (q != "#") { a.data(o, "href.tabs", q); a.data(o, "load.tabs", q.replace(/#.*$/, "")); var w = p._tabId(o); o.href = "#" + w; var v = a("#" + w); if (!v.length) { v = a(d.panelTemplate).attr("id", w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r - 1] || p.list); v.data("destroy.tabs", true) } p.panels = p.panels.add(v) } else { d.disabled.push(r) } } }); if (n) { this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"); this.lis.addClass("ui-state-default ui-corner-top"); this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"); if (d.selected === undefined) { if (location.hash) { this.anchors.each(function (q, o) { if (o.hash == location.hash) { d.selected = q; return false } }) } if (typeof d.selected != "number" && d.cookie) { d.selected = parseInt(p._cookie(), 10) } if (typeof d.selected != "number" && this.lis.filter(".ui-tabs-selected").length) { d.selected = this.lis.index(this.lis.filter(".ui-tabs-selected")) } d.selected = d.selected || 0 } else { if (d.selected === null) { d.selected = -1 } } d.selected = ((d.selected >= 0 && this.anchors[d.selected]) || d.selected < 0) ? d.selected : 0; d.disabled = a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"), function (q, o) { return p.lis.index(q) }))).sort(); if (a.inArray(d.selected, d.disabled) != -1) { d.disabled.splice(a.inArray(d.selected, d.disabled), 1) } this.panels.addClass("ui-tabs-hide"); this.lis.removeClass("ui-tabs-selected ui-state-active"); if (d.selected >= 0 && this.anchors.length) { this.panels.eq(d.selected).removeClass("ui-tabs-hide"); this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active"); p.element.queue("tabs", function () { p._trigger("show", null, p._ui(p.anchors[d.selected], p.panels[d.selected])) }); this.load(d.selected) } a(window).bind("unload", function () { p.lis.add(p.anchors).unbind(".tabs"); p.lis = p.anchors = p.panels = null }) } else { d.selected = this.lis.index(this.lis.filter(".ui-tabs-selected")) } this.element[d.collapsible ? "addClass" : "removeClass"]("ui-tabs-collapsible"); if (d.cookie) { this._cookie(d.selected, d.cookie) } for (var g = 0, m; (m = this.lis[g]); g++) { a(m)[a.inArray(g, d.disabled) != -1 && !a(m).hasClass("ui-tabs-selected") ? "addClass" : "removeClass"]("ui-state-disabled") } if (d.cache === false) { this.anchors.removeData("cache.tabs") } this.lis.add(this.anchors).unbind(".tabs"); if (d.event != "mouseover") { var f = function (o, i) { if (i.is(":not(.ui-state-disabled)")) { i.addClass("ui-state-" + o) } }; var j = function (o, i) { i.removeClass("ui-state-" + o) }; this.lis.bind("mouseover.tabs", function () { f("hover", a(this)) }); this.lis.bind("mouseout.tabs", function () { j("hover", a(this)) }); this.anchors.bind("focus.tabs", function () { f("focus", a(this).closest("li")) }); this.anchors.bind("blur.tabs", function () { j("focus", a(this).closest("li")) }) } var b, h; if (d.fx) { if (a.isArray(d.fx)) { b = d.fx[0]; h = d.fx[1] } else { b = h = d.fx } } function e(i, o) { i.css({ display: "" }); if (a.browser.msie && o.opacity) { i[0].style.removeAttribute("filter") } } var k = h ? function (i, o) { a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active"); o.hide().removeClass("ui-tabs-hide").animate(h, h.duration || "normal", function () { e(o, h); p._trigger("show", null, p._ui(i, o[0])) }) } : function (i, o) { a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active"); o.removeClass("ui-tabs-hide"); p._trigger("show", null, p._ui(i, o[0])) }; var l = b ? function (o, i) { i.animate(b, b.duration || "normal", function () { p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default"); i.addClass("ui-tabs-hide"); e(i, b); p.element.dequeue("tabs") }) } : function (o, i, q) { p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default"); i.addClass("ui-tabs-hide"); p.element.dequeue("tabs") }; this.anchors.bind(d.event + ".tabs", function () { var o = this, r = a(this).closest("li"), i = p.panels.filter(":not(.ui-tabs-hide)"), q = a(p._sanitizeSelector(this.hash)); if ((r.hasClass("ui-tabs-selected") && !d.collapsible) || r.hasClass("ui-state-disabled") || r.hasClass("ui-state-processing") || p._trigger("select", null, p._ui(this, q[0])) === false) { this.blur(); return false } d.selected = p.anchors.index(this); p.abort(); if (d.collapsible) { if (r.hasClass("ui-tabs-selected")) { d.selected = -1; if (d.cookie) { p._cookie(d.selected, d.cookie) } p.element.queue("tabs", function () { l(o, i) }).dequeue("tabs"); this.blur(); return false } else { if (!i.length) { if (d.cookie) { p._cookie(d.selected, d.cookie) } p.element.queue("tabs", function () { k(o, q) }); p.load(p.anchors.index(this)); this.blur(); return false } } } if (d.cookie) { p._cookie(d.selected, d.cookie) } if (q.length) { if (i.length) { p.element.queue("tabs", function () { l(o, i) }) } p.element.queue("tabs", function () { k(o, q) }); p.load(p.anchors.index(this)) } else { throw "jQuery UI Tabs: Mismatching fragment identifier." } if (a.browser.msie) { this.blur() } }); this.anchors.bind("click.tabs", function () { return false }) }, destroy: function () { var b = this.options; this.abort(); this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"); this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"); this.anchors.each(function () { var c = a.data(this, "href.tabs"); if (c) { this.href = c } var d = a(this).unbind(".tabs"); a.each(["href", "load", "cache"], function (e, f) { d.removeData(f + ".tabs") }) }); this.lis.unbind(".tabs").add(this.panels).each(function () { if (a.data(this, "destroy.tabs")) { a(this).remove() } else { a(this).removeClass(["ui-state-default", "ui-corner-top", "ui-tabs-selected", "ui-state-active", "ui-state-hover", "ui-state-focus", "ui-state-disabled", "ui-tabs-panel", "ui-widget-content", "ui-corner-bottom", "ui-tabs-hide"].join(" ")) } }); if (b.cookie) { this._cookie(null, b.cookie) } }, add: function (e, d, c) { if (c === undefined) { c = this.anchors.length } var b = this, g = this.options, i = a(g.tabTemplate.replace(/#\{href\}/g, e).replace(/#\{label\}/g, d)), h = !e.indexOf("#") ? e.replace("#", "") : this._tabId(a("a", i)[0]); i.addClass("ui-state-default ui-corner-top").data("destroy.tabs", true); var f = a("#" + h); if (!f.length) { f = a(g.panelTemplate).attr("id", h).data("destroy.tabs", true) } f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"); if (c >= this.lis.length) { i.appendTo(this.list); f.appendTo(this.list[0].parentNode) } else { i.insertBefore(this.lis[c]); f.insertBefore(this.panels[c]) } g.disabled = a.map(g.disabled, function (k, j) { return k >= c ? ++k : k }); this._tabify(); if (this.anchors.length == 1) { i.addClass("ui-tabs-selected ui-state-active"); f.removeClass("ui-tabs-hide"); this.element.queue("tabs", function () { b._trigger("show", null, b._ui(b.anchors[0], b.panels[0])) }); this.load(0) } this._trigger("add", null, this._ui(this.anchors[c], this.panels[c])) }, remove: function (b) { var d = this.options, e = this.lis.eq(b).remove(), c = this.panels.eq(b).remove(); if (e.hasClass("ui-tabs-selected") && this.anchors.length > 1) { this.select(b + (b + 1 < this.anchors.length ? 1 : -1)) } d.disabled = a.map(a.grep(d.disabled, function (g, f) { return g != b }), function (g, f) { return g >= b ? --g : g }); this._tabify(); this._trigger("remove", null, this._ui(e.find("a")[0], c[0])) }, enable: function (b) { var c = this.options; if (a.inArray(b, c.disabled) == -1) { return } this.lis.eq(b).removeClass("ui-state-disabled"); c.disabled = a.grep(c.disabled, function (e, d) { return e != b }); this._trigger("enable", null, this._ui(this.anchors[b], this.panels[b])) }, disable: function (c) { var b = this, d = this.options; if (c != d.selected) { this.lis.eq(c).addClass("ui-state-disabled"); d.disabled.push(c); d.disabled.sort(); this._trigger("disable", null, this._ui(this.anchors[c], this.panels[c])) } }, select: function (b) { if (typeof b == "string") { b = this.anchors.index(this.anchors.filter("[href$=" + b + "]")) } else { if (b === null) { b = -1 } } if (b == -1 && this.options.collapsible) { b = this.options.selected } this.anchors.eq(b).trigger(this.options.event + ".tabs") }, load: function (e) { var c = this, g = this.options, b = this.anchors.eq(e)[0], d = a.data(b, "load.tabs"); this.abort(); if (!d || this.element.queue("tabs").length !== 0 && a.data(b, "cache.tabs")) { this.element.dequeue("tabs"); return } this.lis.eq(e).addClass("ui-state-processing"); if (g.spinner) { var f = a("span", b); f.data("label.tabs", f.html()).html(g.spinner) } this.xhr = a.ajax(a.extend({}, g.ajaxOptions, { url: d, success: function (i, h) { a(c._sanitizeSelector(b.hash)).html(i); c._cleanup(); if (g.cache) { a.data(b, "cache.tabs", true) } c._trigger("load", null, c._ui(c.anchors[e], c.panels[e])); try { g.ajaxOptions.success(i, h) } catch (j) { } c.element.dequeue("tabs") } })) }, abort: function () { this.element.queue([]); this.panels.stop(false, true); if (this.xhr) { this.xhr.abort(); delete this.xhr } this._cleanup() }, url: function (c, b) { this.anchors.eq(c).removeData("cache.tabs").data("load.tabs", b) }, length: function () { return this.anchors.length } }); a.extend(a.ui.tabs, { version: "1.7.2", getter: "length", defaults: { ajaxOptions: null, cache: false, cookie: null, collapsible: false, disabled: [], event: "click", fx: null, idPrefix: "ui-tabs-", panelTemplate: "<div></div>", spinner: "<em>Loading&#8230;</em>", tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'} }); a.extend(a.ui.tabs.prototype, { rotation: null, rotate: function (d, f) { var b = this, g = this.options; var c = b._rotate || (b._rotate = function (h) { clearTimeout(b.rotation); b.rotation = setTimeout(function () { var i = g.selected; b.select(++i < b.anchors.length ? i : 0) }, d); if (h) { h.stopPropagation() } }); var e = b._unrotate || (b._unrotate = !f ? function (h) { if (h.clientX) { b.rotate(null) } } : function (h) { t = g.selected; c() }); if (d) { this.element.bind("tabsshow", c); this.anchors.bind(g.event + ".tabs", e); c() } else { clearTimeout(b.rotation); this.element.unbind("tabsshow", c); this.anchors.unbind(g.event + ".tabs", e); delete this._rotate; delete this._unrotate } } }) })(jQuery); ;

/*
* nyroModal - jQuery Plugin
* http://nyromodal.nyrodev.com
*
* Copyright (c) 2010 Cedric Nirousset (nyrodev.com)
* Licensed under the MIT license
*
* $Date: 2010-02-23 (Tue, 23 Feb 2010) $
* $version: 1.6.2
*/
jQuery(function ($) { var userAgent = navigator.userAgent.toLowerCase(); var browserVersion = (userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/) || [0, '0'])[1]; var isIE6 = (/msie/.test(userAgent) && !/opera/.test(userAgent) && parseInt(browserVersion) < 7 && (!window.XMLHttpRequest || typeof (XMLHttpRequest) === 'function')); var body = $('body'); var currentSettings; var callingSettings; var shouldResize = false; var gallery = {}; var fixFF = false; var contentElt; var contentEltLast; var modal = { started: false, ready: false, dataReady: false, anim: false, animContent: false, loadingShown: false, transition: false, resizing: false, closing: false, error: false, blocker: null, blockerVars: null, full: null, bg: null, loading: null, tmp: null, content: null, wrapper: null, contentWrapper: null, scripts: new Array(), scriptsShown: new Array() }; var resized = { width: false, height: false, windowResizing: false }; var initSettingsSize = { width: null, height: null, windowResizing: true }; var windowResizeTimeout; $.fn.nyroModal = function (settings) { if (!this) return false; return this.each(function () { var me = $(this); if (this.nodeName.toLowerCase() == 'form') { me.unbind('submit.nyroModal').bind('submit.nyroModal', function (e) { if (e.isDefaultPrevented()) return false; if (me.data('nyroModalprocessing')) return true; if (this.enctype == 'multipart/form-data') { processModal($.extend(settings, { from: this })); return true } e.preventDefault(); processModal($.extend(settings, { from: this })); return false }) } else { me.unbind('click.nyroModal').bind('click.nyroModal', function (e) { if (e.isDefaultPrevented()) return false; e.preventDefault(); processModal($.extend(settings, { from: this })); return false }) } }) }; $.fn.nyroModalManual = function (settings) { if (!this.length) processModal(settings); return this.each(function () { processModal($.extend(settings, { from: this })) }) }; $.nyroModalManual = function (settings) { processModal(settings) }; $.nyroModalSettings = function (settings, deep1, deep2) { setCurrentSettings(settings, deep1, deep2); if (!deep1 && modal.started) { if (modal.bg && settings.bgColor) currentSettings.updateBgColor(modal, currentSettings, function () { }); if (modal.contentWrapper && settings.title) setTitle(); if (!modal.error && (settings.windowResizing || (!modal.resizing && (('width' in settings && settings.width == currentSettings.width) || ('height' in settings && settings.height == currentSettings.height))))) { modal.resizing = true; if (modal.contentWrapper) calculateSize(true); if (modal.contentWrapper && modal.contentWrapper.is(':visible') && !modal.animContent) { if (fixFF) modal.content.css({ position: '' }); currentSettings.resize(modal, currentSettings, function () { currentSettings.windowResizing = false; modal.resizing = false; if (fixFF) modal.content.css({ position: 'fixed' }); if ($.isFunction(currentSettings.endResize)) currentSettings.endResize(modal, currentSettings) }) } } } }; $.nyroModalRemove = function () { removeModal() }; $.nyroModalNext = function () { var link = getGalleryLink(1); if (link) return link.nyroModalManual(getCurrentSettingsNew()); return false }; $.nyroModalPrev = function () { var link = getGalleryLink(-1); if (link) return link.nyroModalManual(getCurrentSettingsNew()); return false }; $.fn.nyroModal.settings = { debug: false, blocker: false, windowResize: true, modal: false, type: '', forceType: null, from: '', hash: '', processHandler: null, selIndicator: 'nyroModalSel', formIndicator: 'nyroModal', content: null, bgColor: '#000000', ajax: {}, swf: { wmode: 'transparent' }, width: null, height: null, minWidth: 400, minHeight: 300, resizable: true, autoSizable: true, padding: 25, regexImg: '[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$', addImageDivTitle: false, defaultImgAlt: 'Image', setWidthImgTitle: true, ltr: true, gallery: null, galleryLinks: '<a href="#" class="nyroModalPrev">Prev</a><a href="#"  class="nyroModalNext">Next</a>', galleryCounts: galleryCounts, galleryLoop: false, zIndexStart: 100, cssOpt: { bg: { position: 'absolute', overflow: 'hidden', top: 0, left: 0, height: '100%', width: '100%' }, wrapper: { position: 'absolute', top: '50%', left: '50%' }, wrapper2: {}, content: {}, loading: { position: 'absolute', top: '50%', left: '50%', marginTop: '-50px', marginLeft: '-50px'} }, wrap: { div: '<div class="wrapper"></div>', ajax: '<div class="wrapper"></div>', form: '<div class="wrapper"></div>', formData: '<div class="wrapper"></div>', image: '<div class="wrapperImg"></div>', swf: '<div class="wrapperSwf"></div>', iframe: '<div class="wrapperIframe"></div>', iframeForm: '<div class="wrapperIframe"></div>', manual: '<div class="wrapper"></div>' }, closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="close">Close</a>', title: null, titleFromIframe: true, openSelector: '.nyroModal', closeSelector: '.nyroModalClose', contentLoading: '<a href="#" class="nyroModalClose">Cancel</a>', errorClass: 'error', contentError: 'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>', handleError: null, showBackground: showBackground, hideBackground: hideBackground, endFillContent: null, showContent: showContent, endShowContent: null, beforeHideContent: null, hideContent: hideContent, showTransition: showTransition, hideTransition: hideTransition, showLoading: showLoading, hideLoading: hideLoading, resize: resize, endResize: null, updateBgColor: updateBgColor, endRemove: null }; function processModal(settings) { if (modal.loadingShown || modal.transition || modal.anim) return; debug('processModal'); modal.started = true; callingSettings = $.extend(true, settings); setDefaultCurrentSettings(settings); if (!modal.full) modal.blockerVars = modal.blocker = null; modal.error = false; modal.closing = false; modal.dataReady = false; modal.scripts = new Array(); modal.scriptsShown = new Array(); currentSettings.type = fileType(); if (currentSettings.forceType) { if (!currentSettings.content) currentSettings.from = true; currentSettings.type = currentSettings.forceType; currentSettings.forceType = null } if ($.isFunction(currentSettings.processHandler)) currentSettings.processHandler(currentSettings); var from = currentSettings.from; var url = currentSettings.url; initSettingsSize.width = currentSettings.width; initSettingsSize.height = currentSettings.height; if (currentSettings.type == 'swf') { setCurrentSettings({ overflow: 'visible' }, 'cssOpt', 'content'); currentSettings.content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + currentSettings.width + '" height="' + currentSettings.height + '"><param name="movie" value="' + url + '"></param>'; var tmp = ''; $.each(currentSettings.swf, function (name, val) { currentSettings.content += '<param name="' + name + '" value="' + val + '"></param>'; tmp += ' ' + name + '="' + val + '"' }); currentSettings.content += '<embed src="' + url + '" type="application/x-shockwave-flash" width="' + currentSettings.width + '" height="' + currentSettings.height + '"' + tmp + '></embed></object>' } if (from) { var jFrom = $(from).blur(); if (currentSettings.type == 'form') { var data = $(from).serializeArray(); data.push({ name: currentSettings.formIndicator, value: 1 }); if (currentSettings.selector) data.push({ name: currentSettings.selIndicator, value: currentSettings.selector.substring(1) }); showModal(); $.ajax($.extend({}, currentSettings.ajax, { url: url, data: data, type: jFrom.attr('method') ? jFrom.attr('method') : 'get', success: ajaxLoaded, error: loadingError })); debug('Form Ajax Load: ' + jFrom.attr('action')) } else if (currentSettings.type == 'formData') { initModal(); jFrom.attr('target', 'nyroModalIframe'); jFrom.attr('action', url); jFrom.prepend('<input type="hidden" name="' + currentSettings.formIndicator + '" value="1" />'); if (currentSettings.selector) jFrom.prepend('<input type="hidden" name="' + currentSettings.selIndicator + '" value="' + currentSettings.selector.substring(1) + '" />'); modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:\'\';"></iframe>'); $('iframe', modal.tmp).css({ width: currentSettings.width, height: currentSettings.height }).error(loadingError).load(formDataLoaded); debug('Form Data Load: ' + jFrom.attr('action')); showModal(); showContentOrLoading() } else if (currentSettings.type == 'image') { debug('Image Load: ' + url); var title = jFrom.attr('title') || currentSettings.defaultImgAlt; initModal(); modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt', title); modal.tmp.css({ lineHeight: 0 }); $('img', modal.tmp).error(loadingError).load(function () { debug('Image Loaded: ' + this.src); $(this).unbind('load'); var w = modal.tmp.width(); var h = modal.tmp.height(); modal.tmp.css({ lineHeight: '' }); resized.width = w; resized.height = h; setCurrentSettings({ width: w, height: h, imgWidth: w, imgHeight: h }); initSettingsSize.width = w; initSettingsSize.height = h; setCurrentSettings({ overflow: 'visible' }, 'cssOpt', 'content'); modal.dataReady = true; if (modal.loadingShown || modal.transition) showContentOrLoading() }).attr('src', url); showModal() } else if (currentSettings.type == 'iframeForm') { initModal(); modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>'); debug('Iframe Form Load: ' + url); $('iframe', modal.tmp).eq(0).css({ width: '100%', height: $.support.boxModel ? '99%' : '100%' }).load(iframeLoaded); modal.dataReady = true; showModal() } else if (currentSettings.type == 'iframe') { initModal(); modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>'); debug('Iframe Load: ' + url); $('iframe', modal.tmp).eq(0).css({ width: '100%', height: $.support.boxModel ? '99%' : '100%' }).load(iframeLoaded); modal.dataReady = true; showModal() } else if (currentSettings.type) { debug('Content: ' + currentSettings.type); initModal(); modal.tmp.html(currentSettings.content); var w = modal.tmp.width(); var h = modal.tmp.height(); var div = $(currentSettings.type); if (div.length) { setCurrentSettings({ type: 'div' }); w = div.width(); h = div.height(); if (contentElt) contentEltLast = contentElt; contentElt = div; modal.tmp.append(div.contents()) } initSettingsSize.width = w; initSettingsSize.height = h; setCurrentSettings({ width: w, height: h }); if (modal.tmp.html()) modal.dataReady = true; else loadingError(); if (!modal.ready) showModal(); else endHideContent() } else { debug('Ajax Load: ' + url); setCurrentSettings({ type: 'ajax' }); var data = currentSettings.ajax.data || {}; if (currentSettings.selector) { if (typeof data == "string") { data += '&' + currentSettings.selIndicator + '=' + currentSettings.selector.substring(1) } else { data[currentSettings.selIndicator] = currentSettings.selector.substring(1) } } showModal(); $.ajax($.extend(true, currentSettings.ajax, { url: url, success: ajaxLoaded, error: loadingError, data: data })) } } else if (currentSettings.content) { debug('Content: ' + currentSettings.type); setCurrentSettings({ type: 'manual' }); initModal(); modal.tmp.html($('<div/>').html(currentSettings.content).contents()); if (modal.tmp.html()) modal.dataReady = true; else loadingError(); showModal() } else { } } function setDefaultCurrentSettings(settings) { debug('setDefaultCurrentSettings'); currentSettings = $.extend(true, {}, $.fn.nyroModal.settings, settings); setMargin() } function setCurrentSettings(settings, deep1, deep2) { if (modal.started) { if (deep1 && deep2) { $.extend(true, currentSettings[deep1][deep2], settings) } else if (deep1) { $.extend(true, currentSettings[deep1], settings) } else { if (modal.animContent) { if ('width' in settings) { if (!modal.resizing) { settings.setWidth = settings.width; shouldResize = true } delete settings['width'] } if ('height' in settings) { if (!modal.resizing) { settings.setHeight = settings.height; shouldResize = true } delete settings['height'] } } $.extend(true, currentSettings, settings) } } else { if (deep1 && deep2) { $.extend(true, $.fn.nyroModal.settings[deep1][deep2], settings) } else if (deep1) { $.extend(true, $.fn.nyroModal.settings[deep1], settings) } else { $.extend(true, $.fn.nyroModal.settings, settings) } } } function setMarginScroll() { if (isIE6 && !modal.blocker) { if (document.documentElement) { currentSettings.marginScrollLeft = document.documentElement.scrollLeft; currentSettings.marginScrollTop = document.documentElement.scrollTop } else { currentSettings.marginScrollLeft = document.body.scrollLeft; currentSettings.marginScrollTop = document.body.scrollTop } } else { currentSettings.marginScrollLeft = 0; currentSettings.marginScrollTop = 0 } } function setMargin() { setMarginScroll(); currentSettings.marginLeft = -(currentSettings.width + currentSettings.borderW) / 2; currentSettings.marginTop = -(currentSettings.height + currentSettings.borderH) / 2; if (!modal.blocker) { currentSettings.marginLeft += currentSettings.marginScrollLeft; currentSettings.marginTop += currentSettings.marginScrollTop } } function setMarginLoading() { setMarginScroll(); var outer = getOuter(modal.loading); currentSettings.marginTopLoading = -(modal.loading.height() + outer.h.border + outer.h.padding) / 2; currentSettings.marginLeftLoading = -(modal.loading.width() + outer.w.border + outer.w.padding) / 2; if (!modal.blocker) { currentSettings.marginLeftLoading += currentSettings.marginScrollLeft; currentSettings.marginTopLoading += currentSettings.marginScrollTop } } function setTitle() { var title = $('h1#nyroModalTitle', modal.contentWrapper); if (title.length) title.text(currentSettings.title); else modal.contentWrapper.prepend('<h1 id="nyroModalTitle">' + currentSettings.title + '</h1>') } function initModal() { debug('initModal'); if (!modal.full) { if (currentSettings.debug) setCurrentSettings({ color: 'white' }, 'cssOpt', 'bg'); var full = { zIndex: currentSettings.zIndexStart, position: 'fixed', top: 0, left: 0, width: '100%', height: '100%' }; var contain = body; var iframeHideIE = ''; if (currentSettings.blocker) { modal.blocker = contain = $(currentSettings.blocker); var pos = modal.blocker.offset(); var w = modal.blocker.outerWidth(); var h = modal.blocker.outerHeight(); if (isIE6) { setCurrentSettings({ height: '100%', width: '100%', top: 0, left: 0 }, 'cssOpt', 'bg') } modal.blockerVars = { top: pos.top, left: pos.left, width: w, height: h }; var plusTop = (/msie/.test(userAgent) ? 0 : getCurCSS(body.get(0), 'borderTopWidth')); var plusLeft = (/msie/.test(userAgent) ? 0 : getCurCSS(body.get(0), 'borderLeftWidth')); full = { position: 'absolute', top: pos.top + plusTop, left: pos.left + plusLeft, width: w, height: h} } else if (isIE6) { body.css({ marginLeft: 0, marginRight: 0 }); var w = body.width(); var h = $(window).height() + 'px'; if ($(window).height() >= body.outerHeight()) { h = body.outerHeight() + 'px' } else w += 20; w += 'px'; body.css({ width: w, height: h, position: 'static', overflow: 'hidden' }); $('html').css({ overflow: 'hidden' }); setCurrentSettings({ cssOpt: { bg: { position: 'absolute', zIndex: currentSettings.zIndexStart + 1, height: '110%', width: '110%', top: currentSettings.marginScrollTop + 'px', left: currentSettings.marginScrollLeft + 'px' }, wrapper: { zIndex: currentSettings.zIndexStart + 2 }, loading: { zIndex: currentSettings.zIndexStart + 3}} }); iframeHideIE = $('<iframe id="nyroModalIframeHideIe" src="javascript:\'\';"></iframe>').css($.extend({}, currentSettings.cssOpt.bg, { opacity: 0, zIndex: 50, border: 'none' })) } contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide()); modal.full = $('#nyroModalFull').css(full).show(); modal.bg = $('#nyroModalBg').css($.extend({ backgroundColor: currentSettings.bgColor }, currentSettings.cssOpt.bg)).before(iframeHideIE); modal.bg.bind('click.nyroModal', clickBg); modal.loading = $('#nyroModalLoading').css(currentSettings.cssOpt.loading).hide(); modal.contentWrapper = $('#nyroModalWrapper').css(currentSettings.cssOpt.wrapper).hide(); modal.content = $('#nyroModalContent'); modal.tmp = $('#nyrModalTmp').hide(); if ($.isFunction($.fn.mousewheel)) { modal.content.mousewheel(function (e, d) { var elt = modal.content.get(0); if ((d > 0 && elt.scrollTop == 0) || (d < 0 && elt.scrollHeight - elt.scrollTop == elt.clientHeight)) { e.preventDefault(); e.stopPropagation() } }) } $(document).bind('keydown.nyroModal', keyHandler); modal.content.css({ width: 'auto', height: 'auto' }); modal.contentWrapper.css({ width: 'auto', height: 'auto' }); if (!currentSettings.blocker && currentSettings.windowResize) { $(window).bind('resize.nyroModal', function () { window.clearTimeout(windowResizeTimeout); windowResizeTimeout = window.setTimeout(windowResizeHandler, 200) }) } } } function windowResizeHandler() { $.nyroModalSettings(initSettingsSize) } function showModal() { debug('showModal'); if (!modal.ready) { initModal(); modal.anim = true; currentSettings.showBackground(modal, currentSettings, endBackground) } else { modal.anim = true; modal.transition = true; currentSettings.showTransition(modal, currentSettings, function () { endHideContent(); modal.anim = false; showContentOrLoading() }) } } function clickBg(e) { if (!currentSettings.modal) removeModal() } function keyHandler(e) { if (e.keyCode == 27) { if (!currentSettings.modal) removeModal() } else if (currentSettings.gallery && modal.ready && modal.dataReady && !modal.anim && !modal.transition) { if (e.keyCode == 39 || e.keyCode == 40) { e.preventDefault(); $.nyroModalNext(); return false } else if (e.keyCode == 37 || e.keyCode == 38) { e.preventDefault(); $.nyroModalPrev(); return false } } } function fileType() { var from = currentSettings.from; var url; if (from && from.nodeName) { var jFrom = $(from); url = jFrom.attr(from.nodeName.toLowerCase() == 'form' ? 'action' : 'href'); if (!url) url = location.href.substring(window.location.host.length + 7); currentSettings.url = url; if (jFrom.attr('rev') == 'modal') currentSettings.modal = true; currentSettings.title = jFrom.attr('title'); if (from && from.rel && from.rel.toLowerCase() != 'nofollow') { var indexSpace = from.rel.indexOf(' '); currentSettings.gallery = indexSpace > 0 ? from.rel.substr(0, indexSpace) : from.rel } var imgType = imageType(url, from); if (imgType) return imgType; if (isSwf(url)) return 'swf'; var iframe = false; if (from.target && from.target.toLowerCase() == '_blank' || (from.hostname && from.hostname.replace(/:\d*$/, '') != window.location.hostname.replace(/:\d*$/, ''))) { iframe = true } if (from.nodeName.toLowerCase() == 'form') { if (iframe) return 'iframeForm'; setCurrentSettings(extractUrlSel(url)); if (jFrom.attr('enctype') == 'multipart/form-data') return 'formData'; return 'form' } if (iframe) return 'iframe' } else { url = currentSettings.url; if (!currentSettings.content) currentSettings.from = true; if (!url) return null; if (isSwf(url)) return 'swf'; var reg1 = new RegExp("^http://|https://", "g"); if (url.match(reg1)) return 'iframe' } var imgType = imageType(url, from); if (imgType) return imgType; var tmp = extractUrlSel(url); setCurrentSettings(tmp); if (!tmp.url) return tmp.selector } function imageType(url, from) { var image = new RegExp(currentSettings.regexImg, 'i'); if (image.test(url)) { return 'image' } } function isSwf(url) { var swf = new RegExp('[^\.]\.(swf)\s*$', 'i'); return swf.test(url) } function extractUrlSel(url) { var ret = { url: null, selector: null }; if (url) { var hash = getHash(url); var hashLoc = getHash(window.location.href); var curLoc = window.location.href.substring(0, window.location.href.length - hashLoc.length); var req = url.substring(0, url.length - hash.length); if (req == curLoc || req == $('base').attr('href')) { ret.selector = hash } else { ret.url = req; ret.selector = hash } } return ret } function loadingError() { debug('loadingError'); modal.error = true; if (!modal.ready) return; if ($.isFunction(currentSettings.handleError)) currentSettings.handleError(modal, currentSettings); modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError); $(currentSettings.closeSelector, modal.loading).unbind('click.nyroModal').bind('click.nyroModal', removeModal); setMarginLoading(); modal.loading.css({ marginTop: currentSettings.marginTopLoading + 'px', marginLeft: currentSettings.marginLeftLoading + 'px' }) } function fillContent() { debug('fillContent'); if (!modal.tmp.html()) return; modal.content.html(modal.tmp.contents()); modal.tmp.empty(); wrapContent(); if (currentSettings.type == 'iframeForm') { $(currentSettings.from).attr('target', 'nyroModalIframe').data('nyroModalprocessing', 1).submit().attr('target', '_blank').removeData('nyroModalprocessing') } if (!currentSettings.modal) modal.wrapper.prepend(currentSettings.closeButton); if ($.isFunction(currentSettings.endFillContent)) currentSettings.endFillContent(modal, currentSettings); modal.content.append(modal.scripts); $(currentSettings.closeSelector, modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal', removeModal); $(currentSettings.openSelector, modal.contentWrapper).nyroModal(getCurrentSettingsNew()) } function getCurrentSettingsNew() { return callingSettings; var currentSettingsNew = $.extend(true, {}, currentSettings); if (resized.width) currentSettingsNew.width = null; else currentSettingsNew.width = initSettingsSize.width; if (resized.height) currentSettingsNew.height = null; else currentSettingsNew.height = initSettingsSize.height; currentSettingsNew.cssOpt.content.overflow = 'auto'; return currentSettingsNew } function wrapContent() { debug('wrapContent'); var wrap = $(currentSettings.wrap[currentSettings.type]); modal.content.append(wrap.children().remove()); modal.contentWrapper.wrapInner(wrap); if (currentSettings.gallery) { modal.content.append(currentSettings.galleryLinks); gallery.links = $('[rel="' + currentSettings.gallery + '"], [rel^="' + currentSettings.gallery + ' "]'); gallery.index = gallery.links.index(currentSettings.from); if (currentSettings.galleryCounts && $.isFunction(currentSettings.galleryCounts)) currentSettings.galleryCounts(gallery.index + 1, gallery.links.length, modal, currentSettings); var currentSettingsNew = getCurrentSettingsNew(); var linkPrev = getGalleryLink(-1); if (linkPrev) { var prev = $('.nyroModalPrev', modal.contentWrapper).attr('href', linkPrev.attr('href')).click(function (e) { e.preventDefault(); $.nyroModalPrev(); return false }); if (isIE6 && currentSettings.type == 'swf') { prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:\'\';"></iframe>').css({ position: prev.css('position'), top: prev.css('top'), left: prev.css('left'), width: prev.width(), height: prev.height(), opacity: 0, border: 'none' })) } } else { $('.nyroModalPrev', modal.contentWrapper).remove() } var linkNext = getGalleryLink(1); if (linkNext) { var next = $('.nyroModalNext', modal.contentWrapper).attr('href', linkNext.attr('href')).click(function (e) { e.preventDefault(); $.nyroModalNext(); return false }); if (isIE6 && currentSettings.type == 'swf') { next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:\'\';"></iframe>').css($.extend({}, { position: next.css('position'), top: next.css('top'), left: next.css('left'), width: next.width(), height: next.height(), opacity: 0, border: 'none' }))) } } else { $('.nyroModalNext', modal.contentWrapper).remove() } } calculateSize() } function getGalleryLink(dir) { if (currentSettings.gallery) { if (!currentSettings.ltr) dir *= -1; var index = gallery.index + dir; if (index >= 0 && index < gallery.links.length) return gallery.links.eq(index); else if (currentSettings.galleryLoop) { if (index < 0) return gallery.links.eq(gallery.links.length - 1); else return gallery.links.eq(0) } } return false } function calculateSize(resizing) { debug('calculateSize'); modal.wrapper = modal.contentWrapper.children('div:first'); resized.width = false; resized.height = false; if (false && !currentSettings.windowResizing) { initSettingsSize.width = currentSettings.width; initSettingsSize.height = currentSettings.height } if (currentSettings.autoSizable && (!currentSettings.width || !currentSettings.height)) { modal.contentWrapper.css({ opacity: 0, width: 'auto', height: 'auto' }).show(); var tmp = { width: 'auto', height: 'auto' }; if (currentSettings.width) { tmp.width = currentSettings.width } else if (currentSettings.type == 'iframe') { tmp.width = currentSettings.minWidth } if (currentSettings.height) { tmp.height = currentSettings.height } else if (currentSettings.type == 'iframe') { tmp.height = currentSettings.minHeight } modal.content.css(tmp); if (!currentSettings.width) { currentSettings.width = modal.content.outerWidth(true); resized.width = true } if (!currentSettings.height) { currentSettings.height = modal.content.outerHeight(true); resized.height = true } modal.contentWrapper.css({ opacity: 1 }); if (!resizing) modal.contentWrapper.hide() } if (currentSettings.type != 'image' && currentSettings.type != 'swf') { currentSettings.width = Math.max(currentSettings.width, currentSettings.minWidth); currentSettings.height = Math.max(currentSettings.height, currentSettings.minHeight) } var outerWrapper = getOuter(modal.contentWrapper); var outerWrapper2 = getOuter(modal.wrapper); var outerContent = getOuter(modal.content); var tmp = { content: { width: currentSettings.width, height: currentSettings.height }, wrapper2: { width: currentSettings.width + outerContent.w.total, height: currentSettings.height + outerContent.h.total }, wrapper: { width: currentSettings.width + outerContent.w.total + outerWrapper2.w.total, height: currentSettings.height + outerContent.h.total + outerWrapper2.h.total} }; if (currentSettings.resizable) { var maxHeight = modal.blockerVars ? modal.blockerVars.height : $(window).height() - outerWrapper.h.border - (tmp.wrapper.height - currentSettings.height); var maxWidth = modal.blockerVars ? modal.blockerVars.width : $(window).width() - outerWrapper.w.border - (tmp.wrapper.width - currentSettings.width); maxHeight -= currentSettings.padding * 2; maxWidth -= currentSettings.padding * 2; if (tmp.content.height > maxHeight || tmp.content.width > maxWidth) { if (currentSettings.type == 'image' || currentSettings.type == 'swf') { var useW = currentSettings.imgWidth ? currentSettings.imgWidth : currentSettings.width; var useH = currentSettings.imgHeight ? currentSettings.imgHeight : currentSettings.height; var diffW = tmp.content.width - useW; var diffH = tmp.content.height - useH; if (diffH < 0) diffH = 0; if (diffW < 0) diffW = 0; var calcH = maxHeight - diffH; var calcW = maxWidth - diffW; var ratio = Math.min(calcH / useH, calcW / useW); calcW = Math.floor(useW * ratio); calcH = Math.floor(useH * ratio); tmp.content.height = calcH + diffH; tmp.content.width = calcW + diffW } else { tmp.content.height = Math.min(tmp.content.height, maxHeight); tmp.content.width = Math.min(tmp.content.width, maxWidth) } tmp.wrapper2 = { width: tmp.content.width + outerContent.w.total, height: tmp.content.height + outerContent.h.total }; tmp.wrapper = { width: tmp.content.width + outerContent.w.total + outerWrapper2.w.total, height: tmp.content.height + outerContent.h.total + outerWrapper2.h.total} } } if (currentSettings.type == 'swf') { $('object, embed', modal.content).attr('width', tmp.content.width).attr('height', tmp.content.height) } else if (currentSettings.type == 'image') { $('img', modal.content).css({ width: tmp.content.width, height: tmp.content.height }) } modal.content.css($.extend({}, tmp.content, currentSettings.cssOpt.content)); modal.wrapper.css($.extend({}, tmp.wrapper2, currentSettings.cssOpt.wrapper2)); if (!resizing) modal.contentWrapper.css($.extend({}, tmp.wrapper, currentSettings.cssOpt.wrapper)); if (currentSettings.type == 'image' && currentSettings.addImageDivTitle) { $('img', modal.content).removeAttr('alt'); var divTitle = $('div', modal.content); if (currentSettings.title != currentSettings.defaultImgAlt && currentSettings.title) { if (divTitle.length == 0) { divTitle = $('<div>' + currentSettings.title + '</div>'); modal.content.append(divTitle) } if (currentSettings.setWidthImgTitle) { var outerDivTitle = getOuter(divTitle); divTitle.css({ width: (tmp.content.width + outerContent.w.padding - outerDivTitle.w.total) + 'px' }) } } else if (divTitle.length = 0) { divTitle.remove() } } if (currentSettings.title) setTitle(); tmp.wrapper.borderW = outerWrapper.w.border; tmp.wrapper.borderH = outerWrapper.h.border; setCurrentSettings(tmp.wrapper); setMargin() } function removeModal(e) { debug('removeModal'); if (e) e.preventDefault(); if (modal.full && modal.ready) { $(document).unbind('keydown.nyroModal'); if (!currentSettings.blocker) $(window).unbind('resize.nyroModal'); modal.ready = false; modal.anim = true; modal.closing = true; if (modal.loadingShown || modal.transition) { currentSettings.hideLoading(modal, currentSettings, function () { modal.loading.hide(); modal.loadingShown = false; modal.transition = false; currentSettings.hideBackground(modal, currentSettings, endRemove) }) } else { if (fixFF) modal.content.css({ position: '' }); modal.wrapper.css({ overflow: 'hidden' }); modal.content.css({ overflow: 'hidden' }); $('iframe', modal.content).hide(); if ($.isFunction(currentSettings.beforeHideContent)) { currentSettings.beforeHideContent(modal, currentSettings, function () { currentSettings.hideContent(modal, currentSettings, function () { endHideContent(); currentSettings.hideBackground(modal, currentSettings, endRemove) }) }) } else { currentSettings.hideContent(modal, currentSettings, function () { endHideContent(); currentSettings.hideBackground(modal, currentSettings, endRemove) }) } } } if (e) return false } function showContentOrLoading() { debug('showContentOrLoading'); if (modal.ready && !modal.anim) { if (modal.dataReady) { if (modal.tmp.html()) { modal.anim = true; if (modal.transition) { fillContent(); modal.animContent = true; currentSettings.hideTransition(modal, currentSettings, function () { modal.loading.hide(); modal.transition = false; modal.loadingShown = false; endShowContent() }) } else { currentSettings.hideLoading(modal, currentSettings, function () { modal.loading.hide(); modal.loadingShown = false; fillContent(); setMarginLoading(); setMargin(); modal.animContent = true; currentSettings.showContent(modal, currentSettings, endShowContent) }) } } } else if (!modal.loadingShown && !modal.transition) { modal.anim = true; modal.loadingShown = true; if (modal.error) loadingError(); else modal.loading.html(currentSettings.contentLoading); $(currentSettings.closeSelector, modal.loading).unbind('click.nyroModal').bind('click.nyroModal', removeModal); setMarginLoading(); currentSettings.showLoading(modal, currentSettings, function () { modal.anim = false; showContentOrLoading() }) } } } function ajaxLoaded(data) { debug('AjaxLoaded: ' + this.url); if (currentSettings.selector) { var tmp = {}; var i = 0; data = data.replace(/\r\n/gi, 'nyroModalLN').replace(/<script(.|\s)*?\/script>/gi, function (x) { tmp[i] = x; return '<pre style="display: none" class=nyroModalScript rel="' + (i++) + '"></pre>' }); data = $('<div>' + data + '</div>').find(currentSettings.selector).html().replace(/<pre style="display: none;?" class="?nyroModalScript"? rel="(.?)"><\/pre>/gi, function (x, y, z) { return tmp[y] }).replace(/nyroModalLN/gi, "\r\n") } modal.tmp.html(filterScripts(data)); if (modal.tmp.html()) { modal.dataReady = true; showContentOrLoading() } else loadingError() } function formDataLoaded() { debug('formDataLoaded'); var jFrom = $(currentSettings.from); jFrom.attr('action', jFrom.attr('action') + currentSettings.selector); jFrom.attr('target', ''); $('input[name=' + currentSettings.formIndicator + ']', currentSettings.from).remove(); var iframe = modal.tmp.children('iframe'); var iframeContent = iframe.unbind('load').contents().find(currentSettings.selector || 'body').not('script[src]'); iframe.attr('src', 'about:blank'); modal.tmp.html(iframeContent.html()); if (modal.tmp.html()) { modal.dataReady = true; showContentOrLoading() } else loadingError() } function iframeLoaded() { if ((window.location.hostname && currentSettings.url.indexOf(window.location.hostname) > -1) || currentSettings.url.indexOf('http://')) { var iframe = $('iframe', modal.full).contents(); var tmp = {}; if (currentSettings.titleFromIframe) { tmp.title = iframe.find('title').text(); if (!tmp.title) { try { tmp.title = iframe.find('title').html() } catch (err) { } } } var body = iframe.find('body'); if (!currentSettings.height && body.height()) tmp.height = body.height(); if (!currentSettings.width && body.width()) tmp.width = body.width(); $.extend(initSettingsSize, tmp); $.nyroModalSettings(tmp) } } function galleryCounts(nb, total, elts, settings) { if (total > 1) settings.title += (settings.title ? ' - ' : '') + nb + '/' + total } function endHideContent() { debug('endHideContent'); modal.anim = false; if (contentEltLast) { contentEltLast.append(modal.content.contents()); contentEltLast = null } else if (contentElt) { contentElt.append(modal.content.contents()); contentElt = null } modal.content.empty(); gallery = {}; modal.contentWrapper.hide().children().remove().empty().attr('style', '').hide(); if (modal.closing || modal.transition) modal.contentWrapper.hide(); modal.contentWrapper.css(currentSettings.cssOpt.wrapper).append(modal.content); showContentOrLoading() } function endRemove() { debug('endRemove'); $(document).unbind('keydown', keyHandler); modal.anim = false; modal.full.remove(); modal.full = null; if (isIE6) { body.css({ height: '', width: '', position: '', overflow: '', marginLeft: '', marginRight: '' }); $('html').css({ overflow: '' }) } if ($.isFunction(currentSettings.endRemove)) currentSettings.endRemove(modal, currentSettings) } function endBackground() { debug('endBackground'); modal.ready = true; modal.anim = false; showContentOrLoading() } function endShowContent() { debug('endShowContent'); modal.anim = false; modal.animContent = false; modal.contentWrapper.css({ opacity: '' }); fixFF = /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) && parseFloat(browserVersion) < 1.9 && currentSettings.type != 'image'; if (fixFF) modal.content.css({ position: 'fixed' }); modal.content.append(modal.scriptsShown); if (currentSettings.type == 'iframe') modal.content.find('iframe').attr('src', currentSettings.url); if ($.isFunction(currentSettings.endShowContent)) currentSettings.endShowContent(modal, currentSettings); if (shouldResize) { shouldResize = false; $.nyroModalSettings({ width: currentSettings.setWidth, height: currentSettings.setHeight }); delete currentSettings['setWidth']; delete currentSettings['setHeight'] } if (resized.width) setCurrentSettings({ width: null }); if (resized.height) setCurrentSettings({ height: null }) } function getHash(url) { if (typeof url == 'string') { var hashPos = url.indexOf('#'); if (hashPos > -1) return url.substring(hashPos) } return '' } function filterScripts(data) { if (typeof data == 'string') data = data.replace(/<\/?(html|head|body)([^>]*)>/gi, ''); var tmp = new Array(); $.each($.clean({ 0: data }, this.ownerDocument), function () { if ($.nodeName(this, "script")) { if (!this.src || $(this).attr('rel') == 'forceLoad') { if ($(this).attr('rev') == 'shown') modal.scriptsShown.push(this); else modal.scripts.push(this) } } else tmp.push(this) }); return tmp } function getOuter(elm) { elm = elm.get(0); var ret = { h: { margin: getCurCSS(elm, 'marginTop') + getCurCSS(elm, 'marginBottom'), border: getCurCSS(elm, 'borderTopWidth') + getCurCSS(elm, 'borderBottomWidth'), padding: getCurCSS(elm, 'paddingTop') + getCurCSS(elm, 'paddingBottom') }, w: { margin: getCurCSS(elm, 'marginLeft') + getCurCSS(elm, 'marginRight'), border: getCurCSS(elm, 'borderLeftWidth') + getCurCSS(elm, 'borderRightWidth'), padding: getCurCSS(elm, 'paddingLeft') + getCurCSS(elm, 'paddingRight')} }; ret.h.outer = ret.h.margin + ret.h.border; ret.w.outer = ret.w.margin + ret.w.border; ret.h.inner = ret.h.padding + ret.h.border; ret.w.inner = ret.w.padding + ret.w.border; ret.h.total = ret.h.outer + ret.h.padding; ret.w.total = ret.w.outer + ret.w.padding; return ret } function getCurCSS(elm, name) { var ret = parseInt($.curCSS(elm, name, true)); if (isNaN(ret)) ret = 0; return ret } function debug(msg) { if ($.fn.nyroModal.settings.debug || currentSettings && currentSettings.debug) nyroModalDebug(msg, modal, currentSettings || {}) } function showBackground(elts, settings, callback) { elts.bg.css({ opacity: 0 }).fadeTo(500, 0.75, callback) } function hideBackground(elts, settings, callback) { elts.bg.fadeOut(300, callback) } function showLoading(elts, settings, callback) { elts.loading.css({ marginTop: settings.marginTopLoading + 'px', marginLeft: settings.marginLeftLoading + 'px', opacity: 0 }).show().animate({ opacity: 1 }, { complete: callback, duration: 400 }) } function hideLoading(elts, settings, callback) { callback() } function showContent(elts, settings, callback) { elts.loading.css({ marginTop: settings.marginTopLoading + 'px', marginLeft: settings.marginLeftLoading + 'px' }).show().animate({ width: settings.width + 'px', height: settings.height + 'px', marginTop: settings.marginTop + 'px', marginLeft: settings.marginLeft + 'px' }, { duration: 350, complete: function () { elts.contentWrapper.css({ width: settings.width + 'px', height: settings.height + 'px', marginTop: settings.marginTop + 'px', marginLeft: settings.marginLeft + 'px' }).show(); elts.loading.fadeOut(200, callback) } }) } function hideContent(elts, settings, callback) { elts.contentWrapper.animate({ height: '50px', width: '50px', marginTop: (-(25 + settings.borderH) / 2 + settings.marginScrollTop) + 'px', marginLeft: (-(25 + settings.borderW) / 2 + settings.marginScrollLeft) + 'px' }, { duration: 350, complete: function () { elts.contentWrapper.hide(); callback() } }) } function showTransition(elts, settings, callback) { elts.loading.css({ marginTop: elts.contentWrapper.css('marginTop'), marginLeft: elts.contentWrapper.css('marginLeft'), height: elts.contentWrapper.css('height'), width: elts.contentWrapper.css('width'), opacity: 0 }).show().fadeTo(400, 1, function () { elts.contentWrapper.hide(); callback() }) } function hideTransition(elts, settings, callback) { elts.contentWrapper.hide().css({ width: settings.width + 'px', height: settings.height + 'px', marginLeft: settings.marginLeft + 'px', marginTop: settings.marginTop + 'px', opacity: 1 }); elts.loading.animate({ width: settings.width + 'px', height: settings.height + 'px', marginLeft: settings.marginLeft + 'px', marginTop: settings.marginTop + 'px' }, { complete: function () { elts.contentWrapper.show(); elts.loading.fadeOut(400, function () { elts.loading.hide(); callback() }) }, duration: 350 }) } function resize(elts, settings, callback) { elts.contentWrapper.animate({ width: settings.width + 'px', height: settings.height + 'px', marginLeft: settings.marginLeft + 'px', marginTop: settings.marginTop + 'px' }, { complete: callback, duration: 400 }) } function updateBgColor(elts, settings, callback) { if (!$.fx.step.backgroundColor) { elts.bg.css({ backgroundColor: settings.bgColor }); callback() } else elts.bg.animate({ backgroundColor: settings.bgColor }, { complete: callback, duration: 400 }) } $($.fn.nyroModal.settings.openSelector).nyroModal() }); var tmpDebug = ''; function nyroModalDebug(msg, elts, settings) { if (elts.full && elts.bg) { elts.bg.prepend(msg + '<br />' + tmpDebug); tmpDebug = '' } else tmpDebug += msg + '<br />' }

//Mask JavaScript API (v0.3) - dswitzer [at] pengoworks [dot] com
//http://www.pengoworks.com/workshop/js/mask/
//
//Some new features by Sylvain Machefert - http://iubito.free.fr

function _MaskAPI() {
    this.version = "0.3";
    this.instances = 0;
    this.objects = {};
}
MaskAPI = new _MaskAPI();

function Mask(m, t) {
    this.mask = m;
    this.type = (typeof t == "string") ? t : "string";
    if (this.type == "date") {
        // Replace french letters a=année/j=jour by y=year/d=day
        // jj/mm/aaaa => dd/mm/yyyy
        var reg = new RegExp("a", "g");
        this.mask = this.mask.replace(reg, "y");
        var reg2 = new RegExp("j", "g");
        this.mask = this.mask.replace(reg2, "d");
    }
    this.error = [];
    this.errorCodes = [];
    this.value = "";
    this.strippedValue = "";
    this.allowPartial = false;
    this.id = MaskAPI.instances++;
    this.ref = "MaskAPI.objects['" + this.id + "']";
    MaskAPI.objects[this.id] = this;
}

Mask.prototype.attach = function (o) {
    if ((o.readonly == null) || (o.readonly == false)) {
        o.onkeydown = new Function("return " + this.ref + ".isAllowKeyPress(event, this)");
        o.onkeyup = new Function("return " + this.ref + ".getKeyPress(event, this)");
        o.onblur = new Function("this.value = " + this.ref + ".format(this.value)");
    }
}

Mask.prototype.isAllowKeyPress = function (e, o) {
    if (this.type != "string") return true;
    var xe = new xEvent(e);

    if (((xe.keyCode > 47) && (o.value.length >= this.mask.length)) && !xe.ctrlKey) return false;
    return true;
}

Mask.prototype.getKeyPress = function (e, o, _u) {
    this.allowPartial = true;
    var xe = new xEvent(e);

    //	var k = String.fromCharCode(xe.keyCode);

    if ((xe.keyCode > 47) || (_u == true) || (xe.keyCode == 8 || xe.keyCode == 46)) {
        var v = o.value, d;
        if (xe.keyCode == 8 || xe.keyCode == 46) d = true;
        else d = false

        if (this.type == "number") this.value = this.setNumber(v, d);
        else if (this.type == "date") this.value = this.setDateKeyPress(v, d);
        else this.value = this.setGeneric(v, d);

        o.value = this.value;
    }

    this.allowPartial = false;
    return true;
}

Mask.prototype.format = function (s) {
    if (this.type == "number") this.value = this.setNumber(s);
    else if (this.type == "date") this.value = this.setDate(s);
    else this.value = this.setGeneric(s);
    return this.value;
}

Mask.prototype.throwError = function (c, e, v) {
    //	alert(e);
    //	une_variable = e;
    //	document.formulaire.inputhidden.value = e;
    document.frmExample.erreur.value = e;
    this.error[this.error.length] = e;
    this.errorCodes[this.errorCodes.length] = c;
    if (typeof v == "string") return v;
    return true;
}

// ************************ GENERIC *********************** //

Mask.prototype.setGeneric = function (_v, _d) {
    var v = _v, m = this.mask;
    var r = "x#*", rt = [], nv = "", t, x, a = [], j = 0, rx = { "x": "A-Za-z", "#": "0-9", "*": "A-Za-z0-9" };

    // strip out invalid characters
    v = v.replace(new RegExp("[^" + rx["*"] + "]", "gi"), "");
    if ((_d == true) && (v.length == this.strippedValue.length)) v = v.substring(0, v.length - 1);
    this.strippedValue = v;
    var b = [];
    for (var i = 0; i < m.length; i++) {
        // grab the current character
        x = m.charAt(i);
        // check to see if current character is a mask, escape commands are not a mask character
        t = (r.indexOf(x) > -1);
        // if the current character is an escape command, then grab the next character
        if (x == "!") x = m.charAt(i++);
        // build a regex to test against
        if ((t && !this.allowPartial) || (t && this.allowPartial && (rt.length < v.length))) rt[rt.length] = "[" + rx[x] + "]";
        // build mask definition table
        a[a.length] = { "char": x, "mask": t };
    }

    var hasOneValidChar = false;
    // if the regex fails, return an error
    if (!this.allowPartial && !(new RegExp(rt.join(""))).test(v)) return this.throwError(1, "The value \"" + _v + "\" must be in the format " + this.mask + ".\n\nLa valeur \"" + _v + "\" doit être dans le format " + this.mask + ".", _v);
    // loop through the mask definition, and build the formatted string
    else if ((this.allowPartial && (v.length > 0)) || !this.allowPartial) {
        for (i = 0; i < a.length; i++) {
            if (a[i].mask) {
                while (v.length > 0 && !(new RegExp(rt[j])).test(v.charAt(j))) v = (v.length == 1) ? "" : v.substring(1);
                if (v.length > 0) {
                    nv += v.charAt(j);
                    hasOneValidChar = true;
                }
                j++;
            } else nv += a[i]["char"];
            if (this.allowPartial && (j > v.length)) break;
        }
    }

    if (this.allowPartial && !hasOneValidChar) nv = "";

    return nv;
}

// ************************ NUMBERS *********************** //

Mask.prototype.setNumber = function (_v, _d) {
    var v = String(_v).replace(/[^\d.-]*/gi, ""), m = this.mask;
    // make sure there's only one decimal point
    v = v.replace(/\./, "d").replace(/\./g, "").replace(/d/, ".");

    // check to see if an invalid mask operation has been entered
    if (!/^[\$€%£¥]?((\$?[\+-]?([0#]{1,3}(,|\ |\ |_))?[0#]*(\.[0#]*)?)|([\+-]?\([\+-]?([0#]{1,3}(,|\ |\ |_))?[0#]*(\.[0#]*)?\)))[\$€%£¥]?$/.test(m))
        return this.throwError(1, "An invalid mask was specified for the \nMask constructor.\n\nUn masque in valide a été défini dans le constructeur", _v);

    if ((_d == true) && (v.length == this.strippedValue.length)) v = v.substring(0, v.length - 1);

    if (this.allowPartial && (v.replace(/[^0-9]/, "").length == 0)) return v;
    this.strippedValue = v;

    if (v.length == 0) v = NaN;
    var vn = Number(v);
    if (isNaN(vn)) return this.throwError(2, "The value entered was not a number.\n\nLa valeur entrée n'est pas un nombre.", _v);

    // if no mask, stop processing
    if (m.length == 0) return v;

    // get the value before the decimal point
    var vi = String(Math.abs((v.indexOf(".") > -1) ? v.split(".")[0] : v));
    // get the value after the decimal point
    var vd = (v.indexOf(".") > -1) ? v.split(".")[1] : "";
    var _vd = vd;

    var isNegative = ((Math.abs(vn) * -1 == vn) && (Math.abs(vn) != 0));

    // check for masking operations
    var show = {
        "¥": (m.indexOf("¥") != -1), // Japanese yen
        "£": (m.indexOf("£") != -1), // English Pound
        "€": (m.indexOf("€") != -1), // /^[€]/.test(m), // Euro
        "$": (m.indexOf("$") != -1), // /^[\$]/.test(m), // Dollar
        "%": (m.indexOf("%") != -1), // Percentage
        "(": (isNegative && (m.indexOf("(") > -1)),
        "+": ((m.indexOf("+") != -1) && !isNegative)
    }
    show["-"] = (isNegative && (!show["("] || (m.indexOf("-") != -1)));
    // if mask contain more than one symbol ¥ € $ and %, select just one
    if (show["¥"] && (show["£"] || show["€"] || show["$"] || show["%"])) show["¥"] = false;
    if (show["£"] && (show["€"] || show["$"] || show["%"])) show["£"] = false;
    if (show["€"] && (show["$"] || show["%"])) show["€"] = false;
    if (show["$"] && show["%"]) show["$"] = false;


    // replace all non-place holders from the mask
    m = m.replace(/[^#0._,]*/gi, "");

    /*
    make sure there are the correct number of decimal places
    */
    // get number of digits after decimal point in mask
    var dm = (m.indexOf(".") > -1) ? m.split(".")[1] : "";
    if (dm.length == 0) {
        vi = String(Math.round(Number(vi)));
        vd = "";
    } else {
        // find the last zero, which indicates the minimum number
        // of decimal places to show
        var md = dm.lastIndexOf("0") + 1;
        //In this algorithm, we consider #.000 mask, and we consider we add a '9' after to test the round.
        //123.0456 => 123.46 that's incorrect !
        //So count the number of 0 at the beginning of vd (decimal value)
        var nb0vd = 0;
        var zeros = "";
        while (nb0vd <= vd.length && vd.substring(nb0vd, 1) == "0") {
            nb0vd++; zeros += "0";
        }

        // if the number of decimal places is greater than the mask, then round off
        if (vd.length > dm.length) {
            vd = zeros + String(Math.round(Number(vd.substring(0, dm.length + 1)) / 10));
            //Sometimes we get 12.997 12.998 12.999 12.1000 so remove the first number and add it to vi (integer value)
            if (vd.length > dm.length) {
                addtovi = vd.substring(0, 1); //Get the first number
                vd = vd.substring(1, vd.length); //Remove this first number from vd
                vi = String(Number(vi) + Number(addtovi));
            }
            //And now 12.000 12.001 12.01 so we pad with 0 at the left because we expected 12.002
            while (vd.length < md) vd = "0" + vd;
        }
        // otherwise, pad the string w/the required zeros
        else while (vd.length < md) vd += "0";
    }

    /*
    pad the int with any necessary zeros
    */
    // get number of digits before decimal point in mask
    var im = (m.indexOf(".") > -1) ? m.split(".")[0] : m;
    im = im.replace(/[^0#]+/gi, "");
    // find the first zero, which indicates the minimum length
    // that the value must be padded w/zeros
    var mv = im.indexOf("0") + 1;
    // if there is a zero found, make sure it's padded
    if (mv > 0) {
        mv = im.length - mv + 1;
        while (vi.length < mv) vi = "0" + vi;
    }


    /*
    check to see if we need commas in the thousands place holder
    */
    //OLD: if( /[#0]+,[#0]{3}/.test(m) ){
    if (/[#0]+(_|,)[#0]{3}/.test(m)) {
        // add the commas (or a space) as the place holder
        //added by Sylvain Machefert: we can define _ symbol to replace comma with space (French notation)
        //so mask = #,###.00 => 1,234,567.89
        //   mask = #_###.00 => 1 234 567.89
        var x = [], i = 0, n = Number(vi);
        while (n > 999) {
            x[i] = "00" + String(n % 1000);
            x[i] = x[i].substring(x[i].length - 3);
            n = Math.floor(n / 1000);
            i++;
        }
        x[i] = String(n % 1000);
        vi = x.reverse().join((m.substring(1, 2)).replace("_", " ")); //",");
    }


    /*
    combine the new value together
    */
    if ((vd.length > 0 && !this.allowPartial) || ((dm.length > 0) && this.allowPartial && (v.indexOf(".") > -1) && (_vd.length >= vd.length))) {
        v = vi + "." + vd;
    } else if ((dm.length > 0) && this.allowPartial && (v.indexOf(".") > -1) && (_vd.length < vd.length)) {
        v = vi + "." + _vd;
    } else {
        v = vi;
    }

    if (show["¥"]) v = v + "¥";
    if (show["£"]) v = "£" + v;
    if (show["€"]) v = "€ " + v; // this.mask.replace(/(^[€])(.+)/gi, "€ ") + v;
    if (show["$"]) v = "$" + v; // this.mask.replace(/(^[\$])(.+)/gi, "$ ") + v;
    if (show["%"]) v = v + " %";
    if (show["+"]) v = "+" + v;
    if (show["-"]) v = "-" + v;
    if (show["("]) v = "(" + v + ")";
    return v;
}

// ************************ DATES *********************** //

Mask.prototype.setDate = function (_v) {
    var v = _v, m = this.mask;
    var a, e, mm, dd, yy, x, s;

    // split mask into array, to see position of each day, month & year
    a = m.split(/[^mdy]+/);
    // split mask into array, to get delimiters
    s = m.split(/[mdy]+/);
    // convert the string into an array in which digits are together
    e = v.split(/[^0-9]/);

    if (s[0].length == 0) s.splice(0, 1);

    for (var i = 0; i < a.length; i++) {
        x = a[i].charAt(0).toLowerCase();
        if (x == "m") mm = parseInt(e[i], 10) - 1;
        else if (x == "d") dd = parseInt(e[i], 10);
        else if (x == "y") yy = parseInt(e[i], 10);
    }

    // if year is abbreviated, guess at the year
    if (String(yy).length < 3) {
        yy = 2000 + yy;
        if ((new Date()).getFullYear() + 20 < yy) yy = yy - 100;
    }

    // create date object
    var d = new Date(yy, mm, dd);

    if (d.getDate() != dd) return this.throwError(1, "An invalid day was entered.\n\nLe jour est incorrect.", _v);
    else if (d.getMonth() != mm) return this.throwError(2, "An invalid month was entered.\n\nLe mois est incorrect.", _v);

    var nv = "";

    for (i = 0; i < a.length; i++) {
        x = a[i].charAt(0).toLowerCase();
        if (x == "m") {
            mm++;
            if (a[i].length == 2) {
                mm = "0" + mm;
                mm = mm.substring(mm.length - 2);
            }
            nv += mm;
        } else if (x == "d") {
            if (a[i].length == 2) {
                dd = "0" + dd;
                dd = dd.substring(dd.length - 2);
            }
            nv += dd;
        } else if (x == "y") {
            if (a[i].length == 2) nv += d.getYear();
            else nv += d.getFullYear();
        }

        if (i < a.length - 1) nv += s[i];
    }

    return nv;
}

Mask.prototype.setDateKeyPress = function (_v, _d) {
    var v = _v, m = this.mask, k = v.charAt(v.length - 1);
    var a, e, c, ml, vl, mm = "", dd = "", yy = "", x, p, z;

    if (_d == true) {
        while ((/[^0-9]/gi).test(v.charAt(v.length - 1))) v = v.substring(0, v.length - 1);
        if ((/[^0-9]/gi).test(this.strippedValue.charAt(this.strippedValue.length - 1))) v = v.substring(0, v.length - 1);
        if (v.length == 0) return "";
    }

    // split mask into array, to see position of each day, month & year
    a = m.split(/[^mdy]/);
    // split mask into array, to get delimiters
    s = m.split(/[mdy]/);
    // remove spaces
    v = v.replace(/\s/g, "");
    // convert the string into an array in which digits are together
    e = v.split(/[^0-9]/);
    // position in mask
    p = (e.length > 0) ? e.length - 1 : 0;
    // determine what mask value the user is currently entering
    c = a[p].charAt(0);
    // determine the length of the current mask value
    ml = a[p].length;

    for (var i = 0; i < e.length; i++) {
        x = a[i].charAt(0).toLowerCase();
        if (x == "m") mm = parseInt(e[i], 10) - 1;
        else if (x == "d") dd = parseInt(e[i], 10);
        else if (x == "y") yy = parseInt(e[i], 10);
    }

    var nv = "";
    var j = 0;

    for (i = 0; i < e.length; i++) {
        x = a[i].charAt(0).toLowerCase();
        if (x == "m") {
            z = ((/[^0-9]/).test(k) && c == "m");
            mm++;
            if ((e[i].length == 2 && mm < 10)
					|| (a[i].length == 2 && c != "m")
					|| (mm > 1 && c == "m")
					|| (z && a[i].length == 2)) {
                //####
                mm = "0" + mm;
                if (mm > 12) //If month > 12, remove the second number 14 => remove 4
                    mm = "1";
                else //month is correct, < 12
                    mm = mm.substring(mm.length - 2);
                if (mm == 0) //if month is "00" remove the 2nd zero, waiting for a number > 0 !
                    mm = "0";
            }
            vl = String(mm).length;
            ml = 2;
            nv += mm;
        } else if (x == "d") {
            z = ((/[^0-9]/).test(k) && c == "d");
            if ((e[i].length == 2 && dd < 10)
					|| (a[i].length == 2 && c != "d")
					|| (dd > 3 && c == "d")
					|| (z && a[i].length == 2)
					) {
                dd = "0" + dd;
                if (dd > 31)
                    dd = "3";
                /*
                if (dd > 31 && (mm in [0,1,3,5,7,8,10,12]))
                dd = "3";//dd.substring(1);
                else if (dd > 30 && (mm in [4,6,9,11]))
                dd = "3";
                else if (dd > 28+((yy%4 == 0 && yy%100 !=0) || yy%400==0 || yy==0) && (mm==2))
                dd = "2";
                */
                else
                    dd = dd.substring(dd.length - 2);
                if (dd == 0)
                    dd = "0";
            }
            vl = String(dd).length;
            ml = 2;
            nv += dd;
        } else if (x == "y") {
            z = ((/[^0-9]/).test(k) && c == "y");
            if (c == "y") yy = String(yy);
            else {
                if (a[i].length == 2) yy = d.getYear();
                else yy = d.getFullYear();
            }
            if ((e[i].length == 2 && yy < 10) || (a[i].length == 2 && c != "y") || (z && a[i].length == 2)) {
                yy = "0" + yy;
                yy = yy.substring(yy.length - 2);
            }
            ml = a[i].length;
            vl = String(yy).length;
            nv += yy;
        }

        if (((ml == vl || z) && (x == c) && (i < s.length)) || (i < s.length && x != c)) nv += s[i];
    }

    this.strippedValue = (nv == "NaN") ? "" : nv;

    return this.strippedValue;
}


function xEvent(e) {
    // routine for NS, Opera, etc DOM browsers
    if (window.Event) {
        var isKeyPress = (e.type.substring(0, 3) == "key");

        this.keyCode = (isKeyPress) ? parseInt(e.which, 10) : 0;
        this.button = (!isKeyPress) ? parseInt(e.which, 10) : 0;
        this.srcElement = e.target;
        this.type = e.type;
        this.x = e.pageX;
        this.y = e.pageY;
        this.screenX = e.screenX;
        this.screenY = e.screenY;
        if (!isKeyPress) {
            if (document.layers) {
                this.altKey = ((e.modifiers & Event.ALT_MASK) > 0);
                this.ctrlKey = ((e.modifiers & Event.CONTROL_MASK) > 0);
                this.shiftKey = ((e.modifiers & Event.SHIFT_MASK) > 0);
                this.keyCode = this.translateKeyCode(this.keyCode);
            } else {
                this.altKey = e.altKey;
                this.ctrlKey = e.ctrlKey;
                this.shiftKey = e.shiftKey;
            }
        }
        // routine for Internet Explorer DOM browsers
    } else {
        e = window.event;
        this.keyCode = parseInt(e.keyCode, 10);
        this.button = e.button;
        this.srcElement = e.srcElement;
        this.type = e.type;
        if (document.all) {
            this.x = e.clientX + document.body.scrollLeft;
            this.y = e.clientY + document.body.scrollTop;
        } else {
            this.x = e.clientX;
            this.y = e.clientY;
        }
        this.screenX = e.screenX;
        this.screenY = e.screenY;
        this.altKey = e.altKey;
        this.ctrlKey = e.ctrlKey;
        this.shiftKey = e.shiftKey;
    }
    if (this.button == 0) {
        this.setKeyPressed(this.keyCode);
        this.keyChar = String.fromCharCode(this.keyCode);
    }
}

// this method will try to remap the keycodes so the keycode value
// returned will be consistent. this doesn't work for all cases,
// since some browsers don't always return a unique value for a
// key press.
xEvent.prototype.translateKeyCode = function (i) {
    var l = {};
    // remap NS4 keycodes to IE/W3C keycodes
    if (!!document.layers) {
        if (this.keyCode > 96 && this.keyCode < 123) return this.keyCode - 32;
        l = {
            96: 192, 126: 192, 33: 49, 64: 50, 35: 51, 36: 52, 37: 53, 94: 54, 38: 55, 42: 56, 40: 57, 41: 48, 92: 220, 124: 220, 125: 221,
            93: 221, 91: 219, 123: 219, 39: 222, 34: 222, 47: 191, 63: 191, 46: 190, 62: 190, 44: 188, 60: 188, 45: 189, 95: 189, 43: 187,
            61: 187, 59: 186, 58: 186,
            "null": null
        }
    }
    return (!!l[i]) ? l[i] : i;
}


// try to determine the actual value of the key pressed
xEvent.prototype.setKP = function (i, s) {
    this.keyPressedCode = i;
    this.keyNonChar = (typeof s == "string");
    this.keyPressed = (this.keyNonChar) ? s : String.fromCharCode(i);
    this.isNumeric = (parseInt(this.keyPressed, 10) == this.keyPressed);
    this.isAlpha = ((this.keyCode > 64 && this.keyCode < 91) && !this.altKey && !this.ctrlKey);
    return true;
}

// try to determine the actual value of the key pressed
xEvent.prototype.setKeyPressed = function (i) {
    var b = this.shiftKey;
    if (!b && (i > 64 && i < 91)) return this.setKP(i + 32);
    if (i > 95 && i < 106) return this.setKP(i - 48);

    switch (i) {
        case 49: case 51: case 52: case 53: if (b) i = i - 16; break;
        case 50: if (b) i = 64; break;
        case 54: if (b) i = 94; break;
        case 55: if (b) i = 38; break;
        case 56: if (b) i = 42; break;
        case 57: if (b) i = 40; break;
        case 48: if (b) i = 41; break;
        case 192: if (b) i = 126; else i = 96; break;
        case 189: if (b) i = 95; else i = 45; break;
        case 187: if (b) i = 43; else i = 61; break;
        case 220: if (b) i = 124; else i = 92; break;
        case 221: if (b) i = 125; else i = 93; break;
        case 219: if (b) i = 123; else i = 91; break;
        case 222: if (b) i = 34; else i = 39; break;
        case 186: if (b) i = 58; else i = 59; break;
        case 191: if (b) i = 63; else i = 47; break;
        case 190: if (b) i = 62; else i = 46; break;
        case 188: if (b) i = 60; else i = 44; break;

        case 106: case 57379: i = 42; break;
        case 107: case 57380: i = 43; break;
        case 109: case 57381: i = 45; break;
        case 110: i = 46; break;
        case 111: case 57378: i = 47; break;

        case 8: return this.setKP(i, "[backspace]");
        case 9: return this.setKP(i, "[tab]");
        case 13: return this.setKP(i, "[enter]");
        case 16: case 57389: return this.setKP(i, "[shift]");
        case 17: case 57390: return this.setKP(i, "[ctrl]");
        case 18: case 57388: return this.setKP(i, "[alt]");
        case 19: case 57402: return this.setKP(i, "[break]");
        case 20: return this.setKP(i, "[capslock]");
        case 32: return this.setKP(i, "[space]");
        case 91: return this.setKP(i, "[windows]");
        case 93: return this.setKP(i, "[properties]");

        case 33: case 57371: return this.setKP(i * -1, "[pgup]");
        case 34: case 57372: return this.setKP(i * -1, "[pgdown]");
        case 35: case 57370: return this.setKP(i * -1, "[end]");
        case 36: case 57369: return this.setKP(i * -1, "[home]");
        case 37: case 57375: return this.setKP(i * -1, "[left]");
        case 38: case 57373: return this.setKP(i * -1, "[up]");
        case 39: case 57376: return this.setKP(i * -1, "[right]");
        case 40: case 57374: return this.setKP(i * -1, "[down]");
        case 45: case 57382: return this.setKP(i * -1, "[insert]");
        case 46: case 57383: return this.setKP(i * -1, "[delete]");
        case 144: case 57400: return this.setKP(i * -1, "[numlock]");
    }

    if (i > 111 && i < 124) return this.setKP(i * -1, "[f" + (i - 111) + "]");

    return this.setKP(i);
}

//---------------------------------------------------------------
//
//
//  CheckNegative
//
//
//---------------------------------------------------------------
//
function CheckNegative(sender) {
    if (event.keyCode == 189) { // dash (-)
        if (sender.value.indexOf('-', 0) > 0)
            sender.value = sender.value.replace('-', '');
    }
}

function addCommas_skm(someNum) {
    while (someNum.match(/^\d\d{3}/)) {
        someNum = someNum.replace(/(\d)(\d{3}(\.| |$))/, '$1 $2');
    }
    return someNum;
}


function addSeparatorsNF(nStr, inD, outD, sep) {
    nStr += '';
    var dpos = nStr.indexOf(inD);
    var nStrEnd = '';
    if (dpos != -1) {
        nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
        nStr = nStr.substring(0, dpos);
    }
    //    var rgx = /(\d+)(\d{3})/;
    //    while (rgx.test(nStr)) {
    //        nStr = nStr.replace(rgx, '$1' + sep + '$2');
    //    }
    return nStr + nStrEnd;
}


function addCommas(nStr) {
    var n = nStr;
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ' ' + '$2');
    }
    return x1 + x2;
}


function FormatText(event, sender) {
    if ((event.keyCode >= 37 && event.keyCode <= 40)) return true; // Left, Up, Right and Down

    sender.value = addCommas_skm(removeSpaces(sender.value.replace(",", ".")));
    return true;
}

function getKeyChar(e) {
    var key = '', keychar = '';
    key = getKeyCode(e);
    if (key == null) return true;
    keychar = String.fromCharCode(key);
    keychar = keychar.toLowerCase();
    return keychar;
}

//by valid chars
function getKeyCode(e)// v1.0
{
    if (window.event)
        return window.event.keyCode;
    else if (e)
        return e.which;
    else
        return null;
}
function keyRestrict(e, validchars) { // v3.0
    var key = '', keychar = '';
    key = getKeyCode(e);
    if (key == null) return true;

    keychar = String.fromCharCode(key);
    keychar = keychar.toLowerCase();
    validchars = validchars.toLowerCase();
    if (validchars.indexOf(keychar) != -1)
        return true;
    if (key == null || key == 0 || key == 8 || key == 9 || key == 13 || key == 27)
        return true;
    return false;
}

//---------------------------------------------------------------
//
//
//  CheckInteger
//
//
//---------------------------------------------------------------
//
function CheckInteger(event, sender, allowNegative) {
    //document.getElementById('TextBox1').value = event.keyCode;

    if (allowNegative == true) {
        return (keyRestrict(event, '-0123456789') && checkOnlyOne(getKeyCode(event), sender.value));
    } else {
        return keyRestrict(event, '0123456789');
    }

    /*
    
    if ((event.keyCode >= 48 && event.keyCode <= 57 && event.shiftKey == true) || // 0-9 numbers
    (event.keyCode >= 96 && event.keyCode <= 105 && event.shiftKey == false) || // 0-9 numbers (the numeric keys at the right of the keyboard)
    (event.keyCode >= 37 && event.keyCode <= 40) || // Left, Up, Right and Down
    event.keyCode == 8 || // backspaceASKII
    event.keyCode == 9 || // tabASKII
    event.keyCode == 16 || // shift
    event.keyCode == 17 || // control
    event.keyCode == 35 || // End
    event.keyCode == 36 || // Home
    event.keyCode == 46) // deleteASKII
    return true;
    else if (event.keyCode == 189 && allowNegative == true) { // dash (-)
    if (sender.value.indexOf('-', 0) > -1)
    return false;
    else
    return true;
    }
    else
    return false;
    */
}

function CheckPhone(event, sender) {
    if (keyRestrict(event, '0123456789 +()')) {
        return checkOnlyOne(getKeyCode(event), sender.value);
    } else
        return false;
}

function isNumeric(sText, decimals, negatives) {
    var isNumber = true;
    var numDecimals = 0;
    var validChars = "0123456789";
    if (decimals) validChars += ".,";
    if (negatives) validChars += "-";
    var thisChar;
    for (i = 0; i < sText.length && isNumber == true; i++) {
        thisChar = sText.charAt(i);
        if (negatives && thisChar == "-" && i > 0) isNumber = false;
        if (decimals && (thisChar == "." || thisChar == ",")) {
            numDecimals = numDecimals + 1;
            if (i == 0 || i == sText.length - 1) isNumber = false;
            if (numDecimals > 1) isNumber = false;
        }
        if (validChars.indexOf(thisChar) == -1) isNumber = false;
    }
    return isNumber;
}

function getFloat(nStr) {
    return parseFloat(removeSpaces(nStr));
}

function removeSpaces(nStr) {

    while (nStr.indexOf(" ") != -1)
        nStr = nStr.replace(" ", "");
    return nStr;
}

function checkOnlyOne(keychar, value) {
    var onlyOneChars = '+-().';
    //    alert(keychar + ' ' + value);
    keychar = String.fromCharCode(keychar);
    if (keychar == ",") keychar = ".";
    if (onlyOneChars.indexOf(keychar) != -1) {
        return (value.replace(",", ".").indexOf(keychar) == -1);
    } else {
        return true;
    }
}

//---------------------------------------------------------------
//
//
//  CheckDecimal
//
//
//---------------------------------------------------------------
//
function CheckDecimal(event, sender, numberOfInteger, numberOfFrac, allowNegative) {
    if (allowNegative == true) {
        if (keyRestrict(event, '-0123456789.,')) {
            return checkOnlyOne(getKeyCode(event), sender.value);
        } else return false;
    } else {
        if (keyRestrict(event, '0123456789.,')) {
            if (sender.value.length == 0 && (getKeyChar(event) == "," || getKeyChar(event) == "."))
                return false;
            else
                if (checkOnlyOne(getKeyCode(event), sender.value)) {

                    if (sender.value.indexOf(".") > -1 && getFloat(sender.value).toString().split(".").length > 1)
                        return true;
                    else
                        return true;
                }
                else return false;
        }
        else
            return false;
    }
}
/* 
* flowplayer.js 3.1.4. The Flowplayer API
* 
* Copyright 2009 Flowplayer Oy
* 
* This file is part of Flowplayer.
* 
* Flowplayer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* Flowplayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with Flowplayer.  If not, see <http://www.gnu.org/licenses/>.
* 
* Date: 2009-02-25 21:24:29 +0000 (Wed, 25 Feb 2009)
* Revision: 166 
*/
(function () { function g(o) { console.log("$f.fireEvent", [].slice.call(o)) } function k(q) { if (!q || typeof q != "object") { return q } var o = new q.constructor(); for (var p in q) { if (q.hasOwnProperty(p)) { o[p] = k(q[p]) } } return o } function m(t, q) { if (!t) { return } var o, p = 0, r = t.length; if (r === undefined) { for (o in t) { if (q.call(t[o], o, t[o]) === false) { break } } } else { for (var s = t[0]; p < r && q.call(s, p, s) !== false; s = t[++p]) { } } return t } function c(o) { return document.getElementById(o) } function i(q, p, o) { if (typeof p != "object") { return q } if (q && p) { m(p, function (r, s) { if (!o || typeof s != "function") { q[r] = s } }) } return q } function n(s) { var q = s.indexOf("."); if (q != -1) { var p = s.substring(0, q) || "*"; var o = s.substring(q + 1, s.length); var r = []; m(document.getElementsByTagName(p), function () { if (this.className && this.className.indexOf(o) != -1) { r.push(this) } }); return r } } function f(o) { o = o || window.event; if (o.preventDefault) { o.stopPropagation(); o.preventDefault() } else { o.returnValue = false; o.cancelBubble = true } return false } function j(q, o, p) { q[o] = q[o] || []; q[o].push(p) } function e() { return "_" + ("" + Math.random()).substring(2, 10) } var h = function (t, r, s) { var q = this; var p = {}; var u = {}; q.index = r; if (typeof t == "string") { t = { url: t} } i(this, t, true); m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","), function () { var v = "on" + this; if (v.indexOf("*") != -1) { v = v.substring(0, v.length - 1); var w = "onBefore" + v.substring(2); q[w] = function (x) { j(u, w, x); return q } } q[v] = function (x) { j(u, v, x); return q }; if (r == -1) { if (q[w]) { s[w] = q[w] } if (q[v]) { s[v] = q[v] } } }); i(this, { onCuepoint: function (x, w) { if (arguments.length == 1) { p.embedded = [null, x]; return q } if (typeof x == "number") { x = [x] } var v = e(); p[v] = [x, w]; if (s.isLoaded()) { s._api().fp_addCuepoints(x, r, v) } return q }, update: function (w) { i(q, w); if (s.isLoaded()) { s._api().fp_updateClip(w, r) } var v = s.getConfig(); var x = (r == -1) ? v.clip : v.playlist[r]; i(x, w, true) }, _fireEvent: function (v, y, w, A) { if (v == "onLoad") { m(p, function (B, C) { if (C[0]) { s._api().fp_addCuepoints(C[0], r, B) } }); return false } A = A || q; if (v == "onCuepoint") { var z = p[y]; if (z) { return z[1].call(s, A, w) } } if (y && "onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v) != -1) { i(A, y); if (y.metaData) { if (!A.duration) { A.duration = y.metaData.duration } else { A.fullDuration = y.metaData.duration } } } var x = true; m(u[v], function () { x = this.call(s, A, y, w) }); return x } }); if (t.onCuepoint) { var o = t.onCuepoint; q.onCuepoint.apply(q, typeof o == "function" ? [o] : o); delete t.onCuepoint } m(t, function (v, w) { if (typeof w == "function") { j(u, v, w); delete t[v] } }); if (r == -1) { s.onCuepoint = this.onCuepoint } }; var l = function (p, r, q, t) { var s = {}; var o = this; var u = false; if (t) { i(s, t) } m(r, function (v, w) { if (typeof w == "function") { s[v] = w; delete r[v] } }); i(this, { animate: function (y, z, x) { if (!y) { return o } if (typeof z == "function") { x = z; z = 500 } if (typeof y == "string") { var w = y; y = {}; y[w] = z; z = 500 } if (x) { var v = e(); s[v] = x } if (z === undefined) { z = 500 } r = q._api().fp_animate(p, y, z, v); return o }, css: function (w, x) { if (x !== undefined) { var v = {}; v[w] = x; w = v } r = q._api().fp_css(p, w); i(o, r); return o }, show: function () { this.display = "block"; q._api().fp_showPlugin(p); return o }, hide: function () { this.display = "none"; q._api().fp_hidePlugin(p); return o }, toggle: function () { this.display = q._api().fp_togglePlugin(p); return o }, fadeTo: function (y, x, w) { if (typeof x == "function") { w = x; x = 500 } if (w) { var v = e(); s[v] = w } this.display = q._api().fp_fadeTo(p, y, x, v); this.opacity = y; return o }, fadeIn: function (w, v) { return o.fadeTo(1, w, v) }, fadeOut: function (w, v) { return o.fadeTo(0, w, v) }, getName: function () { return p }, getPlayer: function () { return q }, _fireEvent: function (w, v, x) { if (w == "onUpdate") { var y = q._api().fp_getPlugin(p); if (!y) { return } i(o, y); delete o.methods; if (!u) { m(y.methods, function () { var A = "" + this; o[A] = function () { var B = [].slice.call(arguments); var C = q._api().fp_invoke(p, A, B); return C === "undefined" || C === undefined ? o : C } }); u = true } } var z = s[w]; if (z) { z.apply(o, v); if (w.substring(0, 1) == "_") { delete s[w] } } } }) }; function b(o, t, z) { var E = this, y = null, x, u, p = [], s = {}, B = {}, r, v, w, D, A, q; i(E, { id: function () { return r }, isLoaded: function () { return (y !== null) }, getParent: function () { return o }, hide: function (F) { if (F) { o.style.height = "0px" } if (y) { y.style.height = "0px" } return E }, show: function () { o.style.height = q + "px"; if (y) { y.style.height = A + "px" } return E }, isHidden: function () { return y && parseInt(y.style.height, 10) === 0 }, load: function (F) { if (!y && E._fireEvent("onBeforeLoad") !== false) { m(a, function () { this.unload() }); x = o.innerHTML; if (x && !flashembed.isSupported(t.version)) { o.innerHTML = "" } flashembed(o, t, { config: z }); if (F) { F.cached = true; j(B, "onLoad", F) } } return E }, unload: function () { if (x.replace(/\s/g, "") !== "") { if (E._fireEvent("onBeforeUnload") === false) { return E } try { if (y) { y.fp_close(); E._fireEvent("onUnload") } } catch (F) { } y = null; o.innerHTML = x } return E }, getClip: function (F) { if (F === undefined) { F = D } return p[F] }, getCommonClip: function () { return u }, getPlaylist: function () { return p }, getPlugin: function (F) { var H = s[F]; if (!H && E.isLoaded()) { var G = E._api().fp_getPlugin(F); if (G) { H = new l(F, G, E); s[F] = H } } return H }, getScreen: function () { return E.getPlugin("screen") }, getControls: function () { return E.getPlugin("controls") }, getConfig: function (F) { return F ? k(z) : z }, getFlashParams: function () { return t }, loadPlugin: function (I, H, K, J) { if (typeof K == "function") { J = K; K = {} } var G = J ? e() : "_"; E._api().fp_loadPlugin(I, H, K, G); var F = {}; F[G] = J; var L = new l(I, null, E, F); s[I] = L; return L }, getState: function () { return y ? y.fp_getState() : -1 }, play: function (G, F) { function H() { if (G !== undefined) { E._api().fp_play(G, F) } else { E._api().fp_play() } } if (y) { H() } else { E.load(function () { H() }) } return E }, getVersion: function () { var G = "flowplayer.js 3.1.4"; if (y) { var F = y.fp_getVersion(); F.push(G); return F } return G }, _api: function () { if (!y) { throw "Flowplayer " + E.id() + " not loaded when calling an API method" } return y }, setClip: function (F) { E.setPlaylist([F]); return E }, getIndex: function () { return w } }); m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","), function () { var F = "on" + this; if (F.indexOf("*") != -1) { F = F.substring(0, F.length - 1); var G = "onBefore" + F.substring(2); E[G] = function (H) { j(B, G, H); return E } } E[F] = function (H) { j(B, F, H); return E } }); m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed").split(","), function () { var F = this; E[F] = function (H, G) { if (!y) { return E } var I = null; if (H !== undefined && G !== undefined) { I = y["fp_" + F](H, G) } else { I = (H === undefined) ? y["fp_" + F]() : y["fp_" + F](H) } return I === "undefined" || I === undefined ? E : I } }); E._fireEvent = function (O) { if (typeof O == "string") { O = [O] } var P = O[0], M = O[1], K = O[2], J = O[3], I = 0; if (z.debug) { g(O) } if (!y && P == "onLoad" && M == "player") { y = y || c(v); A = y.clientHeight; m(p, function () { this._fireEvent("onLoad") }); m(s, function (Q, R) { R._fireEvent("onUpdate") }); u._fireEvent("onLoad") } if (P == "onLoad" && M != "player") { return } if (P == "onError") { if (typeof M == "string" || (typeof M == "number" && typeof K == "number")) { M = K; K = J } } if (P == "onContextMenu") { m(z.contextMenu[M], function (Q, R) { R.call(E) }); return } if (P == "onPluginEvent") { var F = M.name || M; var G = s[F]; if (G) { G._fireEvent("onUpdate", M); G._fireEvent(K, O.slice(3)) } return } if (P == "onPlaylistReplace") { p = []; var L = 0; m(M, function () { p.push(new h(this, L++, E)) }) } if (P == "onClipAdd") { if (M.isInStream) { return } M = new h(M, K, E); p.splice(K, 0, M); for (I = K + 1; I < p.length; I++) { p[I].index++ } } var N = true; if (typeof M == "number" && M < p.length) { D = M; var H = p[M]; if (H) { N = H._fireEvent(P, K, J) } if (!H || N !== false) { N = u._fireEvent(P, K, J, H) } } m(B[P], function () { N = this.call(E, M, K); if (this.cached) { B[P].splice(I, 1) } if (N === false) { return false } I++ }); return N }; function C() { if ($f(o)) { $f(o).getParent().innerHTML = ""; w = $f(o).getIndex(); a[w] = E } else { a.push(E); w = a.length - 1 } q = parseInt(o.style.height, 10) || o.clientHeight; if (typeof t == "string") { t = { src: t} } r = o.id || "fp" + e(); v = t.id || r + "_api"; t.id = v; z.playerId = r; if (typeof z == "string") { z = { clip: { url: z}} } if (typeof z.clip == "string") { z.clip = { url: z.clip} } z.clip = z.clip || {}; if (o.getAttribute("href", 2) && !z.clip.url) { z.clip.url = o.getAttribute("href", 2) } u = new h(z.clip, -1, E); z.playlist = z.playlist || [z.clip]; var F = 0; m(z.playlist, function () { var H = this; if (typeof H == "object" && H.length) { H = { url: "" + H} } m(z.clip, function (I, J) { if (J !== undefined && H[I] === undefined && typeof J != "function") { H[I] = J } }); z.playlist[F] = H; H = new h(H, F, E); p.push(H); F++ }); m(z, function (H, I) { if (typeof I == "function") { if (u[H]) { u[H](I) } else { j(B, H, I) } delete z[H] } }); m(z.plugins, function (H, I) { if (I) { s[H] = new l(H, I, E) } }); if (!z.plugins || z.plugins.controls === undefined) { s.controls = new l("controls", null, E) } s.canvas = new l("canvas", null, E); t.bgcolor = t.bgcolor || "#000000"; t.version = t.version || [9, 0]; t.expressInstall = "http://www.flowplayer.org/swf/expressinstall.swf"; function G(H) { if (!E.isLoaded() && E._fireEvent("onBeforeClick") !== false) { E.load() } return f(H) } x = o.innerHTML; if (x.replace(/\s/g, "") !== "") { if (o.addEventListener) { o.addEventListener("click", G, false) } else { if (o.attachEvent) { o.attachEvent("onclick", G) } } } else { if (o.addEventListener) { o.addEventListener("click", f, false) } E.load() } } if (typeof o == "string") { flashembed.domReady(function () { var F = c(o); if (!F) { throw "Flowplayer cannot access element: " + o } else { o = F; C() } }) } else { C() } } var a = []; function d(o) { this.length = o.length; this.each = function (p) { m(o, p) }; this.size = function () { return o.length } } window.flowplayer = window.$f = function () { var p = null; var o = arguments[0]; if (!arguments.length) { m(a, function () { if (this.isLoaded()) { p = this; return false } }); return p || a[0] } if (arguments.length == 1) { if (typeof o == "number") { return a[o] } else { if (o == "*") { return new d(a) } m(a, function () { if (this.id() == o.id || this.id() == o || this.getParent() == o) { p = this; return false } }); return p } } if (arguments.length > 1) { var r = arguments[1]; var q = (arguments.length == 3) ? arguments[2] : {}; if (typeof o == "string") { if (o.indexOf(".") != -1) { var t = []; m(n(o), function () { t.push(new b(this, k(r), k(q))) }); return new d(t) } else { var s = c(o); return new b(s !== null ? s : o, r, q) } } else { if (o) { return new b(o, r, q) } } } return null }; i(window.$f, { fireEvent: function () { var o = [].slice.call(arguments); var q = $f(o[0]); return q ? q._fireEvent(o.slice(1)) : null }, addPlugin: function (o, p) { b.prototype[o] = p; return $f }, each: m, extend: i }); if (typeof jQuery == "function") { jQuery.prototype.flowplayer = function (q, p) { if (!arguments.length || typeof arguments[0] == "number") { var o = []; this.each(function () { var r = $f(this); if (r) { o.push(r) } }); return arguments.length ? o[arguments[0]] : new d(o) } return this.each(function () { $f(this, k(q), p ? k(p) : {}) }) } } })(); (function () { var e = typeof jQuery == "function"; var i = { width: "100%", height: "100%", allowfullscreen: true, allowscriptaccess: "always", quality: "high", version: null, onFail: null, expressInstall: null, w3c: false, cachebusting: false }; if (e) { jQuery.tools = jQuery.tools || {}; jQuery.tools.flashembed = { version: "1.0.4", conf: i} } function j() { if (c.done) { return false } var l = document; if (l && l.getElementsByTagName && l.getElementById && l.body) { clearInterval(c.timer); c.timer = null; for (var k = 0; k < c.ready.length; k++) { c.ready[k].call() } c.ready = null; c.done = true } } var c = e ? jQuery : function (k) { if (c.done) { return k() } if (c.timer) { c.ready.push(k) } else { c.ready = [k]; c.timer = setInterval(j, 13) } }; function f(l, k) { if (k) { for (key in k) { if (k.hasOwnProperty(key)) { l[key] = k[key] } } } return l } function g(k) { switch (h(k)) { case "string": k = k.replace(new RegExp('(["\\\\])', "g"), "\\$1"); k = k.replace(/^\s?(\d+)%/, "$1pct"); return '"' + k + '"'; case "array": return "[" + b(k, function (n) { return g(n) }).join(",") + "]"; case "function": return '"function()"'; case "object": var l = []; for (var m in k) { if (k.hasOwnProperty(m)) { l.push('"' + m + '":' + g(k[m])) } } return "{" + l.join(",") + "}" } return String(k).replace(/\s/g, " ").replace(/\'/g, '"') } function h(l) { if (l === null || l === undefined) { return false } var k = typeof l; return (k == "object" && l.push) ? "array" : k } if (window.attachEvent) { window.attachEvent("onbeforeunload", function () { __flash_unloadHandler = function () { }; __flash_savedUnloadHandler = function () { } }) } function b(k, n) { var m = []; for (var l in k) { if (k.hasOwnProperty(l)) { m[l] = n(k[l]) } } return m } function a(r, t) { var q = f({}, r); var s = document.all; var n = '<object width="' + q.width + '" height="' + q.height + '"'; if (s && !q.id) { q.id = "_" + ("" + Math.random()).substring(9) } if (q.id) { n += ' id="' + q.id + '"' } if (q.cachebusting) { q.src += ((q.src.indexOf("?") != -1 ? "&" : "?") + Math.random()) } if (q.w3c || !s) { n += ' data="' + q.src + '" type="application/x-shockwave-flash"' } else { n += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' } n += ">"; if (q.w3c || s) { n += '<param name="movie" value="' + q.src + '" />' } q.width = q.height = q.id = q.w3c = q.src = null; for (var l in q) { if (q[l] !== null) { n += '<param name="' + l + '" value="' + q[l] + '" />' } } var o = ""; if (t) { for (var m in t) { if (t[m] !== null) { o += m + "=" + (typeof t[m] == "object" ? g(t[m]) : t[m]) + "&" } } o = o.substring(0, o.length - 1); n += '<param name="flashvars" value=\'' + o + "' />" } n += "</object>"; return n } function d(m, p, l) { var k = flashembed.getVersion(); f(this, { getContainer: function () { return m }, getConf: function () { return p }, getVersion: function () { return k }, getFlashvars: function () { return l }, getApi: function () { return m.firstChild }, getHTML: function () { return a(p, l) } }); var q = p.version; var r = p.expressInstall; var o = !q || flashembed.isSupported(q); if (o) { p.onFail = p.version = p.expressInstall = null; m.innerHTML = a(p, l) } else { if (q && r && flashembed.isSupported([6, 65])) { f(p, { src: r }); l = { MMredirectURL: location.href, MMplayerType: "PlugIn", MMdoctitle: document.title }; m.innerHTML = a(p, l) } else { if (m.innerHTML.replace(/\s/g, "") !== "") { } else { m.innerHTML = "<h2>Flash version " + q + " or greater is required</h2><h3>" + (k[0] > 0 ? "Your version is " + k : "You have no flash plugin installed") + "</h3>" + (m.tagName == "A" ? "<p>Click here to download latest version</p>" : "<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>"); if (m.tagName == "A") { m.onclick = function () { location.href = "http://www.adobe.com/go/getflashplayer" } } } } } if (!o && p.onFail) { var n = p.onFail.call(this); if (typeof n == "string") { m.innerHTML = n } } if (document.all) { window[p.id] = document.getElementById(p.id) } } window.flashembed = function (l, m, k) { if (typeof l == "string") { var n = document.getElementById(l); if (n) { l = n } else { c(function () { flashembed(l, m, k) }); return } } if (!l) { return } if (typeof m == "string") { m = { src: m} } var o = f({}, i); f(o, m); return new d(l, o, k) }; f(window.flashembed, { getVersion: function () { var m = [0, 0]; if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") { var l = navigator.plugins["Shockwave Flash"].description; if (typeof l != "undefined") { l = l.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); var n = parseInt(l.replace(/^(.*)\..*$/, "$1"), 10); var r = /r/.test(l) ? parseInt(l.replace(/^.*r(.*)$/, "$1"), 10) : 0; m = [n, r] } } else { if (window.ActiveXObject) { try { var p = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7") } catch (q) { try { p = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); m = [6, 0]; p.AllowScriptAccess = "always" } catch (k) { if (m[0] == 6) { return m } } try { p = new ActiveXObject("ShockwaveFlash.ShockwaveFlash") } catch (o) { } } if (typeof p == "object") { l = p.GetVariable("$version"); if (typeof l != "undefined") { l = l.replace(/^\S+\s+(.*)$/, "$1").split(","); m = [parseInt(l[0], 10), parseInt(l[2], 10)] } } } } return m }, isSupported: function (k) { var m = flashembed.getVersion(); var l = (m[0] > k[0]) || (m[0] == k[0] && m[1] >= k[1]); return l }, domReady: c, asString: g, getHTML: a }); if (e) { jQuery.fn.flashembed = function (l, k) { var m = null; this.each(function () { m = flashembed(this, l, k) }); return l.api === false ? this : m } } })();
//Methode d'initialisation d'une video flowplayer
function oddo_initializeVideo(containerId, clipUrl, myNetConnectionUrl, myKey, clipName) {
    $f(containerId, '/_layouts/oddo/flowplayer/flowplayer.commercial-3.1.5.swf', {
        canvas: {
            backgroundColor: '#7f8a93',
            backgroundGradient: 'none'
        },
        clip: {
            url: clipUrl,
            provider: 'simplecdn',
            accelerated: true,
            onStart: function (clip) {
                xt_med("M", "1", clipName, "play", parseInt(this.getTime()), 4, 1, 1)
            },

            onResume: function (clip) {
                xt_med("M", "1", clipName, "play", parseInt(this.getTime()), 4, 1, 1)
            },

            // track pause event for this clip. time (in seconds) is also tracked 
            onPause: function (clip) {
                xt_med("M", "1", clipName, "pause", parseInt(this.getTime()), 4, 1, 1)
            },

            // track stop event for this clip. time is also tracked 
            onStop: function (clip) {
                xt_med("M", "1", clipName, "stop", parseInt(this.getTime()), 4, 1, 1)
            },

            // track finish event for this clip 
            onFinish: function (clip) {
                xt_med("M", "1", clipName, "stop", parseInt(this.getTime()), 4, 1, 1)
            }
        },
        plugins: {
            simplecdn: {
                url: '/_layouts/oddo/flowplayer/flowplayer.rtmp-3.1.3.swf',
                netConnectionUrl: myNetConnectionUrl
            },
            controls: {
                volumeSliderGradient: 'none',
                sliderGradient: 'none',
                buttonOverColor: '#D8004F',
                buttonColor: '#9f0038',
                backgroundGradient: [0.6, 0.3, 0, 0, 0],
                bufferGradient: 'none',
                progressGradient: 'medium',
                backgroundColor: '#7f8a93',
                height: 24,
                opacity: 1.0,
                autoHide: 'always',
                time: false,
                stop: true
            }
        },
        key: myKey,
        logo: null
    });
}

//Initialisation du formulaire de contact
$j(document).ready(function () {

    $j(".ocu-modal").click(function () {
        $j.nyroModalManual({
            bgColor: '#FFFFFF',
            type: 'iframe',
            width: 700,
            height: 550,
            padding: 0,
            url: this.href,
            wrap: { iframe: '<div class="oddo-lightboxWrapper"></div>' }
        });
        return false;
    });

});

//Méthode utilisée par l'agent virtuel pour afficher la lightbox du formulaire de contact
function oddo_showContactForm(options) {
    // Paramètres du plugin
    var defaults =
	{

	    //mode
	    //  department
	    //  product
	    //  cgpipartner
	    //  webmaster (default)
	    //  headdepartment
	    mode: "webmaster",

	    //department
	    //  oam (oddo asset management) : 1
	    //  obp (oddo banque privée : 2
	    //  ocf (oddo corporate finance) : 3
	    //  metals (oddo metals) : 4
	    //  power (oddo power) : 5
	    //  options (oddo options) : 6
	    //  securities (oddo securities) : 7
	    //  services (oddo services) : 8
	    department: 0,

	    //product
	    //  clienteleprivee : 1
	    //  investisseursinstitutionnels : 2
	    //  cgpi : 3
	    //  entreprises : 4
	    product: 0
	};

    var opts = $.extend({}, defaults, options)

    var webUrl = SP.ClientContext.get_current().get_url();
    if (webUrl.charAt(webUrl.length - 1) != "/")
        webUrl += "/";

    var formUrl = webUrl + "_layouts/oddo/contactus.aspx?mode=" + opts.mode + "&department=" + opts.department + "&product=" + opts.product;

    $j.nyroModalManual({
        bgColor: '#FFFFFF',
        type: 'iframe',
        width: 700,
        height: 550,
        padding: 0,
        url: formUrl
    });

}

//Méthode utilisée par l'agent virtuel pour afficher la lightbox du web call back
function oddo_showWebCallBackForm() {
    window.open('/_layouts/oddo/WebCallBack/wcb-pop.htm?SOCIETE=Oddo&CODEBOUTON=ODDO0001&CODEBOUTONDIFF=&', 'WebCallBack', 'toolbar=no,resizable=no,scrollbars=no,status=no,menubar=no,width=476,height=350');
}


//JobApplicationForm
$j(document).ready(function () {

    $j(".oja-modal").click(function () {
        $j.nyroModalManual({
            bgColor: '#FFFFFF',
            type: 'iframe',
            width: 700,
            height: 550,
            padding: 0,
            url: this.href,
            wrap: { iframe: '<div class="oddo-lightboxWrapper"></div>' }
        });
        return false;
    });

});

//RotateItems
jQuery.fn.rotateItems = function (options) {
    // Paramètres du plugin
    var defaults =
	{
	    itemsToShow: 1,
	    navigationButtonOnHeader: true
	};

    var opts = $.extend({}, defaults, options)

    return this.each(function () {
        var currentItemIndex = 0;

        // Récupération du nombre d'élements depuis le conteneur source
        var contentCount = $(this).find(".content-block .content-item").size();
        var mom = $(this);

        // Afficher les N premières valeurs
        $(this).find(".content-selected").append($(this).find(".content-block .content-item").slice(currentItemIndex, opts.itemsToShow).clone(true).show());

        var buttonZone = $(this);

        if (opts.navigationButtonOnHeader) {
            // Placer les boutons de navigation sur le contenu dans l'entête
            var lookupZone = $(this).parent().parent().parent().parent().parent().find(".ms-WPHeaderTdSelection").before();
            var added = lookupZone.after("<td class=\"ms-WPHeaderTd\" style=\"width:20px;\">&nbsp;<a class=\"content-nextbutton\" style=\"display:none;cursor:pointer;position:relative;top:1px;\"><img src=\"/_layouts/images/ODDO/FlecheSuivant.gif\"></a></td>");
            added.after("<td class=\"ms-WPHeaderTd\" style=\"width:20px;\">&nbsp;<a class=\"content-previousbutton\" style=\"display:none;cursor:pointer;position:relative;top:1px;\"><img src=\"/_layouts/images/ODDO/FlechePrecedent.gif\"></a></td>");
            buttonZone = lookupZone.parent();
        }

        var buttonNext = buttonZone.find(".content-nextbutton");
        var buttonPrevious = buttonZone.find(".content-previousbutton").hide();

        if (contentCount > (currentItemIndex + opts.itemsToShow)) {
            buttonNext.show();
        }
        else {
            buttonNext.hide();
        }

        buttonNext.click(function () {
            var contentSelected = mom.find(".content-selected");

            // Effacer les données, et afficher les suivantes
            contentSelected.children().remove();

            currentItemIndex += opts.itemsToShow;
            contentSelected.append(mom.find(".content-block .content-item").slice(currentItemIndex, currentItemIndex + opts.itemsToShow).clone(true).hide().fadeIn());

            if (contentCount <= (currentItemIndex + opts.itemsToShow)) {
                buttonNext.hide();
            }

            buttonPrevious.show();
        });

        buttonPrevious.click(function () {
            var contentSelected = mom.find(".content-selected");

            // Effacer les données, et afficher les suivantes
            contentSelected.children().remove();

            currentItemIndex -= opts.itemsToShow;
            contentSelected.append(mom.find(".content-block .content-item").slice(currentItemIndex, currentItemIndex + opts.itemsToShow).clone(true).hide().fadeIn());

            if (currentItemIndex <= 0) {
                buttonPrevious.hide();
            }

            buttonNext.show();
        });
    });
}


//EspaceClient
$(document).ready(function () {
    var mouseOver = false;
    $(".customerArea").hover(function () {
        if (mouseOver == false)
            $("#headlink").slideDown();
        mouseOver = true;
    }, function () {
        mouseOver = false;
        setTimeout(function () {
            if (mouseOver == false)
                $("#headlink").slideUp();
        }, 1500);
    });
});

$j(document).ready(function () {

    $j(".owcb-modal").click(function () {
        $j.nyroModalManual({
            bgColor: '#FFFFFF',
            type: 'iframe',
            width: 700,
            height: 550,
            padding: 0,
            url: this.href
        });
        return false;
    });

});


//Liens avec target _blank
$j(document).ready(function () {
$j("a").each(function(){
    if($j(this).attr("rel") == "external")
        $j(this).attr("target", "_blank");
});});

//Menu de navigation
(function ($) {
    /* hoverIntent by Brian Cherne */
    $.fn.hoverIntent = function (f, g) {
        // default configuration options
        var cfg = {
            sensitivity: 7,
            interval: 100,
            timeout: 0
        };
        // override configuration options with user supplied object
        cfg = $.extend(cfg, g ? { over: f, out: g} : f);

        // instantiate variables
        // cX, cY = current X and Y position of mouse, updated by mousemove event
        // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
        var cX, cY, pX, pY;

        // A private function for getting mouse position
        var track = function (ev) {
            cX = ev.pageX;
            cY = ev.pageY;
        };

        // A private function for comparing current and previous mouse position
        var compare = function (ev, ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            // compare mouse positions to see if they've crossed the threshold
            if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) {
                $(ob).unbind("mousemove", track);
                // set hoverIntent state to true (so mouseOut can be called)
                ob.hoverIntent_s = 1;
                return cfg.over.apply(ob, [ev]);
            } else {
                // set previous coordinates for next time
                pX = cX; pY = cY;
                // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
                ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval);
            }
        };

        // A private function for delaying the mouseOut function
        var delay = function (ev, ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            ob.hoverIntent_s = 0;
            return cfg.out.apply(ob, [ev]);
        };

        // A private function for handling mouse 'hovering'
        var handleHover = function (e) {
            // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
            var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
            while (p && p != this) { try { p = p.parentNode; } catch (e) { p = this; } }
            if (p == this) { return false; }

            // copy objects to be passed into t (required for event object to be passed in IE)
            var ev = jQuery.extend({}, e);
            var ob = this;

            // cancel hoverIntent timer if it exists
            if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

            // else e.type == "onmouseover"
            if (e.type == "mouseover") {
                // set "previous" X and Y position based on initial entry point
                pX = ev.pageX; pY = ev.pageY;
                // update "current" X and Y position based on mousemove
                $(ob).bind("mousemove", track);
                // start polling interval (self-calling timeout) to compare mouse coordinates over time
                if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval); }

                // else e.type == "onmouseout"
            } else {
                // unbind expensive mousemove event
                $(ob).unbind("mousemove", track);
                // if hoverIntent state is true, then call the mouseOut function after the specified delay
                if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob); }, cfg.timeout); }
            }
        };

        // bind the function to the two event listeners
        return this.mouseover(handleHover).mouseout(handleHover);
    };

})(jQuery);

(function ($) {
    $.fn.superfish = function (op) {

        var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="', c.arrowClass, '"> &#187;</span>'].join('')),
			over = function () {
			    var $$ = $(this), menu = getMenu($$);
			    clearTimeout(menu.sfTimer);
			    $$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function () {
			    var $$ = $(this), menu = getMenu($$), o = sf.op;
			    clearTimeout(menu.sfTimer);
			    menu.sfTimer = setTimeout(function () {
			        o.retainPath = ($.inArray($$[0], o.$path) > -1);
			        $$.hideSuperfishUl();
			        if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1) { over.call(o.$path); }
			    }, o.delay);
			},
			getMenu = function ($menu) {
			    var menu = $menu.parents(['ul.', c.menuClass, ':first'].join(''))[0];
			    sf.op = sf.o[menu.serial];
			    return menu;
			},
			addArrow = function ($a) { $a.addClass(c.anchorClass).append($arrow.clone()); };

        return this.each(function () {
            var s = this.serial = sf.o.length;
            var o = $.extend({}, sf.defaults, op);
            o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function () {
                $(this).addClass([o.hoverClass, c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
            });
            sf.o[s] = sf.op = o;

            $('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function () {
                if (o.autoArrows) addArrow($('>a:first-child', this));
            })
			.not('.' + c.bcClass)
				.hideSuperfishUl();

            var $a = $('a', this);
            $a.each(function (i) {
                var $li = $a.eq(i).parents('li');
                $a.eq(i).focus(function () { over.call($li); }).blur(function () { out.call($li); });
            });
            o.onInit.call(this);

        }).each(function () {
            var menuClasses = [c.menuClass];
            if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
            $(this).addClass(menuClasses.join(' '));
        });
    };

    var sf = $.fn.superfish;
    sf.o = [];
    sf.op = {};
    sf.IE7fix = function () {
        var o = sf.op;
        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined)
            this.toggleClass(sf.c.shadowClass + '-off');
    };
    sf.c = {
        bcClass: 'sf-breadcrumb',
        menuClass: 'sf-js-enabled',
        anchorClass: 'sf-with-ul',
        arrowClass: 'sf-sub-indicator',
        shadowClass: 'sf-shadow'
    };
    sf.defaults = {
        hoverClass: 'sfHover',
        pathClass: 'overideThisToUse',
        pathLevels: 1,
        delay: 500,
        animation: { opacity: 'show' },
        speed: '400',
        autoArrows: false,
        dropShadows: true,
        disableHI: false, 	// true disables hoverIntent detection
        onInit: function () { }, // callback functions
        onBeforeShow: function () { },
        onShow: function () { },
        onHide: function () { }
    };
    $.fn.extend({
        hideSuperfishUl: function () {
            var o = sf.op,
				not = (o.retainPath === true) ? o.$path : '';
            o.retainPath = false;
            var $ul = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility', 'hidden');
            o.onHide.call($ul);
            return this;
        },
        showSuperfishUl: function () {
            var o = sf.op,
				sh = sf.c.shadowClass + '-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility', 'visible');
            sf.IE7fix.call($ul);
            o.onBeforeShow.call($ul);
            $ul.animate(o.animation, o.speed, function () { sf.IE7fix.call($ul); o.onShow.call($ul); });
            return this;
        }
    });

})(jQuery);

$(document).ready(function () {
    $("ul.sf-menu").superfish({
        pathClass: 'current'
    });
});


//Affichage de fenêtre MessageBox
$j(document).ready(function () {

    $j(".omb-modal").click(function () {
        $j.nyroModalManual({
            bgColor: '#FFFFFF',
            type: 'iframe',
            width: 400,
            height: 200,
            minHeight: 150,
            padding: 0,
            url: this.href,
            wrap: { iframe: '<div class="oddo-lightboxWrapper"></div>' }
        });
        return false;
    });

});




//Méthode utilisée pour afficher la lightbox de la MessageBox
function oddo_showMessageBox(options, url) {
    // Paramètres du plugin
    var defaults =
	{

	    //Type
	    //  Confirm
	    //  Error
	    //  Warning
	    //  Default (default)
	    //  Info
	    Type: "Default",

	    //Title
	    Title: "Message",

	    //Message
	    Message: ""
	};

    var opts = $j.extend({}, defaults, options);
    var formUrl = url + "/_layouts/oddo/messagebox.aspx?Type=" + encodeURI(opts.Type) + "&Title=" + encodeURI(opts.Title) + "&Message=" + encodeURI(opts.Message);
    $j.nyroModalManual({
        bgColor: '#FFFFFF',
        type: 'iframe',
        width: 400,
        height: 200,
        minHeight: 150,
        padding: 0,
        url: formUrl,
        wrap: { iframe: '<div class="oddo-lightboxWrapper"></div>' }
    });
}

//Méthode utilisée pour afficher la lightbox de la MessageBox à partir d'une lightbox
function oddo_showMessageBoxFromLightBox(options, url) {
    // Paramètres du plugin
    var defaults =
	{

	    //Type
	    //  Confirm
	    //  Error
	    //  Warning
	    //  Default (default)
	    //  Info
	    Type: "Default",

	    //Title
	    Title: "Message",

	    //Message
	    Message: ""
	};

    var opts = $j.extend({}, defaults, options);
    var formUrl = url + "/_layouts/oddo/messagebox.aspx?Type=" + encodeURI(opts.Type) + "&Title=" + encodeURI(opts.Title) + "&Message=" + encodeURI(opts.Message);
    parent.$j.nyroModalManual({
        bgColor: '#FFFFFF',
        type: 'iframe',
        width: 400,
        height: 200,
        minHeight: 150,
        padding: 0,
        url: formUrl,
        wrap: { iframe: '<div class="oddo-lightboxWrapper"></div>' }
    });
}

//Méthode utilisée pour caché le tooltip
$j(document).ready(function () {
    $j('td[title]').each(function () {
        $j(this).attr("title","");
    });
});


//WelcomeImage
function oddo_displayWelcomeImage(url, iw, ih, vh, intervalFadersIn, delayFadersIn, intervalFadersOut, delayFadersOut, delayImageOut, intervalBackgroundIn, delayBackgroundIn) {

    //Cache le site
    $(".main-container").hide(0);

    //window size
    var ww = $(window).width();
    var wh = $(window).height();

    //window position
    var st = $(window).scrollTop();
    var sl = $(window).scrollLeft();

    //image position
    var it = (wh - ih) / 2;
    var il = (ww - iw) / 2;

    //On s'assure que le coin haut-gauche est visible
    if (it < 0)
        it = 0;
    if (il < 0)
        il = 0;

    var imageUrl = "url('" + url + "')";

    //Positionne l'image
    $("#oddo-welcome-image").css({
        marginTop: 0,
        marginLeft: il,
        width: iw,
        height: ih,
        zIndex: 500,
        position: "relative",
        backgroundImage: imageUrl
    });

    //Positionne le fader du haut
    var hideHeight = (ih - vh) / 2;
    $("#oddo-welcome-image-fader-top").css({
        position: "absolute",
        top: 0,
        left: 0,
        width: iw,
        height: hideHeight,
        backgroundColor: "white",
        zIndex: 501
    });

    //Positionne le fader du bas
    $("#oddo-welcome-image-fader-bottom").css({
        position: "absolute",
        bottom: 0,
        left: 0,
        width: iw,
        height: hideHeight,
        backgroundColor: "white",
        zIndex: 501
    });

    //Lance l'animation des faders
    setInterval(function () {

        $("#oddo-welcome-image-fader-top").slideUp(delayFadersIn);
        $("#oddo-welcome-image-fader-bottom").slideUp(delayFadersIn);

        setInterval(oddo_hideWelcomeImage, intervalFadersOut);

    }, intervalFadersIn);

    //Au moindre click, on lance l'animation de fondu
    $("#oddo-welcome-image-background").one("click", oddo_hideWelcomeImage);

    //Fonction d'animation de fondu de fin
    function oddo_hideWelcomeImage() {

        //Cache les éléments d'intro avec fondu
        $("#oddo-welcome-image-fader-top").fadeOut(delayFadersOut);
        $("#oddo-welcome-image-fader-bottom").fadeOut(delayFadersOut);
        $("#oddo-welcome-image-background").fadeOut(delayImageOut);
        $("#oddo-welcome-image").fadeOut(delayImageOut);

        //Apparition de la page avec fondu
        setTimeout(function () {
            $(".main-container").fadeIn(delayBackgroundIn);
        }, intervalBackgroundIn);

    }

}

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject = function () { var D = "undefined", r = "object", S = "Shockwave Flash", W = "ShockwaveFlash.ShockwaveFlash", q = "application/x-shockwave-flash", R = "SWFObjectExprInst", x = "onreadystatechange", O = window, j = document, t = navigator, T = false, U = [h], o = [], N = [], I = [], l, Q, E, B, J = false, a = false, n, G, m = true, M = function () { var aa = typeof j.getElementById != D && typeof j.getElementsByTagName != D && typeof j.createElement != D, ah = t.userAgent.toLowerCase(), Y = t.platform.toLowerCase(), ae = Y ? /win/.test(Y) : /win/.test(ah), ac = Y ? /mac/.test(Y) : /mac/.test(ah), af = /webkit/.test(ah) ? parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, X = ! +"\v1", ag = [0, 0, 0], ab = null; if (typeof t.plugins != D && typeof t.plugins[S] == r) { ab = t.plugins[S].description; if (ab && !(typeof t.mimeTypes != D && t.mimeTypes[q] && !t.mimeTypes[q].enabledPlugin)) { T = true; X = false; ab = ab.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); ag[0] = parseInt(ab.replace(/^(.*)\..*$/, "$1"), 10); ag[1] = parseInt(ab.replace(/^.*\.(.*)\s.*$/, "$1"), 10); ag[2] = /[a-zA-Z]/.test(ab) ? parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0 } } else { if (typeof O.ActiveXObject != D) { try { var ad = new ActiveXObject(W); if (ad) { ab = ad.GetVariable("$version"); if (ab) { X = true; ab = ab.split(" ")[1].split(","); ag = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)] } } } catch (Z) { } } } return { w3: aa, pv: ag, wk: af, ie: X, win: ae, mac: ac} } (), k = function () { if (!M.w3) { return } if ((typeof j.readyState != D && j.readyState == "complete") || (typeof j.readyState == D && (j.getElementsByTagName("body")[0] || j.body))) { f() } if (!J) { if (typeof j.addEventListener != D) { j.addEventListener("DOMContentLoaded", f, false) } if (M.ie && M.win) { j.attachEvent(x, function () { if (j.readyState == "complete") { j.detachEvent(x, arguments.callee); f() } }); if (O == top) { (function () { if (J) { return } try { j.documentElement.doScroll("left") } catch (X) { setTimeout(arguments.callee, 0); return } f() })() } } if (M.wk) { (function () { if (J) { return } if (!/loaded|complete/.test(j.readyState)) { setTimeout(arguments.callee, 0); return } f() })() } s(f) } } (); function f() { if (J) { return } try { var Z = j.getElementsByTagName("body")[0].appendChild(C("span")); Z.parentNode.removeChild(Z) } catch (aa) { return } J = true; var X = U.length; for (var Y = 0; Y < X; Y++) { U[Y]() } } function K(X) { if (J) { X() } else { U[U.length] = X } } function s(Y) { if (typeof O.addEventListener != D) { O.addEventListener("load", Y, false) } else { if (typeof j.addEventListener != D) { j.addEventListener("load", Y, false) } else { if (typeof O.attachEvent != D) { i(O, "onload", Y) } else { if (typeof O.onload == "function") { var X = O.onload; O.onload = function () { X(); Y() } } else { O.onload = Y } } } } } function h() { if (T) { V() } else { H() } } function V() { var X = j.getElementsByTagName("body")[0]; var aa = C(r); aa.setAttribute("type", q); var Z = X.appendChild(aa); if (Z) { var Y = 0; (function () { if (typeof Z.GetVariable != D) { var ab = Z.GetVariable("$version"); if (ab) { ab = ab.split(" ")[1].split(","); M.pv = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)] } } else { if (Y < 10) { Y++; setTimeout(arguments.callee, 10); return } } X.removeChild(aa); Z = null; H() })() } else { H() } } function H() { var ag = o.length; if (ag > 0) { for (var af = 0; af < ag; af++) { var Y = o[af].id; var ab = o[af].callbackFn; var aa = { success: false, id: Y }; if (M.pv[0] > 0) { var ae = c(Y); if (ae) { if (F(o[af].swfVersion) && !(M.wk && M.wk < 312)) { w(Y, true); if (ab) { aa.success = true; aa.ref = z(Y); ab(aa) } } else { if (o[af].expressInstall && A()) { var ai = {}; ai.data = o[af].expressInstall; ai.width = ae.getAttribute("width") || "0"; ai.height = ae.getAttribute("height") || "0"; if (ae.getAttribute("class")) { ai.styleclass = ae.getAttribute("class") } if (ae.getAttribute("align")) { ai.align = ae.getAttribute("align") } var ah = {}; var X = ae.getElementsByTagName("param"); var ac = X.length; for (var ad = 0; ad < ac; ad++) { if (X[ad].getAttribute("name").toLowerCase() != "movie") { ah[X[ad].getAttribute("name")] = X[ad].getAttribute("value") } } P(ai, ah, Y, ab) } else { p(ae); if (ab) { ab(aa) } } } } } else { w(Y, true); if (ab) { var Z = z(Y); if (Z && typeof Z.SetVariable != D) { aa.success = true; aa.ref = Z } ab(aa) } } } } } function z(aa) { var X = null; var Y = c(aa); if (Y && Y.nodeName == "OBJECT") { if (typeof Y.SetVariable != D) { X = Y } else { var Z = Y.getElementsByTagName(r)[0]; if (Z) { X = Z } } } return X } function A() { return !a && F("6.0.65") && (M.win || M.mac) && !(M.wk && M.wk < 312) } function P(aa, ab, X, Z) { a = true; E = Z || null; B = { success: false, id: X }; var ae = c(X); if (ae) { if (ae.nodeName == "OBJECT") { l = g(ae); Q = null } else { l = ae; Q = X } aa.id = R; if (typeof aa.width == D || (!/%$/.test(aa.width) && parseInt(aa.width, 10) < 310)) { aa.width = "310" } if (typeof aa.height == D || (!/%$/.test(aa.height) && parseInt(aa.height, 10) < 137)) { aa.height = "137" } j.title = j.title.slice(0, 47) + " - Flash Player Installation"; var ad = M.ie && M.win ? "ActiveX" : "PlugIn", ac = "MMredirectURL=" + O.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + ad + "&MMdoctitle=" + j.title; if (typeof ab.flashvars != D) { ab.flashvars += "&" + ac } else { ab.flashvars = ac } if (M.ie && M.win && ae.readyState != 4) { var Y = C("div"); X += "SWFObjectNew"; Y.setAttribute("id", X); ae.parentNode.insertBefore(Y, ae); ae.style.display = "none"; (function () { if (ae.readyState == 4) { ae.parentNode.removeChild(ae) } else { setTimeout(arguments.callee, 10) } })() } u(aa, ab, X) } } function p(Y) { if (M.ie && M.win && Y.readyState != 4) { var X = C("div"); Y.parentNode.insertBefore(X, Y); X.parentNode.replaceChild(g(Y), X); Y.style.display = "none"; (function () { if (Y.readyState == 4) { Y.parentNode.removeChild(Y) } else { setTimeout(arguments.callee, 10) } })() } else { Y.parentNode.replaceChild(g(Y), Y) } } function g(ab) { var aa = C("div"); if (M.win && M.ie) { aa.innerHTML = ab.innerHTML } else { var Y = ab.getElementsByTagName(r)[0]; if (Y) { var ad = Y.childNodes; if (ad) { var X = ad.length; for (var Z = 0; Z < X; Z++) { if (!(ad[Z].nodeType == 1 && ad[Z].nodeName == "PARAM") && !(ad[Z].nodeType == 8)) { aa.appendChild(ad[Z].cloneNode(true)) } } } } } return aa } function u(ai, ag, Y) { var X, aa = c(Y); if (M.wk && M.wk < 312) { return X } if (aa) { if (typeof ai.id == D) { ai.id = Y } if (M.ie && M.win) { var ah = ""; for (var ae in ai) { if (ai[ae] != Object.prototype[ae]) { if (ae.toLowerCase() == "data") { ag.movie = ai[ae] } else { if (ae.toLowerCase() == "styleclass") { ah += ' class="' + ai[ae] + '"' } else { if (ae.toLowerCase() != "classid") { ah += " " + ae + '="' + ai[ae] + '"' } } } } } var af = ""; for (var ad in ag) { if (ag[ad] != Object.prototype[ad]) { af += '<param name="' + ad + '" value="' + ag[ad] + '" />' } } aa.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ah + ">" + af + "</object>"; N[N.length] = ai.id; X = c(ai.id) } else { var Z = C(r); Z.setAttribute("type", q); for (var ac in ai) { if (ai[ac] != Object.prototype[ac]) { if (ac.toLowerCase() == "styleclass") { Z.setAttribute("class", ai[ac]) } else { if (ac.toLowerCase() != "classid") { Z.setAttribute(ac, ai[ac]) } } } } for (var ab in ag) { if (ag[ab] != Object.prototype[ab] && ab.toLowerCase() != "movie") { e(Z, ab, ag[ab]) } } aa.parentNode.replaceChild(Z, aa); X = Z } } return X } function e(Z, X, Y) { var aa = C("param"); aa.setAttribute("name", X); aa.setAttribute("value", Y); Z.appendChild(aa) } function y(Y) { var X = c(Y); if (X && X.nodeName == "OBJECT") { if (M.ie && M.win) { X.style.display = "none"; (function () { if (X.readyState == 4) { b(Y) } else { setTimeout(arguments.callee, 10) } })() } else { X.parentNode.removeChild(X) } } } function b(Z) { var Y = c(Z); if (Y) { for (var X in Y) { if (typeof Y[X] == "function") { Y[X] = null } } Y.parentNode.removeChild(Y) } } function c(Z) { var X = null; try { X = j.getElementById(Z) } catch (Y) { } return X } function C(X) { return j.createElement(X) } function i(Z, X, Y) { Z.attachEvent(X, Y); I[I.length] = [Z, X, Y] } function F(Z) { var Y = M.pv, X = Z.split("."); X[0] = parseInt(X[0], 10); X[1] = parseInt(X[1], 10) || 0; X[2] = parseInt(X[2], 10) || 0; return (Y[0] > X[0] || (Y[0] == X[0] && Y[1] > X[1]) || (Y[0] == X[0] && Y[1] == X[1] && Y[2] >= X[2])) ? true : false } function v(ac, Y, ad, ab) { if (M.ie && M.mac) { return } var aa = j.getElementsByTagName("head")[0]; if (!aa) { return } var X = (ad && typeof ad == "string") ? ad : "screen"; if (ab) { n = null; G = null } if (!n || G != X) { var Z = C("style"); Z.setAttribute("type", "text/css"); Z.setAttribute("media", X); n = aa.appendChild(Z); if (M.ie && M.win && typeof j.styleSheets != D && j.styleSheets.length > 0) { n = j.styleSheets[j.styleSheets.length - 1] } G = X } if (M.ie && M.win) { if (n && typeof n.addRule == r) { n.addRule(ac, Y) } } else { if (n && typeof j.createTextNode != D) { n.appendChild(j.createTextNode(ac + " {" + Y + "}")) } } } function w(Z, X) { if (!m) { return } var Y = X ? "visible" : "hidden"; if (J && c(Z)) { c(Z).style.visibility = Y } else { v("#" + Z, "visibility:" + Y) } } function L(Y) { var Z = /[\\\"<>\.;]/; var X = Z.exec(Y) != null; return X && typeof encodeURIComponent != D ? encodeURIComponent(Y) : Y } var d = function () { if (M.ie && M.win) { window.attachEvent("onunload", function () { var ac = I.length; for (var ab = 0; ab < ac; ab++) { I[ab][0].detachEvent(I[ab][1], I[ab][2]) } var Z = N.length; for (var aa = 0; aa < Z; aa++) { y(N[aa]) } for (var Y in M) { M[Y] = null } M = null; for (var X in swfobject) { swfobject[X] = null } swfobject = null }) } } (); return { registerObject: function (ab, X, aa, Z) { if (M.w3 && ab && X) { var Y = {}; Y.id = ab; Y.swfVersion = X; Y.expressInstall = aa; Y.callbackFn = Z; o[o.length] = Y; w(ab, false) } else { if (Z) { Z({ success: false, id: ab }) } } }, getObjectById: function (X) { if (M.w3) { return z(X) } }, embedSWF: function (ab, ah, ae, ag, Y, aa, Z, ad, af, ac) { var X = { success: false, id: ah }; if (M.w3 && !(M.wk && M.wk < 312) && ab && ah && ae && ag && Y) { w(ah, false); K(function () { ae += ""; ag += ""; var aj = {}; if (af && typeof af === r) { for (var al in af) { aj[al] = af[al] } } aj.data = ab; aj.width = ae; aj.height = ag; var am = {}; if (ad && typeof ad === r) { for (var ak in ad) { am[ak] = ad[ak] } } if (Z && typeof Z === r) { for (var ai in Z) { if (typeof am.flashvars != D) { am.flashvars += "&" + ai + "=" + Z[ai] } else { am.flashvars = ai + "=" + Z[ai] } } } if (F(Y)) { var an = u(aj, am, ah); if (aj.id == ah) { w(ah, true) } X.success = true; X.ref = an } else { if (aa && A()) { aj.data = aa; P(aj, am, ah, ac); return } else { w(ah, true) } } if (ac) { ac(X) } }) } else { if (ac) { ac(X) } } }, switchOffAutoHideShow: function () { m = false }, ua: M, getFlashPlayerVersion: function () { return { major: M.pv[0], minor: M.pv[1], release: M.pv[2]} }, hasFlashPlayerVersion: F, createSWF: function (Z, Y, X) { if (M.w3) { return u(Z, Y, X) } else { return undefined } }, showExpressInstall: function (Z, aa, X, Y) { if (M.w3 && A()) { P(Z, aa, X, Y) } }, removeSWF: function (X) { if (M.w3) { y(X) } }, createCSS: function (aa, Z, Y, X) { if (M.w3) { v(aa, Z, Y, X) } }, addDomLoadEvent: K, addLoadEvent: s, getQueryParamValue: function (aa) { var Z = j.location.search || j.location.hash; if (Z) { if (/\?/.test(Z)) { Z = Z.split("?")[1] } if (aa == null) { return L(Z) } var Y = Z.split("&"); for (var X = 0; X < Y.length; X++) { if (Y[X].substring(0, Y[X].indexOf("=")) == aa) { return L(Y[X].substring((Y[X].indexOf("=") + 1))) } } } return "" }, expressInstallCallback: function () { if (a) { var X = c(R); if (X && l) { X.parentNode.replaceChild(l, X); if (Q) { w(Q, true); if (M.ie && M.win) { l.style.display = "block" } } if (E) { E(B) } } a = false } } } } ();

