/*
* Usage:
* This plugin extends jQuery by adding itself as a static method.
* $.Storage - is the class name, which represents the user's data store, whether it's cookies or local storage.
*             <code>if ($.Storage)</code> will tell you if the plugin is loaded.
* $.Storage.set("name", "value") - Stores a named value in the data store.
* $.Storage.set({"name1":"value1", "name2":"value2", etc}) - Stores multiple name/value pairs in the data store.
* $.Storage.get("name") - Retrieves the value of the given name from the data store.
* $.Storage.remove("name") - Permanently deletes the name/value pair from the data store.
*/

(function ($) {
    // Private data
    var isLS = typeof window.localStorage !== 'undefined';
    // Private functions
    function wls(n, v) { var c; if (typeof n === "string" && typeof v === "string") { localStorage[n] = v; return true; } else if (typeof n === "object" && typeof v === "undefined") { for (c in n) { if (n.hasOwnProperty(c)) { localStorage[c] = n[c]; } } return true; } return false; }
    function wc(n, v) { var dt, e, c; dt = new Date(); dt.setTime(dt.getTime() + 31536000000); e = "; expires=" + dt.toGMTString(); if (typeof n === "string" && typeof v === "string") { document.cookie = n + "=" + v + e + "; path=/"; return true; } else if (typeof n === "object" && typeof v === "undefined") { for (c in n) { if (n.hasOwnProperty(c)) { document.cookie = c + "=" + n[c] + e + "; path=/"; } } return true; } return false; }
    function rls(n) { return localStorage[n]; }
    function rc(n) { var nn, ca, i, c; nn = n + "="; ca = document.cookie.split(';'); for (i = 0; i < ca.length; i++) { c = ca[i]; while (c.charAt(0) === ' ') { c = c.substring(1, c.length); } if (c.indexOf(nn) === 0) { return c.substring(nn.length, c.length); } } return null; }
    function dls(n) { return delete localStorage[n]; }
    function dc(n) { return wc(n, "", -1); }

    /**
    * Public API
    * $.Storage - Represents the user's data store, whether it's cookies or local storage.
    * $.Storage.set("name", "value") - Stores a named value in the data store.
    * $.Storage.set({"name1":"value1", "name2":"value2", etc}) - Stores multiple name/value pairs in the data store.
    * $.Storage.get("name") - Retrieves the value of the given name from the data store.
    * $.Storage.remove("name") - Permanently deletes the name/value pair from the data store.
    */
    $.extend({
        Storage: {
            set: isLS ? wls : wc,
            get: isLS ? rls : rc,
            remove: isLS ? dls : dc
        }
    });
})(jQuery);


/* SimpleSli.de */

function simpleSlide(e) {
    jQuery(function ($) {
        var b = { 'status_width': 20, 'status_height': 20, 'status_color_inside': '#fff', 'status_color_outside': '#aaa', 'set_speed': 500, 'fullscreen': 'false', 'swipe': 'false', 'callback': 'function()' }; $.extend(b, e); $.ss_options = b; $('.simpleSlide-slide').css('opacity', '0'); $('.simpleSlide-tray').css('margin', '0'); $('.simpleSlide-window').prepend('<span id="ssLoading" style="color: #808080;font-family:Helvetica, Arial, sans-serif;font-size: 12px; margin: 10px 0 0 10px;display: block">Loading slides...</span>');

        var $first_slide = $('.simpleSlide-slide:first-child').clone();
        $first_slide.children('article').remove();
        $first_slide.appendTo('.simpleSlide-tray');

        var c = $('.simpleSlide-slide img').size(); if (c > 0) { var d = new Array(); var i = 0; $('.simpleSlide-slide img').each(function () { d[i] = $(this).attr('src'); i++ }); i = 0; $(d).each(function () { var a = new Image(); a.src = d[i]; if (a.complete) { c--; i++; if (c == 0) { ssInit() } } else { $(a).load(function () { c--; i++; if (c == 0) { ssInit() } }) } }) } else { ssInit() } 
    }) }; 
