/* Copyright (c) 2009 Jordan Kasper
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * Copyright notice and license must remain intact for legal use
 * Requires: jQuery 1.2+
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Fore usage documentation and examples, visit:
 *         http://jkdesign.org/captcha/
 *
 * TODO:
 *   Full testing suite
 *
 * REVISIONS:
 *   0.1 Initial release
 *   0.2 Changed to use title attribute of image for hash (versus alt)
 *       (We don't want the hash showing as images load)
 *       Fixed simpleCaptcha.php to return properly formatted JSON (fixes bug in jQuery 1.4)
 *
 */
;
(function($) {

    $.fn.simpleCaptcha = function(o) {
        var n = this;
        if (n.length < 1) {
            return n;
        }

        o = (o)?o:{};
        o = auditOptions($.extend({}, $.fn.simpleCaptcha.defaults, o));

        var inputId = "simpleCaptcha_"+($.fn.simpleCaptcha.uid++);
        n
        .addClass('simpleCaptcha')
        .html('')  // clear out the container
        .append(
            "<div class='"+o.introClass+"'>"+o.introText+"</div>"+
            "<div class='"+o.imageBoxClass+"'></div>"+
            "<input class='simpleCaptchaInput' id='"+inputId+"' name='"+o.inputName+"' type='hidden' value='' />"
            );

        // Call simpleCaptcha.php to get images and current selection
        $.ajax({
            url: o.scriptPath,
            data: {
                numImages: o.numImages
            },
            method: 'post',
            dataType: 'json',
            success: function(data, status) {
                if (typeof data.error == 'string') {
                    handleError(n, data.error);
                    return;
                } else {
                    // Add image text to correct place
                    n.find('.'+o.textClass).html(data.text);

                    // Add images to container with click handlers
                    var imgBox = n.find('.'+o.imageBoxClass);
                    $.each(data.images, function() {
                        imgBox.append("<img class='"+o.imageClass+"' src='"+this.file+"' alt='' title='"+this.hash+"' />");
                    });
                    imgBox.find('img.'+o.imageClass)
                    .click(function(e) {
                        n.find('img.'+o.imageClass).removeClass('simpleCaptchaSelected');
                        var hash = $(this).addClass('simpleCaptchaSelected').attr('title');
                        $('#'+inputId).val(hash);
                        n.trigger('select.simpleCaptcha', [hash]);
                        return false;
                    })
                    .keyup(function(e) {
                        if (e.keyCode == 13 || e.which == 13) {
                            $(this).click();
                        }
                    });
                    n.trigger('loaded.simpleCaptcha', [data]);
                }
            },
            error: function(xhr, status) {
                handleError(n, 'Es gab ein Problem: '+xhr.status);
            }
        });

        return n;  // Continue jQuery chain
    };

    var handleError = function(n, msg) {
        n.trigger('error.simpleCaptcha', [msg]);
    }

    // Defined outside simpleCaptcha to allow for usage during construction
    var auditOptions = function(o) {
        if (typeof o.numImages != 'number' || o.numImages < 1) {
            o.numImages = $.fn.simpleCaptcha.defaults.numImages;
        }
        if (typeof o.introText != 'string' || o.introText.length < 1) {
            o.introText = $.fn.simpleCaptcha.defaults.introText;
        }
        if (typeof o.inputName != 'string') {
            o.inputName = $.fn.simpleCaptcha.defaults.inputName;
        }
        if (typeof o.scriptPath != 'string') {
            o.scriptPath = $.fn.simpleCaptcha.defaults.scriptPath;
        }
        if (typeof o.introClass != 'string') {
            o.introClass = $.fn.simpleCaptcha.defaults.introClass;
        }
        if (typeof o.textClass != 'string') {
            o.textClass = $.fn.simpleCaptcha.defaults.textClass;
        }
        if (typeof o.imageBoxClass != 'string') {
            o.imageBoxClass = $.fn.simpleCaptcha.defaults.imageBoxClass;
        }
        if (typeof o.imageClass != 'string') {
            o.imageClass = $.fn.simpleCaptcha.defaults.imageClass;
        }

        return o;
    }

    $.fn.simpleCaptcha.uid = 0;

    // options for simpleCaptcha instances...
    $.fn.simpleCaptcha.defaults = {
        numImages: 5,                     // Number How many images to show the user (providing there are at least that many defined in the script file).
        introText: "<p>Antispam: Klicken Sie auf <span class='captchaText'></span>.</p>",
        // String Text to place above captcha images (can contain html). IMPORTANT: You should probably include a tag with the textClass name on it, for example: <span id='captchaText'></span>
        inputName: 'captchaSelection',    // String Name to use for the captcha hidden input, this is what you will need to check on the receiving end of the form submission.
        scriptPath: 'simpleCaptcha.php',  // String Relative path to the script file to use (usually simpleCaptcha.php).
        introClass: 'captchaIntro',       // String Class to use for the captcha introduction text container.
        textClass: 'captchaText',         // String Class to look for to place the text for the correct captcha image.
        imageBoxClass: 'captchaImages',   // String Class to use for the captchas images container.
        imageClass: 'captchaImage'        // String Class to use for each captcha image.
    };

})(jQuery);




