// Modernizr v1.7  www.modernizr.com
window.Modernizr=function(a,b,c){function G(){e.input=function(a){for(var b=0,c=a.length;b<c;b++)t[a[b]]=!!(a[b]in l);return t}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)l.setAttribute("type",f=a[d]),e=l.type!=="text",e&&(l.value=m,l.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&l.style.WebkitAppearance!==c?(g.appendChild(l),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(l,null).WebkitAppearance!=="textfield"&&l.offsetHeight!==0,g.removeChild(l)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=l.checkValidity&&l.checkValidity()===!1:/^color$/.test(f)?(g.appendChild(l),g.offsetWidth,e=l.value!=m,g.removeChild(l)):e=l.value!=m)),s[a[d]]=!!e;return s}("search tel url email datetime date month week time datetime-local number range color".split(" "))}function F(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+p.join(c+" ")+c).split(" ");return!!E(d,b)}function E(a,b){for(var d in a)if(k[a[d]]!==c&&(!b||b(a[d],j)))return!0}function D(a,b){return(""+a).indexOf(b)!==-1}function C(a,b){return typeof a===b}function B(a,b){return A(o.join(a+";")+(b||""))}function A(a){k.cssText=a}var d="1.7",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l=b.createElement("input"),m=":)",n=Object.prototype.toString,o=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),p="Webkit Moz O ms Khtml".split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v,w=function(a){var c=b.createElement("style"),d=b.createElement("div"),e;c.textContent=a+"{#modernizr{height:3px}}",h.appendChild(c),d.id="modernizr",g.appendChild(d),e=d.offsetHeight===3,c.parentNode.removeChild(c),d.parentNode.removeChild(d);return!!e},x=function(){function d(d,e){e=e||b.createElement(a[d]||"div");var f=(d="on"+d)in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),y=({}).hasOwnProperty,z;C(y,c)||C(y.call,c)?z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)}:z=function(a,b){return y.call(a,b)},r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return a.getContext&&a.getContext("2d")},r.canvastext=function(){return e.canvas&&C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return"ontouchstart"in a||w("@media ("+o.join("touch-enabled),(")+"modernizr)")},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b<c;){var d=p[b].toLowerCase();if(a[d+"_indexedDB"]||a[d+"IndexedDB"])return!0}return!1},r.hashchange=function(){return x("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.history=function(){return !!(a.history&&history.pushState)},r.draganddrop=function(){return x("dragstart")&&x("drop")},r.websockets=function(){return"WebSocket"in a},r.rgba=function(){A("background-color:rgba(150,255,150,.5)");return D(k.backgroundColor,"rgba")},r.hsla=function(){A("background-color:hsla(120,40%,100%,.5)");return D(k.backgroundColor,"rgba")||D(k.backgroundColor,"hsla")},r.multiplebgs=function(){A("background:url(//:),url(//:),red url(//:)");return(new RegExp("(url\\s*\\(.*?){3}")).test(k.background)},r.backgroundsize=function(){return F("backgroundSize")},r.borderimage=function(){return F("borderImage")},r.borderradius=function(){return F("borderRadius","",function(a){return D(a,"orderRadius")})},r.boxshadow=function(){return F("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){B("opacity:.55");return/^0.55$/.test(k.opacity)},r.cssanimations=function(){return F("animationName")},r.csscolumns=function(){return F("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";A((a+o.join(b+a)+o.join(c+a)).slice(0,-a.length));return D(k.backgroundImage,"gradient")},r.cssreflections=function(){return F("boxReflect")},r.csstransforms=function(){return!!E(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},r.csstransforms3d=function(){var a=!!E(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=w("@media ("+o.join("transform-3d),(")+"modernizr)"));return a},r.csstransitions=function(){return F("transitionProperty")},r.fontface=function(){var a,c,d=h||g,e=b.createElement("style"),f=b.implementation||{hasFeature:function(){return!1}};e.type="text/css",d.insertBefore(e,d.firstChild),a=e.sheet||e.styleSheet;var i=f.hasFeature("CSS2","")?function(b){if(!a||!b)return!1;var c=!1;try{a.insertRule(b,0),c=/src/i.test(a.cssRules[0].cssText),a.deleteRule(a.cssRules.length-1)}catch(d){}return c}:function(b){if(!a||!b)return!1;a.cssText=b;return a.cssText.length!==0&&/src/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(b.split(" ")[0])===0};c=i('@font-face { font-family: "font"; src: url(data:,); }'),d.removeChild(e);return c},r.video=function(){var a=b.createElement("video"),c=!!a.canPlayType;if(c){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return c},r.audio=function(){var a=b.createElement("audio"),c=!!a.canPlayType;c&&(c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;"));return c},r.localstorage=function(){try{return!!localStorage.getItem}catch(a){return!1}},r.sessionstorage=function(){try{return!!sessionStorage.getItem}catch(a){return!1}},r.webWorkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var H in r)z(r,H)&&(v=H.toLowerCase(),e[v]=r[H](),u.push((e[v]?"":"no-")+v));e.input||G(),e.crosswindowmessaging=e.postmessage,e.historymanagement=e.history,e.addTest=function(a,b){a=a.toLowerCase();if(!e[a]){b=!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b;return e}},A(""),j=l=null,f&&a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function p(a,b){var c=-1,d=a.length,e,f=[];while(++c<d)e=a[c],(b=e.media||b)!="screen"&&f.push(p(e.imports,b),e.cssText);return f.join("")}function o(a){var b=-1;while(++b<e)a.createElement(d[b])}var c="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",d=c.split("|"),e=d.length,f=new RegExp("(^|\\s)("+c+")","gi"),g=new RegExp("<(/*)("+c+")","gi"),h=new RegExp("(^|[^\\n]*?\\s)("+c+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),i=b.createDocumentFragment(),j=b.documentElement,k=j.firstChild,l=b.createElement("body"),m=b.createElement("style"),n;o(b),o(i),k.insertBefore(m,k.firstChild),m.media="print",a.attachEvent("onbeforeprint",function(){var a=-1,c=p(b.styleSheets,"all"),k=[],o;n=n||b.body;while((o=h.exec(c))!=null)k.push((o[1]+o[2]+o[3]).replace(f,"$1.iepp_$2")+o[4]);m.styleSheet.cssText=k.join("\n");while(++a<e){var q=b.getElementsByTagName(d[a]),r=q.length,s=-1;while(++s<r)q[s].className.indexOf("iepp_")<0&&(q[s].className+=" iepp_"+d[a])}i.appendChild(n),j.appendChild(l),l.className=n.className,l.innerHTML=n.innerHTML.replace(g,"<$1font")}),a.attachEvent("onafterprint",function(){l.innerHTML="",j.removeChild(l),j.appendChild(n),m.styleSheet.cssText=""})}(a,b),e._enableHTML5=f,e._version=d,g.className=g.className.replace(/\bno-js\b/,"")+" js "+u.join(" ");return e}(this,this.document);
/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */

/**
 * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
 *
 * The HTML markup that is used to build the carousel can be as simple as...
 *
 *  <div class="carousel">
 *      <ul>
 *          <li><img src="image/1.jpg" alt="1"></li>
 *          <li><img src="image/2.jpg" alt="2"></li>
 *          <li><img src="image/3.jpg" alt="3"></li>
 *      </ul>
 *  </div>
 *
 * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
 * You don't need any special "class" attribute, or a special "css" file for this plugin.
 * I am using a class attribute just for the sake of explanation here.
 *
 * To navigate the elements of the carousel, you need some kind of navigation buttons.
 * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
 * This need not be part of the carousel "div" itself. It can be any element in your page.
 * Lets assume that the following elements in your document can be used as next, and prev buttons...
 *
 * <button class="prev">&lt;&lt;</button>
 * <button class="next">&gt;&gt;</button>
 *
 * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
 * navigation buttons as options.
 *
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 *
 * That's it, you would have now converted your raw div, into a magnificient carousel.
 *
 * There are quite a few other options that you can use to customize it though.
 * Each will be explained with an example below.
 *
 * @param an options object - You can specify all the options shown below as an options object param.
 *
 * @option btnPrev, btnNext : string - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
 *
 * @option btnGo - array - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      btnGo: [".0", ".1", ".2"]
 * });
 * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
 * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
 * in the carousel. The index of the array represents the index of the element. What i mean is, if the
 * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
 * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
 * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
 * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
 * The best part is that, the tab will "slide" based on the provided effect. :-)
 *
 * @option mouseWheel : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      mouseWheel: true
 * });
 * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
 * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
 * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
 * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
 * as well. They complement each other. To use both together, just supply the options required for both as shown below.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      mouseWheel: true
 * });
 *
 * @option auto : number - default is null, meaning autoscroll is disabled by default
 * @example
 * $(".carousel").jCarouselLite({
 *      auto: 800,
 *      speed: 500
 * });
 * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
 * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
 * Specify this value and magically your carousel will start auto scrolling.
 *
 * @option speed : number - 200 is default
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      speed: 800
 * });
 * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
 * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
 *
 * @option easing : string - no easing effects by default.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      easing: "bounceout"
 * });
 * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
 * the carousel will slide based on the provided easing effect.
 *
 * @option vertical : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      vertical: true
 * });
 * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
 * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
 * display horizontally. The next and prev items will slide the items from left-right in this case.
 *
 * @option circular : boolean - default is true
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      circular: false
 * });
 * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
 * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
 * if you click on the "next" button after you reach the last element, you will stay in the last element itself
 * and similarly for "previous" button and first element.
 *
 * @option visible : number - default is 3
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      visible: 4
 * });
 * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
 * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
 * last item half visible. This gives you the effect of showing the user that there are more images to the right.
 *
 * @option start : number - default is 0
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      start: 2
 * });
 * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
 * has a start of 0, and so on.
 *
 * @option scrool : number - default is 1
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      scroll: 2
 * });
 * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
 * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
 * 2 items when you click the next or previous buttons.
 *
 * @option beforeStart, afterEnd : function - callbacks
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      beforeStart: function(a) {
 *          alert("Before animation starts:" + a);
 *      },
 *      afterEnd: function(a) {
 *          alert("After animation ends:" + a);
 *      }
 * });
 * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
 * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
 * are visible at the time of callback.
 *
 *
 * @cat Plugins/Image Gallery
 * @author Ganeshji Marwaha/ganeshread@gmail.com
 */

(function($) {                                          // Compliant with jquery.noConflict()
$.fn.jCarouselLite = function(o) {
    o = $.extend({
        btnPrev: null,
        btnNext: null,
        btnGo: null,
        mouseWheel: false,
        auto: null,

        speed: 200,
        easing: null,

        vertical: false,
        circular: true,
        visible: 3,
        start: 0,
        scroll: 1,

        beforeStart: null,
        afterEnd: null,
        adaptWidth: true,
        listClass: ''
    }, o || {});
    

    return this.each(function() {                           // Returns the element collection. Chainable.

        var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
        var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
        
        if(o.circular) 
        {
            ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());
            o.start += v;
        }
        	
        var li = $("li", ul), itemLength = li.size(), curr = o.start;
        div.css("visibility", "visible");
        
        setArrows();
        
        li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
        ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
        div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});

        var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
        var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
        var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
        
//        otherwise the issue archive isn't displayed correctly because of the info boxes
//        li.css({width: li.width(), height: li.height()});
        ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
        
        div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images
        
        if(o.adaptWidth)
        {
	        $(window).resize(function() {
	        	
		        // 120 = space left and right for the arrows
	        	var items = $(o.listClass + ' .item-list li');
	        	
	        	if(items.length > 0)
	        		v = Math.floor( ($(window).width() - 120)/($(o.listClass + ' .item-list li').outerWidth() + parseInt($(o.listClass + ' .item-list li').css('margin-right'))) );
	        	
	            liSize = o.vertical ? height(li) : width(li);   
	            ulSize = liSize * itemLength;                   
	            divSize = liSize * v;  
	            
//	            otherwise the issue archive isn't displayed correctly because of the info boxes
//	            li.css({width: li.width(), height: li.height()});
	            ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
	            div.css(sizeCss, divSize+"px");
	            
	            if(parseInt(ul.css('left')) < 0 && (ul.width() - div.width()) * -1 > parseInt(ul.css('left')))
	            {
	            	ul.css('left', (ul.width() - div.width()) * -1 + "px");
	            	curr--;
	            }
	            
	            setArrows();
	        });
        }
        
        

        if(o.btnPrev)
            $(o.btnPrev).click(function() {
                return go(curr-o.scroll);
            });

        if(o.btnNext)
            $(o.btnNext).click(function() {
                return go(curr+o.scroll);
            });

        if(o.btnGo)
            $.each(o.btnGo, function(i, val) {
                $(val).click(function() {
                    return go(o.circular ? o.visible+i : i);
                });
            });

        if(o.mouseWheel && div.mousewheel)
            div.mousewheel(function(e, d) {
                return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
            });

        if(o.auto)
            setInterval(function() {
                go(curr+o.scroll);
            }, o.auto+o.speed);
        
        function setArrows() {
        	if(! o.circular)
        	{
	        	if(curr == 0)
	            	$(o.btnPrev).hide();
	        	else
	        		$(o.btnPrev).show();
	        	
	        	if((curr+o.scroll) < 0 || (curr+o.scroll) > itemLength-v)
	        		$(o.btnNext).hide();
	        	else
	        		$(o.btnNext).show();
        	}
        	
        	return false;
        };
                
        function vis() {
            return li.slice(curr).slice(0,v);
        };

        function go(to) {
            if(!running) {

                if(o.beforeStart)
                    o.beforeStart.call(this, vis());

                if(o.circular) 
                {            // If circular we are in first or last, then goto the other end
                    if(to<=o.start-v-1) 
                    {           
                    	// If first, then goto last
                        ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
                        curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
                    } 
                    else if(to>=itemLength-v+1) 
                    { // If last, then goto first
                        ul.css(animCss, -( (v) * liSize ) + "px" );
                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
                        curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
                    } 
                    else 
                    	curr = to;
                } 
                else 
                {                    // If non-circular and to points to first or last, we just return.
                    if(to<0 || to>itemLength-v) 
                    	return;
                    else 
                    	curr = to;
                }                           // If neither overrides it, the curr will still be "to" and we can proceed.
                
                setArrows();

                running = true;

                ul.animate(
                    animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
                    function() {
                        if(o.afterEnd)
                            o.afterEnd.call(this, vis());
                        running = false;
                    }
                );
                // Disable buttons when the carousel reaches the last/first, and enable when not
                if(!o.circular) {
                    $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
                    $( (curr-o.scroll<0 && o.btnPrev)
                        ||
                       (curr+o.scroll > itemLength-v && o.btnNext)
                        ||
                       []
                     ).addClass("disabled");
                }

            }
            return false;
        };
    });
};

function css(el, prop) {
    return parseInt($.css(el[0], prop)) || 0;
};
function width(el) {
    return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
};
function height(el) {
    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
};

})(jQuery);;
/*!
 * jQuery Cycle Lite Plugin
 * http://malsup.com/jquery/cycle/lite/
 * Copyright (c) 2008-2011 M. Alsup
 * Version: 1.3.1 (07-OCT-2011)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.3.2 or later
 */
;(function($) {

var ver = 'Lite-1.3';

$.fn.cycle = function(options) {
    return this.each(function() {
        options = options || {};
        
        if (this.cycleTimeout) clearTimeout(this.cycleTimeout);
        this.cycleTimeout = 0;
        this.cyclePause = 0;
        
        var $cont = $(this);
        var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
        var els = $slides.get();
        if (els.length < 2) {
            window.console && console.log('terminating; too few slides: ' + els.length);
            return; // don't bother
        }

        // support metadata plugin (v1.0 and v2.0)
        var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
		var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
		if (meta)
			opts = $.extend(opts, meta);
            
        opts.before = opts.before ? [opts.before] : [];
        opts.after = opts.after ? [opts.after] : [];
        opts.after.unshift(function(){ opts.busy=0; });
            
        // allow shorthand overrides of width, height and timeout
        var cls = this.className;
        opts.width = parseInt((cls.match(/w:(\d+)/)||[])[1]) || opts.width;
        opts.height = parseInt((cls.match(/h:(\d+)/)||[])[1]) || opts.height;
        opts.timeout = parseInt((cls.match(/t:(\d+)/)||[])[1]) || opts.timeout;

        if ($cont.css('position') == 'static') 
            $cont.css('position', 'relative');
        if (opts.width) 
            $cont.width(opts.width);
        if (opts.height && opts.height != 'auto') 
            $cont.height(opts.height);

        var first = 0;
        $slides.css({position: 'absolute', top:0, left:0}).each(function(i) { 
            $(this).css('z-index', els.length-i) 
        });
        
        $(els[first]).css('opacity',1).show(); // opacity bit needed to handle reinit case
        if ($.browser.msie) els[first].style.removeAttribute('filter');

        if (opts.fit && opts.width) 
            $slides.width(opts.width);
        if (opts.fit && opts.height && opts.height != 'auto') 
            $slides.height(opts.height);
        if (opts.pause) 
            $cont.hover(function(){this.cyclePause=1;}, function(){this.cyclePause=0;});

        var txFn = $.fn.cycle.transitions[opts.fx];
		txFn && txFn($cont, $slides, opts);
        
        $slides.each(function() {
            var $el = $(this);
            this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
            this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
        });

        if (opts.cssFirst)
            $($slides[first]).css(opts.cssFirst);

        if (opts.timeout) {
            // ensure that timeout and speed settings are sane
            if (opts.speed.constructor == String)
                opts.speed = {slow: 600, fast: 200}[opts.speed] || 400;
            if (!opts.sync)
                opts.speed = opts.speed / 2;
            while((opts.timeout - opts.speed) < 250)
                opts.timeout += opts.speed;
        }
        opts.speedIn = opts.speed;
        opts.speedOut = opts.speed;

 		opts.slideCount = els.length;
        opts.currSlide = first;
        opts.nextSlide = 1;

        // fire artificial events
        var e0 = $slides[first];
        if (opts.before.length)
            opts.before[0].apply(e0, [e0, e0, opts, true]);
        if (opts.after.length > 1)
            opts.after[1].apply(e0, [e0, e0, opts, true]);
        
        if (opts.click && !opts.next)
            opts.next = opts.click;
        if (opts.next)
            $(opts.next).bind('click', function(){return advance(els,opts,opts.rev?-1:1)});
        if (opts.prev)
            $(opts.prev).bind('click', function(){return advance(els,opts,opts.rev?1:-1)});

        if (opts.timeout)
            this.cycleTimeout = setTimeout(function() {
                go(els,opts,0,!opts.rev)
            }, opts.timeout + (opts.delay||0));
    });
};

function go(els, opts, manual, fwd) {
    if (opts.busy) return;
    var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide];
    if (p.cycleTimeout === 0 && !manual) 
        return;

    if (manual || !p.cyclePause) {
        if (opts.before.length)
            $.each(opts.before, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
        var after = function() {
            if ($.browser.msie)
                this.style.removeAttribute('filter');
            $.each(opts.after, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
            queueNext();
        };

        if (opts.nextSlide != opts.currSlide) {
            opts.busy = 1;
            $.fn.cycle.custom(curr, next, opts, after);
        }
        var roll = (opts.nextSlide + 1) == els.length;
        opts.nextSlide = roll ? 0 : opts.nextSlide+1;
        opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
    }
    
    function queueNext() {
        if (opts.timeout)
            p.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev) }, opts.timeout);
    }
};

