var DBG = {
	log : function(b) {
		try {
			if (window.console) {
				console.debug("FP: " + b)
			}
		} catch (a) {
		}
	}
};
(function(a) {
	a.cl_markFirstLastChild = function(b) {
		if (!b) {
			b = "ul, dl"
		}
		a(b).find(">:first-child").addClass("is-first").end().find(
				">:last-child").addClass("is-last").end()
	};
	a.cl_parseOpacity = function(b) {
		if (!b) {
			b = "body"
		}
		for ( var c = 0; c <= 10; c++) {
			a(b).find(".set-opacity_" + c).css("opacity", c / 10).end()
		}
	};
	a.extend( {
		getPlainObjectKeys : function(c) {
			var b = [];
			if (a.isPlainObject(c)) {
				a.each(c, function(d) {
					b.push(d)
				})
			}
			return b
		}
	});
	a.fn.prj_popup = function(b) {
		var d = {
			directories : "no",
			height : 800,
			left : 50,
			location : "no",
			menubar : "no",
			resizeable : "yes",
			scrollbars : "no",
			status : "no",
			top : 50,
			toolbar : "no",
			width : 600
		}, c = a.getPlainObjectKeys(d);
		return this.each(function() {
			if (a(this).getTag() == "a" && a(this).attr("href") != ""
					&& a(this).attr("href").substr(0, 1) != "#") {
				a(this).attr("target", "_blank");
				if (a.isFunction(a.metadata) || a.isPlainObject(a.metadata)) {
					if (b) {
						a.extend(d, b)
					}
					var e = a(this).metadata(), f = "";
					a.each(c, function(h, g) {
						v = (e[g] == undefined || e[g] == "") ? d[g] : e[g];
						f += ((f != "") ? "," : "") + g + "=" + v
					});
					a(this).data(
							"popup",
							{
								n : ((e.ident != undefined) ? e.ident : "pp"
										+ Math.ceil(Math.random() * 9999)),
								p : f
							});
					a(this).bind(
							"open",
							function() {
								var g = window.open(a(this).attr("href"), a(
										this).data("popup").n, a(this).data(
										"popup").p);
								g.focus();
								DBG
										.log("PopUp:" + a(this).attr("href")
												+ "; Name="
												+ a(this).data("popup").n
												+ "; Params="
												+ a(this).data("popup").p)
							}).click(function(g) {
						g.preventDefault();
						a(this).trigger("open")
					}).keypress(function(g) {
						g.preventDefault();
						if (g.keyCode == 13) {
							a(this).trigger("open")
						}
					})
				}
			}
		})
	};
	a.prj_overlay = function(e, b) {
		var c = function(k, j, f, h) {
			var g = "", i = ((k && k.length > 0) ? '<span class="title">' + k
					+ "</span>" : "");
			if (i !== "") {
				if (j.length > 1) {
					i += '<span class="count">' + (f + 1) + " / " + j.length
							+ "</span>"
				}
				g = '<div class="fancybox-title_container"><div class="fancybox-title_content">' + i + '<div class="clearfloat">&nbsp;</div></div><span class="fancybox-title_toggle">&nbsp;</span><div class="clearfloat">&nbsp;</div></div>'
			}
			return g
		}, d = {
			centerOnScroll : true,
			margin : 10,
			overlayColor : "#fff",
			overlayOpacity : 0.8,
			padding : 5,
			titleFormat : c,
			titlePosition : "over",
			onComplete : function() {
				var g = a("#fancybox-title .fancybox-title_content"), f = a("#fancybox-title .fancybox-title_toggle");
				a("#fancybox-title").bind( {
					mouseleave : function() {
						g.slideUp(250);
						f.removeClass("fancybox-title_toggle-do_close")
					},
					mouseenter : function() {
						g.slideDown(250);
						f.addClass("fancybox-title_toggle-do_close")
					}
				})
			}
		};
		if (!e || a(e).length < 1) {
			e = document.body
		}
		if (b) {
			a.extend(d, b)
		}
		if (a("a.jq-overlay", a(e)).length > 0) {
			a("a.jq-overlay", a(e)).each(
					function() {
						var f = d;
						if (a(this).parent().parent()
								.find(".img-info .caption").length > 0) {
							f.title = a(this).parent().parent().find(
									".img-info .caption").html()
						}
						a(this).fancybox(f).end()
					})
		}
		if (a("a.jq-overlay_web", a(e)).length > 0) {
			a("a.jq-overlay_web", a(e)).each(function() {
				var f = {
					height : 560,
					showCloseButton : false,
					showNavArrows : false,
					width : 780
				}, g = {};
				if (a.isFunction(a.metadata) || a.isPlainObject(a.metadata)) {
					g = a(this).metadata()
				}
				a(this).fancybox(a.extend( {}, d, f, g, {
					autoScale : false,
					type : "iframe"
				}))
			})
		}
		if (a("a.jq-overlay_inline", a(e)).length > 0) {
			a("a.jq-overlay_inline", a(e)).each(function() {
				var g = {};
				if (a.isFunction(a.metadata) || a.isPlainObject(a.metadata)) {
					g = a(this).metadata();
					var f = {};
					if (g.height != undefined) {
						f.height = g.height
					}
					if (g.width != undefined) {
						f.width = g.width
					}
					a(a(this).attr("href")).css(f)
				}
				a(this).fancybox(a.extend( {}, d, g))
			})
		}
	};
	a.fn.prj_zebra = function(b) {
		var c = {
			classEven : "even",
			classOdd : "odd"
		};
		return this.each(function() {
			if (b) {
				a.extend(c, b)
			}
			if (a(this).getTag() == "table") {
				a(this).find(">tbody > tr:odd, >tbody > tr:odd td,").addClass(
						c.classOdd);
				a(this).find(">tbody > tr:even, >tbody > tr:even td").addClass(
						c.classEven)
			} else {
				a(this).children(":odd").addClass(c.classOdd);
				a(this).children(":even").addClass(c.classEven)
			}
		})
	}
})(jQuery);
$(document).bind( {
	"available.wave" : function(a) {
		$("#welle1").pan( {
			depth : 30,
			dir : "left",
			fps : 30,
			speed : 2
		});
		$("#welle2").pan( {
			depth : 40,
			dir : "right",
			fps : 30,
			speed : 2
		});
		$("#welle2, #welle1").spRelSpeed(4);
		window.actions = {
			fly_slowly_forwards : function() {
				$("#welle2, #welle1").spRelSpeed(10).spChangeDir("left")
			}
		};
		window.page = {
			hide_panels : function() {
				$(".wellen").hide(300)
			},
			show_panel : function(b) {
				this.hide_panels();
				$(b).show(300)
			}
		}
	}
});