/*
	Author: Robin Thrift
	You are free to use this plug in in any way you want non-commercially and commercially.
	However if you redistribute (even when altered by you) you have to give credit to me.
	How you give me credit is up to you. Here are two links you could link off to:

	http://www.twitter.com/r0bs3n
	http://rob-thrift.com

	And now have FUN!

	Alerations by: Chris Coyier
*/

// allows for use of $ without conflict worries
(function($) {

    $.fn.insetBorder = function(options) {

        if ((options!=undefined) && (options.inset!=undefined))
        {
            if (options.insetleft==undefined) {
                options.insetleft = options.inset;
            }
            if (options.insetright==undefined) {
                options.insetright = options.inset;
            }
            if (options.insettop==undefined) {
                options.insettop = options.inset;
            }
            if (options.insetbottom==undefined) {
                options.insetbottom = options.inset;
            }
        }

        // defaults
        options = $.extend({
            speed : 250,
            insetleft : 10,
            insetright : 10,
            insettop : 10,
            insetbottom : 10,
            borderColor : '#ffffff',
            borderType: "solid",
            outerClass : "ibe_outer",
            innerClass : "ibe_inner"
        }, options);

        // run plugin on entire jQuery set
        return this.each(function(i) {

            var
            $el = $(this),
            ibe_height = $el.outerHeight(),
            ibe_width = $el.outerWidth();

            var
            wrapper = $("<div />", {
                "class": options.outerClass,
                "css"  : {
                    "width": ibe_width,
                    "height": ibe_height,
                    "overflow": "hidden",
                    "top": 0,
                    "left": 0,
                    "position": "relative"
                },
                "mouseenter": function() {
                    $el
                    .next()
                    .animate({
                        "top": "-" + options.insettop ,
                        "left": "-" + options.insetleft ,
                        "height": ibe_height ,
                        "width": ibe_width ,
                        "opacity": .1
                    }, {
                        "duration": options.speed,
                        "queue": false,
                        "complete": function() {

                        // BUG: for some reason this is getting called twice.

                        // Kinda works... attempt at allowing selectability of main element
                        // The problem is this only fires on complete but must make visibile on mouseleave no matter what
                        // $el.next().css("visibility", "hidden");

                        }
                    });
                    $el.parent().css('-moz-box-shadow','0px 0px 5px #333');

                /*
                                         *$el.parent().animate({
                                             "border": "1px solid #ccc"
                                             });
                                       */

                // on mouseleave
                },
                "mouseleave": function() {

                    $el
                    .next()
                    // .css({
                    //  "visibility": "visible"
                    // })
                    .animate({
                        "top": 0,
                        "left": 0,
                        "height": (ibe_height - (options.insettop + options.insetbottom))  +  "px",
                        "width": (ibe_width - (options.insetleft + options.insetright))  +  "px",
                        "opacity": 1
                    }, {
                        "duration": options.speed,
                        "queue": false
                    });
                    $el.parent().css('-moz-box-shadow','0px 0px 0px #000');

                /*
                                                   $el.parent().animate({
                                             "border": "0px solid #770000"
                                             });
                                            */
                }
            }),

            after = $("<div />", {
                "class": options.innerClass,
                "css"  : {
                    "height": (ibe_height - (options.insettop + options.insetbottom)) + "px",
                    "width": (ibe_width - (options.insetleft + options.insetright)) + "px",
                    "border-left": options.insetleft + "px " + options.borderType + " " + options.borderColor,
                    "border-right": options.insetright + "px " + options.borderType + " " + options.borderColor,
                    "border-top": options.insettop + "px " + options.borderType + " " + options.borderColor,
                    "border-bottom": options.insetbottom + "px " + options.borderType + " " + options.borderColor,
                    "position": "absolute",
                    "top": 0,
                    "left": 0
                }
            });

            $el.wrap(wrapper).after(after);

        });

    };

})(jQuery);