// advance slide forward or back
function advance(els, opts, val) {
    var p = els[0].parentNode, timeout = p.cycleTimeout;
    if (timeout) {
        clearTimeout(timeout);
        p.cycleTimeout = 0;
    }
    opts.nextSlide = opts.currSlide + val;
    if (opts.nextSlide < 0) {
        opts.nextSlide = els.length - 1;
    }
    else if (opts.nextSlide >= els.length) {
        opts.nextSlide = 0;
    }
    go(els, opts, 1, val>=0);
    return false;
};

$.fn.cycle.custom = function(curr, next, opts, cb) {
    var $l = $(curr), $n = $(next);
    $n.css(opts.cssBefore);
    var fn = function() {$n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb)};
    $l.animate(opts.animOut, opts.speedOut, opts.easeOut, function() {
        $l.css(opts.cssAfter);
        if (!opts.sync) fn();
    });
    if (opts.sync) fn();
};

$.fn.cycle.transitions = {
    fade: function($cont, $slides, opts) {
		$slides.not(':eq(0)').hide();
		opts.cssBefore = { opacity: 0, display: 'block' };
		opts.cssAfter  = { display: 'none' };
		opts.animOut = { opacity: 0 };
		opts.animIn = { opacity: 1 };
    },
    fadeout: function($cont, $slides, opts) {
		opts.before.push(function(curr,next,opts,fwd) {
			$(curr).css('zIndex',opts.slideCount + (fwd === true ? 1 : 0));
			$(next).css('zIndex',opts.slideCount + (fwd === true ? 0 : 1));
		});
		$slides.not(':eq(0)').hide();
		opts.cssBefore = { opacity: 1, display: 'block', zIndex: 1 };
		opts.cssAfter  = { display: 'none', zIndex: 0 };
		opts.animOut = { opacity: 0 };
    }
};

$.fn.cycle.ver = function() { return ver; };

// @see: http://malsup.com/jquery/cycle/lite/
$.fn.cycle.defaults = {
	animIn:        {},
	animOut:       {},
	fx:           'fade',
    after:         null, 
    before:        null, 
	cssBefore:     {},
	cssAfter:      {},
    delay:         0,    
    fit:           0,    
    height:       'auto',
	metaAttr:     'cycle',
    next:          null, 
    pause:         0,    
    prev:          null, 
    speed:         1000, 
    slideExpr:     null,
    sync:          1,    
    timeout:       4000 
};

})(jQuery);
;
/**
 * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
 * Common usage: wipe images (left and right to show the previous or next image)
 * 
 * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
 * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
 * @version 1.1 (1st September 2010) - support wipe up and wipe down
 * @version 1.0 (15th July 2010)
 */
(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);;
/**
 * 
 * Find more about the scrolling function at
 * http://cubiq.org/iscroll
 *
 * Copyright (c) 2010 Matteo Spinelli, http://cubiq.org/
 * Released under MIT license
 * http://cubiq.org/dropbox/mit-license.txt
 * 
 * Version 3.7.1 - Last updated: 2010.10.08
 * 
 */

(function(){
function iScroll (el, options) {
	
	var that = this, i;
	that.element = typeof el == 'object' ? el : document.getElementById(el);
	that.wrapper = that.element.parentNode;
	
	that.element.style.webkitTransitionProperty = '-webkit-transform';
	that.element.style.webkitTransitionTimingFunction = 'cubic-bezier(0,0,0.25,1)';
	that.element.style.webkitTransitionDuration = '0';
	that.element.style.webkitTransform = translateOpen + '0,0' + translateClose;

	// Default options
	that.options = {
		bounce: has3d,
		momentum: has3d,
		checkDOMChanges: true,
		topOnDOMChanges: false,
		hScrollbar: has3d,
		vScrollbar: has3d,
		fadeScrollbar: isIthing || !isTouch,
		shrinkScrollbar: isIthing || !isTouch,
		desktopCompatibility: false,
		overflow: 'auto',
		snap: false,
		bounceLock: false,
		scrollbarColor: 'rgba(0,0,0,0.5)',
		onScrollEnd: function () {}
	};
	
	// User defined options
	if (typeof options == 'object') {
		for (i in options) {
			that.options[i] = options[i];
		}
	}

	if (that.options.desktopCompatibility) {
		that.options.overflow = 'hidden';
	}
	
	that.onScrollEnd = that.options.onScrollEnd;
	delete that.options.onScrollEnd;
	
	that.wrapper.style.overflow = that.options.overflow;
	
	that.refresh();

	window.addEventListener('onorientationchange' in window ? 'orientationchange' : 'resize', that, false);

	if (isTouch || that.options.desktopCompatibility) {
		that.element.addEventListener(START_EVENT, that, false);
		that.element.addEventListener(MOVE_EVENT, that, false);
		that.element.addEventListener(END_EVENT, that, false);
	}
	
	if (that.options.checkDOMChanges) {
		that.element.addEventListener('DOMSubtreeModified', that, false);
	}
}

iScroll.prototype = {
	x: 0,
	y: 0,
	enabled: true,

	handleEvent: function (e) {
		var that = this;
		
		switch (e.type) {
			case START_EVENT:
				that.touchStart(e);
				break;
			case MOVE_EVENT:
				that.touchMove(e);
				break;
			case END_EVENT:
				that.touchEnd(e);
				break;
			case 'webkitTransitionEnd':
				that.transitionEnd();
				break;
			case 'orientationchange':
			case 'resize':
				that.refresh();
				break;
			case 'DOMSubtreeModified':
				that.onDOMModified(e);
				break;
		}
	},
	
	onDOMModified: function (e) {
		var that = this;

		// (Hopefully) execute onDOMModified only once
		if (e.target.parentNode != that.element) {
			return;
		}

		setTimeout(function () { that.refresh(); }, 0);

		if (that.options.topOnDOMChanges && (that.x!=0 || that.y!=0)) {
			that.scrollTo(0,0,'0');
		}
	},

	refresh: function () {
		var that = this,
			resetX = that.x, resetY = that.y,
			snap;
		
		that.scrollWidth = that.wrapper.clientWidth;
		that.scrollHeight = that.wrapper.clientHeight;
		that.scrollerWidth = that.element.offsetWidth;
		that.scrollerHeight = that.element.offsetHeight;
		that.maxScrollX = that.scrollWidth - that.scrollerWidth;
		that.maxScrollY = that.scrollHeight - that.scrollerHeight;
		that.directionX = 0;
		that.directionY = 0;
		
		if (that.scrollX) {
			if (that.maxScrollX >= 0) {
				resetX = 0;
			} else if (that.x < that.maxScrollX) {
				resetX = that.maxScrollX;
			}
		}
		if (that.scrollY) {
			if (that.maxScrollY >= 0) {
				resetY = 0;
			} else if (that.y < that.maxScrollY) {
				resetY = that.maxScrollY;
			}
		}

		// Snap
		if (that.options.snap) {
			that.maxPageX = -Math.floor(that.maxScrollX/that.scrollWidth);
			that.maxPageY = -Math.floor(that.maxScrollY/that.scrollHeight);

			snap = that.snap(resetX, resetY);
			resetX = snap.x;
			resetY = snap.y;
		}

		if (resetX!=that.x || resetY!=that.y) {
			that.setTransitionTime('0');
			that.setPosition(resetX, resetY, true);
		}
		
		that.scrollX = that.scrollerWidth > that.scrollWidth;
		that.scrollY = !that.options.bounceLock && !that.scrollX || that.scrollerHeight > that.scrollHeight;

		// Update horizontal scrollbar
		if (that.options.hScrollbar && that.scrollX) {
			that.scrollBarX = that.scrollBarX || new scrollbar('horizontal', that.wrapper, that.options.fadeScrollbar, that.options.shrinkScrollbar, that.options.scrollbarColor);
			that.scrollBarX.init(that.scrollWidth, that.scrollerWidth);
		} else if (that.scrollBarX) {
			that.scrollBarX = that.scrollBarX.remove();
		}

		// Update vertical scrollbar
		if (that.options.vScrollbar && that.scrollY && that.scrollerHeight > that.scrollHeight) {
			that.scrollBarY = that.scrollBarY || new scrollbar('vertical', that.wrapper, that.options.fadeScrollbar, that.options.shrinkScrollbar, that.options.scrollbarColor);
			that.scrollBarY.init(that.scrollHeight, that.scrollerHeight);
		} else if (that.scrollBarY) {
			that.scrollBarY = that.scrollBarY.remove();
		}
	},

	setPosition: function (x, y, hideScrollBars) {
		var that = this;
		
		that.x = x;
		that.y = y;

		that.element.style.webkitTransform = translateOpen + that.x + 'px,' + that.y + 'px' + translateClose;

		// Move the scrollbars
		if (!hideScrollBars) {
			if (that.scrollBarX) {
				that.scrollBarX.setPosition(that.x);
			}
			if (that.scrollBarY) {
				that.scrollBarY.setPosition(that.y);
			}
		}
	},
	
	setTransitionTime: function(time) {
		var that = this;
		
		time = time || '0';
		that.element.style.webkitTransitionDuration = time;
		
		if (that.scrollBarX) {
			that.scrollBarX.bar.style.webkitTransitionDuration = time;
			that.scrollBarX.wrapper.style.webkitTransitionDuration = has3d && that.options.fadeScrollbar ? '300ms' : '0';
		}
		if (that.scrollBarY) {
			that.scrollBarY.bar.style.webkitTransitionDuration = time;
			that.scrollBarY.wrapper.style.webkitTransitionDuration = has3d && that.options.fadeScrollbar ? '300ms' : '0';
		}
	},
		
	touchStart: function(e) {
		var that = this,
			matrix;
		
		/* changed kfu */
		that.moved = false;
        if ( e.target.tagName == "SELECT" || e.target.tagName == "INPUT" || e.target.tagName == "BUTTON" || e.target.tagName == "TEXTAREA") {
            return true;
        }

		e.preventDefault();
		/* end changed */	
		
		if (!that.enabled) {
			return;
		}

		e.preventDefault();
		e.stopPropagation();
		
		that.scrolling = true;		// This is probably not needed, but may be useful if iScroll is used in conjuction with other frameworks

		that.moved = false;
		that.distX = 0;
		that.distY = 0;

		that.setTransitionTime('0');

		// Check if the scroller is really where it should be
		if (that.options.momentum || that.options.snap) {
			matrix = new WebKitCSSMatrix(window.getComputedStyle(that.element).webkitTransform);
			if (matrix.e != that.x || matrix.f != that.y) {
				document.removeEventListener('webkitTransitionEnd', that, false);
				that.setPosition(matrix.e, matrix.f);
				that.moved = true;
			}
		}

		that.touchStartX = isTouch ? e.changedTouches[0].pageX : e.pageX;
		that.scrollStartX = that.x;

		that.touchStartY = isTouch ? e.changedTouches[0].pageY : e.pageY;
		that.scrollStartY = that.y;

		that.scrollStartTime = e.timeStamp;

		that.directionX = 0;
		that.directionY = 0;
	},
	
	touchMove: function(e) {
		if (!this.scrolling) {
			return;
		}

		var that = this,
			pageX = isTouch ? e.changedTouches[0].pageX : e.pageX,
			pageY = isTouch ? e.changedTouches[0].pageY : e.pageY,
			leftDelta = that.scrollX ? pageX - that.touchStartX : 0,
			topDelta = that.scrollY ? pageY - that.touchStartY : 0,
			newX = that.x + leftDelta,
			newY = that.y + topDelta;

		//e.preventDefault();
		e.stopPropagation();	// Stopping propagation just saves some cpu cycles (I presume)

		that.touchStartX = pageX;
		that.touchStartY = pageY;

		// Slow down if outside of the boundaries
		if (newX >= 0 || newX < that.maxScrollX) {
			newX = that.options.bounce ? Math.round(that.x + leftDelta / 3) : (newX >= 0 || that.maxScrollX>=0) ? 0 : that.maxScrollX;
		}
		if (newY >= 0 || newY < that.maxScrollY) { 
			newY = that.options.bounce ? Math.round(that.y + topDelta / 3) : (newY >= 0 || that.maxScrollY>=0) ? 0 : that.maxScrollY;
		}

		if (that.distX + that.distY > 5) {			// 5 pixels threshold

			// Lock scroll direction
			if (that.distX-3 > that.distY) {
				newY = that.y;
				topDelta = 0;
			} else if (that.distY-3 > that.distX) {
				newX = that.x;
				leftDelta = 0;
			}

			that.setPosition(newX, newY);
			that.moved = true;
			that.directionX = leftDelta > 0 ? -1 : 1;
			that.directionY = topDelta > 0 ? -1 : 1;
		} else {
			that.distX+= Math.abs(leftDelta);
			that.distY+= Math.abs(topDelta);
//			that.dist+= Math.abs(leftDelta) + Math.abs(topDelta);
		}
	},
	
	touchEnd: function(e) {
		if (!this.scrolling) {
			return;
		}

		var that = this,
			time = e.timeStamp - that.scrollStartTime,
			point = isTouch ? e.changedTouches[0] : e,
			target, ev,
			momentumX, momentumY,
			newDuration = 0,
			newPositionX = that.x, newPositionY = that.y,
			snap;

		that.scrolling = false;

		if (!that.moved) {
			that.resetPosition();

			if (isTouch) {
				// Find the last touched element
				target = point.target;
				while (target.nodeType != 1) {
					target = target.parentNode;
				}

				// Create the fake event
				ev = document.createEvent('MouseEvents');
				ev.initMouseEvent('click', true, true, e.view, 1,
					point.screenX, point.screenY, point.clientX, point.clientY,
					e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
					0, null);
				ev._fake = true;
				target.dispatchEvent(ev);
			}

			return;
		}

		if (!that.options.snap && time > 250) {			// Prevent slingshot effect
			that.resetPosition();
			return;
		}

		if (that.options.momentum) {
			momentumX = that.scrollX === true
				? that.momentum(that.x - that.scrollStartX,
								time,
								that.options.bounce ? -that.x + that.scrollWidth/5 : -that.x,
								that.options.bounce ? that.x + that.scrollerWidth - that.scrollWidth + that.scrollWidth/5 : that.x + that.scrollerWidth - that.scrollWidth)
				: { dist: 0, time: 0 };

			momentumY = that.scrollY === true
				? that.momentum(that.y - that.scrollStartY,
								time,
								that.options.bounce ? -that.y + that.scrollHeight/5 : -that.y,
								that.options.bounce ? (that.maxScrollY < 0 ? that.y + that.scrollerHeight - that.scrollHeight : 0) + that.scrollHeight/5 : that.y + that.scrollerHeight - that.scrollHeight)
				: { dist: 0, time: 0 };

			newDuration = Math.max(Math.max(momentumX.time, momentumY.time), 1);		// The minimum animation length must be 1ms
			newPositionX = that.x + momentumX.dist;
			newPositionY = that.y + momentumY.dist;
		}

		if (that.options.snap) {
			snap = that.snap(newPositionX, newPositionY);
			newPositionX = snap.x;
			newPositionY = snap.y;
			newDuration = Math.max(snap.time, newDuration);
		}

		that.scrollTo(newPositionX, newPositionY, newDuration + 'ms');
	},

	transitionEnd: function () {
		var that = this;
		document.removeEventListener('webkitTransitionEnd', that, false);
		that.resetPosition();
	},

	resetPosition: function () {
		var that = this,
			resetX = that.x,
		 	resetY = that.y;

		if (that.x >= 0) {
			resetX = 0;
		} else if (that.x < that.maxScrollX) {
			resetX = that.maxScrollX;
		}

		if (that.y >= 0 || that.maxScrollY > 0) {
			resetY = 0;
		} else if (that.y < that.maxScrollY) {
			resetY = that.maxScrollY;
		}
		
		if (resetX != that.x || resetY != that.y) {
			that.scrollTo(resetX, resetY);
		} else {
			if (that.moved) {
				that.onScrollEnd();		// Execute custom code on scroll end
				that.moved = false;
			}

			// Hide the scrollbars
			if (that.scrollBarX) {
				that.scrollBarX.hide();
			}
			if (that.scrollBarY) {
				that.scrollBarY.hide();
			}
		}
	},
	
	snap: function (x, y) {
		var that = this, time;

		if (that.directionX > 0) {
			x = Math.floor(x/that.scrollWidth);
		} else if (that.directionX < 0) {
			x = Math.ceil(x/that.scrollWidth);
		} else {
			x = Math.round(x/that.scrollWidth);
		}
		that.pageX = -x;
		x = x * that.scrollWidth;
		if (x > 0) {
			x = that.pageX = 0;
		} else if (x < that.maxScrollX) {
			that.pageX = that.maxPageX;
			x = that.maxScrollX;
		}

		if (that.directionY > 0) {
			y = Math.floor(y/that.scrollHeight);
		} else if (that.directionY < 0) {
			y = Math.ceil(y/that.scrollHeight);
		} else {
			y = Math.round(y/that.scrollHeight);
		}
		that.pageY = -y;
		y = y * that.scrollHeight;
		if (y > 0) {
			y = that.pageY = 0;
		} else if (y < that.maxScrollY) {
			that.pageY = that.maxPageY;
			y = that.maxScrollY;
		}

		// Snap with constant speed (proportional duration)
		time = Math.round(Math.max(
				Math.abs(that.x - x) / that.scrollWidth * 500,
				Math.abs(that.y - y) / that.scrollHeight * 500
			));
			
		return { x: x, y: y, time: time };
	},

	scrollTo: function (destX, destY, runtime) {
		var that = this;

		if (that.x == destX && that.y == destY) {
			that.resetPosition();
			return;
		}

		that.moved = true;
		that.setTransitionTime(runtime || '350ms');
		that.setPosition(destX, destY);

		if (runtime==='0' || runtime=='0s' || runtime=='0ms') {
			that.resetPosition();
		} else {
			document.addEventListener('webkitTransitionEnd', that, false);	// At the end of the transition check if we are still inside of the boundaries
		}
	},
	
	scrollToPage: function (pageX, pageY, runtime) {
		var that = this, snap;

		if (!that.options.snap) {
			that.pageX = -Math.round(that.x / that.scrollWidth);
			that.pageY = -Math.round(that.y / that.scrollHeight);
		}

		if (pageX == 'next') {
			pageX = ++that.pageX;
		} else if (pageX == 'prev') {
			pageX = --that.pageX;
		}

		if (pageY == 'next') {
			pageY = ++that.pageY;
		} else if (pageY == 'prev') {
			pageY = --that.pageY;
		}

		pageX = -pageX*that.scrollWidth;
		pageY = -pageY*that.scrollHeight;

		snap = that.snap(pageX, pageY);
		pageX = snap.x;
		pageY = snap.y;

		that.scrollTo(pageX, pageY, runtime || '500ms');
	},

	scrollToElement: function (el, runtime) {
		el = typeof el == 'object' ? el : this.element.querySelector(el);

		if (!el) {
			return;
		}

		var that = this,
			x = that.scrollX ? -el.offsetLeft : 0,
			y = that.scrollY ? -el.offsetTop : 0;

		if (x >= 0) {
			x = 0;
		} else if (x < that.maxScrollX) {
			x = that.maxScrollX;
		}

		if (y >= 0) {
			y = 0;
		} else if (y < that.maxScrollY) {
			y = that.maxScrollY;
		}

		that.scrollTo(x, y, runtime);
	},

	momentum: function (dist, time, maxDistUpper, maxDistLower) {
		var friction = 2.5,
			deceleration = 1.2,
			speed = Math.abs(dist) / time * 1000,
			newDist = speed * speed / friction / 1000,
			newTime = 0;

		// Proportinally reduce speed if we are outside of the boundaries 
		if (dist > 0 && newDist > maxDistUpper) {
			speed = speed * maxDistUpper / newDist / friction;
			newDist = maxDistUpper;
		} else if (dist < 0 && newDist > maxDistLower) {
			speed = speed * maxDistLower / newDist / friction;
			newDist = maxDistLower;
		}
		
		newDist = newDist * (dist < 0 ? -1 : 1);
		newTime = speed / deceleration;

		return { dist: Math.round(newDist), time: Math.round(newTime) };
	},
	
	destroy: function (full) {
		var that = this;

		window.removeEventListener('onorientationchange' in window ? 'orientationchange' : 'resize', that, false);		
		that.element.removeEventListener(START_EVENT, that, false);
		that.element.removeEventListener(MOVE_EVENT, that, false);
		that.element.removeEventListener(END_EVENT, that, false);
		document.removeEventListener('webkitTransitionEnd', that, false);

		if (that.options.checkDOMChanges) {
			that.element.removeEventListener('DOMSubtreeModified', that, false);
		}

		if (that.scrollBarX) {
			that.scrollBarX = that.scrollBarX.remove();
		}

		if (that.scrollBarY) {
			that.scrollBarY = that.scrollBarY.remove();
		}
		
		if (full) {
			that.wrapper.parentNode.removeChild(that.wrapper);
		}
		
		return null;
	}
};

function scrollbar (dir, wrapper, fade, shrink, color) {
	var that = this,
		doc = document;
	
	that.dir = dir;
	that.fade = fade;
	that.shrink = shrink;
	that.uid = ++uid;

	// Create main scrollbar
	that.bar = doc.createElement('div');

	that.bar.style.cssText = 'position:absolute;top:0;left:0;-webkit-transition-timing-function:cubic-bezier(0,0,0.25,1);pointer-events:none;-webkit-transition-duration:0;-webkit-transition-delay:0;-webkit-transition-property:-webkit-transform;z-index:10;background:' + color + ';' +
		'-webkit-transform:' + translateOpen + '0,0' + translateClose + ';' +
		(dir == 'horizontal' ? '-webkit-border-radius:3px 2px;min-width:6px;min-height:5px' : '-webkit-border-radius:2px 3px;min-width:5px;min-height:6px');

	// Create scrollbar wrapper
	that.wrapper = doc.createElement('div');
	that.wrapper.style.cssText = '-webkit-mask:-webkit-canvas(scrollbar' + that.uid + that.dir + ');position:absolute;z-index:10;pointer-events:none;overflow:hidden;opacity:0;-webkit-transition-duration:' + (fade ? '300ms' : '0') + ';-webkit-transition-delay:0;-webkit-transition-property:opacity;' +
		(that.dir == 'horizontal' ? 'bottom:2px;left:2px;right:7px;height:5px' : 'top:2px;right:2px;bottom:7px;width:5px;');

	// Add scrollbar to the DOM
	that.wrapper.appendChild(that.bar);
	wrapper.appendChild(that.wrapper);
}

scrollbar.prototype = {
	init: function (scroll, size) {
		var that = this,
			doc = document,
			pi = Math.PI,
			ctx;

		// Create scrollbar mask
		if (that.dir == 'horizontal') {
			if (that.maxSize != that.wrapper.offsetWidth) {
				that.maxSize = that.wrapper.offsetWidth;
				ctx = doc.getCSSCanvasContext("2d", "scrollbar" + that.uid + that.dir, that.maxSize, 5);
				ctx.fillStyle = "rgb(0,0,0)";
				ctx.beginPath();
				ctx.arc(2.5, 2.5, 2.5, pi/2, -pi/2, false);
				ctx.lineTo(that.maxSize-2.5, 0);
				ctx.arc(that.maxSize-2.5, 2.5, 2.5, -pi/2, pi/2, false);
				ctx.closePath();
				ctx.fill();
			}
		} else {
			if (that.maxSize != that.wrapper.offsetHeight) {
				that.maxSize = that.wrapper.offsetHeight;
				ctx = doc.getCSSCanvasContext("2d", "scrollbar" + that.uid + that.dir, 5, that.maxSize);
				ctx.fillStyle = "rgb(0,0,0)";
				ctx.beginPath();
				ctx.arc(2.5, 2.5, 2.5, pi, 0, false);
				ctx.lineTo(5, that.maxSize-2.5);
				ctx.arc(2.5, that.maxSize-2.5, 2.5, 0, pi, false);
				ctx.closePath();
				ctx.fill();
			}
		}

		that.size = Math.max(Math.round(that.maxSize * that.maxSize / size), 6);
		that.maxScroll = that.maxSize - that.size;
		that.toWrapperProp = that.maxScroll / (scroll - size);
		that.bar.style[that.dir == 'horizontal' ? 'width' : 'height'] = that.size + 'px';
	},
	
	setPosition: function (pos) {
		var that = this;
		
		if (that.wrapper.style.opacity != '1') {
			that.show();
		}

		pos = Math.round(that.toWrapperProp * pos);

		if (pos < 0) {
			pos = that.shrink ? pos + pos*3 : 0;
			if (that.size + pos < 7) {
				pos = -that.size + 6;
			}
		} else if (pos > that.maxScroll) {
			pos = that.shrink ? pos + (pos-that.maxScroll)*3 : that.maxScroll;
			if (that.size + that.maxScroll - pos < 7) {
				pos = that.size + that.maxScroll - 6;
			}
		}

		pos = that.dir == 'horizontal'
			? translateOpen + pos + 'px,0' + translateClose
			: translateOpen + '0,' + pos + 'px' + translateClose;

		that.bar.style.webkitTransform = pos;
	},

	show: function () {
		if (has3d) {
			this.wrapper.style.webkitTransitionDelay = '0';
		}
		this.wrapper.style.opacity = '1';
	},

	hide: function () {
		if (has3d) {
			this.wrapper.style.webkitTransitionDelay = '350ms';
		}
		this.wrapper.style.opacity = '0';
	},
	
	remove: function () {
		this.wrapper.parentNode.removeChild(this.wrapper);
		return null;
	}
};

// Is translate3d compatible?
var has3d = ('WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix()),
	// Device sniffing
	isIthing = (/iphone|ipad/gi).test(navigator.appVersion),
	isTouch = ('ontouchstart' in window),
	// Event sniffing
	START_EVENT = isTouch ? 'touchstart' : 'mousedown',
	MOVE_EVENT = isTouch ? 'touchmove' : 'mousemove',
	END_EVENT = isTouch ? 'touchend' : 'mouseup',
	// Translate3d helper
	translateOpen = 'translate' + (has3d ? '3d(' : '('),
	translateClose = has3d ? ',0)' : ')',
	// Unique ID
	uid = 0;

// Expose iScroll to the world
window.iScroll = iScroll;
})();;
/*
	Lightbox JS: Fullsize Image Overlays 
	by Lokesh Dhakar - http://www.huddletogether.com

	For more information on this script, visit:
	http://huddletogether.com/projects/lightbox/

	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
	(basically, do anything you want, just leave my name and link)
	
	Table of Contents
	-----------------
	Configuration
	
	Functions
	- getPageScroll()
	- getPageSize()
	- pause()
	- getKey()
	- listenKey()
	- showLightbox()
	- hideLightbox()
	- initLightbox()
	- addLoadEvent()
	
	Function Calls
	- addLoadEvent(initLightbox)

*/



//
// Configuration
//

// If you would like to use a custom loading image or close button reference them in the next two lines.
var loadingImage = '';		
var closeButton = '';		





//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


//
// pause(numberMillis)
// Pauses code execution for specified time. Uses busy code, not good.
// Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602
//
function pause(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime)
			return;
	}
}