function ssInit() { jQuery(function ($) { $('.simpleSlide-window').each(function () { if ($.ss_options.fullscreen == 'true') { $('body').css('overflow', 'hidden') } var a = $(this).html(); var b = removeWhiteSpace(a); $(this).html(b); var c = $(this).find('.simpleSlide-slide').size(); $(this).find('.simpleSlide-slide').css('display', 'block'); var d = $(this).find('.simpleSlide-slide').first().outerHeight(); if ($.ss_options.fullscreen == 'true') { fullScreen(this) }; $(this).find('.simpleSlide-slide').css({ 'display': 'inline', 'float': 'left' }); var e = $(this).find('.simpleSlide-slide').first().outerWidth(); var f = $(this).attr('rel'); if ($.ss_options.fullscreen == 'false') { $(this).css({ 'height': d, 'width': e, 'position': 'relative' }) }; $(this).css('overflow', 'hidden'); setTraySize(this, c, e); setSimpleSlideStatus(f, d, e, c); setPaging(this); $(this).find('#ssLoading').remove(); if ($.ss_options.swipe == 'true' && !$.browser.msie) { simpleSwipe(this) }; $(this).find('.simpleSlide-slide').animate({ 'opacity': '1' }, 300, "swing") }); if (typeof ($.ss_options.callback) == 'function') { $.ss_options.callback.call(this) }; 
function setPaging(a) { var b = 1; $(a).find('.simpleSlide-slide').each(function () { $(this).attr('alt', b); b++ }) }; 
function fullScreen(a) { var b = new Image(); b.src = $(a).find('img').first().attr('src'); var c = $(window).width() / $(window).height(); var d = b.width / b.height; var e = $(window).height(); var f = $(window).width(); if (c > d) { var g = (f / b.width) * b.height; var h = (g - e) / 2; $(a).find('img').attr('width', f).attr('height', g).css('marginLeft', 0); $(a).css({ 'marginLeft': 0, 'marginTop': '-' + h + 'px', 'height': e + h }); $(a).find('.simpleSlide-slide').css({ 'width': f, 'height': g, 'overflow': 'hidden' }) } else { var i = (e / b.height) * b.width; var j = (i - f) / 2; $(a).find('img').attr('height', e).attr('width', i); $(a).find('img').css({ 'marginLeft': '-' + j + 'px' }); $(a).find('.simpleSlide-slide').css({ 'width': f, 'height': e, 'overflow': 'hidden' }); $(a).css({ 'marginTop': 0, 'height': e }) }; $(a).find('.simpleSlide-tray').css('marginLeft', 0) }; 
function setTraySize(a, b, c) { var d = b * c; $(a).find('.simpleSlide-tray').css({ 'width': d + 'px' }); $(a).find('.simpleSlide-slide').css('display', 'inline-block') }; 
function setSimpleSlideStatus(a, b, c, d) { var e = $.ss_options.status_width / c; var f = e * b; $('.status-tray[rel="' + a + '"]').css({ 'overflow': 'hidden', 'width': $.ss_options.status_width * (d - 1)/*Change -1*/, 'height': $.ss_options.status_height, 'background-color': $.ss_options.status_color_outside, 'overflow:': 'hidden' }); $('.status-window[rel="' + a + '"]').css({ 'width': $.ss_options.status_width, 'height': $.ss_options.status_height, 'background-color': $.ss_options.status_color_inside }); if (jQuery.support.opacity) { $('.status-window .status-tray[rel="' + a + '"]').css({ 'opacity': '.5', 'background-color': $.ss_options.status_color_inside }) }; if (!jQuery.support.opacity) { $('.status-window .status-tray[rel="' + a + '"]').css({ 'filter': 'alpha(opacity=50)', 'background-color': $.ss_options.status_color_inside }) } }; $('.left-button, .right-button, .jump-to').live('click', function () { var a = $(this).attr('rel'); if (!$('div.simpleSlide-tray[rel="' + a + '"]').is(':animated')) { simpleSlideAction(this, a) } }) }) }; 
function simpleSwipe(f) { var g = { threshold: { x: $(f).width() * .15, y: $(f).height() * .1 }, swipeLeft: function () { simpleSlideAction('.right-button', $(f).attr('rel')) }, swipeRight: function () { simpleSlideAction('.left-button', $(f).attr('rel')) }, preventDefaultEvents: true }; var h = $.extend(g, h); if (!f) return false; return $(f).each(function () { var c = $(f); var d = { x: 0, y: 0 }; var e = { x: 0, y: 0 }; 
function touchStart(a) { d.x = a.targetTouches[0].pageX; d.y = a.targetTouches[0].pageY }; 
function touchMove(a) { if (g.preventDefaultEvents) { a.preventDefault() }; e.x = a.targetTouches[0].pageX; e.y = a.targetTouches[0].pageY }; 
function touchEnd(a) { var b = d.y - e.y; if (b < g.threshold.y && b > (g.threshold.y * -1)) { changeX = d.x - e.x; if (changeX > g.threshold.x) { g.swipeLeft() }; if (changeX < (g.threshold.x * -1)) { g.swipeRight() } } }; 
function touchCancel(a) { console.log('Cancelling swipe gesture...') }; f.addEventListener("touchstart", touchStart, false); f.addEventListener("touchmove", touchMove, false); f.addEventListener("touchend", touchEnd, false); f.addEventListener("touchcancel", touchCancel, false) }) }; 