/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;
(function($){
    $.fn.superfish = function(op){

        var sf = $.fn.superfish,
        c = sf.c,
        $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
        over = function(){
            var $$ = $(this), menu = getMenu($$);
            clearTimeout(menu.sfTimer);
            $$.showSuperfishUl().siblings().hideSuperfishUl();
        },
        out = function(){
            var $$ = $(this), menu = getMenu($$), o = sf.op;
            clearTimeout(menu.sfTimer);
            menu.sfTimer=setTimeout(function(){
                o.retainPath=($.inArray($$[0],o.$path)>-1);
                $$.hideSuperfishUl();
                if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){
                    over.call(o.$path);
                }
            },o.delay);
        },
        getMenu = function($menu){
            var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
            sf.op = sf.o[menu.serial];
            return menu;
        },
        addArrow = function($a){
            $a.addClass(c.anchorClass).append($arrow.clone());
        };
			
        return this.each(function() {
            var s = this.serial = sf.o.length;
            var o = $.extend({},sf.defaults,op);
            o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
                $(this).addClass([o.hoverClass,c.bcClass].join(' '))
                .filter('li:has(ul)').removeClass(o.pathClass);
            });
            sf.o[s] = sf.op = o;
			
            $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
                if (o.autoArrows) addArrow( $('>a:first-child',this) );
            })
            .not('.'+c.bcClass)
            .hideSuperfishUl();
			
            var $a = $('a',this);
            $a.each(function(i){
                var $li = $a.eq(i).parents('li');
                $a.eq(i).focus(function(){
                    over.call($li);
                }).blur(function(){
                    out.call($li);
                });
            });
            o.onInit.call(this);
			
        }).each(function() {
            var menuClasses = [c.menuClass];
            if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
            $(this).addClass(menuClasses.join(' '));
        });
    };

    var sf = $.fn.superfish;
    sf.o = [];
    sf.op = {};
    sf.IE7fix = function(){
        var o = sf.op;
        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
            this.toggleClass(sf.c.shadowClass+'-off');
    };
    sf.c = {
        bcClass     : 'sf-breadcrumb',
        menuClass   : 'sf-js-enabled',
        anchorClass : 'sf-with-ul',
        arrowClass  : 'sf-sub-indicator',
        shadowClass : 'sf-shadow'
    };
    sf.defaults = {
        hoverClass	: 'sfHover',
        pathClass	: 'overideThisToUse',
        pathLevels	: 1,
        delay		: 800,
        animation	: {
            opacity:'show'
        },
        speed		: 'normal',
        autoArrows	: true,
        dropShadows : true,
        disableHI	: false,		// true disables hoverIntent detection
        onInit		: function(){}, // callback functions
        onBeforeShow: function(){},
        onShow		: function(){},
        onHide		: function(){}
    };
    $.fn.extend({
        hideSuperfishUl : function(){
            var o = sf.op,
            not = (o.retainPath===true) ? o.$path : '';
            o.retainPath = false;
            var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
            .find('>ul').hide().css('visibility','hidden');
            o.onHide.call($ul);
            return this;
        },
        showSuperfishUl : function(){
            var o = sf.op,
            sh = sf.c.shadowClass+'-off',
            $ul = this.addClass(o.hoverClass)
            .find('>ul:hidden').css('visibility','visible');
            sf.IE7fix.call($ul);
            o.onBeforeShow.call($ul);
            $ul.animate(o.animation,o.speed,function(){
                sf.IE7fix.call($ul);
                o.onShow.call($ul);
            });
            return this;
        }
    });

})(jQuery);