//
// getKey(key)
// Gets keycode. If 'x' is pressed then it hides the lightbox.
//

function getKey(e){
	if (e == null) { // ie
		keycode = event.keyCode;
	} else { // mozilla
		keycode = e.which;
	}
	key = String.fromCharCode(keycode).toLowerCase();
	
	if(key == 'x'){ hideLightbox(); }
}


//
// listenKey()
//
function listenKey () {	document.onkeypress = getKey; }
	

//
// showLightbox()
// Preloads images. Pleaces new image in lightbox then centers and displays.
//
function showLightbox(objLink)
{
	// prep objects
	var objOverlay = document.getElementById('overlay');
	var objLightbox = document.getElementById('lightbox');
	var objCaption = document.getElementById('lightboxCaption');
	var objImage = document.getElementById('lightboxImage');
	var objLoadingImage = document.getElementById('loadingImage');
	var objLightboxDetails = document.getElementById('lightboxDetails');

	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();

	// center loadingImage if it exists
	if (objLoadingImage) {
		objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.height) / 2) + 'px');
		objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + 'px');
		objLoadingImage.style.display = 'block';
	}

	// set height of Overlay to take up whole page and show
	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objOverlay.style.display = 'block';

	// preload image
	imgPreload = new Image();

	imgPreload.onload=function(){
		objImage.src = objLink.href;

		// center lightbox and make sure that the top and left values are not negative
		// and the image placed outside the viewport
		var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2);
		var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2);
		
		objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
		objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";


		objLightboxDetails.style.width = imgPreload.width + 'px';
		
		if(objLink.getAttribute('title')){
			objCaption.style.display = 'block';
			//objCaption.style.width = imgPreload.width + 'px';
			objCaption.innerHTML = objLink.getAttribute('title');
		} else {
			objCaption.style.display = 'none';
		}
		
		// A small pause between the image loading and displaying is required with IE,
		// this prevents the previous image displaying for a short burst causing flicker.
		if (navigator.appVersion.indexOf("MSIE")!=-1){
			pause(250);
		} 

		if (objLoadingImage) {	objLoadingImage.style.display = 'none'; }

		// Hide select boxes as they will 'peek' through the image in IE
		selects = document.getElementsByTagName("select");
        for (i = 0; i != selects.length; i++) {
                selects[i].style.visibility = "hidden";
        }

	
		objLightbox.style.display = 'block';

		// After image is loaded, update the overlay height as the new image might have
		// increased the overall page height.
		arrayPageSize = getPageSize();
		objOverlay.style.height = (arrayPageSize[1] + 'px');
		
		// Check for 'x' keypress
		listenKey();

		return false;
	}

	imgPreload.src = objLink.href;
	
}





//
// hideLightbox()
//
function hideLightbox()
{
	// get objects
	objOverlay = document.getElementById('overlay');
	objLightbox = document.getElementById('lightbox');

	// hide lightbox and overlay
	objOverlay.style.display = 'none';
	objLightbox.style.display = 'none';

	// make select boxes visible
	selects = document.getElementsByTagName("select");
    for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}

	// disable keypress listener
	document.onkeypress = '';
}




//
// initLightbox()
// Function runs on window load, going through link tags looking for rel="lightbox".
// These links receive onclick events that enable the lightbox display for their targets.
// The function also inserts html markup at the top of the page which will be used as a
// container for the overlay pattern and the inline image.
//
function initLightbox()
{
	
	if (!document.getElementsByTagName){ return; }
	var anchors = document.getElementsByTagName("a");

	// loop through all anchor tags
	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];

		if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "lightbox")){
			anchor.onclick = function () {showLightbox(this); return false;}
		}
	}

	// the rest of this code inserts html at the top of the page that looks like this:
	//
	// <div id="overlay">
	//		<a href="#" onclick="hideLightbox(); return false;"><img id="loadingImage" /></a>
	//	</div>
	// <div id="lightbox">
	//		<a href="#" onclick="hideLightbox(); return false;" title="Click anywhere to close image">
	//			<img id="closeButton" />		
	//			<img id="lightboxImage" />
	//		</a>
	//		<div id="lightboxDetails">
	//			<div id="lightboxCaption"></div>
	//			<div id="keyboardMsg"></div>
	//		</div>
	// </div>
	
	var objBody = document.getElementsByTagName("body").item(0);
	
	// create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay');
	objOverlay.onclick = function () {hideLightbox(); return false;}
	objOverlay.style.display = 'none';
	objOverlay.style.position = 'absolute';
	objOverlay.style.top = '0';
	objOverlay.style.left = '0';
	objOverlay.style.zIndex = '90';
 	objOverlay.style.width = '100%';
	objBody.insertBefore(objOverlay, objBody.firstChild);
	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();

	// preload and create loader image
	var imgPreloader = new Image();
	
	// if loader image found, create link to hide lightbox and create loadingimage
	imgPreloader.onload=function(){

		var objLoadingImageLink = document.createElement("a");
		objLoadingImageLink.setAttribute('href','#');
		objLoadingImageLink.onclick = function () {hideLightbox(); return false;}
		objOverlay.appendChild(objLoadingImageLink);
		
		var objLoadingImage = document.createElement("img");
		objLoadingImage.src = loadingImage;
		objLoadingImage.setAttribute('id','loadingImage');
		objLoadingImage.style.position = 'absolute';
		objLoadingImage.style.zIndex = '150';
		objLoadingImageLink.appendChild(objLoadingImage);

		imgPreloader.onload=function(){};	//	clear onLoad, as IE will flip out w/animated gifs

		return false;
	}

	imgPreloader.src = loadingImage;

	// create lightbox div, same note about styles as above
	var objLightbox = document.createElement("div");
	objLightbox.setAttribute('id','lightbox');
	objLightbox.style.display = 'none';
	objLightbox.style.position = 'absolute';
	objLightbox.style.zIndex = '100';	
	objBody.insertBefore(objLightbox, objOverlay.nextSibling);
	
	// create link
	var objLink = document.createElement("a");
	objLink.setAttribute('href','#');
	objLink.setAttribute('title','Click to close');
	objLink.onclick = function () {hideLightbox(); return false;}
	objLightbox.appendChild(objLink);

	// preload and create close button image
	var imgPreloadCloseButton = new Image();

	// if close button image found, 
//	imgPreloadCloseButton.onload=function(){
//
//		var objCloseButton = document.createElement("img");
//		objCloseButton.src = closeButton;
//		objCloseButton.setAttribute('id','closeButton');
//		objCloseButton.style.position = 'absolute';
//		objCloseButton.style.zIndex = '200';
//		objLink.appendChild(objCloseButton);
//
//		return false;
//	}

	imgPreloadCloseButton.src = closeButton;

	// create image
	var objImage = document.createElement("img");
	objImage.setAttribute('id','lightboxImage');
	objLink.appendChild(objImage);
	
	// create details div, a container for the caption and keyboard message
	var objLightboxDetails = document.createElement("div");
	objLightboxDetails.setAttribute('id','lightboxDetails');
	objLightbox.appendChild(objLightboxDetails);

	// create caption
	var objCaption = document.createElement("div");
	objCaption.setAttribute('id','lightboxCaption');
	objCaption.style.display = 'none';
	objLightboxDetails.appendChild(objCaption);

	// create keyboard message
	var objKeyboardMsg = document.createElement("div");
	objKeyboardMsg.setAttribute('id','keyboardMsg');
	objLightboxDetails.appendChild(objKeyboardMsg);


}




