// MAILMASK
jQuery(document).ready(function () {
    noSpam();
	
	jQuery('#slideshow').rhinoslider();
// Colorbox
	jQuery("a[rel='colorbox']").colorbox();
	jQuery("a[rel='lightbox']").colorbox({maxWidth:"600px"}); 
	jQuery(".iframe").colorbox({width:"650", height:"80%", iframe:true});
	
// ende Colorbox
});

function noSpam() {
    jQuery('a.escape').each(function () {
        jQuery(this).find('span').first().html('@');
        jQuery(this).attr('href', 'mailto:' + jQuery(this).text());
    });
}

// select all desired input fields and attach tooltips to them
jQuery(".form :input.tool").tooltip({
    position: "center right",
    offset: [-2, 10],
    effect: "fade",
    opacity: 0.7
});

/* Animation für die Navi oben */
jQuery(document).ready(function(){
	jQuery(".drop > ul").hide(); 
	jQuery(".drop").hover(function(){
		jQuery(this).children("ul").stop(true, true);
		jQuery(this).children("ul").slideDown(600); 
		},function(){
		jQuery(this).children("ul").slideUp(400);});
});

// form_validation v. 2.2 incl. newslettererror
//  ----------------------------
// | Euroweb Internet GmbH     |
//  ----------------------------
//	Last changed:	15. 02. 2011
// by Sebastian Pontow - s.pontow@euroweb.de
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('j 1h(J){9 4=0;9 2=\'\';9 8=\'\';9 e=\'\';9 6=\'\';1g(9 i=0;i<h.C("l").1f;i++){2=h.C("l")[i];5(2.I){8=h.o(2.I)}e=2.3;6=2.3.H(/ 4/,\'\');5(2.1j==J&&8){5(8.1l==\'1k\'){5(8.E==m){h.o(\'l-y\').3+=\' k D\'}b{9 F=h.o(\'l-y\').3.H(/ k D/,\'\');h.o(\'l-y\').3=F}}5(e.g(/k/)){5(8.14==\'13\'){5(8.17[1].18){2.3=6;2.3+=\' 4\';4=1}b{2.3=6}}b 5(8.1c==\'1b\'){5(8.E==v){2.3=6;2.3+=\' 4\';4=1}b{2.3=6}}b{5(8.n==\'\'){2.3=6;2.3+=\' 4\';4=1}b{2.3=6}}}5(e.g(/1o/)){9 x=G(8);5(!x&&!e.g(/k/)&&8.n!=\'\'){2.3=6;2.3+=\' 4\';4=1}b{2.3=6}5(!x&&e.g(/k/)){2.3=6;2.3+=\' 4\';4=1}b{5(4==0){2.3=6}}}5(e.g(/1n/)){9 z=12(8);5(!z&&8.n!=\'\'){2.3=6;2.3+=\' 4\';4=1}b{2.3=6}5(!z&&e.g(/k/)){2.3=6;2.3+=\' 4\';4=1}b{5(4==0){2.3=6}}}}}5(4===0){q m}b{9 $c=f(\'#1p\');$c.M(\'N\');$c.1s(\'<r>1t 1w B 1v 1u.</r> 1G 1q 1x 1D 1B 19 K&L;1F. 1z 1A K&L;1a 15 B <r 16="4">1d</r> 1i.<1e /><a 10="A">11 Q R&P;O</a>\').S(d);f(\'#t\').T(d,0.7);f(\'#A\').X(\'W\',\'U\').V(j(){$c.s(d);f(\'#t\').s(d)});q v}}j G(u){9 p=(1E(1m(u.n))==m)?v:m;q p}j 12(u){9 p=(u.n.g(/^[\\w\\.\\-]+@([\\w\\-]+\\.)+[a-1C-Z]+$/))?m:v;q p}j 1r(){9 $c=f(\'#1y\');$c.1H(\'<a 10="Y">11 Q R&P;O</a>\');$c.M(\'N\');$c.S(d);f(\'#t\').T(d,0.7);f(\'#Y\').X(\'W\',\'U\').V(j(){$c.s(d);f(\'#t\').s(d)})}',62,106,'||currentLabel|className|error|if|newClass||currentField|var||else|errorbox|300|klasse|jQuery|match|document||function|required|label|true|value|getElementById|returnvar|return|strong|fadeOut|cboxOverlay|field|false||numeric|telefon|valid|errorclose|sind|getElementsByTagName|rueckruf|checked|newTelClass|isNumber|replace|htmlFor|formular|ausgef|uuml|appendTo|body|en|szlig|Meldung|schlie|fadeIn|fadeTo|pointer|click|cursor|css|errorclose2||id|Diese|isMailValid|SELECT|tagName|Punkte|class|childNodes|selected|Pflichtfelder|llten|checkbox|type|rot|br|length|for|validateForm|gekennzeichnet|form|Rueckruf|name|parseInt|mail|number|fehlermeldung|haben|newsletterError|html|Beim|aufgetreten|Fehler|Abschicken|eventuell|fehlermeldung2|Die|falsch|alle|zA|nicht|isNaN|llt|Sie|append'.split('|'),0,{}));






/**
  * Rhinoslider 0.83
  * (C) Copyright Sebastian Pontow, Rene Maas
  * http://www.rhinoslider.com/
  * http://www.rhinoslider.com/license/
  * support@rhinoslider.com
  */
