﻿jQuery.fn.supersleight = function(settings) { settings = jQuery.extend({ imgs: true, backgrounds: true, shim: 'transparent.gif', apply_positioning: true }, settings); return this.each(function(){
if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
jQuery(this).find('*').andSelf().each(function(i,obj) { var self = jQuery(obj); if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) { var bg = self.css('background-image'); var src = bg.substring(5,bg.length-2); var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale'); var styles = { 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')", 'background-image': 'url('+settings.shim+')' }; self.css(styles); };
if (settings.imgs && self.is('img[src$=png]')){ var styles = { 'width': self.width() + 'px', 'height': self.height() + 'px', 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')" }; self.css(styles).attr('src', settings.shim); }; if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){ self.css('position', 'relative'); }; }); }; }); };


$(document).ready(function(){


    //flowplayer
   if ($("DIV.Content .ContentImg A.flowplayer").length) {
    /*
            var expose = $("a.flowplayer").expose({ 
             
                 // return exposing API 
                 api: true, 
             
             
                 // use our customized mask 
                 maskId: 'exposeMask', 
             
                 // mask shows only 10% of the content through 
                 opacity: 0.9, 
             
                 // close expose slowly 
                 closeSpeed: 'slow', 
             
                 // we only want to close exposing when playback is finished 
                 // (or the ESC button is pressed) 
                 closeOnClick: false, 
             
                 // when the mask closes, alter its background color 
                 onBeforeClose: function() { 
                      this.getMask().css({backgroundColor: '#b8128f'}); 
                      $f().pause(); 
                 },
        
                 // when the mask loads again, use the original background color 
                 onBeforeLoad: function() {
                      this.getMask().css({backgroundColor: null}); 
                 }
            });
    */
            var flowplayerDefaults = {
                 playerURI: "/js/flowplayer.commercial-3.1.5.swf",
                 config: {
                      key: '#@90b2b6474ecdfad7c37',
                      plugins: {
                            controls: {
                                 url: '/js/flowplayer.controls-3.1.5.swf',
                                 autoPlay: true,
                                 backgroundColor: '#333333',
                                 backgroundGradient: 'low',
                                 all: false,
                                 play: true,
                                 time: false,
                                 scrubber: true,
                                 mute: true,
                                 fullscreen:true,
                                 height: 25,
                                 progressColor: '#999999',
                                 bufferColor: '#333333',
                                 opacity: 0.5,
                                 autoHide: 'always'
                            }
                      },
                                onBeforeClick: function() {
                                    // unload previously loaded player
                                    $f().unload();
                                    // get wrapper element as jQuery object
                                    var wrap = $(this.getParent());
                                    wrap.parent().addClass('FullWidth');
                                    // hide nested play button
                                    wrap.find("img").fadeOut();
                                    // start growing animation
                                    wrap.animate({width:420, height:280}, 500, function() {
                                        // when animation finishes we will load our player
                                        $f(this).load();
                                    });
                                    // disable default click behaviour (player loading)
                                    return false;
                                },
                                // unload action resumes to original state
                                onUnload: function() {
                                    var wrap = $(this.getParent());
                                    wrap.parent().removeClass('FullWidth');
                                    $(this.getParent()).animate({width:235, height:146}, 500, function()  {
                                        // make play button visible again
                                        $(this).find("img").fadeIn();
                                    });
                                },
                     // when playback finishes perform our custom unload action
                     onFinish: function() {
                          this.unload();
                     },
                     /* expose-plugin */
                     // when playback starts/resume, perform exposing 
                     onStart: function() {
                          /* expose.load(); */
                     },
                     onResume: function() { 
                          /* expose.load(); */
                     }, 
                     onPause: function() {
                          this.unload();
                         /* expose.close(); */
                     } 
                 }
            };
                
            var flowplayerWide = {
                 playerURI: "/js/flowplayer.commercial-3.1.5.swf",
                 config: {
                      key: '#@90b2b6474ecdfad7c37',
                      plugins: {
                            controls: {
                                 url: '/js/flowplayer.controls-3.1.5.swf',
                                 autoPlay: true,
                                 backgroundColor: '#333333',
                                 backgroundGradient: 'low',
                                 all: false,
                                 play: true,
                                 time: false,
                                 scrubber: true,
                                 mute: true,
                                 fullscreen:true,
                                 height: 25,
                                 progressColor: '#999999',
                                 bufferColor: '#333333',
                                 opacity: 0.5,
                                 autoHide: 'always'
                            }
                      }
                 }
            };
              //und die Auslöser dazu
              $("DIV.Content .ContentImg A.flowplayer").flowplayer(
                    flowplayerDefaults.playerURI,
                    flowplayerDefaults.config
              );
              $("DIV.Content .ContentImg A.flowplayerwide").flowplayer(
                    flowplayerWide.playerURI,
                    flowplayerWide.config
              );

              /* lupe: totsetzen */
              var p= $("DIV.Content .ContentImg A.flowplayer").parent();
              $("div.ImgText a",p).css('display','none');
              var p= $("DIV.Content .ContentImg A.flowplayerwide").parent();
              $("div.ImgText a",p).css('display','none');
              
          } /* flowplayer-END */

    //Tabellenzellen einfärben
    $("div.Content table tr:even").addClass("Odd");
    $("div.Content table tr:eq(0)").addClass("th");

    $('#showFragen').click(function(){
            //allelayeraus();
            $('#LayerFragen').show();
    });

    // schliessen
    $('.closeLayer').click($.unblockUI);
    // contactlayer
    $('#linkContact').click(function() {
        $.blockUI({
            message: $('#contactlayer'),
            css: {
                border: 'none',
                backgroundColor: '',
                cursor: 'auto',
                top: '80px',
                left: ($(window).width() - 490) /2 + 'px',
                position: 'absolute'
            }
        });
        $('.blockOverlay').css("cursor", "default").click($.unblockUI);
    });
    //init IE6-Patch
    $('body').supersleight({shim: '/images/structure/transparent.gif'});
     
});