//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
//
function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}



addLoadEvent(initLightbox);	// run initLightbox onLoad;
/*
 * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
 *
 * http://www.heise.de/extras/socialshareprivacy/
 * http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
 *
 * Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
 * Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
 *
 * is released under the MIT License http://www.opensource.org/licenses/mit-license.php
 *
 * Spread the word, link to us if you can.
 */
(function(b){function x(b,a){var f=decodeURIComponent(b);if(f.length<=a)return b;var j=f.substring(0,a-1).lastIndexOf(" ");return f=encodeURIComponent(f.substring(0,j))+"\u2026"}function p(c){return b('meta[name="'+c+'"]').attr("content")||""}function r(){var c=p("DC.title"),a=p("DC.creator");c.length>0&&a.length>0?c+=" - "+a:c=b("title").text();return encodeURIComponent(c)}function s(){var c=document.location.href,a=b("link[rel=canonical]").attr("href");a&&a.length>0&&(a.indexOf("http")<0&&(a=document.location.protocol+
"//"+document.location.host+a),c=a);return c}b.fn.socialSharePrivacy=function(c){var a=b.extend(!0,{services:{facebook:{status:"on",dummy_img:Drupal.settings.basePath + "sites/all/themes/silentworld/data/socialshareprivacy/dummy_facebook.png",txt_info:"2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen &ndash; siehe <em>i</em>.",txt_fb_off:"nicht mit Facebook verbunden",txt_fb_on:"mit Facebook verbunden",
perma_option:"on",display_name:"Facebook",referrer_track:"",language:"de_DE",action:"recommend"},twitter:{status:"on",dummy_img:Drupal.settings.basePath + "sites/all/themes/silentworld/data/socialshareprivacy/dummy_twitter.png",txt_info:"2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen &ndash; siehe <em>i</em>.",txt_twitter_off:"nicht mit Twitter verbunden",txt_twitter_on:"mit Twitter verbunden",perma_option:"on",
display_name:"Twitter",referrer_track:"",tweet_text:r,language:"en"},gplus:{status:"on",dummy_img:Drupal.settings.basePath + "sites/all/themes/silentworld/data/socialshareprivacy/dummy_gplus.png",txt_info:"2 Klicks f&uuml;r mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k&ouml;nnen Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte &uuml;bertragen &ndash; siehe <em>i</em>.",txt_gplus_off:"nicht mit Google+ verbunden",txt_gplus_on:"mit Google+ verbunden",perma_option:"on",display_name:"Google+",
referrer_track:"",language:"de"}},info_link:"http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html",txt_help:"Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter oder Google in die USA &uuml;bertragen und unter Umst&auml;nden auch dort gespeichert. N&auml;heres erfahren Sie durch einen Klick auf das <em>i</em>.",settings_perma:"Dauerhaft aktivieren und Daten&uuml;ber&shy;tragung zustimmen:",cookie_path:"/",cookie_domain:document.location.host,
cookie_expires:"365",css_path:Drupal.settings.basePath + "sites/all/themes/silentworld/css/socialshareprivacy.css",uri:s},c),f=a.services.facebook.status==="on",j=a.services.twitter.status==="on",n=a.services.gplus.status==="on";if(f||j||n)return a.css_path.length>0&&(document.createStyleSheet?document.createStyleSheet(a.css_path):b("head").append('<link rel="stylesheet" type="text/css" href="'+a.css_path+'" />')),this.each(function(){b(this).prepend('<ul class="social_share_privacy_area"></ul>');var d=b(".social_share_privacy_area",this),
c=a.uri;typeof c==="function"&&(c=c(d));if(f){var g=encodeURIComponent(c+a.services.facebook.referrer_track),p='<iframe src="http://www.facebook.com/plugins/like.php?locale='+a.services.facebook.language+"&amp;href="+g+"&amp;send=false&amp;layout=button_count&amp;width=120&amp;show_faces=false&amp;action="+a.services.facebook.action+'&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height:21px;" allowTransparency="true"></iframe>',
t='<img src="'+a.services.facebook.dummy_img+'" alt="Facebook &quot;Like&quot;-Dummy" class="fb_like_privacy_dummy" />';d.append('<li class="facebook help_info"><span class="info">'+a.services.facebook.txt_info+'</span><span class="switch off">'+a.services.facebook.txt_fb_off+'</span><div class="fb_like dummy_btn">'+t+"</div></li>");var k=b("li.facebook",d);b("li.facebook div.fb_like img.fb_like_privacy_dummy,li.facebook span.switch",d).live("click",function(){k.find("span.switch").hasClass("off")?
(k.addClass("info_off"),k.find("span.switch").addClass("on").removeClass("off").html(a.services.facebook.txt_fb_on),k.find("img.fb_like_privacy_dummy").replaceWith(p)):(k.removeClass("info_off"),k.find("span.switch").addClass("off").removeClass("on").html(a.services.facebook.txt_fb_off),k.find(".fb_like").html(t))})}if(j){g=a.services.twitter.tweet_text;typeof g==="function"&&(g=g());var g=x(g,"120"),o=encodeURIComponent(c+a.services.twitter.referrer_track),e=encodeURIComponent(c),r='<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+
o+"&amp;counturl="+e+"&amp;text="+g+"&amp;count=horizontal&amp;lang="+a.services.twitter.language+'" style="width:130px; height:25px;"></iframe>',u='<img src="'+a.services.twitter.dummy_img+'" alt="&quot;Tweet this&quot;-Dummy" class="tweet_this_dummy" />';d.append('<li class="twitter help_info"><span class="info">'+a.services.twitter.txt_info+'</span><span class="switch off">'+a.services.twitter.txt_twitter_off+'</span><div class="tweet dummy_btn">'+u+"</div></li>");var l=b("li.twitter",d);b("li.twitter div.tweet img,li.twitter span.switch",
d).live("click",function(){l.find("span.switch").hasClass("off")?(l.addClass("info_off"),l.find("span.switch").addClass("on").removeClass("off").html(a.services.twitter.txt_twitter_on),l.find("img.tweet_this_dummy").replaceWith(r)):(l.removeClass("info_off"),l.find("span.switch").addClass("off").removeClass("on").html(a.services.twitter.txt_twitter_off),l.find(".tweet").html(u))})}if(n){var s='<div class="g-plusone" data-size="medium" data-href="'+(c+a.services.gplus.referrer_track)+'"></div><script type="text/javascript">window.___gcfg = {lang: "'+
a.services.gplus.language+'"}; (function() { var po = document.createElement("script"); po.type = "text/javascript"; po.async = true; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); <\/script>',v='<img src="'+a.services.gplus.dummy_img+'" alt="&quot;Google+1&quot;-Dummy" class="gplus_one_dummy" />';d.append('<li class="gplus help_info"><span class="info">'+a.services.gplus.txt_info+'</span><span class="switch off">'+
a.services.gplus.txt_gplus_off+'</span><div class="gplusone dummy_btn">'+v+"</div></li>");var m=b("li.gplus",d);b("li.gplus div.gplusone img,li.gplus span.switch",d).live("click",function(){m.find("span.switch").hasClass("off")?(m.addClass("info_off"),m.find("span.switch").addClass("on").removeClass("off").html(a.services.gplus.txt_gplus_on),m.find("img.gplus_one_dummy").replaceWith(s)):(m.removeClass("info_off"),m.find("span.switch").addClass("off").removeClass("on").html(a.services.gplus.txt_gplus_off),
m.find(".gplusone").html(v))})}d.append('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="'+a.info_link+'"><span class="help_info icon"><span class="info">'+a.txt_help+"</span></span></a></div></li>");b(".help_info:not(.info_off)",d).live("mouseenter",function(){var a=b(this),c=window.setTimeout(function(){b(a).addClass("display")},500);b(this).data("timeout_id",c)});b(".help_info",d).live("mouseleave",function(){var a=b(this).data("timeout_id");window.clearTimeout(a);
b(this).hasClass("display")&&b(this).removeClass("display")});c=a.services.facebook.perma_option==="on";g=a.services.twitter.perma_option==="on";o=a.services.gplus.perma_option==="on";if((f&&c||j&&g||n&&o)&&(!b.browser.msie||b.browser.msie&&b.browser.version>7)){for(var i=document.cookie.split(";"),e="{",q=0;q<i.length;q+=1){var w=i[q].split("=");e+='"'+b.trim(w[0])+'":"'+b.trim(w[1])+'"';q<i.length-1&&(e+=",")}e+="}";var e=JSON.parse(e),h=b("li.settings_info",d);h.find(".settings_info_menu").removeClass("perma_option_off");
h.find(".settings_info_menu").append('<span class="settings">Einstellungen</span><form><fieldset><legend>'+a.settings_perma+"</legend></fieldset></form>");f&&c&&(i=e.socialSharePrivacy_facebook==="perma_on"?' checked="checked"':"",h.find("form fieldset").append('<input type="checkbox" name="perma_status_facebook" id="perma_status_facebook"'+i+' /><label for="perma_status_facebook">'+a.services.facebook.display_name+"</label>"));j&&g&&(i=e.socialSharePrivacy_twitter==="perma_on"?' checked="checked"':
"",h.find("form fieldset").append('<input type="checkbox" name="perma_status_twitter" id="perma_status_twitter"'+i+' /><label for="perma_status_twitter">'+a.services.twitter.display_name+"</label>"));n&&o&&(i=e.socialSharePrivacy_gplus==="perma_on"?' checked="checked"':"",h.find("form fieldset").append('<input type="checkbox" name="perma_status_gplus" id="perma_status_gplus"'+i+' /><label for="perma_status_gplus">'+a.services.gplus.display_name+"</label>"));h.find("span.settings").css("cursor","pointer");
b(h.find("span.settings"),d).live("mouseenter",function(){var a=window.setTimeout(function(){h.find(".settings_info_menu").removeClass("off").addClass("on")},500);b(this).data("timeout_id",a)});b(h,d).live("mouseleave",function(){var a=b(this).data("timeout_id");window.clearTimeout(a);h.find(".settings_info_menu").removeClass("on").addClass("off")});b(h.find("fieldset input")).live("click",function(c){var e=c.target.id,g="socialSharePrivacy_"+e.substr(e.lastIndexOf("_")+1,e.length);if(b("#"+c.target.id+
":checked").length){var c=a.cookie_expires,h=a.cookie_path,f=a.cookie_domain,i=new Date;i.setTime(i.getTime()+c*864E5);document.cookie=g+"=perma_on; expires="+i.toUTCString()+"; path="+h+"; domain="+f;b("form fieldset label[for="+e+"]",d).addClass("checked")}else c=a.cookie_path,h=a.cookie_domain,f=new Date,f.setTime(f.getTime()-100),document.cookie=g+"=perma_on; expires="+f.toUTCString()+"; path="+c+"; domain="+h,b("form fieldset label[for="+e+"]",d).removeClass("checked")});f&&c&&e.socialSharePrivacy_facebook===
"perma_on"&&b("li.facebook span.switch",d).click();j&&g&&e.socialSharePrivacy_twitter==="perma_on"&&b("li.twitter span.switch",d).click();n&&o&&e.socialSharePrivacy_gplus==="perma_on"&&b("li.gplus span.switch",d).click()}})}})(jQuery);
;
/*

	Supersized - Fullscreen Slideshow jQuery Plugin
	Version : 3.2.5
	Site	: www.buildinternet.com/project/supersized
	
	Author	: Sam Dunn
	Company : One Mighty Roar (www.onemightyroar.com)
	License : MIT License / GPL License
	
*/