(function($, document, undefined){
    /**
      * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
      * Copyright (c) 2008 George McGinley Smith
      * All rights reserved.
      */
    jQuery.extend( jQuery.easing,{
        def: 'out',
        out: function (a, b, c, d, e) {
            return -d*(b/=e)*(b-2)+c;
        },
        kick: function (a, b, c, d, e) {
            if ((b/=e/2) < 1){
                return d/2 * Math.pow(2, 10 * (b - 1)) + c;
            }
            return d/2 * (-Math.pow(2, -10 * --b) + 2) + c;
        },
        shuffle: function (a, b, c, d, e) {
            if ((b/=e/2) < 1){
                return d/2*b*b*b*b*b + c;
            }
            return d/2*((b-=2)*b*b*b*b + 2) + c;
        }
    });
     
    var rhinoSlider = function(element,opts){
        var
            settings = jQuery.extend({},jQuery.fn.rhinoslider.defaults, opts),
             
            vars = {
                isPlaying: false,
                intervalAutoPlay: false,
                active: '',
                next: '',
                container: '',
                items: '',
                buttons: [],
                prefix: 'rhino-'
            },
             
            $slider = $(element)
        ;
         
        settings.controlsPrevNext = Boolean(settings.controlsPrevNext);
        settings.controlsKeyboard = Boolean(settings.controlsKeyboard);
        settings.controlsMousewheel= Boolean(settings.controlsMousewheel);
        settings.controlsPlayPause = Boolean(settings.controlsPlayPause);
        settings.controlsThumbs = Boolean(settings.controlsThumbs);
        settings.pauseOnHover = Boolean(settings.pauseOnHover);
        settings.slideStay = Boolean(settings.slideStay);
        settings.autoPlay = Boolean(settings.autoPlay);
        settings.cycled = Boolean(settings.cycled);
        settings.showTime = parseInt(settings.showTime,10);
        settings.effectTime = parseInt(settings.effectTime,10);
        settings.controlFadeTime = parseInt(settings.controlFadeTime,10);
        settings.captionsFadeTime = parseInt(settings.captionsFadeTime,10);
        tmpShiftValue = settings.shiftValue;
        tmpParts = settings.parts;
        settings.shiftValue = [];
        settings.parts = [];
        //if shuffle-effect has x and y shift or parts
        if(settings.effect.indexOf('shuffle') >= 0 || settings.effect.indexOf('explode') >= 0){
            var shiftValue = String(tmpShiftValue);
            if(shiftValue.indexOf(',') >= 0){
                var tmp = shiftValue.split(',');
                settings.shiftValue.x = tmp[0];
                settings.shiftValue.y = tmp[1];
            }else{
                settings.shiftValue.x = parseInt(tmpShiftValue,10);
                settings.shiftValue.y = parseInt(tmpShiftValue,10);
            }
            var parts = String(tmpParts);
            if(parts.indexOf(',') >= 0){
                var tmp = parts.split(',');
                settings.parts.x = tmp[0];
                settings.parts.y = tmp[1];
            }else{
                settings.parts.x = parseInt(tmpParts,10);
                settings.parts.y = parseInt(tmpParts,10);
            }
        }else{
            settings.shiftValue.x = parseInt(tmpShiftValue,10);
            settings.shiftValue.y = parseInt(tmpShiftValue,10);
            settings.parts.x = parseInt(tmpParts,10);
            settings.parts.y = parseInt(tmpParts,10);
        }
         
        settings.initCallbefore();
         
        $slider.data('slider:vars', vars);
        $slider.wrap('<div class="'+vars.prefix+'container">');
        vars.container = $slider.parent('.'+vars.prefix+'container');
        vars.container.style = $slider.style;
        vars.isPlaying = settings.autoPlay;
         
        //the string, which will contain the button-html-code
        var buttons = '';
         
        //add prev/next-buttons
        if(settings.controlsPrevNext){
            buttons = '<span class="'+vars.prefix+'prev '+vars.prefix+'btn">' + settings.prevText + '</span><span class="'+vars.prefix+'next '+vars.prefix+'btn">' + settings.nextText + '</span>';
            vars.container.append(buttons);
 
            vars.buttons.prev = $('.'+vars.prefix+'prev', vars.container);
            vars.buttons.next = $('.'+vars.prefix+'next', vars.container);
             
            //add functionality to the "next"-button
            vars.buttons.prev.click( function(){
                prev($slider, settings);
                 
                //stop autoplay, if set
                if(settings.autoPlay){
                    pause();
                }
            });
             
            //add functionality to the "next"-button
            vars.buttons.next.click( function(){
                next($slider, settings);
                 
                //stop autoplay, if set
                if(settings.autoPlay){
                    pause();
                }
            });
        }
         
        //add play/pause-button
        if(settings.controlsPlayPause){
            buttons = settings.autoPlay ? '<span class="'+vars.prefix+'toggle '+vars.prefix+'pause '+vars.prefix+'btn">' + settings.pauseText + '</span>' : '<span class="'+vars.prefix+'toggle '+vars.prefix+'play '+vars.prefix+'btn">' + settings.playText + '</span>';
            vars.container.append(buttons);
 
            vars.buttons.play = $('.'+vars.prefix+'toggle', vars.container);
             
            //add functionality
            vars.buttons.play.click( function(){
                //self-explaining
                if(vars.isPlaying === false){
                    play();
                }else{
                    pause();
                }
            });
        }
         
        //style
        $('.'+vars.prefix+'btn', vars.container)
            .css({
                position: 'absolute',
                display: 'block',
                cursor:'pointer'
            });
        vars.container.css('position','relative');
 
        //get content-elements and set css-reset for positioning
        vars.items = $slider.children('li');
        vars.items.first().addClass(vars.prefix+'active');
         
        //"free" the slideshow element
        var tmpWidth = $slider.css('width');
        var tmpHeight = $slider.css('height');
        $slider
            .css({
                top: 'auto',
                left: 'auto',
                position: 'relative'
             });
             
        vars.items
            .css({
                margin: 0,
                width: tmpWidth,
                height: tmpHeight,
                position: 'absolute',
                top: 0,
                left: 0,
                zIndex: 0,
                overflow: 'hidden'
            });
         
        //generate navigation
        if(settings.controlsThumbs){
            var navi = '<ol class="'+vars.prefix+'thumbs">';
            vars.items.each(function(i){
                var $item = $(this);
                var id = vars.prefix+'item'+i;
                $item.attr('id',id);
                navi = navi + '<li><span id="'+id+'-thumb" class="'+vars.prefix+'thumb">'+parseInt(i+1,10)+'</span></li>';
            });
            navi = navi + '</ol>';
            vars.container.append(navi);
             
            vars.navigation = $('.'+vars.prefix+'thumbs', vars.container);
            vars.buttons.thumbs = $('.'+vars.prefix+'thumb', vars.navigation);
            vars.buttons.thumbs.first().addClass(vars.prefix+'active-thumb');
            vars.buttons.thumbs.click( function(){
                var itemID = $(this).attr('id').replace('-thumb','');
                next($slider, settings, $('#'+itemID));
     
                //stop autoplay, if set
                if(settings.autoPlay){
                    pause();
                }
            });
        }
         
        //add captions
        if(settings.showCaptions === 'hover' || settings.showCaptions === 'always'){
            vars.items.each(function(){
                var $item = $(this);
                if($item.children('.'+vars.prefix+'caption').length == 0){
                    if($item.children('img').length > 0){
                        $item.append('<div class="'+vars.prefix+'caption">'+$item.children('img:first').attr('title')+'</div>');
                         
                    }
                }
                $item.children('img:first').removeAttr('title');
            });
             
            if(settings.showCaptions === 'hover'){
                $('.'+vars.prefix+'caption').hide();
                vars.container
                    .mouseenter(function(){
                        vars.active.children('.'+vars.prefix+'caption').stop(true, true).fadeTo(settings.captionFadeTime,settings.captionsOpacity);
                    })
                    .mouseleave(function(){
                        vars.active.children('.'+vars.prefix+'caption').delay(200).fadeOut(settings.captionFadeTime);
                    });
            }else if(settings.showCaptions === 'always'){
                $('.'+vars.prefix+'caption').fadeTo(0,settings.captionsOpacity);
            }
        }
         
        vars.active = $('.'+vars.prefix+'active', $slider);
 
        //set special settings for each effect
        switch(settings.effect){
            case 'fade':
                //opacity so the elements in the back don't shine through while the effect is running
                vars.items.css({
                    //opacity so the elements in the back don't shine through while the effect is running
                    opacity: 0
                });
                vars.active.css({opacity: 1});
                break;
            //same settings for both
            case 'kick':
            case 'transfer':
                vars.items.css({
                    //opacity so the elements in the back don't shine through while the effect is running
                    opacity: 0,
                    overflow: 'hidden'
                });
                vars.active.css({opacity: 1});
                break;
            case 'shuffle':
            case 'explode':
                vars.items.css({
                    overflow:'visible'
                });
                break;
        }
         
        vars.active.css({zIndex: 1});
         
        if(settings.autoPlay){
            vars.intervalAutoPlay = setInterval(function(){
                next($slider, settings);
            },settings.showTime);
        } else {
            vars.intervalAutoPlay = false;
        }
         
        //if pause on hover
        if(settings.pauseOnHover){
            //play/pause function cannot be used for they trigger the isPlaying variable
            $slider
                .mouseenter(function(){
                    if(vars.isPlaying){
                        clearInterval(vars.intervalAutoPlay);
                        if(settings.controlsPlayPause){
                            vars.buttons.play
                                .text(settings.playText)
                                .removeClass(vars.prefix+'pause')
                                .addClass(vars.prefix+'play');
                        }
                    }
                })
                .mouseleave(function(){
                    if(vars.isPlaying){
                        vars.intervalAutoPlay = setInterval(function(){
                            next($slider, settings);
                        },settings.showTime);
 
                        if(settings.controlsPlayPause){
                            vars.buttons.play
                                .text(settings.pauseText)
                                .removeClass(vars.prefix+'play').addClass(vars.prefix+'pause');}
                    }
                });
        }
         
        //hide/show controls on hover or never
        if(settings.showControls === 'hover' || settings.showControls === 'never'){
            var allControls = $('.'+vars.prefix+'btn');
            allControls.hide();
             
            if(settings.showControls === 'hover'){
                vars.container
                    .mouseenter(function(){
                        allControls.stop(true, true).fadeIn(settings.controlFadeTime);
                    })
                    .mouseleave(function(){
                        allControls.delay(200).fadeOut(settings.controlFadeTime);
                    });
            }
        }
         
        //catch keyup event and trigger functions if the right key is pressed
        if(settings.controlsKeyboard){
            $(document).keyup(function(e){
                switch(e.keyCode){
                    case 37:
                        clearInterval(vars.intervalAutoPlay);
                        vars.buttons.prev.trigger('click');
                        break;
                    case 39:
                        clearInterval(vars.intervalAutoPlay);
                        vars.buttons.next.trigger('click');
                        break;
                    case 80:
                        vars.buttons.play.trigger('click');
                        break;
                }
            });
        }
         
        //catch mousewheel event and trigger prev or next
        if(settings.controlsMousewheel){
            /**
              * Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
              * Licensed under the MIT License (LICENSE.txt).
              */
            (function(a){function c(b){var c=[].slice.call(arguments,1),d=0,e=true;b=a.event.fix(b||window.event);b.type="mousewheel";if(b.wheelDelta)d=b.wheelDelta/120;if(b.detail)d=-b.detail/3;c.unshift(b,d);return a.event.handle.apply(this,c)}var b=["DOMMouseScroll","mousewheel"];a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],c,false);else this.onmousewheel=c},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],c,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})($)
             
            $slider.mousewheel(function(e, delta){
                var dir = delta > 0 ? 'u' : 'd';
                if(dir === 'u'){
                    vars.buttons.prev.trigger('click');
                } else {
                    vars.buttons.next.trigger('click');
                }
            });
        }
         
        settings.initCallback();
         
        //pause the autoplay and change the bg-image of the button to "play"
        var pause = function(){
            var vars = $slider.data('slider:vars');
            clearInterval(vars.intervalAutoPlay);
            vars.isPlaying = false;
            if(settings.controlsPlayPause){
                vars.buttons.play
                    .text(settings.playText)
                    .removeClass(vars.prefix+'pause')
                    .addClass(vars.prefix+'play');
            }
             
            settings.pauseCallback();
        },
         
        //start/resume the autoplay and change the bg-image of the button to "pause"
        play = function(){
            var vars = $slider.data('slider:vars');
            vars.intervalAutoPlay = setInterval(function(){
                next($slider, settings);
            },settings.showTime);
            vars.isPlaying = true;
            if(settings.controlsPlayPause){
                vars.buttons.play
                    .text(settings.pauseText)
                    .removeClass(vars.prefix+'play')
                    .addClass(vars.prefix+'pause');
                }
             
            settings.playCallback();
        },
         
        prev = function($slider, settings){
            settings.prevCallbefore();
             
            var vars = $slider.data('slider:vars');
            //if some effect is already running, don't stack up another one
            if($('li:animated, li .'+vars.prefix+'partContainer:animated', vars.container).length > 0){
                return false;
            }
             
            //hide captions
            if(settings.showCaptions !== 'never'){
                $('.'+vars.prefix+'caption').stop(true,true).hide();
            }
 
            //check, if the active element is the first, so we can set the last element to be the "next"-element
            if(vars.items.first().hasClass(vars.prefix+'active')){
                vars.next = vars.items.last();
            } else {
                vars.next = vars.active.prev();
            }
             
            if(vars.next.hasClass(vars.prefix+'active')){
                return false;
            }
             
            switch(settings.effect){
                case 'none':
                    fade($slider, settings, false);
                    break;
                case 'fade':
                    fade($slider, settings, true);
                    break;
                case 'slide':
                    slide($slider, settings, settings.slidePrevDirection, settings.slideStay, false);
                    break;
                case 'kick':
                    slide($slider, settings, settings.slidePrevDirection, false, true);
                    break;
                case 'transfer':
                    transfer($slider, settings, settings.slidePrevDirection, settings.slideStay);
                    break;
                case 'shuffle':
                    shuffle($slider, settings, settings.slideStay, false);
                    break;
                case 'explode':
                    shuffle($slider, settings, settings.slideStay, true);
                    break;
            }
             
            setTimeout(function(){
                settings.prevCallback();
            }, settings.effectTime);
        },
         
        next = function($slider, settings, $next){
            settings.nextCallbefore();
             
            var vars = $slider.data('slider:vars');
            //if some effect is already running, don't stack up another one
            if($('li:animated, li .'+vars.prefix+'partContainer:animated', vars.container).length > 0){
                return false;
            }
             
            //hide captions
            if(settings.showCaptions !== 'never'){
                $('.'+vars.prefix+'caption').stop(true,true).hide();
            }
 
            //check, if the active element is the last, so we can set the first element to be the "next"-element
            if(!$next){
                if(vars.items.last().hasClass(vars.prefix+'active')){
                    vars.next = vars.items.first();
                } else {
                    vars.next = vars.active.next();
                }
            }else{
                vars.next = $next;
            }
             
            if(vars.next.hasClass(vars.prefix+'active')){
                return false;
            }
                         
            //choose the effect and start it
            switch(settings.effect){
                case 'none':
                    fade($slider, settings, false);
                    break;
                case 'fade':
                    fade($slider, settings, true);
                    break;
                case 'slide':
                    slide($slider, settings, settings.slideNextDirection, settings.slideStay, false);
                    break;
                case 'kick':
                    slide($slider, settings, settings.slideNextDirection, false, true);
                    break;
                case 'transfer':
                    transfer($slider, settings, settings.slideNextDirection, settings.slideStay);
                    break;
                case 'shuffle':
                    shuffle($slider, settings, settings.slideStay, false);
                    break;
                case 'explode':
                    shuffle($slider, settings, settings.slideStay, true);
                    break;
            }
             
             
            setTimeout(function(){
                settings.nextCallback();
            }, settings.effectTime);
        },
         
        //function to reset elements and style after an effect
        resetElements = function($slider, settings){
            var vars = $slider.data('slider:vars');
            //set the active-element on the same z-index as the rest and reset css
            vars.next
                //add the active-class
                .addClass(vars.prefix+'active')
                //and put  it above the others
                .css({
                    zIndex:1,
                    top: 0,
                    left: 0,
                    width: '100%',
                    height:'100%',
                    margin:0
                });
            vars.active
                .css({
                    zIndex:0,
                    top: 0,
                    left: 0,
                    margin:0
                })
                //and remove its active class
                .removeClass(vars.prefix+'active');
             
            if(settings.controlsThumbs){
                $('.'+vars.prefix+'active-thumb').removeClass(vars.prefix+'active-thumb');
                $('#'+vars.next.attr('id')+'-thumb').addClass(vars.prefix+'active-thumb');
            }
             
            //make the "next"-element the new active-element
            vars.active = vars.next;
             
            //show captions
            if(settings.showCaptions !== 'never'){
                vars.active.children('.'+vars.prefix+'caption').stop(true,true).fadeTo(settings.captionsFadeTime,settings.captionsOpacity);
            }
         
        },
         
        //effect "fade"
        fade = function($slider, settings, animate){
            var vars = $slider.data('slider:vars');
             
            //set next on top of the others and hide it
            if(animate){
                vars.next
                    .css({
                        zIndex:2
                    })
                    //then fade it in - fade with animate-> fade didnt do it...
                    .animate({
                        opacity: 1
                    },settings.effectTime,settings.easing,function(){
                            //and reset the rest
                            resetElements($slider, settings);
                        });
                vars.active
                    .animate({
                        opacity: 0
                    },settings.effectTime);
            } else {
                vars.next
                    .css({
                        zIndex: 2,
                        display: 'block'
                    });
                vars.active.hide(0,function(){
                    resetElements($slider, settings);
                });
            }
        },
         
        //slide-effect contains kick
        slide = function($slider, settings ,direction, stay, fade){
            var vars = $slider.data('slider:vars');
            var values = [];
            if(fade){
                //if effect is kick, set additional values for fade and slide animation
                values.opacity = 0;
                values.delay = settings.effectTime/2;
                values.activeEffectTime = settings.effectTime/2;
                values.easing = 'out';
                values.nextEasing = 'kick';
                settings.shiftValue.x = settings.shiftValue.x < 0 ? settings.shiftValue.x * -1 : settings.shiftValue.x;
            }else{
                // else set standard values
                values.opacity = 1;
                values.delay = 0;
                values.activeEffectTime = settings.effectTime;
                //if showtime is 0, content is sliding permanently so linear is the way to go
                values.easing = settings.showTime === 0 ? 'linear' : 'out';
                values.nextEasing = settings.showTime === 0 ? 'linear' : 'out';
                $slider.css({overflow: 'hidden'});
            }
             
            //check, in which direction the content will be moved
            switch(direction){
                case 'toTop':
                    values.top = fade ? -settings.shiftValue.x : -vars.container.height();
                    values.left = 0;
                    values.nextTop = fade ? settings.shiftValue.x : -values.top;
                    values.nextLeft = 0;
                    break;
                case 'toBottom':
                    values.top = fade ? settings.shiftValue.x : vars.container.height();
                    values.left = 0;
                    values.nextTop = fade ? -settings.shiftValue.x : -values.top;
                    values.nextLeft = 0;
                    break;
                case 'toRight':
                    values.top = 0;
                    values.left = fade ? settings.shiftValue.x : vars.container.width();
                    values.nextTop = 0;
                    values.nextLeft = fade ? -settings.shiftValue.x : -values.left;
                    break;
                case 'toLeft':
                    values.top = 0;
                    values.left = fade ? -settings.shiftValue.x : -vars.container.width();
                    values.nextTop = 0;
                    values.nextLeft = fade ? settings.shiftValue.x : -values.left;
                    break;
            }
             
            //put the "next"-element on top of the others and show/hide it, depending on the effect
            vars.next
                .css({
                    zIndex: 2,
                    opacity: values.opacity
                });
                 
            //if stay is true, the active-element will not move
            if(stay === false){
                vars.active
                    .css({
                        top: 0,
                        left: 0
                    })
                    //delay is for kick, so it seems as if the "next"-element kicks the activ-element away
                    .delay(values.delay)
                    .animate({
                        top: values.top,
                        left: values.left,
                        opacity: values.opacity
                    },values.activeEffectTime,(settings.easing != '') ? settings.easing : values.easing);   //easing is variable because kick seems more "realistic" if it's not too linear
            }
            vars.next
                //position "next"-element depending on the direction
                .css({
                    top: values.nextTop,
                    left: values.nextLeft
                })
                .animate({
                    top: 0,
                    left: 0,
                    opacity: 1
                },settings.effectTime,(settings.easing != '') ? settings.easing : values.nextEasing,function(){
                    //reset element-positions
                    resetElements($slider, settings);
                });
        },
         
        //prepare elements for shuffle effect
        preShuffle = function($slider, settings, $li){
            var vars = $slider.data('slider:vars');
            $li.html('<div class="'+vars.prefix+'partContainer">'+$li.html()+'</div>');
            var part = $li.html();
            var width = $slider.width();
            var height = $slider.height();
            for(i=1;i<(settings.parts.x*settings.parts.y);i++){
                $li.html($li.html()+part);
            }
            var $parts = $li.children('.'+vars.prefix+'partContainer');
            var partValues = [];
            partValues.width = $li.width()/settings.parts.x;
            partValues.height = $li.height()/settings.parts.y;
            $parts
                .each(function(i){
                    var $this = $(this);
                    partValues.top = ((i-(i%settings.parts.x))/settings.parts.x)*partValues.height;
                    partValues.left = (i%settings.parts.x)*partValues.width;
                    partValues.marginTop = -partValues.top;
                    partValues.marginLeft = -partValues.left;
                    $this
                        .css({
                            top:partValues.top,
                            left:partValues.left,
                            width:partValues.width,
                            height:partValues.height,
                            position:'absolute',
                            overflow:'hidden'
                        })
                        .html('<div class="'+vars.prefix+'part">'+$this.html()+'</div>');
                    $this.children('.'+vars.prefix+'part')
                        .css({
                            marginTop:partValues.marginTop,
                            marginLeft:partValues.marginLeft,
                            width:width,
                            height:height,
                            background:$li.css('background-image')+' '+$li.parent().css('background-color')
                        });
            });
            return $parts;
        },
         
        //calc amount of parts
        calcParts = function(parts,c){
            if(parts.x * parts.y > 36){
                if(c){
                    if(parts.x > 1){
                        parts.x--;
                    }else{
                        parts.y--;
                    }
                    c = false;
                }else{
                    if(parts.y > 1){
                        parts.y--;
                    }else{
                        parts.x--;
                    }
                    c = true;
                }
                return calcParts(parts,c);
            }
            return parts;
        },
         
        //effect "shuffle"
        shuffle = function($slider, settings, stay, explode){
            settings.parts.x = settings.parts.x < 1 ? 1 : settings.parts.x;
            settings.parts.y = settings.parts.y < 1 ? 1 : settings.parts.y;
            settings.parts = calcParts(settings.parts,true);
            settings.shiftValue.x = settings.shiftValue.x < 0 ? settings.shiftValue.x * -1 : settings.shiftValue.x;
            settings.shiftValue.y = settings.shiftValue.y < 0 ? settings.shiftValue.y * -1 : settings.shiftValue.y;
            var vars = $slider.data('slider:vars');
            var activeContent = vars.active.html();
            var nextContent = vars.next.html();
            var width = $slider.width();
            var height = $slider.height();
            var $activeParts = preShuffle($slider, settings, vars.active);
            var $nextParts = preShuffle($slider, settings, vars.next);
            var activeBackgroundImage = vars.active.css('background-image');
            var activeBackgroundColor = vars.active.css('background-color');
            var nextBackgroundImage = vars.next.css('background-image');
            var nextBackgroundColor = vars.next.css('background-color');
            vars.active.css({
                backgroundImage: 'none',
                backgroundColor: 'none'
            });
            vars.next.css({
                backgroundImage: 'none',
                backgroundColor: 'none',
                zIndex: 2
            });
            var partValues = [];
            partValues.width = vars.next.width()/settings.parts.x;
            partValues.height = vars.next.height()/settings.parts.y;
            if(stay === false){
                $activeParts.each(function(i){
                    $this = $(this);
                    var newLeft, newTop;
                    if(explode){
                        var position = [];
                        position.top = $this.position().top;
                        position.bottom = $this.parent().height()-$this.position().top-$this.height();
                        position.left = $this.position().left;
                        position.right = $this.parent().width()-$this.position().left-$this.width();
                         
                        var rndX = parseInt(Math.random()*settings.shiftValue.x,10);
                        var rndY = parseInt(Math.random()*settings.shiftValue.y,10);
                        newLeft = position.right <= position.left ? (position.right == position.left ? rndX/2 : rndX) : -rndX;
                        newTop = position.bottom <= position.top ? (position.top == (position.bottom-1) ? rndY/2 : rndY) : -rndY;
                    }else{
                        newLeft = (Math.random()*(settings.shiftValue.x*2)-settings.shiftValue.x);
                        newTop = (Math.random()*(settings.shiftValue.y*2)-settings.shiftValue.y);
                    }
                    $this
                        .animate({
                            top: '+='+newTop,
                            left: '+='+newLeft,
                            opacity: 0
                            },settings.effectTime,(settings.easing != '') ? settings.easing : 'linear');
                });
            }
            $nextParts.each(function(i){
                $this = $(this);
                partValues.top = ((i-(i%settings.parts.x))/settings.parts.x)*partValues.height;
                partValues.left = (i%settings.parts.x)*partValues.width;
                var newLeft, newTop;
                if(explode){
                    var position = [];
                    position.top = $this.position().top;
                    position.bottom = $this.parent().height()-$this.position().top-$this.height();
                    position.left = $this.position().left;
                    position.right = $this.parent().width()-$this.position().left-$this.width();
                     
                    var rndX = parseInt(Math.random()*settings.shiftValue.x,10);
                    var rndY = parseInt(Math.random()*settings.shiftValue.y,10);
                    newLeft = position.right <= position.left ? (position.right == position.left ? rndX/2 : rndX) : -rndX;
                    newTop = position.bottom <= position.top ? (position.top == (position.bottom-1) ? rndY/2 : rndY) : -rndY;
                    newLeft = partValues.left+newLeft;
                    newTop = partValues.top+newTop;
                }else{
                    newLeft = partValues.left+(Math.random()*(settings.shiftValue.x*2)-settings.shiftValue.x);
                    newTop = partValues.top+(Math.random()*(settings.shiftValue.y*2)-settings.shiftValue.y);
                }
                 
                $this
                    .css({
                        top: newTop,
                        left: newLeft,
                        opacity: 0
                    })
                    .animate({
                        top: partValues.top,
                        left: partValues.left,
                        opacity: 1
                        },settings.effectTime,(settings.easing != '') ? settings.easing : 'linear',function(){
                                if(i==$activeParts.length-1){
                                    vars.active.html(activeContent);
                                    vars.next.html(nextContent);
                                    vars.active.css({
                                        backgroundImage: activeBackgroundImage,
                                        backgroundColor: activeBackgroundColor
                                    });
                                    vars.next.css({
                                        backgroundImage: nextBackgroundImage,
                                        backgroundColor: nextBackgroundColor
                                    });
                                    resetElements($slider, settings);
                                }
                            });
            });
        },
         
        transfer = function($slider, settings,direction, stay){
            var vars = $slider.data('slider:vars');
            var values = [];
            //check, in which direction the content will be moved
            switch(direction){
                case 'toTop':
                    values.top = -settings.shiftValue.y;
                    values.left = '50%';
                    values.nextTop = $slider.height()+settings.shiftValue.y;
                    values.nextLeft = '50%';
                    break;
                case 'toBottom':
                    values.top = $slider.height()+settings.shiftValue.y;
                    values.left = '50%';
                    values.nextTop = -settings.shiftValue.y;
                    values.nextLeft = '50%';
                    break;
                case 'toRight':
                    values.top = '50%';
                    values.left = $slider.width()+settings.shiftValue;
                    values.nextTop = '50%';
                    values.nextLeft = -settings.shiftValue.x;
                    break;
                case 'toLeft':
                    values.top = '50%';
                    values.left = -settings.shiftValue.x;
                    values.nextTop = '50%';
                    values.nextLeft = $slider.width()+settings.shiftValue.x;
                    break;
            }
            vars.next.children().wrapAll('<div id="'+vars.prefix+'nextContainer />');
            $nextContainer = $('#'+vars.prefix+'nextContainer', vars.next);
             
            $nextContainer.css({
                width: $slider.width(),
                height: $slider.height(),
                position: 'absolute',
                top: '50%',
                left: '50%',
                margin: '-'+parseInt($slider.height()/2,10)+'px 0 0 -'+parseInt($slider.width()/2,10)+'px'
            });
                 
             
            vars.active.children().wrapAll('<div id="'+vars.prefix+'nextContainer />');
            $activeContainer = $('#'+vars.prefix+'nextContainer', vars.active);
             
            $activeContainer.css({
                width: $slider.width(),
                height: $slider.height(),
                position: 'absolute',
                top: '50%',
                left: '50%',
                margin: '-'+parseInt($slider.height()/2,10)+'px 0 0 -'+parseInt($slider.width()/2,10)+'px'
            });
             
            if(stay == false){
                vars.active
                    .css({
                        width: '100%',
                        height: '100%',
                        top: 0,
                        left: 0
                    })
                    .animate({
                        width: 0,
                        height: 0,
                        top: values.top,
                        left: values.left,
                        opacity: 0
                    },settings.effectTime);
            }
             
            vars.next
                .css({
                    opacity: 0,
                    zIndex: 2,
                    width: 0,
                    height: 0,
                    top: values.nextTop,
                    left: values.nextLeft
                })
                .animate({
                    width: '100%',
                    height: '100%',
                    top: 0,
                    left: 0,
                    opacity: 1
                },settings.effectTime,settings.easing,function(){
                    $activeContainer.children().unwrap();
                    $nextContainer.children().unwrap();
                    resetElements($slider, settings);
            });
        };
    };
     
    jQuery.fn.rhinoslider = function(opts){
         
        return this.each(function(){
            var element = $(this);
            if(element.data('rhinoslider')){

                return element.data('rhinoslider');
            }
            var rhinoslider = new rhinoSlider(this, opts);
            element.data('rhinoslider', rhinoslider);
        });
    };
     
    jQuery.fn.rhinoslider.defaults = {
        effect: 'slide',              //which effect to blend content
        easing: '',                     //easing for animations of the slides
        controlsMousewheel: false,       //enable/disable mousewheel navigation
        controlsKeyboard: false,         //enable/disable keyboard navigation
        controlsPrevNext: false,         //show/hide prev/next-controls
        controlsPlayPause: false,        //show/hide play/pause-controls
        controlsThumbs: false,           //show/hide thumbs for direct access
        pauseOnHover: false,             //pause on mouse-over
        slideStay: false,               //if the active content should be animated too - depending on effect slide
        autoPlay: true,                //start slideshow automatically on init
        cycled: true,                   //begin from start if end has reached 
        showTime: 3000,                 //time, the content is visible before next content will be blend in - depends on autoPlay
        effectTime: 300,               //time, the effect will last
        controlFadeTime: 650,           //duration for fading controls
        captionsFadeTime: 650,          //duration for fading captions
        captionsOpacity: 0.7,           //opacity for captions
        shiftValue: '150',            //width, the animation for moving the content needs, can be comma-seperated string (x,y) or int if both are the same
        parts: '5,3',                   //amount of parts per line for shuffle effect
        showCaptions: 'always',         //show image-title: hover, always, never
        showControls: 'hover',          //show controls: hover, always, never
        slidePrevDirection: 'toTop',   //the direction, the prev-button triggers - depending on effect slide
        slideNextDirection: 'toBottom',  //the direction, the next-button triggers - depending on effect slide
        prevText: 'prev',               //text for the prev-button
        nextText: 'next',               //text for the next-button
        playText: 'play',               //text for the play-button
        pauseText: 'pause',             //text for the pause-button
        initCallbefore: function(){},   //the function, which is started bofore anything is done by this script
        initCallback: function(){},     //the function, which is started when the slider is ready (only once)
        nextCallbefore: function(){},   //the function, which is started before the blending-effect
        prevCallbefore: function(){},   //the function, which is started before the blending-effect
        nextCallback: function(){},     //the function, which is started after the blending-effect
        prevCallback: function(){},     //the function, which is started after the blending-effect
        playCallback: function(){},     //the function, which is started if the autoplay intervall starts
        pauseCallback: function(){}     //the function, which is started if the autoplay intervall ends
    };
     
})(jQuery, document);