/*
 * Supersubs v0.2b - jQuery plugin
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 *
 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
 * their longest list item children. If you use this, please expect bugs and report them
 * to the jQuery Google Group with the word 'Superfish' in the subject line.
 *
 */

;
(function($){ // $ will refer to jQuery within this closure

    $.fn.supersubs = function(options){
        var opts = $.extend({}, $.fn.supersubs.defaults, options);
        // return original object to support chaining
        return this.each(function() {
            // cache selections
            var $$ = $(this);
            // support metadata
            var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
            // get the font size of menu.
            // .css('fontSize') returns various results cross-browser, so measure an em dash instead
            var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
                'padding' : 0,
                'position' : 'absolute',
                'top' : '-999em',
                'width' : 'auto'
            }).appendTo($$).width(); //clientWidth is faster, but was incorrect here
            // remove em dash
            $('#menu-fontsize').remove();
            // cache all ul elements
            $ULs = $$.find('ul');
            // loop through each ul in menu
            $ULs.each(function(i) {
                // cache this ul
                var $ul = $ULs.eq(i);
                // get all (li) children of this ul
                var $LIs = $ul.children();
                // get all anchor grand-children
                var $As = $LIs.children('a');
                // force content to one line and save current float property
                var liFloat = $LIs.css('white-space','nowrap').css('float');
                // remove width restrictions and floats so elements remain vertically stacked
                var emWidth = $ul.add($LIs).add($As).css({
                    'float' : 'none',
                    'width'	: 'auto'
                    })
                // this ul will now be shrink-wrapped to longest li due to position:absolute
                // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
                .end().end()[0].clientWidth / fontsize;
                // add more width to ensure lines don't turn over at certain sizes in various browsers
                emWidth += o.extraWidth;
                // restrict to at least minWidth and at most maxWidth
                if (emWidth > o.maxWidth)		{
                    emWidth = o.maxWidth;
                }
                else if (emWidth < o.minWidth)	{
                    emWidth = o.minWidth;
                }
                emWidth += 'em';
                // set ul to width in ems
                $ul.css('width',emWidth);
                // restore li floats to avoid IE bugs
                // set li width to full width of this ul
                // revert white-space to normal
                $LIs.css({
                    'float' : liFloat,
                    'width' : '100%',
                    'white-space' : 'normal'
                })
                // update offset position of descendant ul to reflect new width of parent
                .each(function(){
                    var $childUl = $('>ul',this);
                    var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
                    $childUl.css(offsetDirection,emWidth);
                });
            });
			
        });
    };
    // expose defaults
    $.fn.supersubs.defaults = {
        minWidth		: 9,		// requires em unit.
        maxWidth		: 25,		// requires em unit.
        extraWidth		: 0			// extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
    };
	
})(jQuery); // plugin code ends