(function($){

	/* Place Supersized Elements
	----------------------------*/
	$(document).ready(function() {
//		$('body').append('<div id="supersized-loader"></div><ul id="supersized"></ul>');
	});
    
    
    $.supersized = function(options){
    	
    	/* Variables
		----------------------------*/
    	var el = '#supersized',
        	base = this;
        // Access to jQuery and DOM versions of element
        base.$el = $(el);
        base.el = el;
        vars = $.supersized.vars;
        // Add a reverse reference to the DOM object
        base.$el.data("supersized", base);
        api = base.$el.data('supersized');
        
        // set the api for access in updateTeaser
        vars.api = api;
		
		base.init = function(){
        	// Combine options and vars
        	$.supersized.vars = $.extend($.supersized.vars, $.supersized.themeVars);
        	$.supersized.vars.options = $.extend({},$.supersized.defaultOptions, $.supersized.themeOptions, options);
            base.options = $.supersized.vars.options;
            
            base._build();
        };
        
        
        /* Build Elements
		----------------------------*/
        base._build = function(){
        	// Add in slide markers
        	var thisSlide = 0,
        		slideSet = '',
				markers = '',
				markerContent,
				thumbMarkers = '',
				thumbImage;
				
			while(thisSlide <= base.options.slides.length-1){
				//Determine slide link content
				switch(base.options.slide_links){
					case 'num':
						markerContent = thisSlide;
						break;
					case 'name':
						markerContent = base.options.slides[thisSlide].title;
						break;
					case 'blank':
						markerContent = '';
						break;
				}
				
				slideSet = slideSet+'<li class="slide-'+thisSlide+'"></li>';
				
				if(thisSlide == base.options.start_slide-1){
					// Slide links
					if (base.options.slide_links)markers = markers+'<li class="slide-link-'+thisSlide+' current-slide"><a>'+markerContent+'</a></li>';
					// Slide Thumbnail Links
					if (base.options.thumb_links){
						base.options.slides[thisSlide].thumb ? thumbImage = base.options.slides[thisSlide].thumb : thumbImage = base.options.slides[thisSlide].image;
						thumbMarkers = thumbMarkers+'<li class="thumb'+thisSlide+' current-thumb"><img src="'+thumbImage+'"/></li>';
					};
				}else{
					// Slide links
					if (base.options.slide_links) markers = markers+'<li class="slide-link-'+thisSlide+'" ><a>'+markerContent+'</a></li>';
					// Slide Thumbnail Links
					if (base.options.thumb_links){
						base.options.slides[thisSlide].thumb ? thumbImage = base.options.slides[thisSlide].thumb : thumbImage = base.options.slides[thisSlide].image;
						thumbMarkers = thumbMarkers+'<li class="thumb'+thisSlide+'"><img src="'+thumbImage+'"/></li>';
					};
				}
				thisSlide++;
			}
			
			if (base.options.slide_links) $(vars.slide_list).html(markers);
			if (base.options.thumb_links && vars.thumb_tray.length){
				$(vars.thumb_tray).append('<ul id="'+vars.thumb_list.replace('#','')+'">'+thumbMarkers+'</ul>');
			}
			
			$(base.el).append(slideSet);
			
			// Add in thumbnails
			if (base.options.thumbnail_navigation){
				// Load previous thumbnail
				vars.current_slide - 1 < 0  ? prevThumb = base.options.slides.length - 1 : prevThumb = vars.current_slide - 1;
				$(vars.prev_thumb).show().html($("<img/>").attr("src", base.options.slides[prevThumb].image));
				
				// Load next thumbnail
				vars.current_slide == base.options.slides.length - 1 ? nextThumb = 0 : nextThumb = vars.current_slide + 1;
				$(vars.next_thumb).show().html($("<img/>").attr("src", base.options.slides[nextThumb].image));
			}
			
            base._start(); // Get things started
        };
        
        
        /* Initialize
		----------------------------*/
    	base._start = function(){
			
			// Determine if starting slide random
			if (base.options.start_slide){
				vars.current_slide = base.options.start_slide - 1;
			}else{
				vars.current_slide = Math.floor(Math.random()*base.options.slides.length);	// Generate random slide number
			}
			
			// If links should open in new window
			var linkTarget = base.options.new_window ? ' target="_blank"' : '';
			
			// Set slideshow quality (Supported only in FF and IE, no Webkit)
			if (base.options.performance == 3){
				base.$el.addClass('speed'); 		// Faster transitions
			} else if ((base.options.performance == 1) || (base.options.performance == 2)){
				base.$el.addClass('quality');	// Higher image quality
			}
						
			// Shuffle slide order if needed		
			if (base.options.random){
				arr = base.options.slides;
				for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x);	// Fisher-Yates shuffle algorithm (jsfromhell.com/array/shuffle)
			    base.options.slides = arr;
			}
			
			/*-----Load initial set of images-----*/
	
			if (base.options.slides.length > 1){
				if(base.options.slides.length > 2){
					// Set previous image
					vars.current_slide - 1 < 0  ? loadPrev = base.options.slides.length - 1 : loadPrev = vars.current_slide - 1;	// If slide is 1, load last slide as previous
					var imageLink = (base.options.slides[loadPrev].url) ? "href='" + base.options.slides[loadPrev].url + "'" : "";
				
					var imgPrev = $('<img src="'+base.options.slides[loadPrev].image+'"/>');
					var slidePrev = base.el+' li:eq('+loadPrev+')';
					imgPrev.appendTo(slidePrev).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading prevslide');
				
					imgPrev.load(function(){
						$(this).data('origWidth', $(this).width()).data('origHeight', $(this).height());
						base.resizeNow();	// Resize background image
					});	// End Load
				}
			} else {
				// Slideshow turned off if there is only one slide
				base.options.slideshow = 0;
			}
			
			// Set current image
			imageLink = (api.getField('url')) ? "href='" + api.getField('url') + "'" : "";
			var img = $('<img src="'+api.getField('image')+'"/>');
			
			var slideCurrent= base.el+' li:eq('+vars.current_slide+')';
			img.appendTo(slideCurrent).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading activeslide');
			
			img.load(function(){
				base._origDim($(this));
				base.resizeNow();	// Resize background image
				base.launch();
				if( typeof theme != 'undefined' && typeof theme._init == "function" ) theme._init();	// Load Theme
			});
			
			if (base.options.slides.length > 1){
				// Set next image
				vars.current_slide == base.options.slides.length - 1 ? loadNext = 0 : loadNext = vars.current_slide + 1;	// If slide is last, load first slide as next
				imageLink = (base.options.slides[loadNext].url) ? "href='" + base.options.slides[loadNext].url + "'" : "";
				
				var imgNext = $('<img src="'+base.options.slides[loadNext].image+'"/>');
				var slideNext = base.el+' li:eq('+loadNext+')';
				imgNext.appendTo(slideNext).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading');
				
				imgNext.load(function(){
					$(this).data('origWidth', $(this).width()).data('origHeight', $(this).height());
					base.resizeNow();	// Resize background image
				});	// End Load
			}
			/*-----End load initial images-----*/
			
			//  Hide elements to be faded in
			base.$el.css('visibility','hidden');
			$('.load-item').hide();
			
			$('#picinfo .description').html(desc[$.supersized.vars.current_slide]);
			if($('#picinfo .description').html() != '')
				$('#picinfo').show();
    	};
		
		
		/* Launch Supersized
		----------------------------*/
		base.launch = function(){
		
			base.$el.css('visibility','visible');
			$('#supersized-loader').remove();		//Hide loading animation
			
			// Call theme function for before slide transition
			if( typeof theme != 'undefined' && typeof theme.beforeAnimation == "function" ) theme.beforeAnimation('next');
			$('.load-item').show();
			
			// Keyboard Navigation
			if (base.options.keyboard_nav){
				$(document.documentElement).keyup(function (event) {
				
					if(vars.in_animation) return false;		// Abort if currently animating
					
					// Left Arrow or Down Arrow
					if ((event.keyCode == 37) || (event.keyCode == 40)) {
						clearInterval(vars.slideshow_interval);	// Stop slideshow, prevent buildup
						base.prevSlide();
					
					// Right Arrow or Up Arrow
					} else if ((event.keyCode == 39) || (event.keyCode == 38)) {
						clearInterval(vars.slideshow_interval);	// Stop slideshow, prevent buildup
						base.nextSlide();
					
					// Spacebar	
					} else if (event.keyCode == 32 && !vars.hover_pause) {
						clearInterval(vars.slideshow_interval);	// Stop slideshow, prevent buildup
						base.playToggle();
					}
				
				});
			}
			
			// Pause when hover on image
			if (base.options.slideshow && base.options.pause_hover){
				$(base.el).hover(function() {
					if(vars.in_animation) return false;		// Abort if currently animating
			   			vars.hover_pause = true;	// Mark slideshow paused from hover
			   			if(!vars.is_paused){
			   				vars.hover_pause = 'resume';	// It needs to resume afterwards
			   				base.playToggle();
			   			}
			   	}, function() {
					if(vars.hover_pause == 'resume'){
						base.playToggle();
						vars.hover_pause = false;
					}
			   	});
			}
			
			if (base.options.slide_links)
			{
				// Slide marker clicked
				$(vars.slide_list+'> li').click(function(){
					index = $(vars.slide_list+'> li').index(this);
					targetSlide = index + 1;
					
					base.goTo(targetSlide);
					return false;
					
				});
				
				 $('.slide-link').mouseover(function() {
						$(this).css('cursor', 'pointer');
				  });
				 
				$('.slide-link').click(function(){
					index = parseInt($(this).attr('id'));
					targetSlide = index + 1;
					
					base.goTo(targetSlide);
					return false;
				});
			}
			
			// Thumb marker clicked
			if (base.options.thumb_links){
				$(vars.thumb_list+'> li').click(function(){
				
					index = $(vars.thumb_list+'> li').index(this);
					targetSlide = index + 1;
					
					api.goTo(targetSlide);
					return false;
					
				});
			}
			
			// Start slideshow if enabled
			if (base.options.slideshow && base.options.slides.length > 1){
	    		
	    		// Start slideshow if autoplay enabled
	    		if (base.options.autoplay && base.options.slides.length > 1){
	    			vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);	// Initiate slide interval
				}else{
					vars.is_paused = true;	// Mark as paused
				}
				
				//Prevent navigation items from being dragged					
				$('.load-item img').bind("contextmenu mousedown",function(){
					return false;
				});
								
			}
			
			// Adjust image when browser is resized
			$(window).resize(function(){
	    		base.resizeNow();
			});
    		
    	};
        
        
        /* Resize Images
		----------------------------*/
		base.resizeNow = function(){
			
			return base.$el.each(function() {
		  		//  Resize each image seperately
		  		$('img', base.el).each(function(){
		  			
					thisSlide = $(this);
					var ratio = (thisSlide.data('origHeight')/thisSlide.data('origWidth')).toFixed(2);	// Define image ratio
					
					// Gather browser size
					var browserwidth = base.$el.width(),
						browserheight = base.$el.height(),
						offset;
					
					/*-----Resize Image-----*/
					if (base.options.fit_always){	// Fit always is enabled
						if ((browserheight/browserwidth) > ratio){
							resizeWidth();
						} else {
							resizeHeight();
						}
					}else{	// Normal Resize
						if ((browserheight <= base.options.min_height) && (browserwidth <= base.options.min_width)){	// If window smaller than minimum width and height
						
							if ((browserheight/browserwidth) > ratio){
								base.options.fit_landscape && ratio < 1 ? resizeWidth(true) : resizeHeight(true);	// If landscapes are set to fit
							} else {
								base.options.fit_portrait && ratio >= 1 ? resizeHeight(true) : resizeWidth(true);		// If portraits are set to fit
							}
						
						} else if (browserwidth <= base.options.min_width){		// If window only smaller than minimum width
						
							if ((browserheight/browserwidth) > ratio){
								base.options.fit_landscape && ratio < 1 ? resizeWidth(true) : resizeHeight();	// If landscapes are set to fit
							} else {
								base.options.fit_portrait && ratio >= 1 ? resizeHeight() : resizeWidth(true);		// If portraits are set to fit
							}
							
						} else if (browserheight <= base.options.min_height){	// If window only smaller than minimum height
						
							if ((browserheight/browserwidth) > ratio){
								base.options.fit_landscape && ratio < 1 ? resizeWidth() : resizeHeight(true);	// If landscapes are set to fit
							} else {
								base.options.fit_portrait && ratio >= 1 ? resizeHeight(true) : resizeWidth();		// If portraits are set to fit
							}
						
						} else {	// If larger than minimums
							
							if ((browserheight/browserwidth) > ratio){
								base.options.fit_landscape && ratio < 1 ? resizeWidth() : resizeHeight();	// If landscapes are set to fit
							} else {
								base.options.fit_portrait && ratio >= 1 ? resizeHeight() : resizeWidth();		// If portraits are set to fit
							}
							
						}
					}
					/*-----End Image Resize-----*/
					
					
					/*-----Resize Functions-----*/
					
					function resizeWidth(minimum){
						if (minimum){	// If minimum height needs to be considered
							if(thisSlide.width() < browserwidth || thisSlide.width() < base.options.min_width ){
								if (thisSlide.width() * ratio >= base.options.min_height){
									thisSlide.width(base.options.min_width);
						    		thisSlide.height(thisSlide.width() * ratio);
						    	}else{
						    		resizeHeight();
						    	}
						    }
						}else{
							if (base.options.min_height >= browserheight && !base.options.fit_landscape){	// If minimum height needs to be considered
								if (browserwidth * ratio >= base.options.min_height || (browserwidth * ratio >= base.options.min_height && ratio <= 1)){	// If resizing would push below minimum height or image is a landscape
									thisSlide.width(browserwidth);
									thisSlide.height(browserwidth * ratio);
								} else if (ratio > 1){		// Else the image is portrait
									thisSlide.height(base.options.min_height);
									thisSlide.width(thisSlide.height() / ratio);
								} else if (thisSlide.width() < browserwidth) {
									thisSlide.width(browserwidth);
						    		thisSlide.height(thisSlide.width() * ratio);
								}
							}else{	// Otherwise, resize as normal
								thisSlide.width(browserwidth);
								thisSlide.height(browserwidth * ratio);
							}
						}
					};
					
					function resizeHeight(minimum){
						if (minimum){	// If minimum height needs to be considered
							if(thisSlide.height() < browserheight){
								if (thisSlide.height() / ratio >= base.options.min_width){
									thisSlide.height(base.options.min_height);
									thisSlide.width(thisSlide.height() / ratio);
								}else{
									resizeWidth(true);
								}
							}
						}else{	// Otherwise, resized as normal
							if (base.options.min_width >= browserwidth){	// If minimum width needs to be considered
								if (browserheight / ratio >= base.options.min_width || ratio > 1){	// If resizing would push below minimum width or image is a portrait
									thisSlide.height(browserheight);
									thisSlide.width(browserheight / ratio);
								} else if (ratio <= 1){		// Else the image is landscape
									thisSlide.width(base.options.min_width);
						    		thisSlide.height(thisSlide.width() * ratio);
								}
							}else{	// Otherwise, resize as normal
								thisSlide.height(browserheight);
								thisSlide.width(browserheight / ratio);
							}
						}
					};
					
					/*-----End Resize Functions-----*/
					
					if (thisSlide.parents('li').hasClass('image-loading')){
						$('.image-loading').removeClass('image-loading');
					}
					
					// Horizontally Center
					if (base.options.horizontal_center){
						$(this).css('left', (browserwidth - $(this).width())/2);
					}
					
					// Vertically Center
					if (base.options.vertical_center){
						$(this).css('top', (browserheight - $(this).height())/2);
					}
					
				});
				
				// Basic image drag and right click protection
				if (base.options.image_protect){
					
					$('img', base.el).bind("contextmenu mousedown",function(){
						return false;
					});
				
				}
				
				return false;
				
			});
			
		};
        
        
        /* Next Slide
		----------------------------*/
		base.nextSlide = function(){
			
			if(vars.in_animation || !api.options.slideshow) return false;		// Abort if currently animating
				else vars.in_animation = true;		// Otherwise set animation marker
				
		    clearInterval(vars.slideshow_interval);	// Stop slideshow
		    
		    var slides = base.options.slides,					// Pull in slides array
				liveslide = base.$el.find('.activeslide');		// Find active slide
				$('.prevslide').removeClass('prevslide');
				liveslide.removeClass('activeslide').addClass('prevslide');	// Remove active class & update previous slide
					
			// Get the slide number of new slide
			vars.current_slide + 1 == base.options.slides.length ? vars.current_slide = 0 : vars.current_slide++;
			
		    var nextslide = $(base.el+' li:eq('+vars.current_slide+')'),
		    	prevslide = base.$el.find('.prevslide');
			
			// If hybrid mode is on drop quality for transition
			if (base.options.performance == 1) base.$el.removeClass('quality').addClass('speed');	
			
			
			/*-----Load Image-----*/
			
			loadSlide = false;
			
			vars.current_slide == base.options.slides.length - 1 ? loadSlide = 0 : loadSlide = vars.current_slide + 1;	// Determine next slide
			
			$('#picinfo .description').html(desc[vars.current_slide]);
			if($('#picinfo .description').html() != '')
				$('#picinfo').show();
			
			var targetList = base.el+' li:eq('+loadSlide+')';
			if (!$(targetList).html()){
				
				// If links should open in new window
				var linkTarget = base.options.new_window ? ' target="_blank"' : '';
				
				imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : "";	// If link exists, build it
				var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>'); 
				
				img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
				
				img.load(function(){
					base._origDim($(this));
					base.resizeNow();
				});	// End Load
			};
						
			// Update thumbnails (if enabled)
			if (base.options.thumbnail_navigation == 1){
			
				// Load previous thumbnail
				vars.current_slide - 1 < 0  ? prevThumb = base.options.slides.length - 1 : prevThumb = vars.current_slide - 1;
				$(vars.prev_thumb).html($("<img/>").attr("src", base.options.slides[prevThumb].image));
			
				// Load next thumbnail
				nextThumb = loadSlide;
				$(vars.next_thumb).html($("<img/>").attr("src", base.options.slides[nextThumb].image));
				
			}
			
			
			
			/*-----End Load Image-----*/
			
			
			// Call theme function for before slide transition
			if( typeof theme != 'undefined' && typeof theme.beforeAnimation == "function" ) theme.beforeAnimation('next');
			
			//Update slide markers
			if (base.options.slide_links){
				$('.current-slide').removeClass('current-slide');
				$(vars.slide_list +'> li' ).eq(vars.current_slide).addClass('current-slide');
			}
		    
		    nextslide.css('visibility','hidden').addClass('activeslide');	// Update active slide
		    
	    	switch(base.options.transition){
	    		case 0: case 'none':	// No transition
	    		    nextslide.css('visibility','visible');
	    		    vars.in_animation = false;
	    		    break;
	    		case 1: case 'fade':	// Fade
	    		    nextslide.animate({opacity : 0},0).css('visibility','visible').animate({opacity : 1, avoidTransforms : false}, base.options.transition_speed, function(){ base.afterAnimation(); });
	    		    break;
	    		case 2: case 'slideTop':	// Slide Top
	    		    nextslide.animate({top : -base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    		    break;
	    		case 3: case 'slideRight':	// Slide Right
	    			nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    			break;
	    		case 4: case 'slideBottom': // Slide Bottom
	    			nextslide.animate({top : base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    			break;
	    		case 5: case 'slideLeft':  // Slide Left
	    			nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    			break;
	    		case 6: case 'carouselRight':	// Carousel Right
	    			nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
					liveslide.animate({ left: -base.$el.width(), avoidTransforms : false }, base.options.transition_speed );
	    			break;
	    		case 7: case 'carouselLeft':   // Carousel Left
	    			nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
					liveslide.animate({ left: base.$el.width(), avoidTransforms : false }, base.options.transition_speed );
	    			break;
	    	}
		    return false;	
		};
		
		
		/* Previous Slide
		----------------------------*/
		base.prevSlide = function(){
			if(vars.in_animation || !api.options.slideshow) return false;		// Abort if currently animating
				else vars.in_animation = true;		// Otherwise set animation marker
			
			clearInterval(vars.slideshow_interval);	// Stop slideshow
			
			var slides = base.options.slides,					// Pull in slides array
				liveslide = base.$el.find('.activeslide');		// Find active slide
				$('.prevslide').removeClass('prevslide');
				liveslide.removeClass('activeslide').addClass('prevslide');		// Remove active class & update previous slide
			
			// Get current slide number
			vars.current_slide == 0 ?  vars.current_slide = base.options.slides.length - 1 : vars.current_slide-- ;
				
		    var nextslide =  $(base.el+' li:eq('+vars.current_slide+')'),
		    	prevslide =  base.$el.find('.prevslide');
			
			// If hybrid mode is on drop quality for transition
			if (base.options.performance == 1) base.$el.removeClass('quality').addClass('speed');	
			
			
			/*-----Load Image-----*/
			
			loadSlide = false;
			
			vars.current_slide - 1 < 0  ? loadSlide = base.options.slides.length - 1 : loadSlide = vars.current_slide - 1;	// Determine next slide
			
			$('#picinfo .description').html(desc[vars.current_slide]);
			if($('#picinfo .description').html() != '')
				$('#picinfo').show();
			
			var targetList = base.el+' li:eq('+loadSlide+')';
			if (!$(targetList).html()){
				// If links should open in new window
				var linkTarget = base.options.new_window ? ' target="_blank"' : '';
				imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : "";	// If link exists, build it
				var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>'); 
				
				img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
				
				img.load(function(){
					base._origDim($(this));
					base.resizeNow();
				});	// End Load
			};
			
			// Update thumbnails (if enabled)
			if (base.options.thumbnail_navigation == 1){
			
				// Load previous thumbnail
				prevThumb = loadSlide;
				$(vars.prev_thumb).html($("<img/>").attr("src", base.options.slides[prevThumb].image));
				
				// Load next thumbnail
				vars.current_slide == base.options.slides.length - 1 ? nextThumb = 0 : nextThumb = vars.current_slide + 1;
				$(vars.next_thumb).html($("<img/>").attr("src", base.options.slides[nextThumb].image));
			}
			
			/*-----End Load Image-----*/
			
			
			// Call theme function for before slide transition
			if( typeof theme != 'undefined' && typeof theme.beforeAnimation == "function" ) theme.beforeAnimation('prev');
			
			//Update slide markers
			if (base.options.slide_links){
				$('.current-slide').removeClass('current-slide');
				$(vars.slide_list +'> li' ).eq(vars.current_slide).addClass('current-slide');
			}
			
		    nextslide.css('visibility','hidden').addClass('activeslide');	// Update active slide
		    
		    switch(base.options.transition){
	    		case 0: case 'none':	// No transition
	    		    nextslide.css('visibility','visible'); vars.in_animation = false; base.afterAnimation();
	    		    break;
	    		case 1: case 'fade':	// Fade
	    		  	nextslide.animate({opacity : 0},0).css('visibility','visible').animate({opacity : 1, avoidTransforms : false}, base.options.transition_speed, function(){ base.afterAnimation(); });
	    		    break;
	    		case 2: case 'slideTop':	// Slide Top (reverse)
	    		    nextslide.animate({top : base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    		    break;
	    		case 3: case 'slideRight':	// Slide Right (reverse)
	    			nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    			break;
	    		case 4: case 'slideBottom': // Slide Bottom (reverse)
	    			nextslide.animate({top : -base.$el.height()}, 0 ).css('visibility','visible').animate({ top:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    			break;
	    		case 5: case 'slideLeft':  // Slide Left (reverse)
	    			nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
	    			break;
	    		case 6: case 'carouselRight':	// Carousel Right (reverse)
	    			nextslide.animate({left : -base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
					liveslide.animate({left : 0}, 0 ).animate({ left: base.$el.width(), avoidTransforms : false}, base.options.transition_speed );
	    			break;
	    		case 7: case 'carouselLeft':   // Carousel Left (reverse)
	    			nextslide.animate({left : base.$el.width()}, 0 ).css('visibility','visible').animate({ left:0, avoidTransforms : false }, base.options.transition_speed, function(){ base.afterAnimation(); });
					liveslide.animate({left : 0}, 0 ).animate({ left: -base.$el.width(), avoidTransforms : false }, base.options.transition_speed );
	    			break;
	    	}
		    return false;	
		};
		
		
		/* Play/Pause Toggle
		----------------------------*/
		base.playToggle = function(){
		
			if (vars.in_animation || !api.options.slideshow) return false;		// Abort if currently animating
			
			if (vars.is_paused){
				
				vars.is_paused = false;
				
				// Call theme function for play
				if( typeof theme != 'undefined' && typeof theme.playToggle == "function" ) theme.playToggle('play');
				
				// Resume slideshow
	        	vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);
	        	  
        	}else{
        		
        		vars.is_paused = true;
        		
        		// Call theme function for pause
        		if( typeof theme != 'undefined' && typeof theme.playToggle == "function" ) theme.playToggle('pause');
        		
        		// Stop slideshow
        		clearInterval(vars.slideshow_interval);	
       		
       		}
		    
		    return false;
    		
    	};
    	
    	
    	/* Go to specific slide
		----------------------------*/
    	base.goTo = function(targetSlide){
			if (vars.in_animation || !api.options.slideshow) return false;		// Abort if currently animating
			
			var totalSlides = base.options.slides.length;
			
			// If target outside range
			if(targetSlide < 0){
				targetSlide = totalSlides;
			}else if(targetSlide > totalSlides){
				targetSlide = 1;
			}
			targetSlide = totalSlides - targetSlide + 1;
			
			clearInterval(vars.slideshow_interval);	// Stop slideshow, prevent buildup
			
			// Call theme function for goTo trigger
			if (typeof theme != 'undefined' && typeof theme.goTo == "function" ) theme.goTo();
			
			if (vars.current_slide == totalSlides - targetSlide){
				if(!(vars.is_paused)){
					vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);
				} 
				return false;
			}
			
			// If ahead of current position
			if(totalSlides - targetSlide > vars.current_slide ){
				
				// Adjust for new next slide
				vars.current_slide = totalSlides-targetSlide-1;
				vars.update_images = 'next';
				base._placeSlide(vars.update_images);
				
			//Otherwise it's before current position
			}else if(totalSlides - targetSlide < vars.current_slide){
				
				// Adjust for new prev slide
				vars.current_slide = totalSlides-targetSlide+1;
				vars.update_images = 'prev';
			    base._placeSlide(vars.update_images);
			    
			}
			
			// set active markers
			if (base.options.slide_links){
				$(vars.slide_list +'> .current-slide').removeClass('current-slide');
				$(vars.slide_list +'> li').eq((totalSlides-targetSlide)).addClass('current-slide');
			}
			
			if (base.options.thumb_links){
				$(vars.thumb_list +'> .current-thumb').removeClass('current-thumb');
				$(vars.thumb_list +'> li').eq((totalSlides-targetSlide)).addClass('current-thumb');
			}
			
		};
        
        
        /* Place Slide
		----------------------------*/
        base._placeSlide = function(place){
    			
			// If links should open in new window
			var linkTarget = base.options.new_window ? ' target="_blank"' : '';
			
			loadSlide = false;
			
			if (place == 'next'){
				
				vars.current_slide == base.options.slides.length - 1 ? loadSlide = 0 : loadSlide = vars.current_slide + 1;	// Determine next slide
				
				var targetList = base.el+' li:eq('+loadSlide+')';
				
				if (!$(targetList).html()){
					// If links should open in new window
					var linkTarget = base.options.new_window ? ' target="_blank"' : '';
					
					imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : "";	// If link exists, build it
					var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>'); 
					
					img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
					
					img.load(function(){
						base._origDim($(this));
						base.resizeNow();
					});	// End Load
				};
				
				base.nextSlide();
				
			}else if (place == 'prev'){
			
				vars.current_slide - 1 < 0  ? loadSlide = base.options.slides.length - 1 : loadSlide = vars.current_slide - 1;	// Determine next slide
				
				var targetList = base.el+' li:eq('+loadSlide+')';
				
				if (!$(targetList).html()){
					// If links should open in new window
					var linkTarget = base.options.new_window ? ' target="_blank"' : '';
					
					imageLink = (base.options.slides[loadSlide].url) ? "href='" + base.options.slides[loadSlide].url + "'" : "";	// If link exists, build it
					var img = $('<img src="'+base.options.slides[loadSlide].image+'"/>'); 
					
					img.appendTo(targetList).wrap('<a ' + imageLink + linkTarget + '></a>').parent().parent().addClass('image-loading').css('visibility','hidden');
					
					img.load(function(){
						base._origDim($(this));
						base.resizeNow();
					});	// End Load
				};
				base.prevSlide();
			}
			
		};
		
		
		/* Get Original Dimensions
		----------------------------*/
		base._origDim = function(targetSlide){
			targetSlide.data('origWidth', targetSlide.width()).data('origHeight', targetSlide.height());
		};
		
		
		/* After Slide Animation
		----------------------------*/
		base.afterAnimation = function(){
			
			// If hybrid mode is on swap back to higher image quality
			if (base.options.performance == 1){
		    	base.$el.removeClass('speed').addClass('quality');
			}
			
			// Update previous slide
			if (vars.update_images){
				vars.current_slide - 1 < 0  ? setPrev = base.options.slides.length - 1 : setPrev = vars.current_slide-1;
				vars.update_images = false;
				$('.prevslide').removeClass('prevslide');
				$(base.el+' li:eq('+setPrev+')').addClass('prevslide');
			}
			
			vars.in_animation = false;
			
			// Resume slideshow
			if (!vars.is_paused && base.options.slideshow){
				vars.slideshow_interval = setInterval(base.nextSlide, base.options.slide_interval);
				if (base.options.stop_loop && vars.current_slide == base.options.slides.length - 1 ) base.playToggle();
			}
			
			// Call theme function for after slide transition
			if (typeof theme != 'undefined' && typeof theme.afterAnimation == "function" ) theme.afterAnimation();
						
			return false;
		
		};
		
		base.getField = function(field){
			return base.options.slides[vars.current_slide][field];
		};
		
        // Make it go!
        base.init();
	};
	
	
	/* Global Variables
	----------------------------*/
	$.supersized.vars = {
	
		// Elements							
		thumb_tray			:	'#thumb-tray',	// Thumbnail tray
		thumb_list			:	'#thumb-list',	// Thumbnail list
		slide_list          :   '#slide-list',	// Slide link list
		
		// Internal variables
		current_slide			:	0,			// Current slide number
		in_animation 			:	false,		// Prevents animations from stacking
		is_paused 				: 	false,		// Tracks paused on/off
		hover_pause				:	false,		// If slideshow is paused from hover
		slideshow_interval		:	false,		// Stores slideshow timer					
		update_images 			: 	false,		// Trigger to update images after slide jump
		options					:	{}			// Stores assembled options list
		
	};
	
	
	/* Default Options
	----------------------------*/
	$.supersized.defaultOptions = {
    
    	// Functionality
		slideshow               :   1,			// Slideshow on/off
		autoplay				:	1,			// Slideshow starts playing automatically
		start_slide             :   1,			// Start slide (0 is random)
		stop_loop				:	0,			// Stops slideshow on last slide
		random					: 	0,			// Randomize slide order (Ignores start slide)
		slide_interval          :   5000,		// Length between transitions
		transition              :   1, 			// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
		transition_speed		:	750,		// Speed of transition
		new_window				:	1,			// Image links open in new window/tab
		pause_hover             :   0,			// Pause slideshow on hover
		keyboard_nav            :   1,			// Keyboard navigation on/off
		performance				:	1,			// 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed //  (Only works for Firefox/IE, not Webkit)
		image_protect			:	1,			// Disables image dragging and right click with Javascript
												   
		// Size & Position
		fit_always				:	0,			// Image will never exceed browser width or height (Ignores min. dimensions)
		fit_landscape			:   0,			// Landscape images will not exceed browser width
		fit_portrait         	:   1,			// Portrait images will not exceed browser height  			   
		min_width		        :   0,			// Min width allowed (in pixels)
		min_height		        :   0,			// Min height allowed (in pixels)
		horizontal_center       :   1,			// Horizontally center background
		vertical_center         :   1,			// Vertically center background
		
												   
		// Components							
		slide_links				:	1,			// Individual links for each slide (Options: false, 'num', 'name', 'blank')
		thumb_links				:	1,			// Individual thumb links for each slide
		thumbnail_navigation    :   0			// Thumbnail navigation
    	
    };
    
    $.fn.supersized = function(options){
        return this.each(function(){
            (new $.supersized(options));
        });
    };
		
})(jQuery);

;
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};;
(function ($) {

	Drupal.behaviors.dynamic_persons = {
	    attach: function(context, settings) {
			$('a.categoryLink:not(.categoryLink-processed)', context).click(function () {
				// show the ajax filter in the navigation and set the selected-icon correctly
				$('#ajaxFilter').show();
				$('#block-views-taxonomy-items-block .views-field').removeClass("active");
				$(this).parent().parent().parent().addClass('active');
				
				// This function will get exceuted after the ajax request is completed successfully
				var updatePersons = function(data) {
					// The data parameter is a JSON object. The “persons” property is the list of products items that was returned from the server response to the ajax request.
					$('#ajaxFilter .headline').html('<h2>' + data.title + '</h2>');
					$('#ajaxFilter .wrapper').html(data.persons);
					$('#ajaxFilter').show();
				};
				$.ajax({
					type: 'POST',
					url: this.href, // Which url should be handle the ajax request. This is the url defined in the <a> html tag
					success: updatePersons, // The js function that will be called upon success request
					dataType: 'json', //define the type of data that is going to get back from the server
					data: 'js=1' //Pass a key/value pair
				});
				return false;  // return false so the navigation stops here and not continue to the page in the link
			}).addClass('categoryLink-processed');
	    }
	  };
	
})(jQuery);

;

(function ($) {
	
	var numberOfSlides;
	var numVideos = 0;
	var imageDuration = 7000; // 7 sec per video/operator
	var articleCarouselInit = false;
	var productCarouselInit = false;
	var issueCarouselInit = false;
	var divebaseCarouselInit = false;
	var personCarouselInit = false;
	var opCarouselInit = false;
	var searching = false;
	var searchInt;
	var currentOpPosition = -1;
	var numberOfOperators;
	var formIScroll;
	var articleScroller;
	var divebaseScroller;
	var aboScroller;
	var archiveScroller;
	var searchScroller;
	var unfilteredScroller;
	
	var isiPad = navigator.userAgent.match(/iPad/i) != null;
	
	//Default settings
	var settings = {
  		start_slide				:	1,		//Start slide (0 is random) //Requires multiple background images
		vertical_center         :   1,		//Vertically center background
		horizontal_center       :   1,		//Horizontally center background
		min_width		        :   0,		//Min width allowed (in pixels)
		min_height		        :   0,		//Min height allowed (in pixels)
		fit_portrait         	:   0,		//Portrait images will not exceed browser height
		fit_landscape			:   0,		//Landscape images will not exceed browser width
		image_protect			:	1		//Disables image dragging and right click with Javascript
	};
	
	var options = $.extend(settings);
	
	
	$(document).ready(function(){
		
		if($('#socialshareprivacy').length > 0)
		{
			$('#socialshareprivacy').socialSharePrivacy({
			  services : {
			    twitter : {
			        'status' : 'off'
			    }
			  }
			});
	    }
		
		/* Operators if currently none are selected*/
		numberOfOperators = $('.view-operator .item-list li').length;
		
		if(numberOfOperators > 1)
		{
			currentOpPosition = 0;
			setInterval(updateOperators, imageDuration);
		}
		
				
		if($('#nextArticle').length > 0)
		{
			$('#nextArticle').css('height', ($(window).height() - parseInt($('#page').css('margin-top'))) + 'px');
			if( $("html").is(".ie7") )
			{
				var ieMargin = (parseInt($('#nextArticle').css('height')) - parseInt($('#nextArticle .recommendation').css('height')))/2;
				$('#nextArticle .recommendation').css('margin-top', ieMargin + 'px');
			}
		}
		
		if($('#nextProduct').length > 0)
		{
			$('#nextProduct').css('height', ($(window).height() - parseInt($('#page').css('margin-top'))) + 'px');
			if( $("html").is(".ie7") )
			{
				var ieMargin = (parseInt($('#nextProduct').css('height')) - parseInt($('#nextProduct .recommendation').css('height')))/2;
				$('#nextProduct .recommendation').css('margin-top', ieMargin + 'px');
			}
		}
		
		/* SLIDESHOW IN BACKGROUND*/
		var slides = $('#slideshow').children();
		numberOfSlides = slides.length;
		
		numVideos = $('video').length;
		
		$(window).resize(function() {
			if($('#nextArticle').length > 0)
			{
				$('#nextArticle').css('height', ($(window).height() - parseInt($('#page').css('margin-top'))) + 'px');
				if( $("html").is(".ie7") )
				{
					var ieMargin = (parseInt($('#nextArticle').css('height')) - parseInt($('#nextArticle .recommendation').css('height')))/2;
					$('#nextArticle .recommendation').css('margin-top', ieMargin + 'px');
				}
			}
			
			if($('#nextProduct').length > 0)
			{
				$('#nextProduct').css('height', ($(window).height() - parseInt($('#page').css('margin-top'))) + 'px');
				if( $("html").is(".ie7") )
				{
					var ieMargin = (parseInt($('#nextProduct').css('height')) - parseInt($('#nextProduct .recommendation').css('height')))/2;
					$('#nextProduct .recommendation').css('margin-top', ieMargin + 'px');
				}
			}
			
			// resize the background videos
			$('video').each(function() {
				var wWidth = $(window).width();
				var wHeight = $(window).height();
				var vWidth = $(this).innerWidth();
				var vHeight = $(this).innerHeight();
				
				if(wWidth * $(this).data('rat2') > wHeight)
				{
					var newW = wWidth;
					var newH = wWidth * $(this).data('rat2');
					$(this).width(newW);
					$(this).height(newH);
				}
				
				if(wHeight * $(this).data('rat1') > wWidth)
				{
					var newH = wHeight;
					var newW = wHeight * $(this).data('rat1');
					$(this).width(newW);
					$(this).height(newH);
				}
			});
			
			$('.myflash').each(function() {
				var wWidth = $(window).width();
				var wHeight = $(window).height();
				var vWidth = $(this).find('object, embed').innerWidth();
				var vHeight = $(this).find('object, embed').innerHeight();
				
				if(wWidth * $(this).data('rat2') > wHeight)
				{
					var newW = wWidth;
					var newH = wWidth * $(this).data('rat2');
					$(this).find('object, embed').width(newW);
					$(this).find('object, embed').height(newH);
				}
				
				if(wHeight * $(this).data('rat1') > wWidth)
				{
					var newH = wHeight;
					var newW = wHeight * $(this).data('rat1');
					$(this).find('object, embed').width(newW);
					$(this).find('object, embed').height(newH);
				}
			});
			
			initializeArticleCarousel();
			initializeProductCarousel();
			initializeIssueCarousel();
			initializePersonCarousel();
			if($('#article-full').length == 0)
			{
				initializeDivebaseCarousel();
			}
			
			resizeHeader();
			resizeSlideshow();
		});
		
		$('video').bind('loadeddata', function() {
			if(numberOfSlides == 0)
				startSlideshow();
			
			$(this).parent().parent().show();
			
			var wWidth = $(window).width();
			var wHeight = $(window).height();
			var vWidth = $(this).innerWidth();
			var vHeight = $(this).innerHeight();
			var rat1 = vWidth/vHeight;
			var rat2 = vHeight/vWidth;
			
			$(this).data('rat1', rat1);
			$(this).data('rat2', rat2);
			
			if(wWidth * $(this).data('rat2') > wHeight)
			{
				var newW = wWidth;
				var newH = wWidth * $(this).data('rat2');
				$(this).width(newW);
				$(this).height(newH);
			}
			
			if(wHeight * $(this).data('rat1') > wWidth)
			{
				var newH = wHeight;
				var newW = wHeight * $(this).data('rat1');
				$(this).width(newW);
				$(this).height(newH);
			}
			
			numVideos--;
			
			$(this).parent().parent().hide();
			if(numberOfSlides > 0)
				startSlideshow();
		});
		
		$(window).load(function() {
			
			if (navigator.userAgent.indexOf("Firefox") != -1)
			{
				$('.myflash').each(function() {
					var wWidth = $(window).width();
					var wHeight = $(window).height();
					var vWidth = $(this).find('embed').innerWidth();
					var vHeight = $(this).find('embed').innerHeight();
					var rat1 = vWidth/vHeight;
					var rat2 = vHeight/vWidth;
					
					$(this).data('rat1', rat1);
					$(this).data('rat2', rat2);
					
					if(wWidth * $(this).data('rat2') > wHeight)
					{
						var newW = wWidth;
						var newH = wWidth * $(this).data('rat2');
						$(this).find('embed').width(newW);
						$(this).find('embed').height(newH);
					}
					
					if(wHeight * $(this).data('rat1') > wWidth)
					{
						var newH = wHeight;
						var newW = wHeight * $(this).data('rat1');
						$(this).find('embed').width(newW);
						$(this).find('embed').height(newH);
					}
				});
			}
			else
			{
				$('.myflash').each(function() {
					var wWidth = $(window).width();
					var wHeight = $(window).height();
					var vWidth = $(this).find('object, embed').innerWidth();
					var vHeight = $(this).find('object, embed').innerHeight();
					var rat1 = vWidth/vHeight;
					var rat2 = vHeight/vWidth;
					
					$(this).data('rat1', rat1);
					$(this).data('rat2', rat2);
					
					if(wWidth * $(this).data('rat2') > wHeight)
					{
						var newW = wWidth;
						var newH = wWidth * $(this).data('rat2');
						$(this).find('object, embed').width(newW);
						$(this).find('object, embed').height(newH);
					}
					
					if(wHeight * $(this).data('rat1') > wWidth)
					{
						var newH = wHeight;
						var newW = wHeight * $(this).data('rat1');
						$(this).find('object, embed').width(newW);
						$(this).find('object, embed').height(newH);
					}
				});
			}
		});
		
		
		$('#playpause, #rewind, #forward').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('#playpause').click(function() {
			if($.supersized.vars.is_paused)
			{
				$(this).attr('src', Drupal.settings.basePath + '/sites/all/themes/silentworld/data/pause.png');
				api.playToggle();
			}
			else
			{
				$(this).attr('src', Drupal.settings.basePath + '/sites/all/themes/silentworld/data/play.png');
				api.playToggle();
			}
		});
		
		$('#rewind').click(function() {
			api.prevSlide();
		});
		
		$('#forward').click(function() {
			api.nextSlide();
		});
		
		if(typeof(desc) != 'undefined')
			$('#picinfo .description').html(desc[numberOfSlides-1]);
		
		if($('video').length == 0)
			startSlideshow();
		initializeArticleCarousel();
		initializeProductCarousel();
		initializeIssueCarousel();
		initializePersonCarousel();
		if($('#article-full').length == 0)
		{
			initializeDivebaseCarousel();
		}
					
		
		// MENU 
		var isOverFilter = false; 
		var t = null;
		
		$('#block-system-main-menu li').hover(
				function() {
					$(this).css('cursor', 'pointer');
					window.clearTimeout(t);
					$('.region-filter .block-views, .region-filter .block-block, .region-filter .block-menu').hide();
					$('#ajaxFilter').hide();
					$('#block-system-main-menu li').not(this).removeClass('active');
				},
				function() {
				}
		);
		
		$('#block-views-taxonomy-items-block, .region-filter .block-views, .region-filter .block-block, .region-filter .block-menu, #ajaxFilter').hover(
				function() {
					isOverFilter = true;
				},
				function() {
					isOverFilter = false;
				}
		);
		
		// filter for travelling should be visible if the user is on the travelling page
		if($('#menu-travel').hasClass('active-trail') && ! isiPad)
		{
			$('#block-views-taxonomy-items-block-3').show();
		}
		
		
		// filter for people should be visible if the user is on the travelling page
		if($('#menu-people').hasClass('active-trail'))
		{
			// don't show the filter when on the persons detail page
			if(document.location.href.indexOf("artikel/") > -1)
				$('#block-views-taxonomy-items-block').show();
		}
		
		
		
		// show filter for travelling
		$('#block-system-main-menu #menu-travel').hover(
				function() {
					$(this).addClass("active");
					$(this).css('cursor', 'pointer');
					$('#block-views-taxonomy-items-block-3').show();
					$('#ajaxFilter').hide();
				},
				function() {
					if(window.location.href.indexOf("weltkarte") == -1 || window.location.href.indexOf("weltkarte-shop") > -1)
						setTimer();
				}
		);
		
		// show filter for people
		$('#block-system-main-menu #menu-people').hover(
			function() {
				$(this).addClass("active");
				$(this).css('cursor', 'pointer');
				$('#block-views-taxonomy-items-block').show();
				$('#ajaxFilter').hide();
			},
			function() {
				if(! $('#menu-people').hasClass('active-trail'))
					setTimer();
			}
		);
		
		// show filter for projects
		$('#block-system-main-menu #menu-project').hover(
				function() {
					$(this).addClass("active");
					$(this).css('cursor', 'pointer');
					$('#block-views-taxonomy-items-block-1').show();
				},
				function() {
					setTimer();
				}
		);
		
		// show filter for products
		$('#block-system-main-menu #menu-product').hover(
				function() {
					$(this).addClass("active");
					$(this).css('cursor', 'pointer');
					$('#block-views-taxonomy-items-block-2').show();
				},
				function() {
					setTimer();
				}
		);
		
		// show filter for service
		$('#block-system-main-menu #menu-service').hover(
				function() {
					$(this).addClass("active");
					$(this).css('cursor', 'pointer');
					$('#block-menu-menu-service-area').show();
				},
				function() {
					setTimer();
				}
		);
		
		
		function setTimer()
		{
			t = window.setTimeout(hideMenuLayer, 1000);
		}
		
		
		function hideMenuLayer()
		{ 
			var set = true;
			
			if(! isOverFilter)
			{
				set = false;
				$('.region-filter .block-views, .region-filter .block-block, .region-filter .block-menu').hide();
				
				if(window.location.href.indexOf("weltkarte") > -1 && window.location.href.indexOf("weltkarte-shop") == -1)
					$('#block-views-taxonomy-items-block-3').show();
				
				if($('#menu-people').hasClass('active-trail') && document.location.href.indexOf("artikel/") > -1)
					$('#block-views-taxonomy-items-block').show();
				
				$('#ajaxFilter').hide();
				$('#block-system-main-menu li').removeClass('active');
			}
			
			if(set)
			{
				setTimer();
			}
		};
		
		
		
		
		
		
		
		
		
		
		// Animation startboxes 
		$('.start-boxes .article li, #picinfo .switcher').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.start-boxes .article li').hover(
			function () {
			    $(this).find('img').show();
			  },
			function () {
				  $(this).find('img').hide();
			  }
		);
			
		$('#picinfo .switcher').toggle(
			function() {
			  $(this).parent().addClass('open');
			}, 
			function() {
				$(this).parent().removeClass('open');
			}
		);

		

		
		
		// Animation product detail page
		$('.node-pageprodukt #showProductTeaser').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.node-pageprodukt #showProductTeaser').toggle(
			function() {
				$(this).parent().find('.description').removeClass('open');
				$(this).parent().find('.showShop').removeClass('open');
				$(this).parent().find('.showShop').addClass('close');
				$(this).parent().find('.description').addClass('close');
				$(this).removeClass('open');
			}, 
			function() {
				$(this).parent().find('.description').removeClass('close');
				$(this).parent().find('.description').addClass('open');
				$(this).addClass('open');
			}
		);
		
		$('.node-pageprodukt .showDiveshop').click(function() {
			$('.node-pageprodukt .description').removeClass('open');
			$('.node-pageprodukt .description').addClass('close');
			$('.node-pageprodukt .showShop').addClass('open');
			$('.node-pageprodukt .showShop').removeClass('close');
		});
		
		$('.node-pageprodukt .showDescription').click(function() {
			$('.node-pageprodukt .showShop').removeClass('open');
			$('.node-pageprodukt .showShop').addClass('close');
			$('.node-pageprodukt .description').addClass('open');
			$('.node-pageprodukt .description').removeClass('close');
		});
		
		
		
		/*
		// Align product box correctly 
		$(window).load(function() {
			$('.node-pageprodukt .description').addClass('open');
			
			$('.node-pageprodukt').data('desc', $('.node-pageprodukt .description').outerHeight());
			$('.node-pageprodukt').data('shop', $('.node-pageprodukt .showShop').outerHeight());
			
			$('.node-pageprodukt .description').addClass('close');
			$('.node-pageprodukt .showShop').addClass('close');
			
			var sum;
			var dist = parseInt($('.node-pageprodukt .description').css('margin-top'));
			if($('.node-pageprodukt').data('desc') > $('.node-pageprodukt').data('shop'))
				sum = $('.node-pageprodukt').innerHeight() + $('.node-pageprodukt').data('desc') + dist;
			else
				sum = $('.node-pageprodukt').innerHeight() + $('.node-pageprodukt').data('shop') + dist;
			
			$('.node-pageprodukt .description').removeClass('close');
			$('.node-pageprodukt .description').addClass('open');
			$('#showProductTeaser').addClass('open');
			
			$('.node-pageprodukt').data('sum', sum);
			
			var posTop = $(document).height() - sum - 55;
			$('.node-pageprodukt').css('top', posTop + 'px');
		});
		
		$(window).resize(function() {
			var posTop = $(document).height() - $('.node-pageprodukt').data('sum') - 55;
			$('.node-pageprodukt').css('top', posTop + 'px');
		});
		*/
		
		$('#nextProduct').mouseover(function() {
			$(this).find('.recommendation').show();
		});
		
		$('#nextProduct').mouseout(function() {
			$(this).find('.recommendation').hide();
		});
		
		/*
		// Align article box correctly 
		$(window).load(function() {
			console.log("window ready " + $('.node-pageartikel .description').height());
			
			$('.node-pageartikel').data('desc', $('.node-pageartikel .description').outerHeight());
			$('.node-pageartikel').data('op', $('.node-pageartikel .operator').outerHeight());
//			$('.node-pageartikel .description, .node-pageartikel .operator').addClass('close');
			$('.node-pageartikel .operator').addClass('close');
			$('.node-pageartikel .description').addClass('open');
			$('.node-pageartikel #showArticleTeaser').addClass('open');
			
			var sum;
			var dist = parseInt($('.node-pageartikel .description').css('margin-top'));
			if($('.node-pageartikel').data('desc') > $('.node-pageartikel').data('op'))
			{
				sum = $('.node-pageartikel').innerHeight() + dist;
			}
			else
			{
				sum = $('.node-pageartikel').innerHeight() - $('.node-pageartikel').data('desc') + $('.node-pageartikel').data('op') + dist;
			}
			
			$('.node-pageartikel').data('sum', sum);
			
			var posTop = $(document).height() - sum - 55;
			$('.node-pageartikel').css('top', posTop + 'px');
		});
		$(window).resize(function() {
			var posTop = $(document).height() - $('.node-pageartikel').data('sum') - 55;
			$('.node-pageartikel').css('top', posTop + 'px');
		});
		 */
		
		
		if($('.node-pageartikel .description .more li').length > 4)
			$('.node-pageartikel').addClass('wide');
		
		
		// Animations info boxes and issue in the article full version
		$('.info-box h4, #article-full .close, #divebase .close, #filter .close, .readArticle').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('#filter .close').click(function() {
			$('#filter').hide();
			$('#slideshow_navi').css('z-index', '5');
			resizeHeader();
		});
		
		$('#article-full .close').click(function() {
			 $('#article-full').hide();
			 $('.node-pageartikel').show();
			 $('#slideshow_navi').css('z-index', '5');
			 resizeHeader();
		});
		
		$('.readArticle').click(function() {
			$('.node-pageartikel').hide();
			$('#article-full').show();
			if(isiPad)
			{
//				$('.colleft h2').append('<div id="socialshareprivacy3">test</div>');
//				if($('#socialshareprivacy3').length > 0)
//				{
//					$('#socialshareprivacy3').socialSharePrivacy({
//					  services : {
//					    twitter : {
//					        'status' : 'off'
//					    }
//					  }
//					});
//			    }
				articleScroller = new iScroll('articlescroller');
			}
			$('#slideshow_navi').css('z-index', '4');
			resizeHeader();
		});
		
		
		$('#divebase .close').click(function() {
			$('#divebase').hide();
			$('.node-pageartikel').show();
			 $('#slideshow_navi').css('z-index', '5');
			 resizeHeader();
		});
		
		$('.showDivebase').click(function() {
			$('.node-pageartikel').hide();
			$('#divebase').show();
			divebaseScroller = new iScroll('divebasescroller');
			$('#slideshow_navi').css('z-index', '4');
			resizeHeader();
			
			initializeDivebaseCarousel();
		});
		
		$('.node-pageartikel #showArticleTeaser').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.node-pageartikel #showArticleTeaser').toggle(
			function() {
				$(this).parent().find('.description').removeClass('open');
				$(this).parent().find('.operator').removeClass('open');
				$(this).parent().find('.description').addClass('close');
				$(this).parent().find('.operator').addClass('close');
				$(this).removeClass('open');
			}, 
			function() {
				$(this).parent().find('.description').addClass('open');
				$(this).parent().find('.description').removeClass('close');
				$(this).addClass('open');
			}
		);
		
		$('#showDivebaseDetail').click(function() {
			$('#article-full').hide();
			$('#divebase').show();
			divebaseScroller = new iScroll('divebasescroller');
			$('#slideshow_navi').css('z-index', '4');
			resizeHeader();
			initializeDivebaseCarousel();
		});
		
		$('#nextArticle').mouseover(function() {
			$(this).find('.recommendation').show();
		});
		
		$('#nextArticle').mouseout(function() {
			$(this).find('.recommendation').hide();
		});
		
		
		// show operator
		$('#operator .close').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.showOperator').click(function() {
			$('.node-pageartikel').hide();
			$('#operator').show();
//			divebaseScroller = new iScroll('divebasescroller');
			$('#slideshow_navi').css('z-index', '4');
			resizeHeader();
			
			initializeOperatorCarousel();
		});

		$('#operator .close').click(function() {
			$('#operator').hide();
			$('.node-pageartikel').show();
			 $('#slideshow_navi').css('z-index', '5');
			 resizeHeader();
		});
		
		
		
		// show the filter with the articles
		$('.node-pageartikel .showArticles').click(function() {
			$('#filter').show();
			initializeArticleCarousel();
			 $('#slideshow_navi').css('z-index', '4');
			 resizeHeader();
		});
		
		
		
		// show the filter with the products
		$('.node-pageprodukt .showProducts').click(function() {
			$('#filter').show();
			$('#slideshow_navi').css('z-index', '4');
			resizeHeader();
			initializeProductCarousel();
		});
		
		$('.info-box').addClass('closed');
		
		
		/*
		auskommentiert wegen issue bei artikel lesen seite
		$('.issue').toggle(
				function() {
					$(this).removeClass('closed');
					$(this).addClass('open');
				}, 
				function() {
					$(this).removeClass('open');
					$(this).addClass('closed');
				}
		);
		*/
		
		
		
		
		// h4 wegen heftarchiv-seite
		$('.info-box h4').toggle(
				function() {
					 $(this).parent().find('.description').not('.info-box .info-box .description').slideDown('fast', function() {
						 $(this).parent().removeClass('closed');
						 $(this).parent().addClass('open');
						 refreshIScroller();
					  });
				}, 
				function() {
					$(this).parent().find('.description').not('.info-box .info-box .description').slideUp('fast', function() {
						$(this).parent().removeClass('open');
						$(this).parent().addClass('closed');
						refreshIScroller();
					});
				}
		);
		
		
		
		
		
		// WEBFORM
		$('.webform-component-fieldset legend').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.webform-component-fieldset .fieldset-title').bind('click', function() {
			window.setTimeout(refreshIScroller, 500);
		});
		
		$('.webform-component-fieldset legend').toggle(
				function() {
					$(this).parent().find('.fieldset-wrapper').slideDown('fast', function() {
						$(this).parent().removeClass('collapsed');
						refreshIScroller();
					});
				}, 
				function() {
					$(this).parent().find('.fieldset-wrapper').slideUp('fast', function() {
						$(this).parent().addClass('collapsed');
						refreshIScroller();
					});
				}
		);
		
		$('.info-box #webform-component-terms .info-box h4').click(function() {
			$('#article-full').hide();
			$('#article-terms').show();
			new iScroll('termscroller');
		});
		
		if($('.info-box #webform-component-terms .info-box .description').length > 0)
		{
			var theHtml = $('.info-box #webform-component-terms .info-box .description').html(); 
			
			$('#article-full').after('<div id="article-terms"><div class="wrapper" id="termscroller">' + theHtml + '</div></div>');
			
			$('.info-box #webform-component-terms .info-box .description').remove();
			
			$('#article-terms .close_terms').mouseover(function() {
				$(this).css('cursor', 'pointer');
			});
			
			$('#article-terms .close_terms').click(function() {
				$('#article-terms').hide();
				$('#article-full').show();
			});
		}
		
		
		
		
		
		
		
		// SEARCH
		$('#showSearch').toggle(
				function() {
					$(this).addClass('open');
					$('#block-views-exp-search-page').show();
					$('#block-views-exp-search-page #edit-search').focus();
				}, 
				function() {
					$(this).removeClass('open');
					$('#block-views-exp-search-page').hide();
				}
		);
				
		$("#block-views-exp-search-page").keydown( function() {
			searching = true;
			window.clearTimeout(searchInt);
			searchInt = window.setTimeout(isSearchActive, 5000);
		});
		
		$('#showSearch, .resultgroup h2').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.resultgroup h2').bind('click', function() {
			window.setTimeout(refreshIScroller, 500);
		});
		
		$('.resultgroup h2').toggle(
				function() {
					$(this).parent().addClass('open');
					$(this).parent().find('.results').slideDown();
					refreshIScroller();
				}, 
				function() {
					$(this).parent().find('.results').slideUp(function() {
						$(this).parent().removeClass('open');
						$(this).parent().parent().removeClass('open');
						refreshIScroller();
					});
				}
		);
		
		
		
		
		// All Articles
		$('.view-articles-unfiltered .item-list:first-child').addClass('first');
		
		$('.view-articles-unfiltered .item-list h2.month').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		$('.view-articles-unfiltered .item-list h2.month').bind('click', function() {
			window.setTimeout(refreshIScroller, 500);
		});
		
		$('.view-articles-unfiltered .item-list h2.month').toggle(
				function() {
					$(this).parent().addClass('open');
					$(this).parent().find('ul').slideDown();
					refreshIScroller();
				}, 
				function() {
					$(this).parent().find('ul').slideUp(function() {
						$(this).parent().removeClass('open');
						refreshIScroller();
					});
				}
		);
		
		
		$('.view-articles-unfiltered .item-list:first-child h2.month').trigger('click');
		
		
		// Add this overlay
		try
		{
			addthis.addEventListener("addthis.menu.open", eventHandler);
			addthis.addEventListener("addthis.ready", addThisReadyHandler);
		}
		catch(e)
		{}
		
		
		
		// CSS mostly for IE 
		$('#search-form .form-item-keys').addClass('clearfix');
		$(".info-box p:last-child").addClass('last');
		$(".region-filter .block-block table tr:first-child").addClass('row-first');
		$('a').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});
		
		if($('#webform-component-bonus').length > 0)
		{
			$('#webform-component-bonus input').attr('id', 'bonusField');
			
			if($('#bonusField').val().length > 0)
			{
				var selected = $('#bonusField').val();
				
				$('.bonus-box input:radio').each(function() {
					
					if(selected == $(this).val())
						$(this).attr('checked', true);
				});
			}
		}
		
		$('#webform-component-agb').addClass('clearfix');
		resizeHeader();
		
		// put the slideshow icons in the back
		if((($('#articlefilter').length > 0 && !$('body').hasClass('front')) || $('body').hasClass('node-type-divebase')) || ($('#divebase').length > 0 && $('#article-full').length == 0)    )
		{
			$('#slideshow_navi').css('z-index', '4');
			$('#picinfo').css('z-index', '4');
		}
		
		$('#webform-component-terms #edit-submitted-terms, #webform-component-terms #edit-submitted-terms--2').addClass('clearfix');
		
		
		
		resizeSlideshow();
		
		
		
		// Specials for the iPad
		if(isiPad)
		{
			// create iScroller
			if($('#abonnement-scroller').length > 0)
			{
				//$('#webform-component-lieferanschrift').addClass('collapsed');
				aboScroller = new iScroll('abonnement-scroller');
			}
			
			if($('#webform-scroller').length > 0)
			{
				//$('#webform-component-lieferanschrift').addClass('collapsed');
				formIScroll = new iScroll('webform-scroller');
			}
			
			if($('#standard-scroller').length > 0)
				new iScroll('standard-scroller');
			
			if($('#search-scroller').length > 0)
				searchScroller = new iScroll('search-scroller');
			
			if($('#feed-scroller').length > 0)
				new iScroll('feed-scroller');
			
			if($('#unfiltered-scroller').length > 0)
				unfilteredScroller = new iScroll('unfiltered-scroller');
		}
	
		
	});
	
	
	function resizeSlideshow()
	{
		/*
		$('#slideshow img').each(function() {
			//Basic image drag and right click protection
			if (options.image_protect){
				$('img', '#slideshow').bind("contextmenu",function(){
					return false;
				});
				$('img', '#slideshow').bind("mousedown",function(){
					return false;
				});
			}
  			
			var ratio = ($(this).height()/$(this).width()).toFixed(2);	//Define image ratio
			thisSlide = $(this);
			
			//Gather browser size
			var browserwidth = $(window).width();
			var browserheight = $(window).height();
			var offset;
			
			//Resize image to proper ratio
			
			if ((browserheight <= options.min_height) && (browserwidth <= options.min_width)){	//If window smaller than minimum width and height
			
				if ((browserheight/browserwidth) > ratio){
					options.fit_landscape && ratio <= 1 ? resizeWidth(true) : resizeHeight(true);	//If landscapes are set to fit
				} else {
					options.fit_portrait && ratio > 1 ? resizeHeight(true) : resizeWidth(true);		//If portraits are set to fit
				}
			
			} else if (browserwidth <= options.min_width){		//If window only smaller than minimum width
			
				if ((browserheight/browserwidth) > ratio){
					options.fit_landscape && ratio <= 1 ? resizeWidth(true) : resizeHeight();	//If landscapes are set to fit
				} else {
					options.fit_portrait && ratio > 1 ? resizeHeight() : resizeWidth(true);		//If portraits are set to fit
				}
				
			} else if (browserheight <= options.min_height){	//If window only smaller than minimum height
			
				if ((browserheight/browserwidth) > ratio){
					options.fit_landscape && ratio <= 1 ? resizeWidth() : resizeHeight(true);	//If landscapes are set to fit
				} else {
					options.fit_portrait && ratio > 1 ? resizeHeight(true) : resizeWidth();		//If portraits are set to fit
				}
			
			} else {	//If larger than minimums
			
				if ((browserheight/browserwidth) > ratio){
					options.fit_landscape && ratio <= 1 ? resizeWidth() : resizeHeight();	//If landscapes are set to fit
				} else {
					options.fit_portrait && ratio > 1 ? resizeHeight() : resizeWidth();		//If portraits are set to fit
				}
				
			}
			
			//End Image Resize
			
			
			//Resize Functions
			function resizeWidth(minimum){
				if (minimum){	//If minimum height needs to be considered
					if(thisSlide.width() < browserwidth || thisSlide.width() < options.min_width ){
						if (thisSlide.width() * ratio >= options.min_height){
							thisSlide.width(options.min_width);
				    		thisSlide.height(thisSlide.width() * ratio);
				    	}else{
				    		resizeHeight();
				    	}
				    }
				}else{
					if (options.min_height >= browserheight && !options.fit_landscape){	//If minimum height needs to be considered
						if (browserwidth * ratio >= options.min_height || (browserwidth * ratio >= options.min_height && ratio <= 1)){	//If resizing would push below minimum height or image is a landscape
							thisSlide.width(browserwidth);
							thisSlide.height(browserwidth * ratio);
						} else if (ratio > 1){		//Else the image is portrait
							thisSlide.height(options.min_height);
							thisSlide.width(thisSlide.height() / ratio);
						} else if (thisSlide.width() < browserwidth) {
							thisSlide.width(browserwidth);
				    		thisSlide.height(thisSlide.width() * ratio);
						}
					}else{	//Otherwise, resize as normal
						thisSlide.width(browserwidth);
						thisSlide.height(browserwidth * ratio);
					}
				}
			};
			
			function resizeHeight(minimum){
				if (minimum){	//If minimum height needs to be considered
					if(thisSlide.height() < browserheight){
						if (thisSlide.height() / ratio >= options.min_width){
							thisSlide.height(options.min_height);
							thisSlide.width(thisSlide.height() / ratio);
						}else{
							resizeWidth(true);
						}
					}
				}else{	//Otherwise, resized as normal
					if (options.min_width >= browserwidth){	//If minimum width needs to be considered
						if (browserheight / ratio >= options.min_width || ratio > 1){	//If resizing would push below minimum width or image is a portrait
							thisSlide.height(browserheight);
							thisSlide.width(browserheight / ratio);
						} else if (ratio <= 1){		//Else the image is landscape
							thisSlide.width(options.min_width);
				    		thisSlide.height(thisSlide.width() * ratio);
						}
					}else{	//Otherwise, resize as normal
						thisSlide.height(browserheight);
						thisSlide.width(browserheight / ratio);
					}
				}
			};
			
			//End Resize Functions
			
			
			//Horizontally Center
			if (options.horizontal_center){
				$(this).css('left', (browserwidth - $(this).width())/2);
			}
			
			//Vertically Center
			if (options.vertical_center){
				$(this).css('top', (browserheight - $(this).height())/2);
			}
		});
		*/
	}
	
	
	function refreshIScroller()
	{
		if(isiPad)
		{
			 if(formIScroll != undefined)
			 {
				 formIScroll.refresh();
			 }
			 
			 if(articleScroller != undefined)
			 {
				 articleScroller.refresh();
			 }
			 
			 if(divebaseScroller != undefined)
			 {
				 divebaseScroller.refresh();
			 }
			 
			 if(aboScroller != undefined)
			 {
				 aboScroller.refresh();
			 }
			 
			 if(archiveScroller != undefined)
			 {
				 archiveScroller.refresh();
			 }
			 
			 if(searchScroller != undefined)
			 {
				 searchScroller.refresh();
			 }
			 
			 if(unfilteredScroller != undefined)
			 {
				 unfilteredScroller.refresh();
			 }
		}
	}
	
	
	function resizeHeader() {
		// otherwise the header is over the scrollbar because of the fullsize background-images (the overflow is set to auto in html and body) 
		$('header .section').css('width', parseInt($('header').css('width')));
	}
	
	function isSearchActive()
	{
		$('#showSearch').trigger('click');
	}
	
	function addThisReadyHandler (evt)
	{
		var pos = $('#article-buttons').offset();
		var newY = (pos.top);
		$('#at15s').attr('style', 'top: ' + newY + 'px !important;');
	}
	
	function eventHandler(evt) 
	{ 
		switch (evt.type) 
		{			        
			case "addthis.menu.open":
				$('#at15s').hide();
				var pos = $('#article-buttons').offset();
//				innerHeight kann nicht berechnet werden, wenn Element nicht sichtbar ist
//				var newY = (pos.top - $('#at15s_inner').height());
				var newY = (pos.top - 200);
				$('#at15s').attr('style', 'top: ' + newY + 'px !important; left: ' + (pos.left + 200) + 'px !important; z-index: 1000;');
				break;
				
			default:
				console.log("received an unexpected event", evt);
		}
	}
	
	function startSlideshow()
	{
		// hide slideshow while developing 
		if(numberOfSlides > 1)
		{
		}
		else if(numberOfSlides == 1)
		{
			if($('video').length > 0)
				startVideo($('video').attr('id'));
		}
	}
	
	function initializeArticleCarousel()
	{
		if(! articleCarouselInit && !isiPad)
		{
			// Sliding through the articles
			var articles = $('.view-article .item-list li');
			
			// number of blocks is changed dynamically in the window.resize-function in jcarousellite_1.0.1.min.js!
			// 120 = space left and right for the arrows
			var numBlocks = Math.floor( ($(window).width() - 120 + parseInt($('.view-article .item-list li').css('margin-right')))/($('.view-article .item-list li').outerWidth() + parseInt($('.view-article .item-list li').css('margin-right'))) );
			
			// don't initialize if the parent element is set to invisible! otherwise the carousel widths aren't set correctly! (e.g. article detail - click on "Artikelübersicht")
			if(articles.length >= numBlocks && $(".view-article").parent().parent().css('display') == 'block')
			{
				articleCarouselInit = true;
				
				$(".view-article .next, .view-article .prev").show();
				
			    $(".view-article .item-list").jCarouselLite({
			        btnNext: ".next",
			        btnPrev: ".prev",
			        visible: numBlocks,
			        circular: false,
			        listClass: '.view-article'
			    });
			}
		}
		else if(isiPad && $('#filterscroller').length > 0 && $('#filter').css('display') == "block")
		{
			var elemWidth = $('#filterscroller li').outerWidth() + parseInt($('#filterscroller li').css('margin-right'));
			$('#filterscroller').css('width', ($('#filterscroller li').length * elemWidth) + 'px');
			new iScroll('filterscroller');
		}
	}
	
	
	function initializeIssueCarousel()
	{
		if(! issueCarouselInit && ! isiPad)
		{
			// Sliding through the issues if there are more than 4
			var issues = $('.view-archive-issue .item-list li');
			
			// number of blocks is changed dynamically in the window.resize-function in jcarousellite_1.0.1.min.js!
			// 120 = space left and right for the arrows
			var numBlocks = Math.floor( ($(window).width() - 120 + parseInt($('.view-archive-issue .item-list li').css('margin-right')))/($('.view-archive-issue .item-list li').outerWidth() + parseInt($('.view-archive-issue .item-list li').css('margin-right'))) );
			
			// don't initialize if the parent element is set to invisible! otherwise the carousel widths aren't set correctly! (e.g. article detail - click on "Artikelübersicht")
			if(issues.length >= numBlocks && $(".view-archive-issue").parent().parent().css('display') == 'block')
			{
				issueCarouselInit = true;
				
				$(".view-archive-issue .next, .view-archive-issue .prev").show();
				
				$(".view-archive-issue .item-list").jCarouselLite({
					btnNext: ".next",
					btnPrev: ".prev",
					visible: numBlocks,
					circular: false,
					listClass: '.view-archive-issue'
				});
			}
		}
		else if(isiPad && $('#archive').length > 0)
		{
			var elemWidth = $('#archive li').outerWidth() + parseInt($('#archive li').css('margin-right'));
			$('#archive-scroller').css('width', ($('#archive-scroller li').length * elemWidth) + 'px');
			archiveScroller = new iScroll('archive-scroller');
		}
	}
	
	
	function initializeProductCarousel()
	{
		if(! productCarouselInit && ! isiPad)
		{
			// Sliding through the products if there are more than 4
			var product = $('.view-product .item-list li');
			
			// number of blocks is changed dynamically in the window.resize-function in jcarousellite_1.0.1.min.js!
			// 120 = space left and right for the arrows
			var numBlocks = Math.floor( ($(window).width() - 120 + parseInt($('.view-product .item-list li').css('margin-right')))/($('.view-product .item-list li').outerWidth() + parseInt($('.view-product .item-list li').css('margin-right'))) );
			
			// don't initialize if the parent element is set to invisible! otherwise the carousel widths aren't set correctly! (e.g. product detail - click on "Produktübersicht")
			if(product.length > numBlocks && $(".view-product").parent().parent().css('display') == 'block')
			{
				productCarouselInit = true;
				
				$(".view-product .next, .view-product .prev").show();
				
				$(".view-product .item-list").jCarouselLite({
					btnNext: ".next",
					btnPrev: ".prev",
					visible: numBlocks,
					circular: false,
					listClass: '.view-product'
				});
			}
		}
		else if(isiPad && $('#articlefilter').length > 0 && !$('body').hasClass('front'))
		{
			var elemWidth = $('#articlefilter li').outerWidth() + parseInt($('#articlefilter li').css('margin-right'));
			$('#filterscroller').css('width', ($('#filterscroller li').length * elemWidth) + 'px');
			new iScroll('filterscroller');
		}
		else if(isiPad && $('#productscroller').length > 0 && $('#filter').css('display') == "block")
		{
			var elemWidth = $('#productscroller li').outerWidth() + parseInt($('#productscroller li').css('margin-right'));
			$('#productscroller').css('width', ($('#productscroller li').length * elemWidth) + 'px');
			new iScroll('productscroller');
		}
	}
	
	function initializeDivebaseCarousel() {
		var dbPhotos = $('#dbCarousel .items li');
		if(dbPhotos.length > 1 && ! isiPad)
		{
			if(! divebaseCarouselInit)
			{
				$("#dbCarousel .items").jCarouselLite({
					btnNext: ".next",
					btnPrev: ".prev",
					adaptWidth: false,
					circular: true,
					visible: 1
				});
				
				divebaseCarouselInit = true;
			}
			
			$("#dbCarousel .next, #dbCarousel .prev").show();
		}
	}
	
	
	function initializePersonCarousel() {
		var dbPhotos = $('#personCarousel .items li');
		if(dbPhotos.length > 1 && ! isiPad)
		{
			if(! personCarouselInit)
			{
				$("#personCarousel .items").jCarouselLite({
					btnNext: ".next",
					btnPrev: ".prev",
					adaptWidth: false,
					circular: true,
					visible: 1
				});
				
				personCarouselInit = true;
			}
			
			$("#personCarousel .next, #personCarousel .prev").show();
		}
	}
	
	function initializeOperatorCarousel() {
		var dbPhotos = $('#opCarousel .items li');
		if(dbPhotos.length > 1 && ! isiPad)
		{
			if(! opCarouselInit)
			{
				$("#opCarousel .items").jCarouselLite({
					btnNext: ".next",
					btnPrev: ".prev",
					adaptWidth: false,
					circular: true,
					visible: 1
				});
				
				opCarouselInit = true;
			}
			
			$("#opCarousel .next, #opCarousel .prev").show();
		}
	}
	
	
	function updateOperators()
	{
		
		var oldOpPosition = currentOpPosition;
		
		if(currentOpPosition == numberOfOperators-1)
		{
			currentOpPosition = 0;
		}
		else
		{
			currentOpPosition++;
		}
		
		$('.view-operator .item-list ul').children('li:eq(' + currentOpPosition +')').show();
		$('.view-operator .item-list ul').children('li:eq(' + oldOpPosition +')').hide();
		/*
		$('.view-operator .item-list ul').children('.li:eq(' + currentOpPosition +')').css('z-index', '2');
		$('.view-operator .item-list ul').children('.li:eq(' + currentOpPosition +')').fadeIn(800, function() {
			$('.view-operator .item-list ul').children('.li:eq(' + oldOpPosition +')').hide();
		});
		*/
	}

})(jQuery);