// ColorBox v1.3.17.2 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function bc(b){if(!U){P=b,_(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1));if(!S){S=T=!0,r.show();if(K.returnFocus)try{P.blur(),a(P).one(l,function(){try{this.focus()}catch(a){}})}catch(c){}q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=Z(K.initialWidth,"x"),K.h=Z(K.initialHeight,"y"),X.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),ba(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()}X.load(!0)}}function bb(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(Q<y.length-1||K.loop)a=setTimeout(X.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(X.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,d),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function ba(b,c){c&&c.call(P),a.event.trigger(b)}function _(b){K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.substring(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function $(a){return K.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function Z(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function Y(c,d,e){e=b.createElement("div"),c&&(e.id=f+c),e.style.cssText=d||"";return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=a.browser.msie&&!a.support.opacity,o=n&&a.browser.version<7,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X;X=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{};if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(g)}),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&bc(f[0]);return f},X.init=function(){z=a(c),r=Y().attr({id:e,"class":n?f+(o?"IE6":"IE"):""}),q=Y("Overlay",o?"position:absolute":"").hide(),s=Y("Wrapper"),t=Y("Content").append(A=Y("LoadedContent","width:0; height:0; overflow:hidden"),C=Y("LoadingOverlay").add(Y("LoadingGraphic")),D=Y("Title"),E=Y("Current"),G=Y("Next"),H=Y("Previous"),F=Y("Slideshow").bind(h,bb),I=Y("Close")),s.append(Y().append(Y("TopLeft"),u=Y("TopCenter"),Y("TopRight")),Y(!1,"clear:left").append(v=Y("MiddleLeft"),t,w=Y("MiddleRight")),Y(!1,"clear:left").append(Y("BottomLeft"),x=Y("BottomCenter"),Y("BottomRight"))).children().children().css({"float":"left"}),B=Y(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(q,r.append(s,B)),t.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}).hide(),G.click(function(){X.next()}),H.click(function(){X.prev()}),I.click(function(){X.close()}),J=G.add(H).add(E).add(F),t.children().removeClass("hover"),q.click(function(){K.overlayClose&&X.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),X.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))})},X.remove=function(){r.add(q).remove(),a("."+g).removeData(e).removeClass(g)},X.position=function(a,c){function g(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,C[0].style.height=C[1].style.height=t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var d=0,e=0;z.unbind("resize."+f),r.hide(),K.fixed&&!o?r.css({position:"fixed"}):(d=z.scrollTop(),e=z.scrollLeft(),r.css({position:"absolute"})),K.right!==!1?e+=Math.max(z.width()-K.w-O-M-Z(K.right,"x"),0):K.left!==!1?e+=Z(K.left,"x"):e+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?d+=Math.max(b.documentElement.clientHeight-K.h-N-L-Z(K.bottom,"y"),0):K.top!==!1?d+=Z(K.top,"y"):d+=Math.round(Math.max(b.documentElement.clientHeight-K.h-N-L,0)/2),r.show(),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:d,left:e},{duration:a,complete:function(){g(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",c&&c(),setTimeout(function(){z.bind("resize."+f,X.position)},1)},step:function(){g(this)}})},X.resize=function(a){if(S){a=a||{},a.width&&(K.w=Z(a.width,"x")-O-M),a.innerWidth&&(K.w=Z(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=Z(a.height,"y")-N-L),a.innerHeight&&(K.h=Z(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=A.wrapInner("<div style='overflow:auto'></div>").children();K.h=b.height(),b.replaceWith(b.children())}A.css({height:K.h}),X.position(K.transition==="none"?0:K.speed)}},X.prep=function(b){function h(){K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h;return K.h}function g(){K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w;return K.w}if(!!S){var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Y("LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function o(){n&&r[0].style.removeAttribute("filter")}var b,c,g,h,i=y.length,k,l;!S||(l=function(){clearTimeout(W),C.hide(),ba(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show(),i>1?(typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",i)).show(),G[K.loop||Q<i-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),b=Q?y[Q-1]:y[i-1],g=Q<i-1?y[Q+1]:y[0],K.slideshow&&F.show(),K.preloading&&(h=a.data(g,e).href||g.href,c=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,c=a.isFunction(c)?c.call(b):c,$(h)&&(a("<img/>")[0].src=h),$(c)&&(a("<img/>")[0].src=c))):J.hide(),K.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],K.fastIframe?l():a(k).one("load",l),k.name=f+ +(new Date),k.src=K.href,K.scrolling||(k.scrolling="no"),n&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(A).one(m,function(){k.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,o):o())},K.transition==="fade"?r.fadeTo(d,0,function(){X.position(0,c)}):X.position(d,c)}},X.load=function(b){var c,d,e=X.prep;T=!0,R=!1,P=y[Q],b||_(),ba(m),ba(i,K.onLoad),K.h=K.height?Z(K.height,"y")-N-L:K.innerHeight&&Z(K.innerHeight,"y"),K.w=K.width?Z(K.width,"x")-O-M:K.innerWidth&&Z(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=Z(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=Z(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,W=setTimeout(function(){C.show()},100),K.inline?(Y().hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):$(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Y("Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(Q<y.length-1||K.loop)&&(R.style.cursor="pointer",R.onclick=function(){X.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Y("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},X.next=function(){!T&&y[1]&&(Q<y.length-1||K.loop)&&(Q=Q<y.length-1?Q+1:0,X.load())},X.prev=function(){!T&&y[1]&&(Q||K.loop)&&(Q=Q?Q-1:y.length-1,X.load())},X.close=function(){S&&!U&&(U=!0,S=!1,ba(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),ba(m),A.remove(),setTimeout(function(){U=!1,ba(l,K.onClosed)},1)}))},X.element=function(){return a(P)},X.settings=d,V=function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),bc(this))},a.fn.delegate?a(b).delegate("."+g,"click",V):a("."+g).live("click",V),a(X.init)})(jQuery,document,this);