function simpleSlideAction(p, q) {
    jQuery(function ($) {
        var d = $.ss_options.set_speed; var e = $('.simpleSlide-window[rel="' + q + '"]').find('.simpleSlide-slide').size(); var f = $('.simpleSlide-window[rel="' + q + '"]').innerWidth(); var g = $('.status-window[rel="' + q + '"]').innerWidth(); var h = g * e; var i = parseInt($('.simpleSlide-tray[rel="' + q + '"]').css('marginLeft'), 10); var j = parseInt($('.status-tray .status-window[rel="' + q + '"]').css('marginLeft'), 10); var k = parseInt($('.status-window .status-tray[rel="' + q + '"]').css('marginLeft'), 10); if ($(p).is('.jump-to')) { var l = $(p).attr('alt'); var m = (l - 1) * (f * (-1)); var n = (l - 1) * (g * (-1)); var o = (l - 1) * (g); move(m, o, n) };

        if ($(p).is('.left-button')) {
            if (i == 0) { var m = i - ((e - 2) * f); var n = k - ((e - 2) * g); var o = j + ((e - 2) * g) }
            else { var m = i + f; var n = k + g; var o = j - g }; move(m, o, n)
        };
        if ($(p).is('.right-button')) {
            if (i == (e - 1) * (f * -1)) {
                d = 1; /*slide transition speed altered for rewind*/
                var m = 0;
                var n = 0;
                var o = 0
            } else {
                d = 900; /*slide transition speed reset*/
                var m = i - f; var n = k - g; var o = j + g
            }; move(m, o, n)
        };
        function move(a, b, c) {
            $('.simpleSlide-tray[rel="' + q + '"]').animate({ 'marginLeft': a }, d, "swing");
            $('.status-window .status-tray[rel="' + q + '"]').animate({ 'marginLeft': c }, d, "swing"); 
            $('.status-tray .status-window[rel="' + q + '"]').animate({ 'marginLeft': b }, d, "swing")

            if (a == (e - 1) * (f * -1)) {
                $('.simpleSlide-tray[rel="' + q + '"]').animate({ 'marginLeft': 0 }, 0, "swing");
                $('.status-tray .status-window[rel="' + q + '"]').animate({ 'marginLeft': 0 }, 0, "swing")
            }
        } 
    })}; 
function removeWhiteSpace(a) { var b = a.replace(/[\r+\n+\t+]\s\s+/g, ""); return b };