// start the html5 video
function startVideo(videoId)
{
	try
	{
		document.getElementById(videoId).play();
	}
	catch(e)
	{}
}


//select the bonus for the abonnement
function chooseBonus(bonus)
{
	if(document.getElementById('bonusField') != null)
		document.getElementById('bonusField').value = bonus;
}

function BlockMove(event) { 
    event.preventDefault() ; 
}


// mit dem prevent default funktioniert nach einem iScroll kein Klick mehr
//document.addEventListener('touchmove', function(e){ e.preventDefault(); }, false);



;
(function ($) {
	$(document).ready(function(){
		
		var isiPad = navigator.userAgent.match(/iPad/i) != null;
		var t;
		
		if(isiPad)
		{
			window.onorientationchange = detectIPadOrientation;
			
			$('#personCarouselIpad ul, #opCarouselIpad ul, #dbCarouselIpad ul').cycle({ 
			    fx:    'fade', 
			    pause:  1 
			});
			
			$('#block-system-main-menu #menu-travel, #block-system-main-menu #menu-people, #block-system-main-menu #menu-project, #block-system-main-menu #menu-product, #block-system-main-menu #menu-service').hover(
					function() {
						$('#ajaxFilter .wrapper div, #ajaxFilter .headline h2').remove();
						$('#ajaxFilter').show();
						window.clearTimeout(t);
						setTimer();
					},
					function() {
					}
			);
			
			detectIPadOrientation();
		}
		
		function detectIPadOrientation () 
	    {
	        if ( orientation == 0 || orientation == 180) 
	        {
	            $('#page').hide();
	            $('#ipadPortrait').show();
	        }
	        else
	        {
	        	$('#page').show();
	        	$('#ipadPortrait').hide();
	        }
	    }
		
		function setTimer()
		{
			t = window.setTimeout(hideMenuLayer, 7000);
		}
		
		function hideMenuLayer()
		{ 
			$('#block-system-main-menu #menu-travel, #block-system-main-menu #menu-people, #block-system-main-menu #menu-project, #block-system-main-menu #menu-product, #block-system-main-menu #menu-service').removeClass('active');
			
			$('.region-filter .block-views, .region-filter .block-block, .region-filter .block-menu').hide();
			
			$('#ajaxFilter').hide();
			$('#block-system-main-menu li').removeClass('active');
		};
	});
})(jQuery);;