(function($){
    /* hoverIntent by Brian Cherne */
    $.fn.hoverIntent = function(f,g) {
        // default configuration options
        var cfg = {
            sensitivity: 7,
            interval: 100,
            timeout: 0
        };
        // override configuration options with user supplied object
        cfg = $.extend(cfg, g ? {
            over: f,
            out: g
        } : f );

        // instantiate variables
        // cX, cY = current X and Y position of mouse, updated by mousemove event
        // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
        var cX, cY, pX, pY;

        // A private function for getting mouse position
        var track = function(ev) {
            cX = ev.pageX;
            cY = ev.pageY;
        };

        // A private function for comparing current and previous mouse position
        var compare = function(ev,ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            // compare mouse positions to see if they've crossed the threshold
            if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
                $(ob).unbind("mousemove",track);
                // set hoverIntent state to true (so mouseOut can be called)
                ob.hoverIntent_s = 1;
                return cfg.over.apply(ob,[ev]);
            } else {
                // set previous coordinates for next time
                pX = cX;
                pY = cY;
                // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
                ob.hoverIntent_t = setTimeout( function(){
                    compare(ev, ob);
                } , cfg.interval );
            }
        };

        // A private function for delaying the mouseOut function
        var delay = function(ev,ob) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
            ob.hoverIntent_s = 0;
            return cfg.out.apply(ob,[ev]);
        };

        // A private function for handling mouse 'hovering'
        var handleHover = function(e) {
            // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
            var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
            while ( p && p != this ) {
                try {
                    p = p.parentNode;
                } catch(e) {
                    p = this;
                }
            }
        if ( p == this ) {
            return false;
        }

        // copy objects to be passed into t (required for event object to be passed in IE)
        var ev = jQuery.extend({},e);
        var ob = this;

        // cancel hoverIntent timer if it exists
        if (ob.hoverIntent_t) {
            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
        }

        // else e.type == "onmouseover"
        if (e.type == "mouseover") {
            // set "previous" X and Y position based on initial entry point
            pX = ev.pageX;
            pY = ev.pageY;
            // update "current" X and Y position based on mousemove
            $(ob).bind("mousemove",track);
            // start polling interval (self-calling timeout) to compare mouse coordinates over time
            if (ob.hoverIntent_s != 1) {
                ob.hoverIntent_t = setTimeout( function(){
                    compare(ev,ob);
                } , cfg.interval );
            }

        // else e.type == "onmouseout"
        } else {
            // unbind expensive mousemove event
            $(ob).unbind("mousemove",track);
            // if hoverIntent state is true, then call the mouseOut function after the specified delay
            if (ob.hoverIntent_s == 1) {
                ob.hoverIntent_t = setTimeout( function(){
                    delay(ev,ob);
                } , cfg.timeout );
            }
        }
    };

    // bind the function to the two event listeners
    return this.mouseover(handleHover).mouseout(handleHover);
};
	
})(jQuery);



/* ################ tabs ende ############### */


jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert(jQuery.easing.default);
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
    },
    easeInQuad: function (x, t, b, c, d) {
        return c*(t/=d)*t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c*(t/=d)*t*t + b;
    },
    easeOutCubic: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t + 1) + b;
    },
    easeInOutCubic: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t + b;
        return c/2*((t-=2)*t*t + 2) + b;
    },
    easeInQuart: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t + b;
    },
    easeOutQuart: function (x, t, b, c, d) {
        return -c * ((t=t/d-1)*t*t*t - 1) + b;
    },
    easeInOutQuart: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
        return -c/2 * ((t-=2)*t*t*t - 2) + b;
    },
    easeInQuint: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t*t + b;
    },
    easeOutQuint: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t*t*t + 1) + b;
    },
    easeInOutQuint: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
        return c/2*((t-=2)*t*t*t*t + 2) + b;
    },
    easeInSine: function (x, t, b, c, d) {
        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
    },
    easeOutSine: function (x, t, b, c, d) {
        return c * Math.sin(t/d * (Math.PI/2)) + b;
    },
    easeInOutSine: function (x, t, b, c, d) {
        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
    },
    easeInExpo: function (x, t, b, c, d) {
        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    },
    easeInOutExpo: function (x, t, b, c, d) {
        if (t==0) return b;
        if (t==d) return b+c;
        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
    },
    easeInCirc: function (x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
    },
    easeInOutCirc: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
    },
    easeInElastic: function (x, t, b, c, d) {
        var s=1.70158;
        var p=0;
        var a=c;
        if (t==0) return b;
        if ((t/=d)==1) return b+c;
        if (!p) p=d*.3;
        if (a < Math.abs(c)) {
            a=c;
            var s=p/4;
        }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    },
    easeOutElastic: function (x, t, b, c, d) {
        var s=1.70158;
        var p=0;
        var a=c;
        if (t==0) return b;
        if ((t/=d)==1) return b+c;
        if (!p) p=d*.3;
        if (a < Math.abs(c)) {
            a=c;
            var s=p/4;
        }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s=1.70158;
        var p=0;
        var a=c;
        if (t==0) return b;
        if ((t/=d/2)==2) return b+c;
        if (!p) p=d*(.3*1.5);
        if (a < Math.abs(c)) {
            a=c;
            var s=p/4;
        }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
    },
    easeInBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*(t/=d)*t*((s+1)*t - s) + b;
    },
    easeOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
    },
    easeInOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
    },
    easeInBounce: function (x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
    },
    easeOutBounce: function (x, t, b, c, d) {
        if ((t/=d) < (1/2.75)) {
            return c*(7.5625*t*t) + b;
        } else if (t < (2/2.75)) {
            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
        } else if (t < (2.5/2.75)) {
            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
        } else {
            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
        }
    },
    easeInOutBounce: function (x, t, b, c, d) {
        if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
    }
});

