﻿var mediaplayer = { mediaContainer: null, stage: null, controlsBottom: null, lblPos: null, currentIndex: 0, playlist: [], init: function() { if ($("a.video, a.image").length == 0) return false; this.mediaContainer = $('<div id="mediaContainer"><div class="mediaBg"></div><div class="mediaBox"><img height="526" width="667" alt="" src="http://1.s.eps-server.de/skin/mplayer/mbBack.png" class="mediaBg"><div class="controlsTop"><span></span><img class="close" src="http://1.s.eps-server.de/' + settings.culture + '/skin/mbControls.gif" alt="' + resources.mplayer.closeWindow + '" /></div><div class="stage"></div><div class="controlsBottom"><img class="prev" src="http://1.s.eps-server.de/' + settings.culture + '/skin/mbControls.gif" alt="' + resources.mplayer.prevImage + '" /><img class="next" src="http://1.s.eps-server.de/' + settings.culture + '/skin/mbControls.gif" alt="' + resources.mplayer.nextImage + '" /></div></div></div>').appendTo(document.body); this.stage = this.mediaContainer.find("div.stage"); this.lblPos = this.mediaContainer.find("div.controlsTop span"); this.controlsBottom = this.mediaContainer.find("div.controlsBottom"); this.controlsBottom.find(".next").click(function() { var next = mediaplayer.currentIndex + 1; if (next > mediaplayer.playlist.length - 1) next = 0; mediaplayer.gotoIndex(next) }); this.controlsBottom.find(".prev").click(function() { var next = mediaplayer.currentIndex - 1; if (next < 0) next = (mediaplayer.playlist.length - 1); mediaplayer.gotoIndex(next) }); this.mediaContainer.find("img.close, div.mediaBg").click(function() { mediaplayer.hide() }); $("a.video").click(function(e) { e.preventDefault(); mediaplayer.playlist = [{ "type": "video", "url": this.href, "name": "", "description": ""}]; mediaplayer.play(0) }); mediaplayer.playlist = new Array(); $("a.image").each(function() { var $this = $(this); var name = this.title.split("|"); mediaplayer.playlist[mediaplayer.playlist.length] = { "type": "image", "url": this.href, "name": name[0], "description": name[1] }; var index = mediaplayer.playlist.length - 1; $this.click(function(e) { e.preventDefault(); mediaplayer.play(index) }) }) }, show: function() { $(document.body).addClass("popup"); this.mediaContainer.fadeIn("fast") }, hide: function() { this.stage.html(""); this.mediaContainer.fadeOut("fast", function() { $(document.body).removeClass("popup") }) }, play: function(index) { if (this.playlist.length == 1) { this.controlsBottom.hide(); this.lblPos.hide() } else { this.controlsBottom.show(); this.lblPos.show() } this.gotoIndex(index); this.show() }, gotoIndex: function(index) { var mediaItem = this.playlist[index]; switch (mediaItem.type) { case "video": this.stage.html('<div id="videoplayer"><a target="_blank" href="http://www.adobe.com/go/getflashplayer"><img src="http://1.s.eps-server.de/skin/mplayer/getflash.gif" alt="Flash Player needed" /><span><strong>You can download the player at:</strong><br />http://www.adobe.com/go/getflashplayer</span></a></div>'); swfobject.embedSWF("/lib/x/player-licensed.swf", "videoplayer", "400", "320", settings.flashVersion, "expressInstall.swf", { "file": mediaItem.url, "width": "400", "height": "320", "controlbar": "over", "autostart": "true", "type": "video" }, { allowfullscreen: "true", wmode: "transparent" }); break; case "image": this.lblPos.html(resources.mplayer.lblPosImage + " " + (index + 1) + " " + resources.mplayer.lblPosOf + " " + (this.playlist.length)); this.stage.html('<img src="' + mediaItem.url + '" alt="' + mediaItem.name + '" /><span><strong>' + mediaItem.name + '</strong><br />' + mediaItem.description + '</span>'); break } this.currentIndex = index } }; var infoForm = { init: function() { if ($(".infomaterial").length == 0) return; var setGroup = function(productsBox) { if (productsBox.prevAll("input:first").is(":checked")) { productsBox.slideDown("fast") } else { if (!productsBox.is(":has(input:checked)")) { productsBox.slideUp("fast") } } }; $(".infomaterial > div > input").change(function() { var productsBox = $(this).nextAll("div.products:first"); setGroup(productsBox) }); $(".infomaterial div.products input").change(function() { var productsBox = $(this).closest("div.products"); setGroup(productsBox) }); $(".infomaterial div.products:not(:has(input:checked))").hide() } }; var rtSearch = { init: function() { var rtContainer = $("div.rtSearch"); if (rtContainer.length == 0) return; $.expr[':'].icontains = function(obj, index, meta, stack) { return (obj.textContent || obj.innerText || jQuery(obj).text() || '').toLowerCase().indexOf(meta[3].toLowerCase()) >= 0 }; rtContainer.find("input[type=text]").keyup(function() { var val = $(this).val(); if (val.length == 0) { rtContainer.find("dl dt").show().next("dd").show() } else { rtContainer.find("dl dt:icontains(" + val + ")").show().next("dd").show(); rtContainer.find("dl dt:not(:icontains(" + val + "))").hide().next("dd").hide() } }) } }; var settings = { culture: 'en-us', flashVersion: '9.0.115' }; $(function() { settings.culture = $("html").attr("lang"); $.getScript("http://s.eps-server.de/" + settings.culture + "/resources.js", function() { $("ul.nav > li > a, div.head .langSelector").hover(function(e) { var $this = $(this); var mouseIn = e.type == "mouseenter"; $this.toggleClass("hover", mouseIn) }); $("div.head .langSelector strong").click(function() { $(this).closest("div").addClass("hover") }); mediaplayer.init() }); $("#ddJumpTo").load("/lib/x/JumpTo.aspx?lang=" + settings.culture, function() { $(this).change(function() { document.location.href = ($(this).val()) }) }); $("input[type=text][title], textarea[title]").focus(function() { if (this.value == this.title) { this.value = ''; $(this).removeClass('tooltip') } this.focused = true }).blur(function() { if (this.value.length == 0) { this.value = this.title; $(this).addClass('tooltip'); this.focused = false } }).each(function() { if (this.value.length == 0) { $(this).addClass('tooltip'); this.value = this.title } }).closest("form").submit(function() { $("input.tooltip[type=text][title], textarea.tooltip[title]").val("") }); rtSearch.init(); infoForm.init(); $.getScript("http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4c092fb3749b4aa5") });
