(function(a) { a.fn.G5PopUp = function(k) { function s(c, h, d) { if (c.length == 0) return false; a(".popupContent").css("background", "#ffffff url(" + b.imageLoading + ") center center no-repeat"); a(".popupCaption").remove(); a(".popupDescription").remove(); a(".popupInner").remove(); a(".popupPrev").attr("src", b.imagePrev); a(".popupNext").attr("src", b.imageNext); h == "undefined" && (h = ""); d == "undefined" && (d = ""); g.length > 0 && b.mediaCounterVisible == true && a(".popupMediaCount").text(b.mediaCounterTxt1 + (f + 1) + b.mediaCounterTxt2 + g.length); a(".popupContent").append("<div class='popupInner'></div>"); a(".popupInner").append("<div class='popupCaption'></div>"); b.title_pos == "bottom" && b.descr_pos == "top" ? a(".popupCaption").before("<div class='popupDescription'></div>") : a(".popupCaption").after("<div class='popupDescription'></div>"); a(".popupInner").css("display", "none"); a(".popupInner").css("opacity", 1); a(".popupInner").css("text-align", "center"); var e = new String(c); D(e, function(e, u) { e == "error" ? u == "image" ? (a(".popupCaption").html("<b>Fehler beim Laden der Abbildung!</b>"), a(".popupInner").append("Die gew&uuml;nschte Abbildung wurde nicht gefunden!<br>" + c)) : (a(".popupCaption").html("<b>Fehler beim Laden des Inhalts!</b>"), a(".popupInner").append("Der gew&uuml;nschte Inhalt wurde nicht gefunden!<br>" + c)) : (a(".popupCaption").html("" + h + ""), h.length == 0 && a(".popupCaption").css("display", "none"), a(".popupDescription").html("" + d + ""), d.length == 0 && a(".popupDescription").css("display", "none"), b.title_pos == "bottom" && b.descr_pos == "bottom" ? a(".popupInner").prepend(e) : b.title_pos == "top" && b.descr_pos == "bottom" ? a(".popupCaption").after(e) : b.descr_pos == "top" && a(".popupDescription").after(e)); var i = a(".popupInner").width(), j = a(".popupInner").height(); v(i, j, function() { a(".popupContent").css("background-image", "none"); a(".popupInner").fadeIn(b.speed); if (u == "image" && e != "error" && g.length > 1) { var c = a(".popupInner > img"), h = c.position().top, c = c.height(); a(".popupInner").append("<div class='popupPrevOverlay'></div>"); a(".popupPrevOverlay").css("position", "absolute"); a(".popupPrevOverlay").css("top", h); a(".popupPrevOverlay").css("left", 0); a(".popupPrevOverlay").css("height", c); a(".popupPrevOverlay").css("width", "45%"); a.browser.msie && (a(".popupPrevOverlay").css("opacity", 0), a(".popupPrevOverlay").css("background", "white")); a(".popupPrevOverlay").css("cursor", "pointer"); a(".popupPrevOverlay").unbind("click").click(function() { a(".popupPrev").click() }); a(".popupPrevOverlay").hover(function() { var c = a(".popupPrevOverlay"); a(".popupPrev").mouseenter(); b.imageNextHoverOverlay.length > 0 && c.css("background", "url(" + b.imagePrevHoverOverlay + ") left center no-repeat"); a.browser.msie && c.css("opacity", 0.9) }, function() { var b = a(".popupPrevOverlay"); a.browser.msie ? (b.css("background", "white"), b.css("opacity", 0)) : b.css("background", "none"); a(".popupPrev").mouseleave() }); a(".popupInner").append("<div class='popupNextOverlay'></div>"); a(".popupNextOverlay").css("position", "absolute"); a(".popupNextOverlay").css("top", h); a(".popupNextOverlay").css("right", 0); a(".popupNextOverlay").css("height", c); a(".popupNextOverlay").css("width", "45%"); a.browser.msie && (a(".popupNextOverlay").css("opacity", 0), a(".popupNextOverlay").css("background", "white")); a(".popupNextOverlay").css("cursor", "pointer"); a(".popupNextOverlay").unbind("click").click(function() { a(".popupNext").click() }); a(".popupNextOverlay").hover(function() { var c = a(".popupNextOverlay"); a(".popupNext").mouseenter(); b.imagePrevHoverOverlay.length > 0 && c.css("background", "url(" + b.imageNextHoverOverlay + ") right center no-repeat"); a.browser.msie && c.css("opacity", 0.9) }, function() { var b = a(".popupNextOverlay"); a.browser.msie ? (b.css("background", "white"), b.css("opacity", 0)) : b.css("background", "none"); a(".popupNext").mouseleave() }) } a.browser.msie && !l && (i = a(".popupInner").width(), j = a(".popupInner").height(), v(i, j)) }); f + 1 <= g.length - 1 && E(new String(g[f + 1][0])); return false }); F() } function D(c, h) { if (c.substr(c.length - 3, 3) == "jpg" || c.substr(c.length - 3, 3) == "png" || c.substr(c.length - 3, 3) == "gif") { var d = t(c); if (d == null) d = new Image, d.onload = function() { w(c, d); var b = a("<img src='" + c + "' alt='' />"); b.css("width", d.width); b.css("height", d.height); d.onload = function() { }; d.onerror = function() { }; h(b, "image") }, d.onerror = function() { d.onload = function() { }; d.onerror = function() { }; h("error", "image") }, d.src = c; else { var e = a("<img src='" + c + "' alt='' />"); e.css("width", d.width); e.css("height", d.height); h(e, "image") } } else { var g = false, f = false, e = void 0; a.ajax({ type: "get", url: c, cache: true, dataType: b.ajaxDataType, error: function() { g || (g = true) }, success: function(a) { e = a }, complete: function() { f || (f = true, g ? h("error", "content") : h(e, "content")) } }) } } function E(a) { if (t(a) == null) { var b = new Image; b.onload = function() { w(a, b) }; b.src = a } } function w(a, b) { t(a) == null && o.push([a, b]) } function t(a) { for (var b = 0; b < o.length; b++) if (o[b][0].toString() == a) return o[b][1]; return null } function v(c, h, d) { var e = a(".popupContent").position().left, g = a(".popupContent").position().top, f = a(".popupContent").width(), i = 0; if (c < b.minWidth) c = b.minWidth; i = f < c ? e - (c - f) / 2 : f > c ? e + (f - c) / 2 : e; a(".popupContent").animate({ left: i, top: g, width: c, height: h }, { step: function(c, d) { switch (d.prop) { case "left": a(".popupBorder").css(d.prop, c - b.border); break; case "top": a(".popupBorder").css(d.prop, c - b.border); break; case "width": a(".popupBorder").css(d.prop, c + 2 * b.padding + 2 * b.border); break; case "height": a(".popupBorder").css(d.prop, c + 2 * b.padding + 2 * b.border) } }, complete: function() { a.isFunction(d) && d(); l || x(true); if (y < a(document).width() || z < a(document).height()) y = a(document).width(), z = a(document).height(), p() } }) } function x(c) { var h = a(".popupContent").position().top - 14, d = a(".popupContent").position().left, e = a(".popupContent").width() + 2 * b.padding; d += e / 2 - a(".popupToolbar").width() / 2; l || (a(".popupToolbar").css("left", d), a(".popupToolbar").css("display", "block"), l = true); c ? a(".popupToolbar").animate({ left: d, top: h }) : (a(".popupToolbar").css("left", d), a(".popupToolbar").css("top", h)) } function p() { var c, h; window.innerHeight && window.scrollMaxY ? (c = window.innerWidth + window.scrollMaxX, h = window.innerHeight + window.scrollMaxY) : document.body.scrollHeight > document.body.offsetHeight ? (c = document.body.scrollWidth, h = document.body.scrollHeight) : (c = document.body.offsetWidth, h = document.body.offsetHeight); var d, e; if (self.innerHeight) d = document.documentElement.clientWidth ? document.documentElement.clientWidth : self.innerWidth, e = self.innerHeight; else if (document.documentElement && document.documentElement.clientHeight) d = document.documentElement.clientWidth, e = document.documentElement.clientHeight; else if (document.body) d = document.body.clientWidth, e = document.body.clientHeight; pageHeight = h < e ? e : h; pageWidth = c < d ? c : d; c = arrayPageSize = [pageWidth, pageHeight, d, e]; var f, g; if (self.pageYOffset) g = self.pageYOffset, f = self.pageXOffset; else if (document.documentElement && document.documentElement.scrollTop) g = document.documentElement.scrollTop, f = document.documentElement.scrollLeft; else if (document.body) g = document.body.scrollTop, f = document.body.scrollLeft; f = arrayPageScroll = [f, g]; a(".popupOverlay").css("width", c[0]); a(".popupOverlay").css("height", c[1]); g = c[2]; h = a(".popupContent").width(); d = a(".popupContent").height(); var i = e = 0; b.center == true ? (e = g / 2 - h / 2, i = f[1] + c[3] / 20, i < 20 && (i = 20), e < 10 && (e = 10)) : (i = b.top, e = b.left); a(".popupBorder").css("top", i - b.border); a(".popupBorder").css("left", e - b.border); a(".popupBorder").css("width", h + 2 * b.padding + 2 * b.border); a(".popupBorder").css("height", d + 2 * b.padding + 2 * b.border); a(".popupContent").css("top", i); a(".popupContent").css("left", e); l && x(false) } function G() { q(); r(); m = j = f = 0; l = n = false; o.length = 0; a(".popupContent").unbind("click"); a(".popupBorder").unbind("click"); a(".popupOverlay").unbind("click"); a(".popupContent").fadeOut(b.speed); a(".popupBorder").fadeOut(b.speed); a(".popupOverlay").fadeOut(b.speed); a(".popupToolbar").fadeOut(b.speed); a(".popupContent").remove(); a(".popupBorder").remove(); a(".popupOverlay").remove(); a(".popupToolbar").remove(); a(window).unbind("resize"); a(document).unbind("resize") } function A() { f++; f == g.length && (f = 0); var a = g[f]; s(a[0], a[1], a[2]) } function F() { q(); a(document).keydown(function(c) { c == null ? (keycode = event.keyCode, escapeKey = 27) : (keycode = c.keyCode, escapeKey = c.DOM_VK_ESCAPE); key = String.fromCharCode(keycode).toLowerCase(); (key == b.keyToClose || key == "x" || keycode == escapeKey) && a(".popupClose").click(); if ((key == b.keyToPrev || keycode == 37) && g.length > 1) q(), a(".popupPrev").click(); if ((key == b.keyToNext || keycode == 39) && g.length > 1) q(), a(".popupNext").click() }) } function q() { a(document).unbind("keydown") } function B() { b.autoplay > 0 && j == 0 && n == false && (a(".popupAutoPlay").hide(), a(".popupAutoPlayStop").show(), a(".popupTimerCount").show(), C()) } function r() { n = true; j != 0 && (clearTimeout(j), j = 0, a(".popupAutoPlay").show(), a(".popupAutoPlayStop").hide(), a(".popupTimerCount").hide()); m = 0 } function C() { b.autoplay > 0 && n == false && (m == b.autoplay && (A(), m = 0), j != 0 && clearTimeout(j), a(".popupTimerCount").text(b.autoplayTxt1 + (b.autoplay - m) + b.autoplayTxt2), j = setTimeout(function() { C() }, 1E3), m++) } var b = { speed: 500, center: true, autoplay: 0, left: 500, top: 500, opacity: 0.7, descr_pos: "top", title_pos: "top", minWidth: 400, minHeight: 150, padding: 10, border: 5, borderColor: "#000000", borderOpacity: 0.3, toolbarBorder: 1, toolbarBorderColor: "gray", mediaCounterVisible: true, mediaCounterTxt1: "Bild ", mediaCounterTxt2: " von ", autoplayTxt1: "", autoplayTxt2: " sek.", imageLoading: "G5PopUp/img/loading.gif", imageToolbarBackground: "G5PopUp/img/menuBg.png", imageNext: "G5PopUp/img/gray_right.png", imageNextHover: "G5PopUp/img/green_right.png", imageNextHoverOverlay: "G5PopUp/img/overlayArrowNext.png", imagePrev: "G5PopUp/img/gray_left.png", imagePrevHover: "G5PopUp/img/green_left.png", imagePrevHoverOverlay: "G5PopUp/img/overlayArrowPrev.png", imageClose: "G5PopUp/img/gray_close.png", imageCloseHover: "G5PopUp/img/red_close.png", imageAutoPlay: "G5PopUp/img/gray_play.png", imageAutoPlayHover: "G5PopUp/img/green_play.png", imageAutoPlayStop: "G5PopUp/img/green_play.png", imageAutoPlayStopHover: "G5PopUp/img/green_pause.png", tooltipNext: "Weiter (oder mit < n >)", tooltipPrev: "Zur&uuml;ck (oder mit < p >)", tooltipClose: "Schlie&szlig;en (oder mit < c >)", tooltipAutoPlay: "Autoplay starten", tooltipAutoPlayStop: "Autoplay anhalten", keyToClose: "c", keyToPrev: "p", keyToNext: "n", ajaxDataType: "html" }, k = a.extend(b, k), f = 0, g = [], j = 0, m = 0, n = false, l = false, y = a(document).width(), z = a(document).height(), o = []; this.each(function() { g.push([new String(a(this).attr("href")), new String(a(this).attr("title")), new String(a(this).attr("descr"))]) }); k = document.getElementById("popupMainDiv"); k == null && (k = document.createElement("div"), k.setAttribute("id", "popupMainDiv"), document.body.insertBefore(k, document.body.childNodes[0])); return this.unbind("click").click(function() { if (a(".popupOverlay").length == 0) { var c = a("#popupMainDiv"); c.prepend("<div class='popupOverlay'></div>"); a(".popupOverlay").css("position", "absolute"); a(".popupOverlay").css("top", 0); a(".popupOverlay").css("left", 0); a(".popupOverlay").css("display", "none"); a(".popupOverlay").css("z-index", 2); a(".popupOverlay").css("opacity", b.opacity); a(".popupOverlay").css("opacity", 0.1); a(".popupOverlay").css("background", "#111111"); c.prepend("<div class='popupBorder'></div>"); a(".popupBorder").css("position", "absolute"); a(".popupBorder").css("background", b.borderColor); a(".popupBorder").css("opacity", b.borderOpacity); a(".popupBorder").css("display", "none"); a(".popupBorder").css("z-index", 3); a(".popupBorder").css("-moz-border-radius", 10); a(".popupBorder").css("-webkit-border-radius", 10); a(".popupBorder").css("border-radius", 10); c.prepend("<div class='popupContent'></div>"); a(".popupContent").css("position", "absolute"); a(".popupContent").css("background", "#ffffff"); a(".popupContent").css("padding", b.padding); a(".popupContent").css("display", "none"); a(".popupContent").css("min-width", b.minWidth); a(".popupContent").css("min-height", b.minHeight); a(".popupContent").css("z-index", 7); a(".popupContent").css("-moz-border-radius", 10); a(".popupContent").css("-webkit-border-radius", 10); a(".popupContent").css("border-radius", 10); c.prepend("<div class='popupToolbar'></div>"); a(".popupToolbar").css("position", "absolute"); a(".popupToolbar").css("z-index", 8); a(".popupToolbar").css("display", "none"); b.imageToolbarBackground.length > 0 ? a(".popupToolbar").css("background", "url(" + b.imageToolbarBackground + ") repeat-x") : a(".popupToolbar").css("background", "gray"); a(".popupToolbar").css("opacity", 0.9); b.toolbarBorder > 0 && b.toolbarBorderColor.length > 0 && a(".popupToolbar").css("border", b.toolbarBorder + "px solid " + b.toolbarBorderColor); a(".popupToolbar").css("-moz-border-radius", 15); a(".popupToolbar").css("-webkit-border-radius", 15); a(".popupToolbar").css("border-radius", 15); c = 30; g.length > 1 && (a(".popupToolbar").prepend("<img class='popupPrev' src='" + b.imagePrev + "' title='" + b.tooltipPrev + " (oder mit Taste &quot;" + b.keyToPrev.toUpperCase() + "&quot;)' />"), a(".popupPrev").css("position", "absolute"), a(".popupPrev").css("left", c), a(".popupPrev").css("display", "none"), a(".popupPrev").css("cursor", "pointer"), a(".popupPrev").unbind("mouseenter").mouseenter(function() { a(this).attr("src", b.imagePrevHover) }), a(".popupPrev").unbind("mouseleave").mouseleave(function() { a(this).attr("src", b.imagePrev) }), c += 50, a(".popupToolbar").append("<div class='popupMediaCount'></div>"), a(".popupMediaCount").css("display", "none"), a(".popupMediaCount").css("position", "absolute"), a(".popupMediaCount").css("left", c), a(".popupMediaCount").css("top", 3), a(".popupMediaCount").css("width", 100), a(".popupMediaCount").css("font-family", "Verdana"), a(".popupMediaCount").css("font-size", 10), a(".popupMediaCount").css("text-align", "center"), a(".popupMediaCount").css("background", "white"), c += 120, a(".popupToolbar").prepend("<img class='popupNext' src='" + b.imageNext + "' title='" + b.tooltipNext + " (oder mit Taste &quot;" + b.keyToNext.toUpperCase() + "&quot;)' />"), a(".popupNext").css("position", "absolute"), a(".popupNext").css("left", c), a(".popupNext").css("display", "none"), a(".popupNext").css("cursor", "pointer"), a(".popupNext").unbind("mouseenter").mouseenter(function() { a(this).attr("src", b.imageNextHover) }), a(".popupNext").unbind("mouseleave").mouseleave(function() { a(this).attr("src", b.imageNext) }), c += 50, b.autoplay > 0 && (a(".popupToolbar").prepend("<img class='popupAutoPlay' src='" + b.imageAutoPlay + "' title='" + b.tooltipAutoPlay + "' />"), a(".popupAutoPlay").css("position", "absolute"), a(".popupAutoPlay").css("left", c), a(".popupAutoPlay").css("display", "none"), a(".popupAutoPlay").css("cursor", "pointer"), a(".popupAutoPlay").unbind("mouseenter").mouseenter(function() { a(this).attr("src", b.imageAutoPlayHover) }), a(".popupAutoPlay").unbind("mouseleave").mouseleave(function() { a(this).attr("src", b.imageAutoPlay) }), a(".popupToolbar").prepend("<img class='popupAutoPlayStop' src='" + b.imageAutoPlayStop + "' title='" + b.tooltipAutoPlayStop + "' />"), a(".popupAutoPlayStop").css("position", "absolute"), a(".popupAutoPlayStop").css("left", c), a(".popupAutoPlayStop").css("display", "none"), a(".popupAutoPlayStop").css("cursor", "pointer"), a(".popupAutoPlayStop").unbind("mouseenter").mouseenter(function() { a(this).attr("src", b.imageAutoPlayStopHover) }), a(".popupAutoPlayStop").unbind("mouseleave").mouseleave(function() { a(this).attr("src", b.imageAutoPlayStop) }), c += 31, a(".popupToolbar").append("<div class='popupTimerCount'></div>"), a(".popupTimerCount").css("display", "none"), a(".popupTimerCount").css("position", "absolute"), a(".popupTimerCount").css("left", c), a(".popupTimerCount").css("top", 3), a(".popupTimerCount").css("width", 50), a(".popupTimerCount").css("font-family", "Verdana"), a(".popupTimerCount").css("font-size", 10), a(".popupTimerCount").css("text-align", "center"), a(".popupTimerCount").css("background", "white"), c += 70)); a(".popupToolbar").prepend("<img class='popupClose' src='" + b.imageClose + "' title='" + b.tooltipClose + " (oder mit Taste &quot;" + b.keyToClose.toUpperCase() + "&quot;)' />"); a(".popupClose").css("position", "absolute"); a(".popupClose").css("left", c); a(".popupClose").css("cursor", "pointer"); a(".popupClose").unbind("mouseenter").mouseenter(function() { a(this).attr("src", b.imageCloseHover) }); a(".popupClose").unbind("mouseleave").mouseleave(function() { a(this).attr("src", b.imageClose) }); c += 60; a(".popupToolbar").css("width", c); a(".popupToolbar").css("height", 20); a(window).unbind("resize").resize(p); a(document).unbind("resize").resize(p); g.length > 1 && (a(".popupPrev").unbind("click").click(function() { f--; f < 0 && (f = g.length - 1); var a = g[f]; s(a[0], a[1], a[2]); r() }), a(".popupNext").unbind("click").click(function() { A(); r() }), b.mediaCounterVisible == true && a(".popupMediaCount").css("display", "block"), b.autoplay > 0 && (a(".popupAutoPlay").click(function() { n = false; B() }), a(".popupAutoPlayStop").click(function() { n = true; r() }))); a(".popupClose").unbind("click").click(G); a(".popupOverlay").unbind("click").click(function() { a(".popupClose").click() }) } a(".popupOverlay").fadeIn(b.speed); a(".popupBorder").show(b.speed); a(".popupContent").show(b.speed); g.length > 1 && (a(".popupPrev").show(b.speed), a(".popupNext").show(b.speed)); B(); p(); c = new String(a(this).attr("href")); for (f = 0; g[f][0].toString() != c.toString(); ) if (f++, f == g.length) { f = 0; break } c = g[f]; s(c[0], c[1], c[2]); return false }) } })(jQuery);