;
(function($){
    $.fn.navSlider = function(options){

        this.options = options;
		
        this.elements = this.find('.'+this.options['elementClass']);
        this.currentIndex = 0;
        this.hideIndex = 0;
        this.periodical = true;
        this.selectedIndex = -1;
        this.slideTimeout = false;
        this.slideActive = false;
        that = this;
		
        // set opacity of image-text-divs
        this.elementsImageTexts = this.find('.'+this.options['elementClass']+' .imageText');
        this.elementsImageTexts.each(function(index, item) {
            $(item).css('opacity', 0.5);
        });
		
        // just show first element
        for (c=0; c<this.elements.length; c++) {
            if (c) {
                $(this.elements[c]).css('opacity', 0);
                $(this.elements[c]).css('display', 'none');
            }
        }
		
        // build slider navigation
		
        //$('<div class="sliderNavBrowse prev" /><div id="'+this.options['navId']+'"><div class="sliderNavItems"></div></div><div class="sliderNavBrowse next" />').appendTo($('#'+this.options['rootId']));
		
        $('<div id="sliderNavigation"><ul></ul></div>').appendTo($('#'+that.options['rootId']));

        //$('#sliderNavigation').after('<div id="debug">false</div>');

        this.navElements = this.find('.'+this.options['menuClass']);
        this.navElements.each(function(index, item) {
			
            navItem = $('<li />').addClass('index'+String(index+1));
            $(item).detach().appendTo($(navItem));
            if (!index) {
                $(navItem).addClass('active');
            }
            $(navItem).appendTo($('#sliderNavigation ul'));
			
            $(item).bind('mouseenter', {
                item:item
            }, function (event) {
                $(event.data.item).parent('li').addClass('hover');
            });
            $(item).bind('mouseleave', {
                item:item
            }, function (event) {
                $(event.data.item).parent('li').removeClass('hover');
            });
            $(item).bind('mouseup', {
                index:index
            }, function (event) {
                that.periodical = false;
                if (that.selectedIndex != event.data.index) {
                    if (that.slideTimeout) {
                        window.clearTimeout(that.slideTimeout);
                    }
                    that.selectedIndex = event.data.index;
                    that.doSlide();
                }
            });
						
        });
        /*
		$('#'+this.options['navId']).scrollable({
			items: '.sliderNavElement',
			circular: true
			
		});
		*/
		
		
		

		
        this.doSlide = function() {

            //if (!that.slideActive) {
                that.slideActive = true;
                //$('#debug').html('true');
                for (c=0; c<that.elements.length; c++) {
                    $(that.elements[c]).stop(true,true);
                }

                
                that.hideIndex = that.currentIndex;
                $(that.navElements[that.currentIndex]).parent('li').removeClass('active');
                $(that.elements[that.currentIndex]).stop(true,true).animate(
                {
                    opacity: 0
                },
                {
                    duration: 150,
                    specialEasing: {
                        opacity: 'linear'
                    },
                    complete: function() {
                        $(that.elements[that.currentIndex]).css('display', 'none');
                        if (that.selectedIndex>=0) {
                            that.currentIndex = that.selectedIndex;
                        }
                        else {
                            that.currentIndex++;
                            if (that.currentIndex >= that.elements.length) {
                                that.currentIndex = 0;
                            }
                        }

                        $(that.navElements[that.currentIndex]).parent('li').addClass('active');
                        $(that.elements[that.currentIndex]).css('display', 'block');
                        $(that.elements[that.currentIndex]).stop(true,true).animate(
                        {
                            opacity: 1
                        },
                        {
                            duration: 900,
                            specialEasing: {
                                opacity: 'linear'
                            },
                            complete: function() {
                                $(that.elements[that.hideIndex]).css('display', 'none');
                                that.slideActive = false;
                                //$('#debug').html('false');
                                if (that.periodical) {
                                    that.slideTimeout = window.setTimeout(that.doSlide, 4000);
                                }
                            }
                        }
                        );
                    }
                }
                );

                                
            //}

        }
		
        that.slideTimeout = window.setTimeout(this.doSlide, 4000);
		
		
    };
})(jQuery);


function zoomBox(){

    $('.magicBoxContainer').hoverIntent(function() {
        /*
       *    $(this).parent().expose({
            maskId: 'exposeMask',
           // zIndex: 10000,
            loadSpeed: 1,
            closeSpeed: 0,
            opacity: .8
        });
        */
        $(this).css('-moz-box-shadow','0px 0px 6px #333');
        $(this).css('zIndex','2');
        $(this).find('p').css('fontSize','116.667%');
    //  $(this).css('font-size','1.1em');
    //$(this).parent().css('z-index','2');
    // $(this).find('h2').css('backgroundColor','#cc0000');
    //  $(this).parent().css('background', 'url(fileadmin/images/layout/bg-dotted.gif)');
    //   $(this).parent().css('backgroundColor', '#efefef');


    }, function () {
        $(this).css('-moz-box-shadow','0px 0px 0px #000');
        $(this).css('zIndex','1');
        $(this).find('p').css('fontSize','100%');
    //  $(this).css('font-size','1em');
    // $(this).parent().css('z-index','1');
    //$(this).find('h2').css('backgroundColor','#ffffff');
    //  $(this).parent().css('background', 'url(fileadmin/images/layout/bg-dotted.gif)');
    //  $(this).parent().css('backgroundColor', '#ffffff');
    //  $.mask.close();

    });
}

function buildSearchBox()
{
    var searchBox = $("#inputSuche input");
    var searchBoxDefault = "Ihr Suchbegriff";

    searchBox.attr("value", "Ihr Suchbegriff");

    searchBox.focus(function(){
        if($(this).attr("value") == searchBoxDefault)
            $(this).attr("value", "");
    });
    searchBox.blur(function(){
        if($(this).attr("value") == "")
            $(this).attr("value", searchBoxDefault);
    });

}

function buildLoginBox()
{
    var loginBoxUser = $("#loginForm input#user");
    var loginBoxUserDefault = "Benutzername";

    loginBoxUser.attr("value", "Benutzername");

    loginBoxUser.focus(function(){
        if($(this).attr("value") == loginBoxUserDefault)
            $(this).attr("value", "");
    });
    loginBoxUser.blur(function(){
        if($(this).attr("value") == "")
            $(this).attr("value", loginBoxUserDefault);
    });





    var loginBoxPass = $("#loginForm input#pass");
    var loginBoxPassDefault = "Passwort";

    loginBoxPass.attr("value", "Passwort");
    loginBoxPass.focus(function(){

        if($(this).attr("value") == loginBoxPassDefault);
        $(this).attr("value", "");
    });


    loginBoxPass.blur(function(){
        if($(this).attr("value") == "")
            $(this).attr("value", loginBoxPassDefault);

    });




//formexPoser();
}

(function($) {

    $.fn.TextAreaExpander = function(minHeight, maxHeight) {
        var hCheck = !($.browser.msie || $.browser.opera);

        function ResizeTextarea(e) {

            e = e.target || e;

            var vlen = e.value.length, ewidth = e.offsetWidth;
            if (vlen != e.valLength || ewidth != e.boxWidth) {

                if (hCheck && (vlen < e.valLength || ewidth != e.boxWidth)) e.style.height = "0px";
                var h = Math.max(e.expandMin, Math.min(e.scrollHeight, e.expandMax));

                e.style.overflow = (e.scrollHeight > h ? "auto" : "hidden");
                e.style.height = h + "px";

                e.valLength = vlen;
                e.boxWidth = ewidth;
            }

            return true;
        };


        this.each(function() {

            if (this.nodeName.toLowerCase() != "textarea") return;

            var p = this.className.match(/expand(\d+)\-*(\d+)*/i);
            this.expandMin = minHeight || (p ? parseInt('0'+p[1], 10) : 0);
            this.expandMax = maxHeight || (p ? parseInt('0'+p[2], 10) : 99999);

            ResizeTextarea(this);

            if (!this.Initialized) {
                this.Initialized = true;
                $(this).css("padding-top", 5).css("padding-bottom", 5);
                $(this).bind("keyup", ResizeTextarea).bind("focus", ResizeTextarea);
            }
        });

        return this;
    };


})(jQuery);




function in_array(item,arr) {
    for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
    return false;
}

/**
* Returns the week number for this date. dowOffset is the day of week the week
* "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday),
* the week returned is the ISO 8601 week number.
* @param int dowOffset
* @return int
*/
Date.prototype.getWeek = function (dowOffset) {
    /*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */

    dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 0; //default dowOffset to zero
    var newYear = new Date(this.getFullYear(),0,1);
    var day = newYear.getDay() - dowOffset; //the day of week the year begins on
    day = (day >= 0 ? day : day + 7);
    var daynum = Math.floor((this.getTime() - newYear.getTime() -
        (this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
    var weeknum;
    //if the year starts before the middle of a week
    if(day < 4) {
        weeknum = Math.floor((daynum+day-1)/7) + 1;
        if(weeknum > 52) {
            nYear = new Date(this.getFullYear() + 1,0,1);
            nday = nYear.getDay() - dowOffset;
            nday = nday >= 0 ? nday : nday + 7;
            /*if the next year starts before the middle of
the week, it is week #1 of that year*/
            weeknum = nday < 4 ? 1 : 53;
        }
    }
    else {
        weeknum = Math.floor((daynum+day-1)/7);
    }
    return weeknum;
};




/***************************************************
 * startskripte
 ***************************************************/

jQuery(document).ready(function(){

   



	



    });

	
	
	
	
