View file PF.Base/module/core/static/jscript/masterslider.min.js

File size: 227.47Kb
//dev\slider\header.js

/*!
 * Master Slider – Responsive Touch Swipe Slider
 * @author Averta (www.averta.net)
 * Copyright © All Rights Reserved, Averta Ltd.
 *
 * @version 1.7.2
 * @date July 2014
 */
//dev\slider\tools\base.js

window.averta = {};

var _debug  = true;

;(function($){

    //"use strict";

    window.package = function(name){
        if(!window[name]) window[name] = {};
    };

    var extend = function(target , object){
        for(var key in object)	target[key] = object[key];
    };

    Function.prototype.extend = function(superclass){
        if(typeof superclass.prototype.constructor === "function"){
            extend(this.prototype , superclass.prototype);
            this.prototype.constructor = this;
        }else{
            this.prototype.extend(superclass);
            this.prototype.constructor = this;
        }
    };

    // Converts JS prefix to CSS prefix
    var trans = {
        'Moz'    : '-moz-',
        'Webkit' : '-webkit-',
        'Khtml'  : '-khtml-' ,
        'O'		 : '-o-',
        'ms'	 : '-ms-',
        'Icab'   : '-icab-'
    };

    $(document).ready(function(){
        window._jcsspfx 		= getVendorPrefix();	   // JS CSS VendorPrefix
        window._csspfx 			= trans[window._jcsspfx];  // CSS VendorPrefix
        window._cssanim 		= supportsTransitions();
        window._css3d   		= supports3DTransforms();
        window._css2d   		= supportsTransforms();
        window._mobile			= /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
        window._touch			= 'ontouchstart' in document;
    });


    // Thanks to LEA VEROU
    // http://lea.verou.me/2009/02/find-the-vendor-prefix-of-the-current-browser/
    function getVendorPrefix() {

        if('result' in arguments.callee) return arguments.callee.result;

        var regex = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/;

        var someScript = document.getElementsByTagName('script')[0];

        for(var prop in someScript.style)
            if(regex.test(prop))
                return arguments.callee.result = prop.match(regex)[0];

        if('WebkitOpacity' in someScript.style) return arguments.callee.result = 'Webkit';
        if('KhtmlOpacity' in someScript.style) return arguments.callee.result = 'Khtml';

        return arguments.callee.result = '';
    }


    // Thanks to Steven Benner.
    // http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
    window.parseQueryString = function(url){
        var queryString = {};
        url.replace(
            new RegExp("([^?=&]+)(=([^&]*))?", "g"),
            function($0, $1, $2, $3) { queryString[$1] = $3; }
        );

        return queryString;
    };

    function checkStyleValue(prop){
        var b = document.body || document.documentElement;
        var s = b.style;
        var p = prop;
        if(typeof s[p] == 'string') {return true; }

        // Tests for vendor specific prop
        v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'],
            p = p.charAt(0).toUpperCase() + p.substr(1);
        for(var i=0; i<v.length; i++) {
            if(typeof s[v[i] + p] == 'string') { return true; }
        }
        return false;
    }

    function supportsTransitions() {
        return checkStyleValue('transition');
    }

    function supportsTransforms(){
        return checkStyleValue('transform');
    }

    function supports3DTransforms(){
        if(!supportsTransforms()) return false;
        var el = document.createElement('i'),
            has3d,
            transforms = {
                'WebkitTransform':'-webkit-transform',
                'OTransform':'-o-transform',
                'MSTransform':'-ms-transform',
                'msTransform':'-ms-transform',
                'MozTransform':'-moz-transform',
                'Transform':'transform',
                'transform':'transform'
            };

        el.style.display = 'block';

        // Add it to the body to get the computed style
        document.body.insertBefore(el, null);

        for(var t in transforms){
            if( el.style[t] !== undefined ){
                el.style[t] = 'translate3d(1px,1px,1px)';
                has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
            }
        }

        document.body.removeChild(el);

        return (has3d != null && has3d.length > 0 && has3d !== "none");
    }

    /**
     * Provides requestAnimationFrame in a cross browser way.
     * @author paulirish / http://paulirish.com/
     */
    var fps60 = 50/3;

    if ( !window.requestAnimationFrame ) {

        window.requestAnimationFrame = ( function() {

            return window.webkitRequestAnimationFrame ||
                window.mozRequestAnimationFrame ||
                window.oRequestAnimationFrame ||
                window.msRequestAnimationFrame ||
                function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element ) {

                    window.setTimeout( callback, fps60 );

                };

        } )();

    }

    if (!window.getComputedStyle) {
        window.getComputedStyle = function(el, pseudo) {
            this.el = el;
            this.getPropertyValue = function(prop) {
                var re = /(\-([a-z]){1})/g;
                if (prop == 'float') prop = 'styleFloat';
                if (re.test(prop)) {
                    prop = prop.replace(re, function () {
                        return arguments[2].toUpperCase();
                    });
                }
                return el.currentStyle[prop] ? el.currentStyle[prop] : null;
            };
            return el.currentStyle;
        };
    }

    // IE8 Array indexOf fix
    if (!Array.prototype.indexOf) {
        Array.prototype.indexOf = function(elt /*, from*/) {
            var len = this.length >>> 0;

            var from = Number(arguments[1]) || 0;
            from = (from < 0)
                ? Math.ceil(from)
                : Math.floor(from);
            if (from < 0)
                from += len;

            for (; from < len; from++)
            {
                if (from in this &&
                    this[from] === elt)
                    return from;
            }
            return -1;
        };
    }

    if(jQuery){
        $.jqLoadFix = function(){
            if(this.complete){
                var that = this;
                setTimeout(function(){$(that).load();} , 1);
            }
        };

        jQuery.uaMatch = jQuery.uaMatch || function( ua ) {
                ua = ua.toLowerCase();

                var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
                    /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
                    /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
                    /(msie) ([\w.]+)/.exec( ua ) ||
                    ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
                    [];

                return {
                    browser: match[ 1 ] || "",
                    version: match[ 2 ] || "0"
                };
            };

        // Don't clobber any existing jQuery.browser in case it's different
        //if ( !jQuery.browser ) {
        matched = jQuery.uaMatch( navigator.userAgent );
        browser = {};

        if ( matched.browser ) {
            browser[ matched.browser ] = true;
            browser.version = matched.version;
        }

        // Chrome is Webkit, but Webkit is also Safari.
        if ( browser.chrome ) {
            browser.webkit = true;
        } else if ( browser.webkit ) {
            browser.safari = true;
        }

        // hofix for IE11 detection
        var isIE11 = !!navigator.userAgent.match(/Trident\/7\./);
        if (isIE11) {
            browser.msie = "true";
            delete browser.mozilla;
        }

        jQuery.browser = browser;

        //}

        $.fn.preloadImg = function(src , _event){
            this.each(function(){
                var $this = $(this);
                var self  = this;
                var img = new Image();
                img.onload = function(event){
                    if(event == null) event = {}; // IE8
                    $this.attr('src' , src);
                    event.width = img.width;
                    event.height = img.height;
                    setTimeout(function(){_event.call(self , event);},50);
                    img = null;
                };
                img.src = src;
            });
            return this;
        };
    }
})(jQuery);
//dev\slider\tools\EventDispatcher.js

;(function(){

    "use strict";

    averta.EventDispatcher = function(){
        this.listeners = {};
    };

    averta.EventDispatcher.extend = function(_proto){
        var instance = new averta.EventDispatcher();
        for(var key in instance)
            if(key != 'constructor') _proto[key] =  averta.EventDispatcher.prototype[key];
    };

    averta.EventDispatcher.prototype = {

        constructor : averta.EventDispatcher,

        addEventListener : function(event , listener , ref){
            if(!this.listeners[event]) this.listeners[event] = [];
            this.listeners[event].push({listener:listener , ref:ref});

        },

        removeEventListener : function(event , listener , ref){
            if(this.listeners[event]){
                for(var i = 0 , l = this.listeners[event].length; i < l ; ++i)
                    if(listener == this.listeners[event][i].listener && ref == this.listeners[event][i].ref){
                        this.listeners[event].splice(i,0);
                    }

                if (this.listeners[event].length == 0)
                    delete this.listeners[event];
            }
        },

        dispatchEvent : function (event) {
            event.target = this;
            if(this.listeners[event.type])
                for(var i = 0 , l = this.listeners[event.type].length; i < l ; ++i){
                    this.listeners[event.type][i].listener.call(this.listeners[event.type][i].ref , event);
                }
        }
    };

})();
//dev\slider\tools\TouchSwipe.js

;(function($){

    "use strict";

    var isTouch 	= 'ontouchstart' in document,
        isPointer 	= window.navigator.pointerEnabled,
        isMSPoiner 	= !isPointer && window.navigator.msPointerEnabled,
        usePointer  = isPointer || isMSPoiner,
    // Events
        ev_start  = (isPointer ? 'pointerdown ' : '' ) + (isMSPoiner ? 'MSPointerDown ' : '' ) + (isTouch ? 'touchstart ' : '' ) + 'mousedown',
        ev_move   = (isPointer ? 'pointermove ' : '' ) + (isMSPoiner ? 'MSPointerMove ' : '' ) + (isTouch ? 'touchmove '  : '' ) + 'mousemove',
        ev_end    = (isPointer ? 'pointerup '   : '' ) + (isMSPoiner ? 'MSPointerUp '   : '' ) + (isTouch ? 'touchend '   : '' ) + 'mouseup',
        ev_cancel = (isPointer ? 'pointercancel '   : '' ) + (isMSPoiner ? 'MSPointerCancel ': '' ) + 'touchcancel';


    averta.TouchSwipe = function($element){
        this.$element = $element;
        this.enabled = true;

        $element.bind(ev_start  , {target: this} , this.__touchStart);

        $element[0].swipe = this;

        this.onSwipe    = null;
        this.swipeType  = 'horizontal';

        this.lastStatus = {};

    };

    var p = averta.TouchSwipe.prototype;

    /*-------------- METHODS --------------*/

    p.getDirection = function(new_x , new_y){
        switch(this.swipeType){
            case 'horizontal':
                return new_x <= this.start_x ? 'left' : 'right';
                break;
            case 'vertical':
                return new_y <= this.start_y ? 'up' : 'down';
                break;
            case 'all':
                if(Math.abs(new_x - this.start_x) > Math.abs(new_y - this.start_y))
                    return new_x <= this.start_x ? 'left' : 'right';
                else
                    return new_y <= this.start_y ? 'up' : 'down';
                break;
        }
    };

    p.priventDefultEvent = function(new_x , new_y){
        //if(this.priventEvt != null) return this.priventEvt;
        var dx = Math.abs(new_x - this.start_x);
        var dy = Math.abs(new_y - this.start_y);

        var horiz =  dx > dy;

        return (this.swipeType === 'horizontal' && horiz) ||
            (this.swipeType === 'vertical' && !horiz);

        //return this.priventEvt;
    };

    p.createStatusObject = function(evt){
        var status_data = {} , temp_x , temp_y;

        temp_x = this.lastStatus.distanceX || 0;
        temp_y = this.lastStatus.distanceY || 0;

        status_data.distanceX = evt.pageX - this.start_x;
        status_data.distanceY = evt.pageY - this.start_y;
        status_data.moveX = status_data.distanceX - temp_x;
        status_data.moveY = status_data.distanceY - temp_y;

        status_data.distance  = parseInt( Math.sqrt(Math.pow(status_data.distanceX , 2) + Math.pow(status_data.distanceY , 2)) );

        status_data.duration  = new Date().getTime() - this.start_time;
        status_data.direction = this.getDirection(evt.pageX , evt.pageY);

        return status_data;
    };


    p.__reset = function(event , jqevt){
        this.reset = false;
        this.lastStatus = {};
        this.start_time = new Date().getTime();
        this.start_x = isTouch ? event.touches[0].pageX : (usePointer ? event.pageX : jqevt.pageX);
        this.start_y = isTouch ? event.touches[0].pageY : (usePointer ? event.pageY : jqevt.pageY);
    };

    p.__touchStart = function(event){

        var swipe = event.data.target;
        var jqevt = event;
        if(!swipe.enabled) return;
        event = event.originalEvent;

        if( usePointer ) {
            $(this).css('-ms-touch-action', swipe.swipeType === 'horizontal' ? 'pan-y' : 'pan-x');
        }

        if(!swipe.onSwipe) {
            $.error('Swipe listener is undefined');
            return;
        }

        if(swipe.touchStarted) return;

        swipe.start_x = isTouch ? event.touches[0].pageX : (usePointer ? event.pageX : jqevt.pageX);
        swipe.start_y = isTouch ? event.touches[0].pageY : (usePointer ? event.pageY : jqevt.pageY);

        swipe.start_time = new Date().getTime();

        $(document).bind(ev_end    , {target: swipe} , swipe.__touchEnd).
        bind(ev_move   , {target: swipe} , swipe.__touchMove).
        bind(ev_cancel , {target: swipe} , swipe.__touchCancel);

        var evt = isTouch ? event.touches[0] : (usePointer ? event : jqevt);
        var status = swipe.createStatusObject(evt);
        status.phase = 'start';

        swipe.onSwipe.call(null , status);

        if(!isTouch)
            jqevt.preventDefault();

        swipe.lastStatus = status;
        swipe.touchStarted = true;
    };

    p.__touchMove = function(event){
        var swipe = event.data.target;
        var jqevt = event;
        event = event.originalEvent;

        if(!swipe.touchStarted) return;

        clearTimeout(swipe.timo);
        swipe.timo = setTimeout(function(){swipe.__reset(event , jqevt);} , 60);

        var evt = isTouch ? event.touches[0] : (usePointer ? event : jqevt);

        var status = swipe.createStatusObject(evt);

        if(swipe.priventDefultEvent(evt.pageX , evt.pageY))
            jqevt.preventDefault();

        status.phase = 'move';

        //if(swipe.lastStatus.direction !== status.direction) swipe.__reset(event , jqevt);

        swipe.lastStatus = status;

        swipe.onSwipe.call(null , status);
    };

    p.__touchEnd = function(event){

        var swipe = event.data.target;
        var jqevt = event;
        event = event.originalEvent;

        clearTimeout(swipe.timo);

        var evt = isTouch ? event.touches[0] : (usePointer ? event : jqevt);

        var status = swipe.lastStatus;

        if(!isTouch)
            jqevt.preventDefault();

        status.phase = 'end';

        swipe.touchStarted = false;
        swipe.priventEvt   = null;

        $(document).unbind(ev_end     , swipe.__touchEnd).
        unbind(ev_move    , swipe.__touchMove).
        unbind(ev_cancel  , swipe.__touchCancel);

        status.speed = status.distance / status.duration;

        swipe.onSwipe.call(null , status);

    };

    p.__touchCancel = function(event){
        var swipe = event.data.target;
        swipe.__touchEnd(event);
    };

    p.enable = function(){
        if(this.enabled) return;
        this.enabled = true;
    };

    p.disable = function(){
        if(!this.enabled) return;
        this.enabled = false;
    };

})(jQuery);
//dev\slider\tools\Timer.js

/**
 * 	Ticker Class
 * 	Author: Averta Ltd
 */

;(function(){
    "use strict";

    averta.Ticker = function(){};

    var st = averta.Ticker,
        list = [],
        len = 0,
        __stopped = true;

    st.add = function (listener , ref){
        list.push([listener , ref]);

        if(list.length === 1) st.start();
        len = list.length;
        return len;
    };

    st.remove = function (listener , ref) {
        for(var i = 0 , l = list.length ; i<l ; ++i){
            if(list[i] && list[i][0] === listener && list[i][1] === ref){
                list.splice(i , 1);
            }
        }

        len = list.length;

        if( len === 0 ){
            st.stop();
        }
    };

    st.start = function (){
        if(!__stopped) return;
        __stopped = false;
        __tick();
    };

    st.stop = function (){
        __stopped = true;
    };

    var __tick = function () {
        if(st.__stopped) return;
        var item;
        for(var i = 0; i!==len; i++){
            item = list[i];
            item[0].call(item[1]);
        }

        requestAnimationFrame(__tick);
    };

})();

/**
 * 	Timer Class
 * 	Author: Averta Ltd
 */
;(function(){
    "use strict";

    if(!Date.now){
        Date.now = function(){
            return new Date().getTime();
        };
    }

    averta.Timer = function(delay , autoStart) {
        this.delay = delay;
        this.currentCount = 0;
        this.paused = false;
        this.onTimer = null;
        this.refrence = null;

        if(autoStart) this.start();

    };

    averta.Timer.prototype = {

        constructor : averta.Timer,

        start : function(){
            this.paused = false;
            this.lastTime = Date.now();
            averta.Ticker.add(this.update , this);
        },

        stop : function(){
            this.paused = true;
            averta.Ticker.remove(this.update , this);
        },

        reset : function(){
            this.currentCount = 0;
            this.paused = true;
            this.lastTime = Date.now();
        },

        update : function(){
            if(this.paused || Date.now() - this.lastTime < this.delay) return;
            this.currentCount ++;
            this.lastTime = Date.now();
            if(this.onTimer)
                this.onTimer.call(this.refrence , this.getTime());

        } ,

        getTime : function(){
            return this.delay * this.currentCount;
        }

    };
})();
//dev\slider\tools\CSSTweener.js

;(function(){

    "use strict";

    var evt = null;

    window.CSSTween = function(element , duration , delay , ease){

        this.$element 	= element;
        this.duration 	= duration  || 1000;
        this.delay 		= delay 	|| 0;
        this.ease 		= ease 		|| 'linear';

        /*if(!evt){
         if(window._jcsspfx === 'O')
         evt = 'otransitionend';
         else if(window._jcsspfx == 'Webkit')
         evt = 'webkitTransitionEnd';
         else
         evt = 'transitionend' ;
         }*/

    };

    var p = CSSTween.prototype;

    /*-------------- METHODS --------------*/

    p.to = function(callback , target){
        this.to_cb 			= callback;
        this.to_cb_target 	= target;

        return this;
    };

    p.from = function(callback , target ){
        this.fr_cb 			= callback;
        this.fr_cb_target 	= target;

        return this;
    };

    p.onComplete = function(callback ,target){
        this.oc_fb 			= callback;
        this.oc_fb_target 	= target;

        return this;
    };

    p.chain = function(csstween){
        this.chained_tween = csstween;
        return this;
    };

    p.reset = function(){
        //this.$element[0].removeEventListener(evt , this.onTransComplete , true);
        clearTimeout(this.start_to);
        clearTimeout(this.end_to);
    };

    p.start = function(){

        clearTimeout(this.start_to);
        clearTimeout(this.end_to);

        this.fresh = true;

        if(this.fr_cb){
            this.$element.css(window._jcsspfx + 'TransitionDuration' , '0ms');
            this.fr_cb.call(this.fr_cb_target);
        }

        var that = this;

        this.onTransComplete = function(event){

            if(!that.fresh) return;

            //that.$element[0].removeEventListener(evt , this.onTransComplete, true);
            //event.stopPropagation();

            that.reset();

            this.$element.css(window._jcsspfx + 'TransitionDuration' , '').
            css(window._jcsspfx + 'TransitionProperty' , '').
            css(window._jcsspfx + 'TransitionTimingFunction' , '').
            css(window._jcsspfx + 'TransitionDelay' , '');


            that.fresh = false;
            if(that.chained_tween) that.chained_tween.start();
            if(that.oc_fb)	that.oc_fb.call(that.oc_fb_target);

        };

        this.start_to = setTimeout(function(){

            that.$element.css(window._jcsspfx + 'TransitionDuration' , that.duration + 'ms').
            css(window._jcsspfx + 'TransitionProperty' , 'all');

            if(that.delay > 0)	that.$element.css(window._jcsspfx + 'TransitionDelay' , that.delay + 'ms');
            else				that.$element.css(window._jcsspfx + 'TransitionDelay' , '');

            that.$element.css(window._jcsspfx + 'TransitionTimingFunction' , that.ease);

            if(that.to_cb)	that.to_cb.call(that.to_cb_target);

            //that.$element[0].addEventListener(evt , that.onTransComplete , true );

            that.end_to = setTimeout(function(){that.onTransComplete();} , that.duration + (that.delay || 0));
        } , 100);

        return this;
    };

})();

/**
 *	Cross Tween Class
 */
;(function(){

    "use strict";

    var _cssanim = null;
    window.CTween = {};

    function transPos(element, properties){
        if(properties.x !== undefined || properties.y !== undefined){
            if(_cssanim){
                var trans = window._jcsspfx+"Transform";
                if(properties.x !== undefined){
                    properties[trans] = (properties[trans] || '') + ' translateX('+properties.x+'px)';
                    delete properties.x;
                }

                if(properties.y !== undefined){
                    properties[trans] = (properties[trans] || '') + ' translateY('+properties.y+'px)';
                    delete properties.y;
                }
            }else{
                if(properties.x !== undefined){
                    var posx = element.css('right') !== 'auto' ? 'right' : 'left';
                    //if(!element[0].bx) element[0].bx = parseInt(element.css(posx));
                    properties[posx] = /*element[0].bx + */properties.x + 'px';
                    delete properties.x;
                }

                if(properties.y !== undefined){
                    var posy = element.css('bottom') !== 'auto' ? 'bottom' : 'top';
                    //if(!element[0].by) element[0].by = parseInt(element.css(posy));
                    properties[posy] = /*element[0].by + */properties.y + 'px';
                    delete properties.y;
                }
            }
        }
        return properties;
    }

    CTween.setPos = function(element , pos){
        element.css(transPos(element , pos));
    };

    CTween.animate = function(element , duration , properties , options){
        if(_cssanim == null) _cssanim = window._cssanim;

        options = options || {};

        transPos(element , properties);

        if(_cssanim){
            var tween = new CSSTween(element , duration , options.delay , EaseDic[options.ease]);
            tween.to(function(){ element.css(properties);});
            if(options.complete) tween.onComplete(options.complete , options.target);
            tween.start();
            tween.stop = tween.reset;
            return tween;
        }

        var onCl;

        if(options.delay) element.delay(options.delay);
        if(options.complete)
            onCl = function(){
                options.complete.call(options.target);
            };

        element.stop(true).animate(properties , duration , options.ease || 'linear' , onCl);

        return element;
    };

    CTween.fadeOut = function(target , duration , remove) {
        var options = {};
        if(remove) options.complete = function(){target.remove();};

        CTween.animate(target , duration || 1000 , {opacity : 0} , options);
    };

    CTween.fadeIn = function(target , duration){
        target.css('opacity' , 0);
        CTween.animate(target , duration || 1000 , {opacity : 1});
    };

})();

;(function(){

    // Thanks to matthewlein
    // https://github.com/matthewlein/Ceaser

    window.EaseDic = {
        'linear'            : 'linear',
        'ease'              : 'ease',
        'easeIn'            : 'ease-in',
        'easeOut'           : 'ease-out',
        'easeInOut'         : 'ease-in-out',

        'easeInCubic'       : 'cubic-bezier(.55,.055,.675,.19)',
        'easeOutCubic'      : 'cubic-bezier(.215,.61,.355,1)',
        'easeInOutCubic'    : 'cubic-bezier(.645,.045,.355,1)',
        'easeInCirc'        : 'cubic-bezier(.6,.04,.98,.335)',
        'easeOutCirc'       : 'cubic-bezier(.075,.82,.165,1)',
        'easeInOutCirc'     : 'cubic-bezier(.785,.135,.15,.86)',
        'easeInExpo'        : 'cubic-bezier(.95,.05,.795,.035)',
        'easeOutExpo'       : 'cubic-bezier(.19,1,.22,1)',
        'easeInOutExpo'     : 'cubic-bezier(1,0,0,1)',
        'easeInQuad'        : 'cubic-bezier(.55,.085,.68,.53)',
        'easeOutQuad'       : 'cubic-bezier(.25,.46,.45,.94)',
        'easeInOutQuad'     : 'cubic-bezier(.455,.03,.515,.955)',
        'easeInQuart'       : 'cubic-bezier(.895,.03,.685,.22)',
        'easeOutQuart'      : 'cubic-bezier(.165,.84,.44,1)',
        'easeInOutQuart'    : 'cubic-bezier(.77,0,.175,1)',
        'easeInQuint'       : 'cubic-bezier(.755,.05,.855,.06)',
        'easeOutQuint'      : 'cubic-bezier(.23,1,.32,1)',
        'easeInOutQuint'    : 'cubic-bezier(.86,0,.07,1)',
        'easeInSine'        : 'cubic-bezier(.47,0,.745,.715)',
        'easeOutSine'       : 'cubic-bezier(.39,.575,.565,1)',
        'easeInOutSine'     : 'cubic-bezier(.445,.05,.55,.95)',
        'easeInBack'        : 'cubic-bezier(.6,-.28,.735,.045)',
        'easeOutBack'       : 'cubic-bezier(.175, .885,.32,1.275)',
        'easeInOutBack'     : 'cubic-bezier(.68,-.55,.265,1.55)'
    };
})();

//dev\slider\tools\Aligner.js

;(function(){

    "use strict";

    window.MSAligner = function(type , $container , $img ){

        this.$container = $container;
        this.$img	    = $img;

        this.type 		= type || 'stretch'; // fill , fit , stretch , tile , center

        this.widthOnly = false;
        this.heightOnly = false;
    };

    var p = MSAligner.prototype;

    /*-------------- METHODS --------------*/

    p.init = function(w , h){

        this.baseWidth = w;
        this.baseHeight = h;
        this.imgRatio = w / h;
        this.imgRatio2 = h / w;

        switch(this.type){
            case 'tile':
                this.$container.css('background-image' , 'url('+ this.$img.attr('src') +')');
                this.$img.remove();
                break;
            case 'center':
                this.$container.css('background-image' , 'url('+ this.$img.attr('src') +')');
                this.$container.css({
                    backgroundPosition 	: 'center center',
                    backgroundRepeat	: 'no-repeat'
                });
                this.$img.remove();
                break;
            case 'stretch':
                this.$img.css({
                    width	: 	'100%',
                    height	: 	'100%'
                });
                break;
            case 'fill':
            case 'fit' :
                this.needAlign = true;
                this.align();
                break;
        }

    };

    p.align = function(){
        if(!this.needAlign) return;

        var cont_w = this.$container.width();
        var cont_h = this.$container.height();

        var contRatio = cont_w / cont_h;

        if(this.type == 'fill'){
            if(this.imgRatio < contRatio ){
                this.$img.width(cont_w);
                this.$img.height(cont_w * this.imgRatio2);
            }else{
                this.$img.height(cont_h);
                this.$img.width(cont_h * this.imgRatio);
            }

        }else if(this.type == 'fit'){

            if(this.imgRatio < contRatio){
                this.$img.height(cont_h);
                this.$img.width(cont_h * this.imgRatio);
            }else{
                this.$img.width(cont_w);
                this.$img.height(cont_w * this.imgRatio2);
            }
        }

        this.setMargin();

    };

    p.setMargin = function(){

        var cont_w = this.$container.width();
        var cont_h = this.$container.height();

        this.$img.css('margin-top' , (cont_h - this.$img[0].offsetHeight) / 2 + 'px');
        this.$img.css('margin-left', (cont_w - this.$img[0].offsetWidth ) / 2 + 'px');
    }

})();
//dev\slider\controls\controller.js

/**
 *  Touch List Control
 * 	version 1.1.2
 *
 * 	Copyright (C) 2014, Averta Ltd. All rights reserved.
 */

;(function(){

    "use strict";

    var _options = {
        bouncing 			: true,
        snapping			: false,
        snapsize			: null,
        friction			: 0.05,
        outFriction			: 0.05,
        outAcceleration		: 0.09,
        minValidDist		: 0.3,
        snappingMinSpeed	: 2,
        paging				: false,
        endless				: false,
        maxSpeed			: 160
    };


    var Controller = function(min , max , options){

        if(max === null || min === null) {
            throw new Error('Max and Min values are required.');
        }

        this.options = options || {};

        for(var key in _options){
            if(!(key in this.options))
                this.options[key] = _options[key];
        }

        this._max_value 	= max;
        this._min_value 	= min;

        this.value 			= min;
        this.end_loc 		= min;

        this.current_snap	= this.getSnapNum(min);

        this.__extrStep 	= 0;
        this.__extraMove 	= 0;

        this.__animID	 	= -1;

    };

    var p = Controller.prototype;

    /*
     ---------------------------------------------------
     PUBLIC METHODS
     ----------------------------------------------------
     */


    p.changeTo = function(value , animate , speed , snap_num , dispatch) {
        this.stopped = false;
        this._internalStop();
        value = this._checkLimits(value);
        speed = Math.abs(speed || 0);

        if(this.options.snapping){
            snap_num = snap_num || this.getSnapNum(value);
            if( dispatch !== false )this._callsnapChange(snap_num);
            this.current_snap = snap_num;
        }

        if(animate){
            this.animating = true;

            var self = this,
                active_id = ++self.__animID,
                amplitude = value - self.value,
                timeStep = 0,
                targetPosition = value,
                animFrict = 1 - self.options.friction,
                timeconst = animFrict + (speed - 20)  * animFrict * 1.3 / self.options.maxSpeed;

            var tick = function(){

                if(active_id !== self.__animID) return;

                var dis =  value - self.value;

                if( Math.abs(dis) > self.options.minValidDist && self.animating ){
                    window.requestAnimationFrame(tick);
                } else {

                    if( self.animating ){
                        self.value = value;
                        self._callrenderer();
                    }

                    self.animating = false;

                    if( active_id !== self.__animID ){
                        self.__animID = -1;
                    }

                    self._callonComplete('anim');

                    return;
                }

                //self.value += dis * timeconst
                self.value = targetPosition - amplitude * Math.exp(-++timeStep * timeconst);

                self._callrenderer();
            };

            tick();

            return;
        }

        this.value = value;
        this._callrenderer();
    };

    p.drag = function(move){

        if(this.start_drag){
            this.drag_start_loc  = this.value;
            this.start_drag = false;
        }

        this.animating 		= false;
        this._deceleration 	= false;

        this.value -= move;

        if ( !this.options.endless && (this.value > this._max_value || this.value < 0)) {
            if (this.options.bouncing) {
                this.__isout = true;
                this.value += move * 0.6;
            } else if (this.value > this._max_value) {
                this.value = this._max_value;
            } else {
                this.value = 0;
            }
        }else if(!this.options.endless && this.options.bouncing){
            this.__isout = false;
        }

        this._callrenderer();

    };

    p.push = function(speed){
        this.stopped = false;
        if(this.options.snapping && Math.abs(speed) <= this.options.snappingMinSpeed){
            this.cancel();
            return;
        }

        this.__speed = speed;
        this.__startSpeed = speed;

        this.end_loc = this._calculateEnd();

        if(this.options.snapping){

            var snap_loc = this.getSnapNum(this.value),
                end_snap = this.getSnapNum(this.end_loc);

            if(this.options.paging){
                snap_loc = this.getSnapNum(this.drag_start_loc);

                this.__isout = false;
                if(speed > 0){
                    this.gotoSnap(snap_loc + 1 , true , speed);
                }else{
                    this.gotoSnap(snap_loc - 1 , true , speed);
                }
                return;
            }else if(snap_loc === end_snap){
                this.cancel();
                return;
            }

            this._callsnapChange(end_snap);
            this.current_snap = end_snap;

        }

        this.animating = false;

        this.__needsSnap = this.options.endless || (this.end_loc > this._min_value && this.end_loc < this._max_value) ;

        if(this.options.snapping && this.__needsSnap)
            this.__extraMove = this._calculateExtraMove(this.end_loc);


        this._startDecelaration();
    };

    p.bounce = function(speed){
        if(this.animating) return;
        this.stopped = false;
        this.animating = false;

        this.__speed = speed;
        this.__startSpeed = speed;

        this.end_loc = this._calculateEnd();

        //if(this.options.paging){}

        this._startDecelaration();
    };

    p.stop = function(){
        this.stopped = true;
        this._internalStop();
    };

    p.cancel = function(){
        this.start_drag = true; // reset flag for next drag
        if(this.__isout){
            this.__speed = 0.0004;
            this._startDecelaration();
        }else if(this.options.snapping){
            this.gotoSnap(this.getSnapNum(this.value) , true);
        }

    };

    p.renderCallback = function(listener , ref){
        this.__renderHook = {fun:listener , ref:ref};
    };

    p.snappingCallback = function(listener , ref){
        this.__snapHook = {fun:listener , ref:ref};
    };

    p.snapCompleteCallback = function(listener , ref){
        this.__compHook = {fun:listener , ref:ref};
    };

    p.getSnapNum = function(value){
        return Math.floor(( value + this.options.snapsize / 2 ) / this.options.snapsize);
    };

    p.nextSnap = function(){
        this._internalStop();

        var curr_snap = this.getSnapNum(this.value);

        if(!this.options.endless && (curr_snap + 1) * this.options.snapsize > this._max_value){
            this.__speed = 8;
            this.__needsSnap = false;
            this._startDecelaration();
        }else{
            this.gotoSnap(curr_snap + 1 , true);
        }

    };

    p.prevSnap = function(){
        this._internalStop();

        var curr_snap = this.getSnapNum(this.value);

        if(!this.options.endless && (curr_snap - 1) * this.options.snapsize < this._min_value){
            this.__speed = -8;
            this.__needsSnap = false;
            this._startDecelaration();
        }else{
            this.gotoSnap(curr_snap - 1 , true);
        }

    };

    p.gotoSnap = function(snap_num , animate , speed){
        this.changeTo(snap_num * this.options.snapsize , animate , speed , snap_num);
    };

    p.destroy = function(){
        this._internalStop();
        this.__renderHook = null;
        this.__snapHook = null;
        this.__compHook = null;
    };

    /*
     ---------------------------------------------------
     PRIVATE METHODS
     ----------------------------------------------------
     */

    p._internalStop = function(){
        this.start_drag = true; // reset flag for next drag
        this.animating = false;
        this._deceleration = false;
        this.__extrStep = 0;
    };

    p._calculateExtraMove = function(value){
        var m = value % this.options.snapsize;
        return m < this.options.snapsize / 2  ? -m : this.options.snapsize - m;
    };

    p._calculateEnd = function(step){
        var temp_speed = this.__speed;
        var temp_value = this.value;
        var i = 0;
        while(Math.abs(temp_speed) > this.options.minValidDist){
            temp_value += temp_speed;
            temp_speed *= this.options.friction;
            i++;
        }
        if(step) return i;
        return temp_value;
    };

    p._checkLimits = function(value){
        if(this.options.endless) 	return value;
        if(value < this._min_value) return this._min_value;
        if(value > this._max_value) return this._max_value;
        return value;
    };

    p._callrenderer = function(){
        if(this.__renderHook) this.__renderHook.fun.call(this.__renderHook.ref , this , this.value);
    };

    p._callsnapChange = function(targetSnap){
        if(!this.__snapHook || targetSnap === this.current_snap) return;
        this.__snapHook.fun.call(this.__snapHook.ref , this , targetSnap , targetSnap - this.current_snap);
    };

    p._callonComplete = function(type){
        if(this.__compHook && !this.stopped){
            this.__compHook.fun.call(this.__compHook.ref , this , this.current_snap , type);
        }

    };

    p._computeDeceleration = function(){

        if(this.options.snapping && this.__needsSnap){
            var xtr_move = (this.__startSpeed - this.__speed) / this.__startSpeed * this.__extraMove;
            this.value += this.__speed + xtr_move - this.__extrStep;
            this.__extrStep = xtr_move;
        }else{
            this.value += this.__speed;
        }

        this.__speed *= this.options.friction; //* 10;

        if(!this.options.endless && !this.options.bouncing){
            if(this.value <= this._min_value){
                this.value = this._min_value;
                this.__speed = 0;
            }else if(this.value >= this._max_value){
                this.value = this._max_value;
                this.__speed = 0;
            }
        }

        this._callrenderer();

        if(!this.options.endless && this.options.bouncing){

            var out_value = 0;

            if(this.value < this._min_value){
                out_value = this._min_value - this.value;
            }else if(this.value > this._max_value){
                out_value = this._max_value - this.value;
            }

            this.__isout =  Math.abs(out_value) >= this.options.minValidDist;

            if(this.__isout){
                if(this.__speed * out_value <= 0){
                    this.__speed += out_value * this.options.outFriction;
                }else {
                    this.__speed = out_value * this.options.outAcceleration;
                }
            }
        }
    };

    p._startDecelaration = function(){
        if(this._deceleration) return;
        this._deceleration = true;

        var self = this;

        var tick = function (){

            if(!self._deceleration) return;

            self._computeDeceleration();

            if(Math.abs(self.__speed) > self.options.minValidDist || self.__isout){
                window.requestAnimationFrame(tick);
            }else{
                self._deceleration = false;
                self.__isout = false;

                if(this.__needsSnap && self.options.snapping && !self.options.paging){
                    self.value = self._checkLimits(self.end_loc + self.__extraMove);
                }else{
                    self.value = Math.round(self.value);
                }

                self._callrenderer();
                self._callonComplete('decel');
            }
        };

        tick();
    };

    window.Controller = Controller;

})();//dev\slider\controls\LayerEffects.js

;(function($){

    window.MSLayerEffects = {};

    var installed,
        _fade = {opacity:0};

    MSLayerEffects.setup = function(){

        if(installed) return;
        installed = true;

        var st 					= MSLayerEffects,
            transform_css 		= window._jcsspfx + 'Transform',
            transform_orig_css  = window._jcsspfx + 'TransformOrigin',
            o					= $.browser.opera; // Opera sucks :|
        _2d					= window._css2d && window._cssanim && !o;

        st.defaultValues = {left : 0 , top: 0 , opacity:1 , right:0 , bottom:0};
        st.defaultValues[transform_css] 	 = '';
        //st.defaultValues[transform_orig_css] = '';
        st.rf = 1;

        st.presetEffParams = {
            random: '30|300',
            long 	: 300,
            short	: 30,
            'false'	:false,
            'true'	:true,
            tl	 : 'top left'	,	bl: 'bottom left',
            tr   : 'top right'	,   br: 'bottom right',
            rt   : 'top right'	,	lb: 'bottom left',
            lt   : 'top left'	,	rb: 'bottom right',
            t	 : 'top'		,	b : 'bottom',
            r	 : 'right'		,	l : 'left',
            c	 : 'center'
        };


        /*
         ----------------------------------------
         2D Effects
         ----------------------------------------
         */

        st.fade = function(){
            return _fade;
        };

        st.left = (_2d)? function(dist , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'translateX(' + -dist*st.rf + 'px)';
            return r;
        } : function (dist, fade){
            var r = fade === false ? {} : {opacity:0};
            r.left = -dist*st.rf + 'px';
            return r;
        };

        st.right = (_2d)? function(dist , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'translateX(' + dist*st.rf + 'px)';
            return r;
        } : function (dist, fade){
            var r = fade === false ? {} : {opacity:0};
            r.left = dist*st.rf + 'px';
            return r;
        };

        st.top = (_2d)? function(dist , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'translateY(' + -dist*st.rf + 'px)';
            return r;
        } : function (dist, fade){
            var r = fade === false ? {} : {opacity:0};
            r.top = -dist*st.rf + 'px';
            return r;
        };

        st.bottom = (_2d)? function(dist , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'translateY(' + dist*st.rf + 'px)';
            return r;
        } : function (dist, fade){
            var r = fade === false ? {} : {opacity:0};
            r.top = dist*st.rf + 'px';
            return r;
        };

        st.from = (_2d)? function(leftdis , topdis , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'translateX('+leftdis*st.rf+'px) translateY(' + topdis*st.rf + 'px)';
            return r;
        } : function (leftdis , topdis, fade){
            var r = fade === false ? {} : {opacity:0};
            r.top = topdis*st.rf + 'px';
            r.left = leftdis*st.rf + 'px';
            return r;
        };


        // --------------------------------------------------------------------

        st.rotate = (_2d)? function(deg , orig ){
            var r = {opacity: 0};
            r[transform_css] = ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg, orig){
            return _fade;
        };

        st.rotateleft = (_2d)? function(deg , dist , orig , fade){
            var r = st.left(dist , fade);
            r[transform_css] += ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , dist , orig , fade){
            return st.left(dist , fade);
        };

        st.rotateright = (_2d)? function(deg , dist , orig , fade){
            var r = st.right(dist , fade);
            r[transform_css] += ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , dist , orig , fade){
            return st.right(dist , fade);
        };

        st.rotatetop = (_2d)? function(deg , dist , orig , fade){
            var r = st.top(dist , fade);
            r[transform_css] += ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , dist , orig , fade){
            return st.top(dist , fade);
        };

        st.rotatebottom = (_2d)? function(deg , dist , orig , fade){
            var r = st.bottom(dist , fade);
            r[transform_css] += ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , dist , orig , fade){
            return st.bottom(dist , fade);
        };

        st.rotatefrom = (_2d)? function(deg , leftdis , topdis , orig , fade){
            var r = st.from(leftdis , topdis , fade);
            r[transform_css] += ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , leftdis , topdis , orig , fade){
            return st.from(leftdis , topdis , fade);
        };

        st.skewleft = (_2d)? function(deg , dist , fade){
            var r = st.left(dist , fade);
            r[transform_css] += ' skewX(' + deg + 'deg)';
            return r;
        } : function (deg , dist , fade){
            return st.left(dist , fade);
        };

        st.skewright = (_2d)? function(deg , dist , fade){
            var r = st.right(dist , fade);
            r[transform_css] += ' skewX(' + -deg + 'deg)';
            return r;
        } : function (deg , dist , fade){
            return st.right(dist , fade);
        };

        st.skewtop = (_2d)? function(deg , dist , fade){
            var r = st.top(dist , fade);
            r[transform_css] += ' skewY(' + deg + 'deg)';
            return r;
        } : function (deg , dist , fade){
            return st.top(dist , fade);
        };

        st.skewbottom = (_2d)? function(deg , dist , fade){
            var r = st.bottom(dist , fade);
            r[transform_css] += ' skewY(' + -deg + 'deg)';
            return r;
        } : function (deg , dist , fade){
            return st.bottom(dist , fade);
        };


        st.scale = (_2d)? function(x , y , orig , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = ' scaleX('+x+') scaleY('+y+')';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y , orig , fade){
            return fade === false ? {} : {opacity:0};
        };

        st.scaleleft = (_2d)? function(x , y  , dist , orig , fade){
            var r = st.left(dist , fade);
            r[transform_css] = ' scaleX('+x+') scaleY('+y+')';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y  , dist , orig , fade){
            return st.left(dist , fade);
        };

        st.scaleright = (_2d)? function(x , y  , dist , orig , fade){
            var r = st.right(dist , fade);
            r[transform_css] = ' scaleX('+x+') scaleY('+y+')';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y  , dist , orig , fade){
            return st.right(dist , fade);
        };

        st.scaletop = (_2d)? function(x , y  , dist , orig , fade){
            var r = st.top(dist , fade);
            r[transform_css] = ' scaleX('+x+') scaleY('+y+')';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y  , dist , orig , fade){
            return st.top(dist , fade);
        };

        st.scalebottom = (_2d)? function(x , y  , dist , orig , fade){
            var r = st.bottom(dist , fade);
            r[transform_css] = ' scaleX('+x+') scaleY('+y+')';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y  , dist , orig , fade){
            return st.bottom(dist , fade);
        };

        st.scalefrom = (_2d)? function(x , y  , leftdis , topdis , orig , fade){
            var r = st.from(leftdis , topdis , fade);
            r[transform_css] += ' scaleX('+x+') scaleY('+y+')';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y  , leftdis , topdis , orig , fade){
            return st.from(leftdis , topdis , fade);
        };

        st.rotatescale = (_2d)? function(deg , x , y  ,  orig , fade){
            var r = st.scale(x , y , orig , fade);
            r[transform_css] += ' rotate('+deg+'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , x , y  ,  orig , fade){
            return st.scale(x , y , orig , fade);
        };


        /*
         ----------------------------------------
         3D Effects
         ----------------------------------------
         */

        st.front = (window._css3d)? function(dist , fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'perspective(2000px) translate3d(0 , 0 ,' + dist + 'px ) rotate(0.001deg)';
            return r;
        } : function (dist){
            return _fade;
        };

        st.back = (window._css3d)? function(dist, fade){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'perspective(2000px) translate3d(0 , 0 ,' + -dist + 'px ) rotate(0.001deg)';
            return r;
        } : function (dist){
            return _fade;
        };

        st.rotatefront = (window._css3d)? function(deg , dist , orig , fade ){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'perspective(2000px) translate3d(0 , 0 ,' + dist + 'px ) rotate('+ (deg || 0.001) +'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , dist , orig , fade ){
            return _fade;
        };

        st.rotateback = (window._css3d)? function(deg , dist , orig , fade ){
            var r = fade === false ? {} : {opacity:0};
            r[transform_css] = 'perspective(2000px) translate3d(0 , 0 ,' + -dist + 'px ) rotate('+ (deg || 0.001) +'deg)';
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (deg , dist , orig , fade ){
            return _fade;
        };

        st.rotate3dleft = (window._css3d)? function(x , y , z , dist , orig , fade){
            var r = st.left(dist , fade);
            r[transform_css] += (x?' rotateX('+x+'deg)' : ' ')+(y?' rotateY('+y+'deg)' : '')+(z?' rotateZ('+z+'deg)' : '');
            if(orig) r[transform_orig_css] = orig;
            return r;

        } : function (x , y , z , dist , orig , fade){
            return st.left(dist , fade);;
        };

        st.rotate3dright = (window._css3d)? function(x , y , z , dist , orig , fade){
            var r = st.right(dist , fade);
            r[transform_css] += (x?' rotateX('+x+'deg)' : ' ')+(y?' rotateY('+y+'deg)' : '')+(z?' rotateZ('+z+'deg)' : '');
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y , z , dist , orig , fade){
            return st.right(dist , fade);;
        };

        st.rotate3dtop = (window._css3d)? function(x , y , z , dist , orig , fade){
            var r = st.top(dist , fade);
            r[transform_css] += (x?' rotateX('+x+'deg)' : ' ')+(y?' rotateY('+y+'deg)' : '')+(z?' rotateZ('+z+'deg)' : '');
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y , z , dist , orig , fade){
            return st.top(dist , fade);;
        };

        st.rotate3dbottom = (window._css3d)? function(x , y , z , dist , orig , fade){
            var r = st.bottom(dist , fade);
            r[transform_css] += (x?' rotateX('+x+'deg)' : ' ')+(y?' rotateY('+y+'deg)' : '')+(z?' rotateZ('+z+'deg)' : '');
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y , z , dist , orig , fade){
            return st.bottom(dist , fade);
        };

        st.rotate3dfront = (window._css3d)? function(x , y , z , dist , orig , fade){
            var r = st.front(dist , fade);
            r[transform_css] += (x?' rotateX('+x+'deg)' : ' ')+(y?' rotateY('+y+'deg)' : '')+(z?' rotateZ('+z+'deg)' : '');
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y , z , dist , orig , fade){
            return st.front(dist , fade);
        };

        st.rotate3dback = (window._css3d)? function(x , y , z , dist , orig , fade){
            var r = st.back(dist , fade);
            r[transform_css] += (x?' rotateX('+x+'deg)' : ' ')+(y?' rotateY('+y+'deg)' : '')+(z?' rotateZ('+z+'deg)' : '');
            if(orig) r[transform_orig_css] = orig;
            return r;
        } : function (x , y , z , dist , orig , fade){
            return st.back(dist , fade);
        };

        // transform effect
        st.t = (window._css3d)? function(fade,tx,ty,tz,r,rx,ry,rz,scx,scy,skx,sky,ox,oy,oz){
            var _r = fade === false ? {} : {opacity:0};
            var transform = 'perspective(2000px) ';

            tx  !== 'n' && (transform += 'translateX(' + tx * st.rf + 'px) ');
            ty  !== 'n' && (transform += 'translateY(' + ty * st.rf + 'px) ');
            tz  !== 'n' && (transform += 'translateZ(' + tz * st.rf + 'px) ');
            r   !== 'n' && (transform += 'rotate(' + r + 'deg) ');
            rx  !== 'n' && (transform += 'rotateX(' + rx + 'deg) ');
            ry  !== 'n' && (transform += 'rotateY(' + ry + 'deg) ');
            rz  !== 'n' && (transform += 'rotateZ(' + rz + 'deg) ');
            skx !== 'n' && (transform += 'skewX(' + skx + 'deg) ');
            sky !== 'n' && (transform += 'skewY(' + sky + 'deg) ');
            scx !== 'n' && (transform += 'scaleX(' + scx + ') ');
            scy !== 'n' && (transform += 'scaleY(' + scy + ')');

            _r[transform_css] = transform;

            var trans_origin = '';

            trans_origin += (ox !== 'n' ? ox + '% ' : '50% ');
            trans_origin += (oy !== 'n' ? oy + '% ' : '50% ');
            trans_origin += (oz !== 'n' ? oz + 'px' : '');

            _r[transform_orig_css] = trans_origin;

            return _r;

        } : function(fade,tx,ty,tz,r,rx,ry,rz,scx,scy,skx,sky,ox,oy,oz) {

            var r = fade === false ? {} : {opacity:0};
            tx  !== 'n' && (r.left = tx * st.rf + 'px');
            ty  !== 'n' && (r.top  = ty * st.rf + 'px');
            return r;
        }
    };
})(jQuery);
//dev\slider\controls\LayerElement.js

;(function($){

    window.MSLayerElement = function(){

        //this.$element = $('<div></div>').addClass('layer-element');
        this.$cont	  = $('<div></div>').addClass('layer-cont');//.append(this.$element);

        this.start_anim = {
            name		: 'fade',
            duration	: 1000,
            ease 		: 'linear',
            delay		: 0
        };

        this.end_anim = {
            duration	: 1000,
            ease 		: 'linear'
        };

        this.type = 'text'; // video , image

        //this.swipe 		= true;
        this.resizable 	= true;
        this.minWidth 	= -1;

        this.__cssConfig = [
            'margin-top' 	,      'padding-top'	,
            'margin-bottom'	,      'padding-left'	,
            'margin-right'	,      'padding-right'	,
            'margin-left'	,      'padding-bottom' ,


            'left'			,       'right'			,
            'top'			,       'bottom'		,
            'font-size' 	,  		'line-height'	,
            /*'height'		, */	'width'
        ];

        this.baseStyle = {};
    };

    var p = MSLayerElement.prototype;

    /*-------------- METHODS --------------*/
    p.__playAnimation = function(animation , css){
        var options = {};
        //if(animation.delay > 0) options.delay = animation.delay;
        if(animation.ease)		options.ease = animation.ease;

        this.show_tween = CTween.animate(this.$element, animation.duration , css , options);
    };

    p._randomParam = function(value){
        var min = Number(value.slice(0,value.indexOf('|')));
        var max = Number(value.slice(value.indexOf('|')+1));

        return min + Math.random() * (max - min);
    };

    p._parseEff = function(eff_name){

        var eff_params = [];

        if(eff_name.indexOf('(') !== -1){
            var temp   = eff_name.slice(0 , eff_name.indexOf('(')).toLowerCase();
            var	value;

            eff_params = eff_name.slice(eff_name.indexOf('(') + 1 , -1).replace(/\"|\'|\s/g , '').split(',');
            eff_name   = temp;

            for(var i = 0 , l = eff_params.length; i < l ; ++i){
                value = eff_params[i];

                if(value in MSLayerEffects.presetEffParams)
                    value = MSLayerEffects.presetEffParams[value];

                eff_params[i] = value;
            }
        }

        return {eff_name:eff_name , eff_params:eff_params};
    };

    p._parseEffParams = function(params){
        var eff_params = [];
        for(var i = 0 , l = params.length; i < l ; ++i){
            var value = params[i];
            if(typeof value === 'string' && value.indexOf('|') !== -1) value = this._randomParam(value);

            eff_params[i] = value;
        }

        return eff_params;
    };

    p._checkPosKey = function(key , style){
        if(key === 'left' && !(key in this.baseStyle) && 'right' in this.baseStyle){
            style.right = -parseInt(style.left) + 'px';
            delete style.left;
            return true;
        }

        if(key === 'top'  && !(key in this.baseStyle) && 'bottom' in this.baseStyle){
            style.bottom = -parseInt(style.top) + 'px';
            delete style.top;
            return true;
        }

        return false;
    };


    /*
     ---------------------------------------------------
     Public Methods
     ---------------------------------------------------
     */
    p.setStartAnim = function(anim){
        $.extend(this.start_anim , anim); $.extend(this.start_anim  , this._parseEff(this.start_anim.name));
        this.$element.css('visibility' , 'hidden');
    };
    p.setEndAnim   = function(anim){ $.extend(this.end_anim   , anim ); };

    p.create = function(){
        this.$element.css('display', 'none')
            .removeAttr('data-delay')
            .removeAttr('data-effect')
            .removeAttr('data-duration')
            .removeAttr('data-type');


        // resizable layer
        if( this.$element.data('resize') !== undefined ) {
            this.resizable = this.$element.data('resize');
            this.$element.removeAttr('data-resize');
        }

        // fixed positioning
        if( this.$element.data('fixed') !== undefined ){
            this.fixed = this.$element.data('fixed');
            this.$element.removeAttr('data-fixed');
        }

        // hide under parameter
        if( this.$element.data('widthlimit') !== undefined ) {
            this.minWidth = this.$element.data('widthlimit');
            this.$element.removeAttr('data-widthlimit');
        }

        if( !this.end_anim.name ) {
            this.end_anim.name = this.start_anim.name;
        }

        if( this.end_anim.time ) {
            this.autoHide = true;//this.end_anim.delay = this.slide.delay * 1000 - this.end_anim.duration;
        }

        // create action event
        // @since v1.7.2
        if( this.$element.data('action') !== undefined ) {
            var slideController = this.slide.slider.slideController;
            this.$element.on('click', function(event){
                slideController.runAction($(this).data('action'));
                event.preventDefault();
            }).addClass('ms-action-layer');
        }

        $.extend(this.end_anim  , this._parseEff(this.end_anim.name));
        this.slider = this.slide.slider;

        // new alignment method
        // @since v1.6.1
        var layerOrigin = this.layerOrigin = this.$element.data('origin');
        if ( layerOrigin ){

            var vOrigin  = layerOrigin.charAt(0),
                hOrigin  = layerOrigin.charAt(1),
                offsetX  = this.$element.data('offset-x'),
                offsetY  = this.$element.data('offset-y');

            if( offsetY !== undefined ){
                this.$element.removeAttr('data-offset-y');
            } else {
                offsetY = 0;
            }

            switch ( vOrigin ){
                case 't':
                    this.$element[0].style.top = offsetY + 'px';
                    break;
                case 'b':
                    this.$element[0].style.bottom = offsetY + 'px';
                    break;
                case 'm':
                    this.$element[0].style.top = offsetY + 'px';
                    this.middleAlign = true;
            }

            if( offsetX !== undefined ){
                this.$element.removeAttr('data-offset-x');
            } else {
                offsetX = 0;
            }

            switch ( hOrigin ){
                case 'l':
                    this.$element[0].style.left = offsetX + 'px';
                    break;
                case 'r':
                    this.$element[0].style.right = offsetX + 'px';
                    break;
                case 'c':
                    this.$element[0].style.left = offsetX + 'px';
                    this.centerAlign = true;
            }

            this.$element.removeAttr('data-origin');
        }

        // parallax effect
        // @since v1.6.0
        this.parallax = this.$element.data('parallax')
        if( this.parallax != null ) {
            this.parallax /= 100;
            this.$parallaxElement = $('<div></div>').addClass('ms-parallax-layer');
            if( this.link ) { // only for image layer
                this.link.wrap(this.$parallaxElement);
                this.$parallaxElement = this.link.parent();
            } else {
                this.$element.wrap(this.$parallaxElement);
                this.$parallaxElement = this.$element.parent();
            }

            this._lastParaX = 0;
            this._lastParaY = 0;
            this._paraX = 0;
            this._paraY = 0;


            // add bottom 0 to the parallax element if layer origin specified to the bottom
            this.alignedToBot = this.layerOrigin && this.layerOrigin.indexOf('b') !== -1;
            if( this.alignedToBot ) {
                this.$parallaxElement.css('bottom', 0);
            }

            if( window._css3d ){
                this.parallaxRender = this.parallaxCSS3DRenderer;
            } else if ( window._css2d ){
                this.parallaxRender = this.parallaxCSS2DRenderer;
            } else {
                this.parallaxRender = this.parallax2DRenderer;
            }

            if( this.slider.options.parallaxMode !== 'swipe' ){ // mouse mode
                averta.Ticker.add(this.parallaxRender, this);
            }
        }
    };

    /*---------------------------------------------------------*/
    /**
     * Change the detestation of parallax position
     * @param  {Number} x
     * @param  {Number} y
     * @since  1.6.0
     */
    p.moveParallax = function(x, y , fast){
        this._paraX = x;
        this._paraY = y;
        if( fast ){
            this._lastParaX = x;
            this._lastParaY = y;
            this.parallaxRender();
        }
    };

    p.parallaxCalc = function(){
        var x_def = this._paraX - this._lastParaX,
            y_def = this._paraY - this._lastParaY;

        this._lastParaX += x_def / 12;
        this._lastParaY += y_def / 12;

        if( Math.abs( x_def ) < 0.019 ) {
            this._lastParaX = this._paraX;
        }

        if( Math.abs( y_def ) < 0.019 ) {
            this._lastParaY = this._paraY;
        }

    }

    /**
     * Parallax move ticker function
     */
    p.parallaxCSS3DRenderer = function(){
        this.parallaxCalc();
        this.$parallaxElement[0].style[window._jcsspfx + 'Transform'] = 'translateX(' + this._lastParaX * this.parallax + 'px) translateY(' + this._lastParaY * this.parallax + 'px) translateZ(0)';
    };

    p.parallaxCSS2DRenderer = function(){
        this.parallaxCalc();
        this.$parallaxElement[0].style[window._jcsspfx + 'Transform'] = 'translateX(' + this._lastParaX * this.parallax + 'px) translateY(' + this._lastParaY * this.parallax + 'px)';
    };

    p.parallax2DRenderer = function(){
        this.parallaxCalc();

        // change bottom instead of top if layer aligned to the bottom (origin)
        if( this.alignedToBot ) {
            this.$parallaxElement[0].style.bottom  = this._lastParaY * this.parallax + 'px';
        } else {
            this.$parallaxElement[0].style.top  = this._lastParaY * this.parallax + 'px';
        }

        this.$parallaxElement[0].style.left = this._lastParaX * this.parallax + 'px';
    };

    /*---------------------------------------------------------*/

    p.init = function(){
        //if(this.initialized) return;
        this.initialized = true;

        var value;

        this.$element.css('visibility' , '');
        // store initial layer styles
        for(var i = 0 , l = this.__cssConfig.length; i < l ; i ++){
            var key = this.__cssConfig[i];
            if( this.type === 'text' && key === 'width'){ // in some browsers using computed style for width in text layer causes unexpected word wrapping
                value = this.$element[0].style.width;
            } else {
                value = this.$element.css(key);
            }

            if(value != 'auto' && value != "" && value != "normal")
                this.baseStyle[key] = parseInt(value);
        }

        // @since v1.6.0
        if ( this.middleAlign ){
            this.baseHeight = this.$element.outerHeight();//this.$element.height();
        }

        if ( this.centerAlign ){
            // in some browsers using computed style for width in text layer causes unexpected word wrapping
            //if ( this.type === 'text' ){
            //	this.baseWidth = parseInt(this.$element[0].style.width);
            //} else {
            this.baseWidth = this.$element.outerWidth();
            //}
        }


    };

    p.locate = function(){

        var layer_cont 	= this.slide.$layers,
            width 		= parseFloat(layer_cont.css('width')),
            height 		= parseFloat(layer_cont.css('height')),
            factor, isPosition;
        this.visible(this.minWidth < width);

        //if(!this.resizable) return;

        factor = this.resizeFactor 	= width / this.slide.slider.options.width;

        // updated @since v1.6.1
        for(var key in this.baseStyle){

            isPosition = key === 'top' || key === 'left' || key === 'bottom' || key === 'right';

            //switch resize/position factor
            if( this.fixed && isPosition ){
                factor = 1;
            } else {
                factor = this.resizeFactor;
            }

            if( !this.resizable && !isPosition ){
                continue;
            }

            if ( key === 'top' && this.middleAlign ){
                this.$element.css(key , this.baseStyle[key] * factor + (height - this.baseHeight * factor) / 2  + 'px');
            } else if ( key === 'left' && this.centerAlign ){
                this.$element.css(key , this.baseStyle[key] * factor + (width - this.baseWidth * factor) / 2  + 'px');
            } else {
                this.$element.css(key , this.baseStyle[key] * factor + 'px');
            }
        }

    };

    p.start = function(){

        if(this.isShowing) return;
        this.isShowing = true;

        var key , base, layer_cont = this.slide.$layers;

        // reads css value form LayerEffects
        MSLayerEffects.rf = this.resizeFactor;
        var effect_css = MSLayerEffects[this.start_anim.eff_name].apply(null , this._parseEffParams(this.start_anim.eff_params));

        // checkes effect css and defines TO css values
        var start_css_eff = {};

        // set from position
        for(key in effect_css){

            // check the position key (top, left, right or bottom) for animatin
            // It mostly will be used in old browsers
            // In effect left:100, layer base style right:300 -> effect changes to right:100
            if( this._checkPosKey(key , effect_css) ){
                continue;
            }

            // set default value from Layer Effects Class
            if( MSLayerEffects.defaultValues[key] != null ){
                start_css_eff[key] = MSLayerEffects.defaultValues[key];
            }

            if( key in this.baseStyle ){
                base = this.baseStyle[key];

                // updated @since v1.6.1
                if ( this.middleAlign && key === 'top' ){
                    base += (parseInt(layer_cont.height()) - this.baseHeight * this.resizeFactor) / 2;
                }

                if ( this.centerAlign && key === 'left' ){
                    base += (parseInt(layer_cont.width()) - this.baseWidth * this.resizeFactor) / 2;
                }
                //----------------------

                effect_css[key] = base + parseFloat(effect_css[key]) + 'px';
                start_css_eff[key] = base + 'px';
            }

            this.$element.css(key , effect_css[key]);
        }

        var that = this;
        clearTimeout(this.to);
        this.to = setTimeout(function(){
            that.$element.css('display' , '');
            that.__playAnimation(that.start_anim , start_css_eff);
        } , that.start_anim.delay || 0.01);


        this.cl_to = setTimeout(function(){
            that.show_cl = true;
        },(this.start_anim.delay || 0.01) + this.start_anim.duration);

        if( this.autoHide ){
            clearTimeout(this.hto);
            this.hto = setTimeout(function(){that.hide();} , that.end_anim.time );
        }
    };

    p.hide = function(){
        this.isShowing = false;

        // reads css value form LayerEffects
        var effect_css = MSLayerEffects[this.end_anim.eff_name].apply(null , this._parseEffParams(this.end_anim.eff_params));

        for(key in effect_css){

            if(this._checkPosKey(key , effect_css)) continue;

            if( key === window._jcsspfx + 'TransformOrigin' ){
                this.$element.css(key , effect_css[key]);
            }

            if(key in this.baseStyle){
                effect_css[key] = this.baseStyle[key] + parseFloat(effect_css[key]) +  'px';
            }

        }

        this.__playAnimation(this.end_anim , effect_css);

        clearTimeout(this.to);
        clearTimeout(this.hto);
        clearTimeout(this.cl_to);
    };

    p.reset = function(){
        this.isShowing = false;
        //this.$element.css(window._csspfx + 'animation-name', ''	);
        this.$element[0].style.display = 'none';
        this.$element.css('opacity', '100');
        this.$element[0].style['transitionDuration'] = '0ms';

        if(this.show_tween)
            this.show_tween.stop(true);

        clearTimeout(this.to);
        clearTimeout(this.hto);
    };

    p.destroy = function(){
        this.reset();
        this.$element.remove();
        this.$cont.remove();
    };

    p.visible = function(value){
        if(this.isVisible == value) return;

        this.isVisible = value;

        this.$element.css('display' , (value ? '' : 'none'));
    };

})(jQuery);
//dev\slider\controls\ImageLayerElement.js

;(function($){

    window.MSImageLayerElement = function(){
        MSLayerElement.call(this);
        this.needPreload = true;

        this.__cssConfig = [
            'margin-top' 	,      'padding-top'	,
            'margin-bottom'	,      'padding-left'	,
            'margin-right'	,      'padding-right'	,
            'margin-left'	,      'padding-bottom' ,

            'left'			,       'right'			,
            'top'			,       'bottom'		,
            'width'			,		'height'
        ];

        this.type = 'image';
    };

    MSImageLayerElement.extend(MSLayerElement);

    var p = MSImageLayerElement.prototype;
    var _super = MSLayerElement.prototype;

    /*-------------- METHODS --------------*/

    p.create = function(){

        if(this.link){
            var p = this.$element.parent();
            p.append(this.link);
            this.link.append(this.$element);
            this.link.removeClass('ms-layer');
            this.$element.addClass('ms-layer');
            p = null;
        }

        _super.create.call(this);

        if(this.$element.data('src') != undefined){
            this.img_src = this.$element.data('src');
            this.$element.removeAttr('data-src');
        }else{
            var that = this;
            this.$element.on('load', function(event){
                that.slide.preloadCount--;
                if(that.slide.preloadCount === 0)
                    that.slide.___onlayersReady();
            }).each($.jqLoadFix);
        }

        if($.browser.msie)
            this.$element.on('dragstart', function(event) { event.preventDefault(); }); // disable native dragging
    };

    p.loadImage = function(){
        var that = this;
        this.$element.preloadImg(this.img_src , function(event){
            that.slide.preloadCount--;
            if(that.slide.preloadCount === 0) that.slide.___onlayersReady();
        });
    };

})(jQuery);
//dev\slider\controls\VideoLayerElement.js

;(function($){

    window.MSVideoLayerElement = function(){
        MSLayerElement.call(this);

        this.__cssConfig.push(
            'height'
        );

        this.type = 'video';
    };

    MSVideoLayerElement.extend(MSLayerElement);

    var p  = MSVideoLayerElement.prototype;
    var _super  = MSLayerElement.prototype;

    /*-------------- METHODS --------------*/
    p.__playVideo = function(){
        if(this.img)CTween.fadeOut(this.img , 500 , false);
        CTween.fadeOut(this.video_btn , 500 , false);
        this.video_frame.attr('src' , 'about:blank').css('display' , 'block');
        if(this.video_url.indexOf('?') == -1) this.video_url += '?';
        this.video_frame.attr('src' , this.video_url + '&autoplay=1');
    };

    p.reset = function(){
        _super.reset.call(this);

        if(this.needPreload || this.$element.data('btn')){
            this.video_btn.css('opacity' , 1);
            this.video_frame.attr('src' , 'about:blank').css('display' , 'none');
        }

        if(this.needPreload){
            this.img.css('opacity' , 1);
            return;
        }

        this.video_frame.attr('src' , this.video_url);
    };

    p.create = function(){
        _super.create.call(this);

        this.video_frame = this.$element.find('iframe').css({width:'100%' , height:'100%'});
        this.video_url   = this.video_frame.attr('src');

        var has_img = this.$element.has('img').length != 0;

        if(!has_img && !this.$element.data('btn')) return;

        this.video_frame.attr('src' , 'about:blank').css('display' , 'none');

        var that = this;

        this.video_btn = $('<div></div>').appendTo(this.$element).addClass('ms-video-btn').click(function() {
            that.__playVideo();
        });

        //this.video_frame.attr('src' , 'about:blank');

        if(!has_img) return;

        this.needPreload = true;
        this.img = this.$element.find('img:first').addClass('ms-video-img');

        if(this.img.data('src') !== undefined){
            this.img_src = this.img.data('src');
            this.img.removeAttr('data-src');
        }else{
            var that = this;
            this.img.attr('src' , this.img_src).on('load', function(event) {
                that.slide.preloadCount--;
                if(that.slide.preloadCount == 0)
                    that.slide.___onlayersReady();
            }).each($.jqLoadFix);
        }

        if($.browser.msie)
            this.img.on('dragstart', function(event) { event.preventDefault(); }); // disables native dragging
    };

    p.loadImage = function(){
        var that = this;
        this.img.preloadImg(this.img_src, function(event) {
            that.slide.preloadCount--;
            if(that.slide.preloadCount == 0) that.slide.___onlayersReady();
        });
    };

})(jQuery);
//dev\slider\controls\HotspotLayer.js

;(function($){

    "use strict";

    window.MSHotspotLayer = function(){
        MSLayerElement.call(this);

        this.__cssConfig = [
            'margin-top' 	,      'padding-top'	,
            'margin-bottom'	,      'padding-left'	,
            'margin-right'	,      'padding-right'	,
            'margin-left'	,      'padding-bottom' ,

            'left'			,       'right'			,
            'top'			,       'bottom'
        ];


        this.ease = 'Expo';
        this.hide_start = true;
        this.type = 'hotspot';
    };

    MSHotspotLayer.extend(MSLayerElement);

    var p = MSHotspotLayer.prototype;
    var _super = MSLayerElement.prototype;

    /*-------------- METHODS --------------*/

    p._showTT = function(){
        if(!this.show_cl)  return;

        clearTimeout(this.hto);
        if(this._tween)	this._tween.stop(true);

        if( this.hide_start ){
            this.align = this._orgAlign;
            this._locateTT();

            this.tt.css({display:'block'});
            this._tween = CTween.animate(this.tt , 900 , this.to , {ease:'easeOut'+this.ease});
            this.hide_start = false;
        }

    };

    p._hideTT = function(){
        if(!this.show_cl)  return;
        if(this._tween)	this._tween.stop(true);

        var that = this;

        clearTimeout(this.hto);
        this.hto = setTimeout(function(){
            that.hide_start = true;
            that._tween = CTween.animate(that.tt , 900 , that.from , {ease:'easeOut'+that.ease , complete:function(){that.tt.css('display' , 'none');}} );
        } , 200);
    };

    p._updateClassName = function(name){
        if(this._lastClass)	this.tt.removeClass(this._lastClass);
        this.tt.addClass(name);
        this._lastClass = name;
    }

    p._alignPolicy = function(){
        var h = this.tt.outerHeight(),
            w = Math.max(this.tt.outerWidth() , parseInt(this.tt.css('max-width'))),
            ww = window.innerWidth,
            wh = window.innerHeight;

        switch(this.align){
            case 'top':
                if(this.base_t < 0 )
                    return 'bottom';
                break;
            case 'right':
                if(this.base_l + w > ww || this.base_t < 0)
                    return 'bottom';
                break;
            case 'left':
                if(this.base_l < 0 || this.base_t < 0)
                    return 'bottom';
                break;
        }

        return null;
    };

    p._locateTT = function(){
        var os = this.$element.offset(),
            os2 = this.slide.slider.$element.offset();

        var dist = 50,
            space = 15 //* this.factor;

        this.pos_x = os.left - os2.left - this.slide.slider.$element.scrollLeft();
        this.pos_y = os.top - os2.top - this.slide.slider.$element.scrollTop();

        this.from = {opacity:0};
        this.to = {opacity:1};

        this._updateClassName('ms-tooltip-'+this.align);
        this.tt_arrow.css('margin-left' , '');

        var arrow_w = 15,//parseInt(this.tt_arrow.css('border-left')) + parseInt(this.tt_arrow.css('border-right')),
            arrow_h = 15;//parseInt(this.tt_arrow.css('border-top'))  + parseInt(this.tt_arrow.css('border-bottom'));

        //console.log(arrow_h,arrow_w);
        //
        switch(this.align){
            case 'top':
                var w = Math.min(this.tt.outerWidth() , parseInt(this.tt.css('max-width')));
                this.base_t = this.pos_y - this.tt.outerHeight() - arrow_h - space;
                this.base_l = this.pos_x - w/2;

                if(this.base_l + w > window.innerWidth){
                    this.tt_arrow.css('margin-left' , -arrow_w/2 + this.base_l + w -window.innerWidth + 'px');
                    this.base_l = window.innerWidth - w;
                }

                if(this.base_l < 0){
                    this.base_l = 0;
                    this.tt_arrow.css('margin-left' , -arrow_w/2 + this.pos_x - this.tt.outerWidth() / 2 + 'px');
                }

                if(window._css3d){
                    this.from[window._jcsspfx+'Transform'] = 'translateY(-'+dist+'px)';
                    this.to[window._jcsspfx+'Transform']   = '';
                }else{
                    this.from.top = (this.base_t - dist) + 'px';
                    this.to.top = this.base_t + 'px';
                }

                break;
            case 'bottom':
                var w = Math.min(this.tt.outerWidth() , parseInt(this.tt.css('max-width')));

                this.base_t = this.pos_y + arrow_h + space;
                this.base_l = this.pos_x - w/2;

                if(this.base_l + w > window.innerWidth){
                    this.tt_arrow.css('margin-left' , -arrow_w/2 + this.base_l + w -window.innerWidth + 'px');
                    this.base_l = window.innerWidth - w;
                }

                if(this.base_l < 0){
                    this.base_l = 0;
                    this.tt_arrow.css('margin-left' , -arrow_w/2 + this.pos_x - this.tt.outerWidth() / 2 + 'px');
                }

                if(window._css3d){
                    this.from[window._jcsspfx+'Transform'] = 'translateY('+dist+'px)';
                    this.to[window._jcsspfx+'Transform'] = '';
                }else{
                    this.from.top = (this.base_t + dist) + 'px';
                    this.to.top = this.base_t + 'px';
                }

                break;
            case 'right':
                this.base_l = this.pos_x + arrow_w + space;
                this.base_t = this.pos_y - this.tt.outerHeight() / 2;

                if(window._css3d){
                    this.from[window._jcsspfx+'Transform'] = 'translateX('+dist+'px)';
                    this.to[window._jcsspfx+'Transform'] = '';
                }else{
                    this.from.left = (this.base_l + dist) + 'px';
                    this.to.left = this.base_l + 'px';
                }

                break;
            case 'left':
                this.base_l = this.pos_x - arrow_w - this.tt.outerWidth() - space;
                this.base_t = this.pos_y - this.tt.outerHeight() / 2;

                if(window._css3d){
                    this.from[window._jcsspfx+'Transform'] = 'translateX(-'+dist+'px)';
                    this.to[window._jcsspfx+'Transform'] = '';
                }else{
                    this.from.left = (this.base_l - dist) + 'px';
                    this.to.left = this.base_l + 'px';
                }

                break;
        }



        var policyAlign = this._alignPolicy();
        if(policyAlign !== null){
            this.align = policyAlign;
            this._locateTT();
            return;
        }

        this.tt.css('top'  ,parseInt(this.base_t)+'px').
        css('left' ,parseInt(this.base_l)+'px');

        this.tt.css(this.from);


    };

    p.start = function(){
        _super.start.call(this);
        this.tt.appendTo(this.slide.slider.$element);
        //this._locateTT();
        this.tt.css('display' , 'none');
    };

    p.reset = function(){
        _super.reset.call(this);
        this.tt.detach();
    };

    p.create = function(){
        var that = this;

        _super.create.call(this);

        this._orgAlign = this.align = this.$element.data('align') !== undefined ? this.$element.data('align') : 'top';

        this.data = this.$element.html();

        this.$element.html('').on('mouseenter' , function(){that._showTT();}).on('mouseleave',function(){that._hideTT();});

        this.point = $('<div><div class="ms-point-center"></div><div class="ms-point-border"></div></div>')
            .addClass('ms-tooltip-point')
            .appendTo(this.$element);

        var link = this.$element.data('link'),
            target = this.$element.data('target');

        if( link ){
            this.point.on('click', function(){window.open(link , target || '_self');});
        }

        this.tt =  $('<div></div>')
            .addClass('ms-tooltip')
            //.addClass('ms-tooltip-'+this.align)
            .css('display','hidden')
            .css('opacity' , 0);

        // @since v1.6.1
        if( this.$element.data('width') !== undefined ){
            this.tt.css('width', this.$element.data('width'))
                .css('max-width', this.$element.data('width'));
        }

        this.tt_arrow = $('<div></div>')
            .addClass('ms-tooltip-arrow')
            .appendTo(this.tt);

        this._updateClassName('ms-tooltip-'+this.align);

        this.ttcont = $('<div></div>')
            .addClass('ms-tooltip-cont')
            .html(this.data)
            .appendTo(this.tt)


        if( this.$element.data('stay-hover') === true ) {
            this.tt.on('mouseenter' , function(){
                if( that.hide_start ){
                    return
                }
                clearTimeout(that.hto);
                that._tween.stop(true);
                that._showTT();
            }).on('mouseleave', function(){
                that._hideTT();
            });
        }
    };

})(jQuery);
//dev\slider\controls\ButtonLayer.js

/**
 * Master Slider Button Layer
 * @author Averta
 * @since 1.7.2
 * @extends {MSLayerElement}
 */
(function($){

    window.MSButtonLayer = function(){
        MSLayerElement.call(this);

        this.type = 'button';
    };

    MSButtonLayer.extend(MSLayerElement);

    var p = MSButtonLayer.prototype;
    var _super = MSLayerElement.prototype;

    var positionKies = ['top', 'left', 'bottom', 'right'];

    /*-------------- METHODS --------------*/

    p.create = function(){
        _super.create.call(this);
        this.$element.wrap('<div class="ms-btn-container"></div>').css('position', 'relative');
        this.$container = this.$element.parent();
    };

    p.locate = function(){
        _super.locate.call(this);
        var key, tempValue;

        for (var i=0; i<4; i++){
            key = positionKies[i];
            if ( key in this.baseStyle ) {
                tempValue = this.$element.css(key);
                this.$element.css(key, '');
                this.$container.css(key, tempValue);
            }
        }

        this.$container.width(this.$element.outerWidth())
            .height(this.$element.outerHeight());
    };

})(jQuery);//dev\slider\SliderEvent.js

window.MSSliderEvent = function (type){
    this.type = type;
};

MSSliderEvent.CHANGE_START      	= 'changeStart';
MSSliderEvent.CHANGE_END       		= 'changeEnd';
MSSliderEvent.WAITING		      	= 'waiting';
MSSliderEvent.AUTOPLAY_CHANGE   	= 'autoplayChange';
MSSliderEvent.VIDEO_PLAY		   	= 'videoPlay';
MSSliderEvent.VIDEO_CLOSE		   	= 'videoClose';
MSSliderEvent.INIT					= 'init';
MSSliderEvent.RESIZE				= 'resize';
MSSliderEvent.RESERVED_SPACE_CHANGE = 'rsc'; // internal use
//dev\slider\Slide.js

;(function($){

    "use strict";

    window.MSSlide = function(){

        this.$element = null;

        this.$loading = $('<div></div>').addClass('ms-slide-loading');

        this.layers = [];

        this.view 		= null;
        this.index 		= -1;

        this.__width 	= 0;
        this.__height 	= 0;

        this.preloadCount = 0;

        this.fillMode = 'fill'; // fill , fit , stretch , tile , center

        this.selected = false;
        this.pselected = false;
        this.autoAppend = true;
        this.isSleeping = true;

        this.moz = $.browser.mozilla;
    };

    var p = MSSlide.prototype;

    /*-------------- METHODS --------------*/


    /* -----------------------------------------------------
     * 				Slide Swipe Reaction
     -----------------------------------------------------*/
    p.onSwipeStart = function(){
        //this.$layers.css(window._csspfx + 'transition-duration' , '0ms');
        if(this.link)  this.linkdis = true;
        if(this.video) this.videodis = true;
    };

    p.onSwipeCancel = function(){
        if(this.link) this.linkdis = false;
        if(this.video) this.videodis = false;
        //this.$layers.css(window._csspfx + 'transition-duration' , this.view.__slideDuration + 'ms');
    };

    /* -----------------------------------------------------
     * 					Slide Layers
     -----------------------------------------------------*/

    p.addLayer = function(layer){
        if(!this.hasLayers)
            this.$layers  = $('<div></div>').addClass('ms-slide-layers');

        this.hasLayers = true;

        this.$layers.append(layer.$element);
        this.layers.push(layer);
        layer.slide = this;
        layer.create();

        // @since 1.7.0
        if( layer.parallax ){
            this.hasParallaxLayer = true;
        }

        if(layer.needPreload) this.preloadCount ++;
    };

    // This method will be called by the last layer after loading all of layers.
    p.___onlayersReady = function(){
        this.ready = true;
        this.slider.api._startTimer();

        if(this.selected){
            /*this.initLayers();
             this.locateLayers();
             this.startLayers();*/

            this.showLayers();

            if(this.vinit){
                this.bgvideo.play();
                if( !this.autoPauseBgVid ) {
                    this.bgvideo.currentTime = 0;
                }
            }

        }

        if(!this.isSleeping)
            this.setup();

        CTween.fadeOut(this.$loading , 300 , true);

        //sequence loading
        if((this.slider.options.preload === 0 || this.slider.options.preload === 'all') && this.index < this.view.slideList.length - 1){
            this.view.slideList[this.index + 1].loadImages();
        }
        else if(this.slider.options.preload === 'all' && this.index === this.view.slideList.length - 1)
            this.slider._removeLoading();

    };

    /*
     p.updateLayers = function(){
     if(!this.hasLayers) return;

     var value = -parseInt(this.$element.css('left')) - this.view.__contPos;

     this.$layers[0].style.opacity = (1 - Math.abs(value / this.__width));
     //this.$layers.css('opacity' ,  1 - Math.abs(value / this.__width));
     };
     */

    p.startLayers = function(){
        for(var i = 0 , l = this.layers.length; i < l; ++i)
            this.layers[i].start();
    };

    p.initLayers = function(force){
        if(this.init && !force || this.slider.init_safemode) return;
        this.init = true;
        for(var i = 0 , l = this.layers.length; i < l; ++i)
            this.layers[i].init();
    };

    p.locateLayers = function(){
        for(var i = 0 , l = this.layers.length; i < l; ++i)
            this.layers[i].locate();
    };

    p.resetLayers = function(){
        this.$layers.css('display' , 'none');
        this.$layers.css('opacity' ,  1);
        for(var i = 0 , l = this.layers.length; i < l; ++i)
            this.layers[i].reset();
    };

    p.hideLayers = function(){
        if(this.preloadCount !== 0) return;
        for(var i = 0 , l = this.layers.length; i < l; ++i)
            this.layers[i].hide();
    };

    p.showLayers = function(){
        if(!this.hasLayers) return;

        if(this.lht){
            if(this.lht.reset)
                this.lht.reset();
            else
                this.lht.stop('true');
        }


        this.resetLayers();
        this.$layers.css('opacity' ,  1)
            .css('display' , '');


        if(this.preloadCount === 0){
            this.initLayers();
            this.locateLayers();
            this.startLayers();
        }
    }

    /* -----------------------------------------------------*/
    p.applyParallax = function(x, y, fast){
        for(var i = 0 , l = this.layers.length; i !== l; ++i){
            if( this.layers[i].parallax != null ){
                this.layers[i].moveParallax(x, y, fast);
            }
        }
    };

    p.enableParallaxEffect = function(){

        if( !this.hasParallaxLayer ){
            return;
        }

        if( this.slider.options.parallaxMode === 'swipe' ){
            this.view.addEventListener(MSViewEvents.SCROLL, this.swipeParallaxMove, this);
        } else {
            this.$element.on('mousemove' , {that:this}, this.mouseParallaxMove)
                .on('mouseleave', {that:this}, this.resetParalax);
            /**
             * Calculates new position of parallax based on device orintation gamma and beta
             * @param  {Event} e
             * @since 1.6.0
             */
            /*if( window._mobile && window.DeviceOrientationEvent ){

             var that = this;
             this.orientationParallaxMove = function(e){
             var beta = Math.round(e.beta),
             gamma = Math.round(e.gamma);

             that.applyParallax(beta * that.__width / 360 , -gamma * that.__height / 360);
             };

             window.addEventListener('deviceorientation', this.orientationParallaxMove, false);
             }*/
        }
    };

    p.disableParallaxEffect = function(){

        if( !this.hasParallaxLayer ){
            return;
        }

        if( this.slider.options.parallaxMode === 'swipe' ){
            this.view.removeEventListener(MSViewEvents.SCROLL, this.swipeParallaxMove, this);
        } else {
            this.$element.off('mousemove', this.mouseParallaxMove)
                .off('mouseleave', this.resetParalax);

            /*if( window._mobile && window.DeviceOrientationEvent ){
             window.removeEventListener('deviceorientation', this.orientationParallaxMove);
             }*/
        }
    };

    p.resetParalax = function(e){
        var that = e.data.that;
        that.applyParallax(0,0);
    };

    /**
     * Calculates new mouse position over slide and moves layers
     * @since 1.6.0
     */
    p.mouseParallaxMove = function(e){
        var that = e.data.that,
            os = that.$element.offset(),
            slider = that.slider;

        if( slider.options.parallaxMode !== 'mouse:y-only' ){
            var x = e.clientX - os.left - that.__width  / 2;
        } else {
            var x = 0;
        }

        if( slider.options.parallaxMode !== 'mouse:x-only' ){
            var y = e.clientY - os.top  - that.__height / 2;
        } else {
            var y = 0;
        }

        that.applyParallax(-x, -y);
    };


    /**
     * Calculates new position of parallax based on slide position
     * @param  {Event} e
     * @since 1.6.0
     */
    p.swipeParallaxMove = function(e){
        var value = this.position - this.view.__contPos;
        this.applyParallax(value, 0, true);
    };

    /* -----------------------------------------------------*/

    p.setBG = function(img){
        this.hasBG = true;
        var that = this;

        this.$imgcont = $('<div></div>').addClass('ms-slide-bgcont');

        this.$element.append(this.$loading)
            .append(this.$imgcont);

        this.$bg_img = $(img).css('visibility' , 'hidden');
        this.$imgcont.append(this.$bg_img);

        this.bgAligner = new MSAligner(that.fillMode , that.$imgcont, that.$bg_img );
        this.bgAligner.widthOnly = this.slider.options.autoHeight;

        if(that.slider.options.autoHeight && (that.pselected || that.selected))
            that.slider.setHeight(that.slider.options.height);

        if(this.$bg_img.data('src') !== undefined){
            this.bg_src = this.$bg_img.data('src');
            this.$bg_img.removeAttr('data-src');
        }else{
            this.$bg_img.one('load', function(event) {that._onBGLoad(event);})
                .each($.jqLoadFix);
        }

        this.preloadCount++;
    };

    p._onBGLoad = function(event){
        this.bgNatrualWidth = event.width;
        this.bgNatrualHeight = event.height;

        this.bgLoaded = true;

        if($.browser.msie)
            this.$bg_img.on('dragstart', function(event) { event.preventDefault(); }); // disables native dragging

        this.preloadCount--;
        if(this.preloadCount === 0){
            this.___onlayersReady();
        }
    };

    p.loadImages = function(){
        if(this.ls)return;

        this.ls = true;

        // @since 1.7.0
        // There is nothing to preload? so slide is ready to show.
        if( this.preloadCount === 0 ){
            this.___onlayersReady();
        }

        if(this.bgvideo)
            this.bgvideo.load();

        if(this.hasBG && this.bg_src){
            var that = this;
            this.$bg_img.preloadImg(this.bg_src , function(event) {that._onBGLoad(event);});
        }

        for(var i = 0 , l = this.layers.length; i < l; ++i){
            if(this.layers[i].needPreload)this.layers[i].loadImage();
        }

    };

    /* -----------------------------------------------------*/

    p.setBGVideo = function($video){
        if(!$video[0].play) return;

        // disables video in mobile devices
        if(window._mobile){
            $video.remove();
            return;
        }

        this.bgvideo  = $video[0];
        var that = this;

        $video.addClass('ms-slide-bgvideo');

        if($video.data('loop') !== false){
            this.bgvideo.addEventListener('ended' , function(){
                //that.bgvideo.currentTime = -1;
                that.bgvideo.play();
            });
        }

        if($video.data('mute') !== false){
            this.bgvideo.muted = true;
        }

        if($video.data('autopause') === true){
            this.autoPauseBgVid = true;
        }

        this.bgvideo_fillmode = $video.data('fill-mode') || 'fill'; // fill , fit , none

        if(this.bgvideo_fillmode !== 'none') {
            this.bgVideoAligner = new MSAligner(this.bgvideo_fillmode , this.$element, $video );

            this.bgvideo.addEventListener('loadedmetadata' , function(){
                if(that.vinit) return;

                that.vinit = true;
                that.video_aspect = that.bgVideoAligner.baseHeight/that.bgVideoAligner.baseWidth;
                that.bgVideoAligner.init(that.bgvideo.videoWidth , that.bgvideo.videoHeight);

                //alert(that.bgvideo.videoWidth + ' ' + that.selected)
                that._alignBGVideo();
                CTween.fadeIn($(that.bgvideo) , 200);
                if(that.selected)
                    that.bgvideo.play();
            });
        }

        $video.css('opacity' , 0);

        this.$bgvideocont = $('<div></div>').addClass('ms-slide-bgvideocont').append($video);

        if(this.hasBG){
            this.$imgcont.before(this.$bgvideocont);
        }else{
            this.$bgvideocont.appendTo(this.$element);
        }
    };

    p._alignBGVideo = function(){
        if(!this.bgvideo_fillmode || this.bgvideo_fillmode === 'none') return;
        this.bgVideoAligner.align();
    };

    /* -----------------------------------------------------*/

    p.setSize = function(width , height , hard){

        this.__width  = width;

        if(this.slider.options.autoHeight){
            if(this.bgLoaded){
                this.ratio = this.__width / this.bgWidth;
                height = Math.floor(this.ratio * this.bgHeight);
                this.$imgcont.height(height);
            }else{
                this.ratio = width / this.slider.options.width;
                height = this.slider.options.height * this.ratio;
            }
        }

        this.__height = height;
        this.$element.width(width).height(height);


        if(this.hasBG && this.bgLoaded)this.bgAligner.align();
        this._alignBGVideo();

        if(hard && this.selected) this.initLayers(hard);
        if(this.selected) this.locateLayers();

        if(this.hasLayers){
            if(this.slider.options.autoHeight){
                this.$layers[0].style.height = this.getHeight() + 'px';
            }

            if(this.slider.options.layersMode == 'center')
                this.$layers[0].style.left = Math.max( 0 ,  (this.__width - this.slider.options.width) / 2 ) + 'px';
        }
    };


    p.getHeight = function(){
        if( this.hasBG && this.bgLoaded ) return this.bgHeight * this.ratio;
        return Math.max(this.$element[0].clientHeight, this.slider.options.height * this.ratio);
    };

    /* -----------------------------------------------------*/
    // YouTube and Vimeo videos
    p.__playVideo = function(){
        if(this.vplayed || this.videodis) return;
        this.vplayed = true;
        if(!this.slider.api.paused){
            this.slider.api.pause();
            this.roc = true; // resume on close;
        }
        this.vcbtn.css('display' , '');
        CTween.fadeOut(this.vpbtn 	, 500 , false);
        CTween.fadeIn(this.vcbtn 	, 500);
        CTween.fadeIn(this.vframe 	, 500);
        this.vframe.css('display' , 'block').attr('src' , this.video + '&autoplay=1');
        this.view.$element.addClass('ms-def-cursor');
        this.view.swipeControl.disable();

        this.slider.slideController.dispatchEvent(new MSSliderEvent(MSSliderEvent.VIDEO_PLAY));
    };

    p.__closeVideo = function(){
        if(!this.vplayed) return;
        this.vplayed = false;
        if(this.roc)
            this.slider.api.resume();
        var that = this;

        CTween.fadeIn(this.vpbtn	, 500);
        CTween.animate(this.vcbtn   , 500 , {opacity:0} , {complete:function(){	that.vcbtn.css  ('display'  , 'none'); }});
        CTween.animate(this.vframe  , 500 , {opacity:0} , {complete:function(){	that.vframe.attr('src'  , 'about:blank').css('display'  , 'none');}});

        this.view.swipeControl.enable();
        this.view.$element.removeClass('ms-def-cursor');
        this.slider.slideController.dispatchEvent(new MSSliderEvent(MSSliderEvent.VIDEO_CLOSE));
    };

    /* -----------------------------------------------------*/

    p.create = function(){
        var that = this;
        if(this.hasLayers){
            this.$element.append(this.$layers);

            if(this.slider.options.layersMode == 'center')
                this.$layers.css('max-width' , this.slider.options.width + 'px');
        }

        if(this.link){
            this.$element.css('cursor' , 'pointer')
                .click(function(){ if(!that.linkdis) window.open(that.link , that.link_targ || '_self'); });
        }

        if(this.video){

            if(this.video.indexOf('?') === -1) this.video += '?';
            this.vframe = $('<iframe></iframe>')
                .addClass('ms-slide-video')
                .css({width:'100%' , height:'100%' , display:'none'})
                .attr('src' , 'about:blank')
                .appendTo(this.$element);

            this.vpbtn = $('<div></div>')
                .addClass('ms-slide-vpbtn')
                .click(function(){that.__playVideo();})
                .appendTo(this.$element);

            this.vcbtn = $('<div></div>')
                .addClass('ms-slide-vcbtn')
                .click(function(){that.__closeVideo();})
                .appendTo(this.$element)
                .css('display','none');

            if(window._touch){
                this.vcbtn.removeClass('ms-slide-vcbtn')
                    .addClass('ms-slide-vcbtn-mobile')
                    .append('<div class="ms-vcbtn-txt">Close video</div>')
                    .appendTo(this.view.$element.parent());
            }
        }

        if(!this.slider.options.autoHeight && this.hasBG){
            this.$imgcont.css('height' , '100%');

            if(this.fillMode === 'center' || this.fillMode === 'stretch')
                this.fillMode = 'fill';
        }

        if( this.slider.options.autoHeight ) {
            this.$element.addClass('ms-slide-auto-height');
        }


        this.sleep(true);
    };


    p.destroy = function(){
        for(var i = 0 , l = this.layers.length; i < l; ++i)
            this.layers[i].$element.stop(true).remove();
        this.$element.remove();
        this.$element = null;
    };

    p.setup = function(){

        //if(this.isSettedup) return;
        //this.isSettedup = true;

        if(!this.initBG && this.bgLoaded){
            this.initBG = true;
            this.$bg_img.css('visibility' , '');
            this.bgWidth  = this.bgNatrualWidth  || this.$bg_img.width();
            this.bgHeight = this.bgNatrualHeight || this.$bg_img.height();

            CTween.fadeIn(this.$imgcont , 300);

            if(this.slider.options.autoHeight)
                this.$imgcont.height(this.bgHeight * this.ratio);

            this.bgAligner.init(this.bgWidth  , this.bgHeight );
            this.setSize(this.__width , this.__height);

            if(this.slider.options.autoHeight && (this.pselected || this.selected))
                this.slider.setHeight(this.getHeight());
        }

    };

    p.prepareToSelect = function(){
        if(this.pselected || this.selected) return;
        this.pselected = true;

        if(this.link || this.video){
            this.view.addEventListener(MSViewEvents.SWIPE_START  , this.onSwipeStart  , this);
            this.view.addEventListener(MSViewEvents.SWIPE_CANCEL , this.onSwipeCancel , this);
        }

        this.loadImages();

        if(this.preloadCount === 0){
            if( this.bgvideo ){
                this.bgvideo.play();
            }

            if( this.slider.options.instantStartLayers){
                this.showLayers();
            }
        }

        // enables parallax effect
        // @since 1.6.0
        this.enableParallaxEffect();

        if( this.moz ){
            this.$element.css('margin-top' , '');
        }
    };

    /*p.prepareToUnselect = function(){
     if(!this.pselected || !this.selected) return;

     this.pselected = false;

     };*/

    p.select = function(){
        if(this.selected) return;
        this.selected = true;
        this.pselected = false;

        this.$element.addClass('ms-sl-selected');

        if(this.hasLayers){
            if(this.slider.options.autoHeight)
                this.$layers[0].style.height = this.getHeight() + 'px';

            if( !this.slider.options.instantStartLayers ) {
                this.showLayers();
            }

            //this.view.addEventListener(MSViewEvents.SCROLL 		, this.updateLayers  , this)
        }

        if( this.preloadCount === 0 && this.bgvideo ) {
            this.bgvideo.play();
        }
    };

    p.unselect = function(){
        this.pselected = false;

        if(this.moz)
            this.$element.css('margin-top' , '0.1px');

        if(this.link || this.video){
            this.view.removeEventListener(MSViewEvents.SWIPE_START 	, this.onSwipeStart  , this);
            this.view.removeEventListener(MSViewEvents.SWIPE_CANCEL  , this.onSwipeCancel , this);
        }

        if(this.bgvideo){
            this.bgvideo.pause();
            if(!this.autoPauseBgVid && this.vinit)
                this.bgvideo.currentTime = 0;
        }

        // hide layers
        if( this.hasLayers && (this.selected || this.slider.options.instantStartLayers) ){
            var that = this;
            that.lht = CTween.animate(this.$layers ,500 , {opacity:0} , {complete:function(){	that.resetLayers();	}});
            //this.view.removeEventListener(MSViewEvents.SCROLL 		, this.updateLayers  , this);

            // disables parallax effect
            // @since 1.6.0
            this.disableParallaxEffect();
        }

        if(!this.selected) return;
        this.selected = false;

        this.$element.removeClass('ms-sl-selected');

        if(this.video && this.vplayed){
            this.__closeVideo();
            this.roc = false;
        }

    };

    p.sleep = function(force){
        if(this.isSleeping && !force) return;
        this.isSleeping = true;
        if(this.autoAppend)
            this.$element.detach();
    };

    p.wakeup = function(){
        if(!this.isSleeping) return;
        this.isSleeping = false;

        if(this.autoAppend)
            this.view.$slideCont.append(this.$element);

        if(this.moz)
            this.$element.css('margin-top' , '0.1px');

        this.setup();

        // aling bg
        if(this.hasBG)
            this.bgAligner.align();
    };

})(jQuery);//dev\slider\SlideController.js

;(function($){

    "use strict";

    var SliderViewList = {};

    window.MSSlideController = function(slider){

        this._delayProgress		= 0;

        this._timer 			= new averta.Timer(100);
        this._timer.onTimer 	= this.onTimer;
        this._timer.refrence 	= this;

        this.currentSlide		= null;

        this.slider 	= slider;
        this.so 		= slider.options;

        averta.EventDispatcher.call(this);

    };

    MSSlideController.registerView = function(name , _class){
        if(name in SliderViewList){
            throw new Error( name + ', is already registered.');
            return;
        }

        SliderViewList[name] = _class;
    };

    MSSlideController.SliderControlList = {};
    MSSlideController.registerControl = function(name , _class){
        if(name in MSSlideController.SliderControlList){
            throw new Error( name + ', is already registered.');
            return;
        }

        MSSlideController.SliderControlList[name] = _class;
    };

    var p = MSSlideController.prototype;

    /*-------------- METHODS --------------*/


    p.setupView = function(){

        var that = this;
        this.resize_listener = function(){that.__resize();};

        // in @version 1.5.7 it will be added in Masterslider.js _setupSliderLayout function
        //$(window).bind('resize', this.resize_listener);

        //if(this.so.smoothHeight) this.so.autoHeight = true;

        var viewOptions = {
            spacing: 		this.so.space,
            mouseSwipe:		this.so.mouse,
            loop:			this.so.loop,
            autoHeight:		this.so.autoHeight,
            swipe:			this.so.swipe,
            speed:			this.so.speed,
            dir:			this.so.dir,
            viewNum: 		this.so.inView,
            critMargin: 	this.so.critMargin
        };

        if(this.so.viewOptions)
            $.extend(viewOptions , this.so.viewOptions);

        if(this.so.autoHeight) this.so.heightLimit = false;

        //this.view.slideDuration = this.so.duration;

        var viewClass = SliderViewList[this.slider.options.view] || MSBasicView;
        if(viewClass._3dreq && (!window._css3d || $.browser.msie) ) viewClass = viewClass._fallback || MSBasicView;

        this.view = new viewClass(viewOptions);

        if(this.so.overPause){
            var that = this;
            this.slider.$element.mouseenter(function(){
                that.is_over = true;
                that._stopTimer();
            }).mouseleave(function(){
                that.is_over = false;
                that._startTimer();
            });
        }

    };

    p.onChangeStart = function(){

        this.change_started = true;

        if(this.currentSlide) this.currentSlide.unselect();
        this.currentSlide = this.view.currentSlide;
        this.currentSlide.prepareToSelect();
        //this.__appendSlides();
        if(this.so.endPause && this.currentSlide.index === this.slider.slides.length - 1){
            this.pause();
            //this._timer.reset();
            this.skipTimer();
        }

        if(this.so.autoHeight){
            this.slider.setHeight(this.currentSlide.getHeight());
        }

        this.dispatchEvent(new MSSliderEvent(MSSliderEvent.CHANGE_START));
    };

    p.onChangeEnd = function(){
        //if(!this.currentSlide.selected)
        //	this._timer.reset();
        this.change_started = false;

        this._startTimer();
        this.currentSlide.select();

        if(this.so.preload > 1){
            var loc ,i , l = this.so.preload - 1;

            // next slides
            for(i=1;i<=l;++i){
                loc = this.view.index + i;

                if(loc >= this.view.slideList.length) {
                    if(this.so.loop){
                        loc = loc - this.view.slideList.length;
                    }else{
                        i = l;
                        continue;
                    }
                }
                this.view.slideList[loc].loadImages();
            }

            // previous slides
            if(l > this.view.slideList.length/2)
                l = Math.floor(this.view.slideList.length/2);

            for(i=1;i<=l;++i){

                loc = this.view.index - i;

                if(loc < 0){
                    if(this.so.loop){
                        loc = this.view.slideList.length + loc;
                    }else{
                        i = l;
                        continue;
                    }
                }
                this.view.slideList[loc].loadImages();
            }
        }

        this.dispatchEvent(new MSSliderEvent(MSSliderEvent.CHANGE_END));

    };

    p.onSwipeStart = function(){
        //this._timer.reset();
        this.skipTimer();
    };

    p.skipTimer = function(){
        this._timer.reset();
        this._delayProgress  = 0;
        this.dispatchEvent(new MSSliderEvent(MSSliderEvent.WAITING));
    };

    p.onTimer = function(time) {

        if(this._timer.getTime() >= this.view.currentSlide.delay * 1000){
            //this._timer.reset();
            this.skipTimer();
            this.view.next();
            this.hideCalled = false;
        }
        this._delayProgress = this._timer.getTime() / (this.view.currentSlide.delay * 10);

        if(this.so.hideLayers && !this.hideCalled && this.view.currentSlide.delay * 1000 - this._timer.getTime() <= 300){
            this.view.currentSlide.hideLayers();
            this.hideCalled = true;
        }

        this.dispatchEvent(new MSSliderEvent(MSSliderEvent.WAITING));
    };

    p._stopTimer = function(){
        if(this._timer)
            this._timer.stop();
    };

    p._startTimer = function(){
        if(!this.paused && !this.is_over && this.currentSlide && this.currentSlide.ready && !this.change_started)
            this._timer.start();
    };

    p.__appendSlides = function(){
        var slide , loc , i = 0 , l = this.view.slideList.length -1;

        // detach all
        for ( i ; i < l ; ++i){
            slide = this.view.slideList[i];
            if(!slide.detached){
                slide.$element.detach();
                slide.detached = true;
            }
        }

        // append current slide
        this.view.appendSlide(this.view.slideList[this.view.index]);

        l = 3;

        // next slides
        for(i=1;i<=l;++i){
            loc = this.view.index + i;

            if(loc >= this.view.slideList.length) {
                if(this.so.loop){
                    loc = loc - this.view.slideList.length;
                }else{
                    i = l;
                    continue;
                }
            }

            slide = this.view.slideList[loc];
            slide.detached = false;
            this.view.appendSlide(slide);

        }

        // previous slides
        if(l > this.view.slideList.length/2)
            l = Math.floor(this.view.slideList.length/2);

        for(i=1;i<=l;++i){

            loc = this.view.index - i;

            if(loc < 0){
                if(this.so.loop){
                    loc = this.view.slideList.length + loc;
                }else{
                    i = l;
                    continue;
                }
            }

            slide = this.view.slideList[loc];
            slide.detached = false;
            this.view.appendSlide(slide);
        }

    }

    p.__resize = function(hard){
        if(!this.created) return;

        this.width = this.slider.$element[0].clientWidth || this.so.width;

        if(!this.so.fullwidth){
            this.width = Math.min(this.width , this.so.width);
            //this.view.$element.css('left' , (this.slider.$element[0].clientWidth - this.width) / 2 + 'px');
        }

        if( this.so.fullheight ){
            this.so.heightLimit = false;
            this.so.autoHeight = false;
            this.height = this.slider.$element[0].clientHeight;
        } else {
            this.height = this.width / this.slider.aspect;
        }

        if( this.so.autoHeight ){
            this.currentSlide.setSize(this.width , null , hard);
            this.view.setSize(this.width , this.currentSlide.getHeight() , hard);
        } else {
            this.view.setSize(this.width , (this.so.heightLimit ? Math.min(this.height , this.so.height) : this.height) , hard);
        }

        if(this.slider.$controlsCont){
            if(this.so.centerControls && this.so.fullwidth) {
                this.view.$element.css('left' , Math.min(0,-(this.slider.$element[0].clientWidth - this.so.width) / 2) + 'px');
            }
        }

        this.dispatchEvent(new MSSliderEvent(MSSliderEvent.RESIZE));
    };

    p.__dispatchInit = function(){
        this.dispatchEvent(new MSSliderEvent(MSSliderEvent.INIT));
    };

    p.setup = function(){

        this.created = true;
        this.paused = !this.so.autoplay;

        //this.slider.$element.append(this.view.$element);
        this.view.addEventListener(MSViewEvents.CHANGE_START , this.onChangeStart , this);
        this.view.addEventListener(MSViewEvents.CHANGE_END   , this.onChangeEnd   , this);
        this.view.addEventListener(MSViewEvents.SWIPE_START  , this.onSwipeStart  , this);

        //this.currentSlide = this.view.slides[this.so.start - 1];
        this.currentSlide = this.view.slideList[this.so.start - 1];
        this.__resize();
        this.view.create(this.so.start - 1);

        if(this.so.preload === 0)
            this.view.slideList[0].loadImages();

        this.scroller = this.view.controller;

        if(this.so.wheel){
            var that = this;
            var last_time = new Date().getTime();
            this.wheellistener = function(event){
                var current_time = new Date().getTime();
                if(current_time - last_time < 350) return;
                last_time = current_time;
                var e = window.event || event.orginalEvent || event;
                var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
                if(delta < 0)		that.next();
                else if(delta > 0)	that.previous();
                return false;
            };

            if($.browser.mozilla) this.slider.$element[0].addEventListener('DOMMouseScroll' , this.wheellistener);
            else this.slider.$element.bind('mousewheel', this.wheellistener);
        }

        if(this.slider.$element[0].clientWidth === 0)
            this.slider.init_safemode = true;

        this.__resize();
    };

    p.index = function(){
        return this.view.index;
    };

    p.count = function(){
        return this.view.slidesCount;
    };

    p.next = function(){
        this.skipTimer();
        this.view.next();
    };

    p.previous = function(){
        this.skipTimer();
        this.view.previous();
    };

    p.gotoSlide = function(index) {
        index = Math.min(index, this.count()-1);
        this.skipTimer();
        this.view.gotoSlide(index);
    };

    p.destroy = function(reset){
        this.slider.destroy(reset);
    };

    p._destroy = function(){
        this._timer.reset();
        this._timer = null;

        $(window).unbind('resize', this.resize_listener);
        this.view.destroy();
        this.view = null;

        if(this.so.wheel){
            if($.browser.mozilla) this.slider.$element[0].removeEventListener('DOMMouseScroll' , this.wheellistener);
            else this.slider.$element.unbind('mousewheel', this.wheellistener);
            this.wheellistener = null;
        }

        this.so = null;
    };

    /**
     * run layer actions like next, previous,...
     * @param  {String} action
     * @since v1.7.2
     */
    p.runAction = function(action){
        var actionParams = [];

        if( action.indexOf('(') !== -1 ){
            var temp = action.slice(0 , action.indexOf('('));
            actionParams = action.slice(action.indexOf('(') + 1 , -1).replace(/\"|\'|\s/g , '').split(',');
            action   = temp;
        }

        if ( action in this ){
            this[action].apply(this, actionParams);
        } else if ( console ){
            console.log('Master Slider Error: Action "'+action+'" not found.');
        }
    };

    p.update = function(hard){
        if(this.slider.init_safemode && hard)
            this.slider.init_safemode = false;
        this.__resize(hard);
    };

    p.locate = function(){
        this.__resize();
    };

    p.resume = function(){
        if(!this.paused) return;
        this.paused = false;
        this._startTimer();
    };

    p.pause = function(){
        if(this.paused) return;
        this.paused = true;
        this._stopTimer();
    };

    p.currentTime = function(){
        return this._delayProgress;
    };

    averta.EventDispatcher.extend(p);
})(jQuery);
//dev\slider\MasterSlider.js

/**
 * Master Slider Main JavaScript File
 * @version 1.7.2
 * @author Averta Ltd.
 */

;(function($){

    "use strict";

    var LayerTypes = {
        'image' 	: MSImageLayerElement,
        'text'  	: MSLayerElement,
        'video' 	: MSVideoLayerElement,
        'hotspot'	: MSHotspotLayer,
        'button'	: MSButtonLayer
    };

    window.MasterSlider = function(){

        // Default Options
        this.options = {
            autoplay 			: false,      // Enables the autoplay slideshow.
            loop 				: false,	  // Enables the continuous sliding mode.
            mouse				: true,		  // Whether the user can use mouse drag navigation.
            swipe				: true,		  // Whether the drag/swipe navigation is enabled.
            grabCursor			: true,		  // Whether the slider uses grab mouse cursor.
            space  				: 0,		  // The spacing value between slides in pixels.
            fillMode			: 'fill',  	  // Specifies the slide background scaling method. Its acceptable values are "fill", "fit", "stretch", "center" and "tile".
            start				: 1,		  // The slider starting slide number.
            view				: 'basic',	  // The slide changing transition.
            width				: 300,		  // The base width of slides. It helps the slider to resize in correct ratio.
            height				: 150,		  // The base height of slides, It helps the slider to resize in correct ratio.
            inView				: 15, 		  // Specifies number of slides which will be added at a same time in DOM.
            critMargin			: 1,		  //
            heightLimit			: true,		  // It force the slide to use max height value as its base specified height value.
            smoothHeight		: true,		  // Whether the slider uses smooth animation while its height changes.
            autoHeight			: false,      // Whether the slider adapts its height to each slide height or not. It overrides heightLimit option.
            fullwidth			: false,	  // It enables the slider to adapt width to its parent element. It's very useful for creating full-width sliders. In default it takes max width as its base width value.
            fullheight			: false,	  // It enables the slider to adapt height to its parent element.
            autofill			: false,	  // It enables the slider to adapt width and height to its parent element, It's very useful for creating fullscreen or fullwindow slider.
            layersMode			: 'center',	  // It accepts two values "center" and "full". The "center" value indicates that the slider aligns layers to the center. This option is only effective in full width mode.
            hideLayers			: false,	  // Whether the slider hides all layers before changing slide.
            endPause			: false,	  // Whether the slider pauses slideshow when it stays at the last slide.
            centerControls 		: true,		  // Whether the slider aligns UI controls to center. This option is only effective in full width mode.
            overPause			: true,		  // Whether the slider pauses slideshow on hover.
            shuffle				: false,	  // Enables the shuffle slide order.
            speed				: 17, 		  // Specifies slide changing speed. It accepts float values between 0 and 100.
            dir					: 'h',		  // Specifies slide changing direction. It accepts two values "h" (horizontal) and "v" (vertical).
            preload				: 0,		  // Specifies number of slides which will be loaded by slider. 0 value means the slider loads slides in sequence.
            wheel				: false,	  // Whether slider uses mouse wheel for navigation.
            layout				: 'boxed',	  // It accepts 'fullwidth', 'fullscreen', 'fillwidth', 'autofill', 'partialview', 'boxed'. It overrides 'fullwidth' and 'autofill' (added in v1.5.6)
            fullscreenMargin	: 0,
            instantStartLayers	: false, 	  // @since 1.5.0, Whether instantly shows slide layers.
            parallaxMode 		: 'mouse'	  // @since 1.6.0, Specifies mode of parallax effect accepts: "mouse", "mouse:x-only", "mouse:y-only" and "swipe"
        };

        this.slides = [];
        this.$element = null;

        // used by new layout method. to force fullwidth or fullscreen
        this.lastMargin = 0;

        // Reserved side spaces of slider
        this.leftSpace = 0;
        this.topSpace = 0;
        this.rightSpace = 0;
        this.bottomSpace = 0;

        var that = this;
        this.resize_listener = function(){that._resize();};
        $(window).bind('resize', this.resize_listener);

    };

    MasterSlider.author  		= 'Averta Ltd. (www.averta.net)';
    MasterSlider.version 		= '1.7.2';
    MasterSlider.releaseDate 	= 'July 2014';

    var p = MasterSlider.prototype;

    /*-------------- METHODS --------------*/

    /**
     * create one slide object for each slide and add it to slide controller
     * @since 1.0
     * @private
     */
    p.__setupSlides = function(){
        var that = this,
            new_slide,
            ind = 0;

        this.$element.children('.ms-slide').each(function(index) {

            var $slide_ele = $(this);

            new_slide 			= new MSSlide();
            new_slide.$element 	= $slide_ele;
            new_slide.slider 	= that;
            new_slide.delay  	= $slide_ele.data('delay') 		!== undefined ? $slide_ele.data('delay') 		: 3;
            new_slide.fillMode 	= $slide_ele.data('fill-mode')	!== undefined ? $slide_ele.data('fill-mode') 	: that.options.fillMode;
            new_slide.index 	= ind++;

            // Slide Background Image
            var slide_img = $slide_ele.children('img:not(.ms-layer)');
            if( slide_img.length > 0 ){
                new_slide.setBG(slide_img[0]);
            }

            // Slide Video Background
            var slide_video = $slide_ele.children('video');
            if( slide_video.length > 0 ) new_slide.setBGVideo(slide_video);

            // controls
            if(that.controls){
                for(var i = 0 , l = that.controls.length; i<l ; ++i)
                    that.controls[i].slideAction(new_slide);
            }

            // Slide Link and Video
            var slide_link = $slide_ele.children('a').each(function(index) {
                var $this = $(this);
                if(this.getAttribute('data-type') === 'video'){
                    new_slide.video = this.getAttribute('href');
                    $this.remove();
                }else if(!$this.hasClass('ms-layer')) {
                    new_slide.link  = this.getAttribute('href');
                    new_slide.link_targ = this.getAttribute('target');
                    $this.remove();
                }
            });//.remove();

            // Slide Layers
            that.__createSlideLayers(new_slide , $slide_ele.find('.ms-layer'));

            that.slides.push(new_slide);
            that.slideController.view.addSlide(new_slide);

        });
    };

    /**
     * Creates layers of specified layer
     * @param  {MSSlide} slide
     * @param  {Array} layers
     * @since 1.0
     * @private
     */
    p.__createSlideLayers = function(slide , layers) {
        if(layers.length == 0) return;

        layers.each(function(index , domEle){
            var $layer_element = $(this),
                $parent_ele;

            if( domEle.nodeName === 'A' && $layer_element.find('>img').data('type') === 'image' ) {
                $parent_ele = $(this);
                $layer_element = $parent_ele.find('img');
            }

            var layer = new (LayerTypes[$layer_element.data('type') || 'text']) ();
            layer.$element = $layer_element;
            layer.link = $parent_ele;

            var eff_parameters = {},
                end_eff_parameters = {};

            if($layer_element.data('effect') 	!== undefined)		eff_parameters.name 			= $layer_element.data('effect');
            if($layer_element.data('ease')		!== undefined) 		eff_parameters.ease 			= $layer_element.data('ease');
            if($layer_element.data('duration')  !== undefined)  	eff_parameters.duration 		= $layer_element.data('duration');
            if($layer_element.data('delay')   	!== undefined)   	eff_parameters.delay			= $layer_element.data('delay');

            if($layer_element.data('hide-effect'))		    		end_eff_parameters.name 		= $layer_element.data('hide-effect');
            if($layer_element.data('hide-ease'))		   			end_eff_parameters.ease 		= $layer_element.data('hide-ease');
            if($layer_element.data('hide-duration') !== undefined)  end_eff_parameters.duration		= $layer_element.data('hide-duration');
            if($layer_element.data('hide-time') 	!== undefined)  end_eff_parameters.time 		= $layer_element.data('hide-time');

            layer.setStartAnim(eff_parameters);
            layer.setEndAnim(end_eff_parameters);

            slide.addLayer(layer);

        });

    };

    /**
     * remove slider initialize loading
     * @since 1.0
     * @private
     */
    p._removeLoading = function(){
        $(window).unbind('resize', this.resize_listener);
        this.$element = $('#' + this.id).removeClass('before-init')
            .css('visibility', 'visible')
            .css('height','')
            .css('opacity' , 0);
        CTween.fadeIn(this.$element);
        this.$loading.remove();

        if(this.slideController)
            this.slideController.__resize();
    };

    /**
     * resize listener, it only used for aligning slider loading and after slider init it will be removed
     * @param  {Event} e
     * @since 1.0
     * @private
     */
    p._resize = function(e){
        if(this.$loading){
            var h = this.$loading[0].clientWidth / this.aspect;
            h = this.options.heightLimit ? Math.min(h , this.options.height) : h;

            this.$loading.height(h);
            this.$element.height(h);
        }
    };

    /**
     * changes the order of slides element before setup slides
     * @since 1.0
     * @private
     */
    p._shuffleSlides = function(){
        var slides = this.$element.children('.ms-slide') , r;

        for(var i = 0 , l = slides.length; i < l ; ++i){
            r = Math.floor(Math.random() * (l - 1));
            if(i != r){
                this.$element[0].insertBefore(slides[i] , slides[r]);
                slides = this.$element.children('.ms-slide');
            }
        }
    };

    /**
     * New method of setting up the layout of slider
     * @since 1.5.6
     */
    p._setupSliderLayout = function(){

        // create side spaces
        this._updateSideMargins();
        this.lastMargin = this.leftSpace;

        var lo = this.options.layout;

        if( lo !== 'boxed' && lo !== 'partialview' ){
            this.options.fullwidth = true;  // enable slider fullscreen for fullwidth, fillwidth, autofill and fullscreen layouts.
        }

        if( lo === 'fullscreen' || lo === 'autofill' ){
            this.options.fullheight = true;
        }

        // partial view
        if ( lo === 'partialview' ){
            this.$element.addClass('ms-layout-partialview');
        }

        if( lo === 'fullscreen' ||  lo === 'fullwidth' ){
            $(window).bind('resize', {that:this}, this._updateLayout);
            this._updateLayout();
        }

        // bind resize handler of slidecontroller __resize
        $(window).bind('resize', this.slideController.resize_listener);
    };

    /**
     * updates layout of slider based on window size
     * @param  {Event} event
     * @since 1.5.6
     */
    p._updateLayout = function(event){
        var that = event? event.data.that : this,
            lo = that.options.layout,
            $element = that.$element;

        // width
        $element.width($('body').innerWidth() - that.leftSpace - that.rightSpace);
        var margin = -$element.offset().left + that.leftSpace + that.lastMargin;
        $element.css('margin-left', margin );
        that.lastMargin = margin;

        // height
        if( lo === 'fullscreen' ){
            $element.height(window.innerHeight - that.options.fullscreenMargin - that.topSpace - that.bottomSpace);
        }
    };


    /**
     * initialize the slider, called by document ready
     * <code>preventInit</code> property prevents auto initialize slider after document ready it used by plugins of slider like Flickr
     * @since 1.0
     * @protected
     */
    p._init = function(){

        _debug && console.log("MasterSlider::_init");

        if(this.preventInit) return;

        _debug && console.log("MasterSlider::preventInit pass");

        this.initialized = true;

        if(this.options.preload !== 'all')
            this._removeLoading();
        //else
        //	this.$element.css('width' , this.$loading[0].clientWidth);

        if(this.options.shuffle) 	this._shuffleSlides();

        MSLayerEffects.setup();

        this.slideController.setupView();
        this.view = this.slideController.view;

        this.$controlsCont = $('<div></div>').addClass('ms-inner-controls-cont').addClass('dont-unbind');//.appendTo(this.$element);
        if(this.options.centerControls){
            this.$controlsCont.css('max-width' , this.options.width + 'px');
        }



        this.$controlsCont.prepend(this.view.$element);

        this.$msContainer = $('<div></div>').addClass('ms-container').prependTo(this.$element).append(this.$controlsCont);

        if(this.controls){
            for(var i = 0 , l = this.controls.length; i<l ; ++i){
                this.controls[i].setup();
            }
        }


        /*else{
         this.$element.append(this.view.$element);
         }*/

        this._setupSliderLayout();
        this.__setupSlides();
        this.slideController.setup();

        if(this.controls){
            for(i = 0 , l = this.controls.length; i<l ; ++i)
                this.controls[i].create();
        }

        if(this.options.autoHeight){
            this.slideController.view.$element.height(this.slideController.currentSlide.getHeight());
        }

        // add grab cursor
        if(this.options.swipe && !window._touch && this.options.grabCursor && this.options.mouse){
            var $view = this.view.$element;

            $view.mousedown(function(){
                $view.removeClass('ms-grab-cursor');
                $view.addClass('ms-grabbing-cursor');
            }).addClass('ms-grab-cursor');

            $(document).mouseup(function(){
                $view.removeClass('ms-grabbing-cursor');
                $view.addClass('ms-grab-cursor');
            });
        }

        this.slideController.__dispatchInit();

        _debug && console.log("MasterSlider::_init end");

    };

    /**
     * changes the height of slider, it used in autoheight slider
     * @param {Number} value
     * @since 1.0
     * @public
     */
    p.setHeight = function(value){
        if(this.options.smoothHeight){
            if(this.htween){
                if(this.htween.reset)this.htween.reset();
                else	 			 this.htween.stop(true);
            }
            this.htween = CTween.animate(this.slideController.view.$element , 500 , {height:value} , {ease:'easeOutQuart'});
        }else
            this.slideController.view.$element.height(value);
    };

    /**
     * reserves white space in sides of slider, it used by controls
     * @param  {String} side  left|right|top|bottom
     * @param  {Number} space
     * @returns {Number} start position in space.
     * @since 1.5.7
     * @public
     */
    p.reserveSpace = function(side, space){
        var sideSpace = side+'Space',
            pos = this[sideSpace];

        this[sideSpace] += space;

        this._updateSideMargins();

        return pos;
    };

    /**
     * returns the reserved space, it used by controls and called when aligned control hides
     * @param  {String} side
     * @param  {Number} space
     * @since 1.5.7
     * @public
     */
    /*p.returnSpace = function(side, space){
     var sideSpace = side+'Space';
     this[sideSpace] = Math.max(0 , this[sideSpace] - space);

     this.api.dispatchEvent(new MSSliderEvent(MSSliderEvent.RESERVED_SPACE_CHANGE));
     this._updateSideMargins();
     };*/

    p._updateSideMargins = function(){
        this.$element.css('margin', this.topSpace + 'px ' + this.rightSpace + 'px ' + this.bottomSpace + 'px ' + this.leftSpace + 'px');
    }

    p._realignControls = function(){
        this.rightSpace = this.leftSpace = this.topSpace = this.bottomSpace = 0;
        this._updateSideMargins();
        this.api.dispatchEvent(new MSSliderEvent(MSSliderEvent.RESERVED_SPACE_CHANGE));
    };

    /*------------------------- Public Methods -----------------------*/

    /**
     * Adds new control to the slider
     * @param  {String} control
     * @param  {Object} options [description]
     * @since 1.0
     * @public
     */
    p.control = function(control , options){
        if(!(control in MSSlideController.SliderControlList)) return;
        if(!this.controls) this.controls = [];
        var ins = new MSSlideController.SliderControlList[control](options);
        ins.slider = this;
        this.controls.push(ins);

        return this;
    };

    /**
     * setup slider
     * @param  {String|jQuery object} id
     * @param  {Object} options
     * @since 1.0
     * @public
     */
    p.setup = function(id , options){
        this.id = id;
        if(typeof id === 'string')
            this.$element = $('#' + id);
        else
            this.$element = id.eq(0);

        //create a copy from slider markup, it will be used in destroy method.
        this.setupMarkup = this.$element.html();

        if(this.$element.length === 0){
            //if(console) console.log('Master Slider Error: #'+id+' not found.');
            return;
        }

        this.$element.addClass('master-slider').addClass('before-init');

        // IE prefix class
        if($.browser.msie){
            this.$element.addClass('ms-ie')
                .addClass('ms-ie' + $.browser.version.slice(0 , $.browser.version.indexOf('.')));
        }

        // Android prefix class
        var ua = navigator.userAgent.toLowerCase();
        var isAndroid = ua.indexOf("android") > -1;
        if(isAndroid) {
            this.$element.addClass('ms-android');
        }

        var that = this;
        $.extend(this.options, options);

        this.aspect = this.options.width / this.options.height;

        this.$loading = $('<div></div>').
        addClass('ms-loading-container').
        insertBefore(this.$element).
        append($('<div></div>').addClass('ms-loading'));

        this.$loading.parent().css('position' , 'relative');


        // old methods
        if(this.options.autofill){
            this.options.fullwidth = true;
            this.options.fullheight = true;
        }

        if(this.options.fullheight){
            this.$element.addClass('ms-fullheight');
        }

        //this._setupSliderLayout();
        this._resize();

        // define slide controller and api
        this.slideController = new MSSlideController(this);
        this.api = this.slideController;

        // $(document).ready(function(){that._init();});

        console.log("MasterSlider.setup invoked");

        window.setTimeout(function(){that._init()},250);

        return this;
    };

    /**
     * destroy the slider instance
     * @param  {Boolean} insertMarkup	 whether add slider markup after destroy.
     * @since 1.4
     * @public
     */
    p.destroy = function(insertMarkup){

        if(this.controls){
            for(var i = 0 , l = this.controls.length; i!==l ; i++)
                this.controls[i].destroy();
        }

        if(this.slideController) this.slideController._destroy();

        if(this.$loading) this.$loading.remove();

        if(insertMarkup)
            this.$element.html(this.setupMarkup).css('visibility' , 'hidden');
        else
            this.$element.remove();

        var lo = this.options.layout;
        if( lo === 'fullscreen' ||  lo === 'fullwidth' ){
            $(window).unbind('resize', this._updateLayout);
        }

        this.view = null;
        this.slides = null;
        this.options = null;
        this.slideController = null;
        this.api = null;
        this.resize_listener = null;
    };

})(jQuery);
//dev\slider\views\ViewEvents.js

window.MSViewEvents = function (type){
    this.type = type;
};

MSViewEvents.SWIPE_START      = 'swipeStart';
MSViewEvents.SWIPE_END        = 'swipeEnd';
MSViewEvents.SWIPE_MOVE		 = 'swipeMove';
MSViewEvents.SWIPE_CANCEL   	 = 'swipeCancel';
MSViewEvents.SCROLL 			 = 'scoll';
MSViewEvents.CHANGE_START     = 'slideChangeStart';
MSViewEvents.CHANGE_END	     = 'slideChangeEnd';

//dev\slider\views\BasicView.js

;(function($){

    "use strict";

    window.MSBasicView = function(options){

        this.options = {
            loop 			: false,
            dir  			: 'h',
            autoHeight 		: false,
            spacing			: 5,
            mouseSwipe		: true,
            swipe			: true,
            speed			: 17,
            minSlideSpeed	: 2,

            viewNum			: 20,
            critMargin		: 1
        };

        $.extend(this.options , options);

        this.dir		= this.options.dir;
        this.loop   	= this.options.loop;
        this.spacing	= this.options.spacing;

        this.__width  = 0;
        this.__height = 0;

        this.__cssProb 		= this.dir === 'h' ? 'left'    : 'top';
        this.__offset 		= this.dir === 'h' ? 'offsetLeft' : 'offsetTop';
        this.__dimension    = this.dir === 'h' ? '__width' : '__height';

        this.__translate_end	= window._css3d ? ' translateZ(0px)' : '';

        this.$slideCont	= $('<div></div>').addClass('ms-slide-container');
        this.$element 	= $('<div></div>').addClass('ms-view').addClass('ms-basic-view').append(this.$slideCont);

        this.currentSlide 	= null;
        this.index 			= -1;
        this.slidesCount	= 0;

        this.slides			= [];
        this.slideList		= []; // All of slides with added priority sort;
        this.viewSlidesList = [];

        this.css3 			= window._cssanim;
        this.start_buffer = 0;
        this.firstslide_snap = 0;

        this.controller 	 = new Controller(0 , 0 , {
            snapping	     : true,
            snapsize		 : 100,
            paging			 : true,
            snappingMinSpeed : this.options.minSlideSpeed,
            friction		 : (100 - this.options.speed * 0.5) / 100,
            endless			 : this.loop
        });

        this.controller.renderCallback(this.dir === 'h'? this._horizUpdate : this._vertiUpdate , this);
        this.controller.snappingCallback(this.__snapUpdate , this);
        this.controller.snapCompleteCallback(this.__snapCompelet , this);

        averta.EventDispatcher.call(this);
    };

    var p = MSBasicView.prototype;

    /*-------------- METHODS --------------*/

    p.__snapCompelet = function(snap , type){
        // if(this.loop && Math.abs(this.__contPos) > 20000){
        // 	this.__locateSlides();
        // 	this.gotoSlide(this.index , true);
        // }

        this.__locateSlides();
        this.start_buffer = 0;

        //console.log(this.currentSlide.index);

        this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_END));
    };

    p.__snapUpdate = function(controller , snap , change){

        if(this.loop){
            var target_index = this.index + change;
            this.updateLoop(target_index);

            if(target_index >= this.slidesCount)	target_index = target_index - this.slidesCount;
            if(target_index <  0)					target_index = this.slidesCount + target_index;

            this.index = target_index;
        }else{
            if(snap < 0 ||  snap >= this.slidesCount) return
            this.index = snap;
        }

        this._checkCritMargins();

        if($.browser.mozilla){
            this.slideList[this.index].$element[0].style.marginTop 	= '0.1px';
            if(this.currentSlide){
                this.currentSlide.$element[0].style.marginTop 	= '';
            }
        }
        var new_slide = this.slideList[this.index];
        if(new_slide === this.currentSlide)return;
        this.currentSlide = new_slide;
        this.__updateSlidesZindex();

        this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_START));
    };


    p._checkCritMargins = function(){
        if(this.normalMode) return;

        var hlf 	= Math.floor(this.options.viewNum / 2),
            inView 	= this.viewSlidesList.indexOf(this.slideList[this.index]),
            size 	= (this[this.__dimension] + this.spacing),
            cm 		= this.options.critMargin;

        if(this.loop){
            if(inView <= cm || inView >= this.viewSlidesList.length - cm){
                size *= (inView - hlf);
                this.__locateSlides(false ,  size + this.start_buffer );
                this.start_buffer += size;
            }

            return;
        }

        if( (inView < cm && this.index >= cm ) || (inView >= this.viewSlidesList.length - cm && this.index < this.slidesCount - cm)){
            this.__locateSlides(false);
        }

    };


    p._vertiUpdate = function(controller , value){

        this.__contPos = value;
        this.dispatchEvent(new MSViewEvents(MSViewEvents.SCROLL));

        if(this.css3){
            this.$slideCont[0].style[window._jcsspfx + 'Transform'] = 'translateY('+-value+'px)' + this.__translate_end;
            return;
        }

        this.$slideCont[0].style.top = -value + 'px';

    };

    p._horizUpdate = function(controller , value){

        this.__contPos = value;
        this.dispatchEvent(new MSViewEvents(MSViewEvents.SCROLL));

        if(this.css3) {
            this.$slideCont[0].style[window._jcsspfx + 'Transform'] = 'translateX('+-value+'px)'+ this.__translate_end;
            return;
        }

        this.$slideCont[0].style.left = -value + 'px';

    };


    p.__updateViewList = function(){

        if(this.normalMode) {
            this.viewSlidesList = this.slides;
            return;
        }

        var temp = this.viewSlidesList.slice();

        // update view list
        this.viewSlidesList = [];
        var i = 0 , hlf = Math.floor(this.options.viewNum / 2) , l;

        if(this.loop){
            for(; i !== this.options.viewNum ; i++)
                this.viewSlidesList.push(this.slides[this.currentSlideLoc - hlf + i]);
        }else{
            // before
            for(i = 0 ; i !== hlf && this.index - i !== -1 ; i++)
                this.viewSlidesList.unshift(this.slideList[this.index - i]);
            // after
            for(i = 1; i !== hlf && this.index + i !== this.slidesCount; i++)
                this.viewSlidesList.push(this.slideList[this.index + i]);
        }

        for (i = 0 , l = temp.length ; i !== l ; i++)
            if( this.viewSlidesList.indexOf(temp[i]) === -1)
                temp[i].sleep();

        temp = null;

        if( this.currentSlide ) {
            this.__updateSlidesZindex();
        }
    };

    p.__locateSlides = function(move , start){

        this.__updateViewList();

        start = !this.loop ? this.slides.indexOf(this.viewSlidesList[0]) * (this[this.__dimension] + this.spacing ) : start || 0;

        // old method
        /*for(i = 0; i < this.slidesCount ; ++i){
         var pos =  i * (this[this.__dimension] + this.spacing);

         this.slides[i].position = pos;
         this.slides[i].$element[0].style[this.__cssProb] =  pos + 'px';
         }*/

        var l = this.viewSlidesList.length , slide;

        for(var i = 0; i !== l ; i++){
            var pos =  start + i * (this[this.__dimension] + this.spacing );
            slide = this.viewSlidesList[i];
            slide.wakeup();
            slide.position = pos;
            slide.$element[0].style[this.__cssProb] =  pos + 'px';
        }

        if(move !== false)this.controller.changeTo( this.slideList[this.index].position , false , null , null , false);

    };

    p.__createLoopList = function(){
        var return_arr = [];
        var i = 0,
            count = this.slidesCount / 2;

        var before_count  = (this.slidesCount % 2 === 0)? count - 1	: Math.floor(count);
        var after_count	  = (this.slidesCount % 2 === 0)? count 	: Math.floor(count);

        this.currentSlideLoc = before_count;

        // before
        for(i = 1 ; i <= before_count ; ++i)
            return_arr.unshift(this.slideList[(this.index - i < 0)? this.slidesCount -  i + this.index: this.index - i]);

        // current
        return_arr.push(this.slideList[this.index]);

        // after
        for(i = 1; i <= after_count; ++i)
            return_arr.push(this.slideList[(this.index + i >= this.slidesCount)? this.index + i - this.slidesCount : this.index + i]);

        return return_arr;

    };

    /*
     * Calculate shortest distance from index to target.
     * It will used in loop gesture.
     *
     * Negative values means left direction.
     */

    p.__getSteps = function(index , target){
        var right = (target < index)?  this.slidesCount - index + target : target - index;
        var left  = Math.abs(this.slidesCount - right);

        return (right < left)? right : -left;
    };

    p.__pushEnd = function(){
        var first_slide = this.slides.shift();
        var last_slide = this.slides[this.slidesCount - 2];

        this.slides.push(first_slide);

        if(!this.normalMode) return;

        var pos = last_slide.$element[0][this.__offset] + this.spacing + this[this.__dimension];
        first_slide.$element[0].style[this.__cssProb] = pos + 'px';
        first_slide.position = pos;
    };

    p.__pushStart = function(){
        var last_slide =  this.slides.pop();
        var first_slide = this.slides[0];

        this.slides.unshift(last_slide);

        if(!this.normalMode) return;

        var pos = first_slide.$element[0][this.__offset] - this.spacing - this[this.__dimension];
        last_slide.$element[0].style[this.__cssProb] = pos + 'px';
        last_slide.position = pos;
    };

    // @since 1.7.0
    // adds z-index to slides
    p.__updateSlidesZindex = function(){
        if ( !this.autoUpdateZIndex ) {
            return;
        }

        var slide,
            l = this.viewSlidesList.length,
            hlf = Math.floor( l/2 );

        if( this.loop ){
            var loc = this.viewSlidesList.indexOf(this.currentSlide);
            for ( var i = 0; i!==l; i++ ){
                slide = this.viewSlidesList[i];
                this.viewSlidesList[i].$element.css('z-index', i<=loc ? i+1 : l-i);
            }
        } else {

            var beforeNum = this.currentSlide.index - this.viewSlidesList[0].index,
                afterNum = l - beforeNum,
                diff = beforeNum - afterNum;

            for ( var i = 0; i!==l; i++ ){
                this.viewSlidesList[i].$element.css('z-index', i<=beforeNum ? i+1 : l-i);
            }

            this.currentSlide.$element.css('z-index', l);
        }

    };

    p.addSlide = function(slide){
        slide.view = this;

        //this.$slideCont.append(slide.$element);

        this.slides.push(slide);
        this.slideList.push(slide);

        this.slidesCount++;
    };

    p.appendSlide = function(slide){
        this.$slideCont.append(slide.$element);
    };

    p.updateLoop = function(index){
        if(this.loop){
            var steps = this.__getSteps(this.index , index);

            for(var i = 0 , l = Math.abs(steps) ; i < l ; ++ i){
                if(steps < 0) 	this.__pushStart();
                else			this.__pushEnd();
            }
        }
    };

    p.gotoSlide = function(index , fast){
        this.updateLoop(index);

        this.index = index;

        var target_slide = this.slideList[this.index];

        this._checkCritMargins();

        //this.controller.changeTo( target_slide.$element[0][this.__offset] , !fast , null , null , false);
        this.controller.changeTo( target_slide.position , !fast , null , null , false);
        if(target_slide === this.currentSlide) return;

        //if(this.currentSlide) this.currentSlide.unselect();

        this.currentSlide = target_slide;
        this.__updateSlidesZindex();
        this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_START));
        if(fast)this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_END));
    };

    p.next = function(){
        this.gotoSlide((this.index + 1 >= this.slidesCount)? 0 : this.index + 1);
    };

    p.previous = function(){
        this.gotoSlide((this.index - 1 < 0)? this.slidesCount - 1 : this.index - 1);
    };

    /* --------------- Swipe control ------------------*/

    p.setupSwipe = function(){

        this.swipeControl = new averta.TouchSwipe(this.$element);
        this.swipeControl.swipeType = this.dir === 'h'? 'horizontal' : 'vertical';
        var that = this;

        if(this.dir === 'h'){
            this.swipeControl.onSwipe = function(status){
                that.horizSwipeMove(status);
            };
        }else{
            this.swipeControl.onSwipe = function(status){
                that.vertSwipeMove(status);
            };
        }

    };

    p.vertSwipeMove = function(status){
        var phase = status.phase;
        if(phase === 'start'){
            this.controller.stop();
            this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_START));
        }else if(phase === 'move' && (!this.loop || Math.abs(this.currentSlide.position - this.controller.value + status.moveY ) < this.cont_size / 2)){
            this.controller.drag(status.moveY);
        }else if(phase === 'end' || phase === 'cancel'){

            var speed = status.distanceY / status.duration * 50/3;

            if(Math.abs(speed) > 0.1){
                this.controller.push(-speed);
                if(speed > this.controller.options.snappingMinSpeed)
                    this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_END));
            }else{
                this.controller.cancel();
                this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_CANCEL));
            }

        }
    };

    p.horizSwipeMove = function(status){
        var phase = status.phase;
        //console.log(this.loop)
        if(phase === 'start'){
            this.controller.stop();
            this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_START));
        }else if(phase === 'move' && (!this.loop || Math.abs(this.currentSlide.position - this.controller.value + status.moveX ) < this.cont_size / 2)){
            this.controller.drag(status.moveX);
        }else if(phase === 'end' || phase === 'cancel'){

            var speed = status.distanceX / status.duration * 50/3;

            if(Math.abs(speed) > 0.1){
                this.controller.push(-speed );
                if(speed > this.controller.options.snappingMinSpeed)
                    this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_END));
            }else{
                this.controller.cancel();
                this.dispatchEvent(new MSViewEvents(MSViewEvents.SWIPE_CANCEL));
            }

        }
    };

    /* ------------------------------------------------*/

    p.setSize = function(width , height , hard){
        if(this.lastWidth === width && height === this.lastHeight && !hard) return;

        this.$element.width(width).height(height);

        for(var i = 0; i < this.slidesCount ; ++i)
            this.slides[i].setSize(width , height , hard);

        this.__width 	= width;
        this.__height 	= height;

        if(this.__created){
            this.__locateSlides();

            this.cont_size = (this.slidesCount - 1) * (this[this.__dimension] + this.spacing);
            if(!this.loop) 	this.controller._max_value = this.cont_size;

            this.controller.options.snapsize = this[this.__dimension] + this.spacing;
            this.controller.changeTo(this.currentSlide.position , false , null , null , false );
            this.controller.cancel();

            this.lastWidth = width;
            this.lastHeight = height;
        }
    };

    p.create = function(index){

        this.__created = true;

        this.index = Math.min((index || 0), this.slidesCount - 1);

        if(this.loop)
            this.slides = this.__createLoopList();

        this.normalMode = this.slidesCount <= this.options.viewNum;

        for(var i = 0; i < this.slidesCount ; ++i)
            this.slides[i].create();

        this.__locateSlides();

        this.controller.options.snapsize = this[this.__dimension] + this.spacing;
        if(!this.loop)	this.controller._max_value = (this.slidesCount - 1) * (this[this.__dimension] + this.spacing);

        this.gotoSlide(this.index , true);

        if(this.options.swipe && (window._touch || this.options.mouseSwipe))
            this.setupSwipe();

    };

    p.destroy = function(){
        if(!this.__created) return;

        for(var i = 0; i < this.slidesCount ; ++i)
            this.slides[i].destroy();

        this.slides = null;
        this.slideList = null;
        this.$element.remove();

        this.controller.destroy();
        this.controller = null;
    };

    averta.EventDispatcher.extend(p);

    MSSlideController.registerView('basic' , MSBasicView);

})(jQuery);
//dev\slider\views\WaveView.js

;(function($){

    "use strict";

    window.MSWaveView = function(options){
        MSBasicView.call(this , options);
        this.$element.removeClass('ms-basic-view').addClass('ms-wave-view');
        this.$slideCont.css(window._csspfx + 'transform-style' , 'preserve-3d');

        // Auto update z index of slides
        // @since 1.7
        this.autoUpdateZIndex = true;
    };

    MSWaveView.extend(MSBasicView);
    MSWaveView._3dreq = true;
    MSWaveView._fallback = MSBasicView;

    var p  = MSWaveView.prototype;
    var _super  = MSBasicView.prototype;

    /*-------------- METHODS --------------*/

    /*p.__setSlideTransDuration = function(value){
     for(var i=0; i<this.slidesCount; ++i)
     this.slides[i].$element.css(window._csspfx + 'transition-duration' , value + 'ms');
     };*/

    p._horizUpdate = function(controller , value){

        _super._horizUpdate.call(this, controller , value);

        var cont_scroll = -value;
        var slide_pos , slide , distance;

        for(var i = 0; i < this.slidesCount; ++i){
            slide = this.slideList[i];
            //slide_pos = parseInt(slide.$element.css('left'));
            distance = -cont_scroll - slide.position;
            this.__updateSlidesHoriz(slide , distance);
        }

    };

    p._vertiUpdate = function(controller , value){

        _super._vertiUpdate.call(this, controller , value);

        var cont_scroll = -value;
        var slide_pos , slide , distance;

        for(var i = 0; i < this.slidesCount; ++i){
            slide = this.slideList[i];
            //slide_pos = parseInt(slide.$element.css('left'));
            distance = -cont_scroll - slide.position;
            this.__updateSlidesVertic(slide , distance);
        }

    };


    p.__updateSlidesHoriz = function(slide , distance){
        var value =  Math.abs(distance * 100 / this.__width);
        //var value2 = Math.min(value , 100);
        //	var sp = Math.min(100 , )
        //slide.$bg_img.css('opacity' , (100 -  Math.abs(distance * 120 / this.__width / 3)) / 100);
        slide.$element.css(window._csspfx + 'transform' , 'translateZ('+ -value * 3 +'px) rotateY(0.01deg)'/* translateX('+(distance < 0 ? 1 : -1) * -value * 5+'px)'*/);
    };

    p.__updateSlidesVertic = function(slide , distance){
        this.__updateSlidesHoriz(slide , distance);
    };

    /*
     p.swipeMove = function(status){

     if(status.phase == 'start'){
     this.__setSlideTransDuration(0);
     }else if(status.phase == 'end'){
     this.__setSlideTransDuration(this.__slideDuration);
     }

     _super.swipeMove.call(this , status);
     };

     p.create = function(index){
     _super.create.call(this , index);

     for(var i = 0; i<this.slidesCount ; ++i){
     this.slides[i].$element.css(window._csspfx + 'transition-property' , window._csspfx 		+ 'transform');
     this.slides[i].$element.css(window._csspfx + 'transition-duration' , this.slideDuration + 'ms');
     }
     };
     */
    MSSlideController.registerView('wave' , MSWaveView);
})(jQuery);

//dev\slider\views\FadeBasicView.js

/**
 * Master Slider Fade Basic view
 * @author averta
 * @version 1.1
 * @package MS
 */

;(function(){

    window.MSFadeBasicView = function(options){
        MSWaveView.call(this , options);
        this.$element.removeClass('ms-wave-view').addClass('ms-fade-basic-view');
    };

    MSFadeBasicView.extend(MSWaveView);

    var p = MSFadeBasicView.prototype;
    var _super = MSFadeBasicView.prototype;

    /*-------------- METHODS --------------*/

    p.__updateSlidesHoriz = function(slide , distance){
        var value =  Math.abs(distance * 0.6 / this.__width);
        value = 1 - Math.min(value , 0.6);
        slide.$element.css('opacity' , value);
    };

    p.__updateSlidesVertic = function(slide , distance){
        this.__updateSlidesHoriz(slide , distance);
    };

    MSSlideController.registerView('fadeBasic' , MSFadeBasicView);
    MSWaveView._fallback = MSFadeBasicView;
})();//dev\slider\views\FadeWaveView.js

/**
 * Master Slider Fade Wave View
 * @author averta
 * @version 1.0
 * @extends {MSWaveView}
 */
;(function(){

    window.MSFadeWaveView = function(options){
        MSWaveView.call(this , options);
        this.$element.removeClass('ms-wave-view').addClass('ms-fade-wave-view').addClass('dont-unbind');
    };

    MSFadeWaveView.extend(MSWaveView);
    MSFadeWaveView._3dreq = true;
    MSFadeWaveView._fallback = MSFadeBasicView;

    var p = MSFadeWaveView.prototype;
    var _super = MSWaveView.prototype;

    /*-------------- METHODS --------------*/

    p.__updateSlidesHoriz = function(slide , distance){
        var value =  Math.abs(distance * 100 / this.__width);
        value = Math.min(value , 100);
        slide.$element.css('opacity' , 1-value/300);
        slide.$element.css(window._csspfx + 'transform' , 'scale('+ (1 - value/800) +') rotateY(0.01deg) ');
    };

    p.__updateSlidesVertic = function(slide , distance){
        this.__updateSlidesHoriz(slide , distance);
    };

    MSSlideController.registerView('fadeWave' , MSFadeWaveView);

})();//dev\slider\views\FlowView.js

;(function($){

    "use strict";

    window.MSFlowView = function(options){
        MSWaveView.call(this , options);
        this.$element.removeClass('ms-wave-view').addClass('ms-flow-view');
        //this.$slideCont.css(window._csspfx + 'transform-style' , 'preserve-3d');
    };

    MSFlowView.extend(MSWaveView);
    MSFlowView._3dreq = true;
    MSFlowView._fallback = MSFadeBasicView;

    var p  = MSFlowView.prototype;
    var _super  = MSWaveView.prototype;

    /*-------------- METHODS --------------*/


    p.__updateSlidesHoriz = function(slide , distance){
        var value  =  Math.abs(distance * 100 / this.__width);
        var rvalue =  Math.min(value * 0.3 , 30) * (distance < 0 ? -1 : 1);
        var zvalue = value * 1.2;
        slide.$element[0].style[window._jcsspfx + 'Transform'] = 'translateZ('+ -zvalue*5 +'px) rotateY(' + rvalue + 'deg) ';
    };

    p.__updateSlidesVertic  = function(slide , distance){
        var value  =  Math.abs(distance * 100 / this.__width);
        var rvalue =  Math.min(value * 0.3 , 30) * (distance < 0 ? -1 : 1);
        var zvalue = value * 1.2;
        slide.$element[0].style[window._jcsspfx + 'Transform'] = 'translateZ('+ -zvalue*5 +'px) rotateX(' + -rvalue + 'deg) ';
    };


    MSSlideController.registerView('flow' , MSFlowView);
})(jQuery);

//dev\slider\views\FadeFlowView.js

/**
 * Master Slider Fade Flow View
 * @author averta
 * @extends {MSWaveView}
 * @version 1.0
 */
;(function(){

    window.MSFadeFlowView = function(options){
        MSWaveView.call(this , options);
        this.$element.removeClass('ms-wave-view').addClass('ms-fade-flow-view');
    };

    MSFadeFlowView.extend(MSWaveView);
    MSFadeFlowView._3dreq = true;

    var p = MSFadeFlowView.prototype;
    var _super = MSWaveView.prototype;

    /*-------------- METHODS --------------*/

    p.__calculate = function(distance){
        var value = Math.min(Math.abs(distance * 100 / this.__width) , 100);
        var rvalue =  Math.min(value * 0.5 , 50) * (distance < 0 ? -1 : 1);
        return {value: value, rvalue: rvalue};
    };

    p.__updateSlidesHoriz = function(slide , distance){
        var clc = this.__calculate(distance);
        slide.$element.css('opacity' , 1-clc.value/300);
        slide.$element[0].style[window._csspfx + 'transform'] = 'translateZ('+ -clc.value +'px) rotateY(' + clc.rvalue + 'deg) ';
    };

    p.__updateSlidesVertic = function(slide , distance){
        var clc = this.__calculate(distance);
        slide.$element.css('opacity' , 1-clc.value/300);
        slide.$element[0].style[window._csspfx + 'transform'] = 'translateZ('+ -clc.value +'px) rotateX(' + -clc.rvalue + 'deg) ';
    };

    MSSlideController.registerView('fadeFlow' , MSFadeFlowView);

})();//dev\slider\views\MaskView.js

;(function($){

    "use strict";

    window.MSMaskView = function(options){
        MSBasicView.call(this , options);
        this.$element.removeClass('ms-basic-view').addClass('ms-mask-view');

    };

    MSMaskView.extend(MSBasicView);

    var p  = MSMaskView.prototype;
    var _super  = MSBasicView.prototype;

    /*-------------- METHODS --------------*/

    p.addSlide = function(slide){ // OK
        slide.view = this;

        slide.$frame = $('<div></div>').addClass('ms-mask-frame').append(slide.$element);
        slide.$element[0].style.position = 'relative';
        //this.$slideCont.append(slide.$frame);
        slide.autoAppend = false;

        this.slides.push(slide);
        this.slideList.push(slide);

        this.slidesCount++;
    };

    p.setSize = function(width , height){
        var slider = this.slides[0].slider;

        for(var i = 0; i < this.slidesCount ; ++i){
            this.slides[i].$frame[0].style.width  = width  + 'px';
            if(!slider.options.autoHeight)
                this.slides[i].$frame[0].style.height = height + 'px';
        }

        _super.setSize.call(this , width , height);
    };

    // p.__snapUpdate = function(controller , snap , change){

    // 	if(this.loop){
    // 		var target_index = this.index + change;
    // 		this.updateLoop(target_index);

    // 		if(target_index >= this.slidesCount)	target_index = target_index - this.slidesCount;
    // 		if(target_index <  0)					target_index = this.slidesCount + target_index;

    // 		this.index = target_index;
    // 	}else{
    // 		if(snap < 0 ||  snap >= this.slidesCount) return
    // 		this.index = snap;
    // 	}


    // 	this._checkCritMargins();

    // 	if($.browser.mozilla){

    // 		this.slideList[this.index].$frame[0].style.marginTop 	= '0.1px';
    // 		this.slideList[this.index].$element[0].style.marginTop 	= '0.1px';

    // 		if(this.currentSlide){
    // 			this.currentSlide.$frame[0].style.marginTop 	= '';
    // 			this.currentSlide.$element[0].style.marginTop 	= '';
    // 		}
    // 	}

    // 		var new_slide = this.slideList[this.index];
    // 	if(new_slide === this.currentSlide)return;

    // 	this.currentSlide = new_slide;
    // 	this.dispatchEvent(new MSViewEvents(MSViewEvents.CHANGE_START));
    // };

    p._horizUpdate = function(controller , value){

        _super._horizUpdate.call(this , controller , value);

        var i = 0;

        if(this.css3) {
            for(i = 0 ; i < this.slidesCount ; ++i){
                this.slideList[i].$element[0].style[window._jcsspfx + 'Transform'] = 'translateX('+(value - this.slideList[i].position)+'px)'+ this.__translate_end;
            }
            return;
        }

        for(i = 0 ; i < this.slidesCount ; ++i){
            this.slideList[i].$element[0].style.left = (value - this.slideList[i].position) + 'px';
        }

    };

    p._vertiUpdate = function(controller , value){

        _super._vertiUpdate.call(this , controller , value);

        var i = 0;

        if(this.css3) {
            for(i = 0 ; i < this.slidesCount ; ++i){
                this.slideList[i].$element[0].style[window._jcsspfx + 'Transform'] = 'translateY('+(value - this.slideList[i].position)+'px)'+ this.__translate_end;
            }
            return;
        }

        for(i = 0 ; i < this.slidesCount ; ++i){
            this.slideList[i].$element[0].style.top = (value - this.slideList[i].position) + 'px';
        }

    };

    p.__pushEnd = function(){ // OK
        var first_slide = this.slides.shift();
        var last_slide = this.slides[this.slidesCount - 2];

        this.slides.push(first_slide);
        if(!this.normalMode) return;

        var pos = last_slide.$frame[0][this.__offset] + this.spacing + this[this.__dimension];
        first_slide.$frame[0].style[this.__cssProb] = pos + 'px';
        first_slide.position = pos;
    };

    p.__pushStart = function(){ // OK

        var last_slide =  this.slides.pop();
        var first_slide = this.slides[0];

        this.slides.unshift(last_slide);

        if(!this.normalMode) return;

        var pos = first_slide.$frame[0][this.__offset] - this.spacing - this[this.__dimension];
        last_slide.$frame[0].style[this.__cssProb] = pos + 'px';
        last_slide.position = pos;
    };

    p.__updateViewList = function(){

        if(this.normalMode) {
            this.viewSlidesList = this.slides;
            return;
        }

        var temp = this.viewSlidesList.slice();

        // update view list
        this.viewSlidesList = [];
        var i = 0 , hlf = Math.floor(this.options.viewNum / 2) , l;

        if(this.loop){
            for(; i !== this.options.viewNum ; i++)
                this.viewSlidesList.push(this.slides[this.currentSlideLoc - hlf + i]);
        }else{
            // before
            for(i = 0 ; i !== hlf && this.index - i !== -1 ; i++)
                this.viewSlidesList.unshift(this.slideList[this.index - i]);
            // after
            for(i = 1; i !== hlf && this.index + i !== this.slidesCount; i++)
                this.viewSlidesList.push(this.slideList[this.index + i]);
        }

        for (i = 0 , l = temp.length ; i !== l ; i++){
            if( this.viewSlidesList.indexOf(temp[i]) === -1){
                temp[i].sleep();
                temp[i].$frame.detach();
            }
        }

        temp = null;
    };


    p.__locateSlides = function(move , start){ // OK
        this.__updateViewList();

        start = !this.loop ? this.slides.indexOf(this.viewSlidesList[0]) * (this[this.__dimension] + this.spacing ) : start || 0;

        // Old method
        // for(var i = 0; i < this.slidesCount ; ++i){
        // 	var pos =  i * (this[this.__dimension] + this.spacing);

        // 	this.slides[i].position = pos;
        // 	this.slides[i].$frame[0].style[this.__cssProb] =  pos + 'px';
        // }

        var l = this.viewSlidesList.length , slide;

        for(var i = 0; i !== l ; i++){
            var pos =  start + i * (this[this.__dimension] + this.spacing );
            slide = this.viewSlidesList[i];

            this.$slideCont.append(slide.$frame);
            slide.wakeup(false);
            slide.position = pos;
            slide.$frame[0].style[this.__cssProb] =  pos + 'px';
        }

        if(move !== false)this.controller.changeTo( this.slideList[this.index].position , false , null , null , false);

    };

    MSSlideController.registerView('mask' , MSMaskView);
})(jQuery);
//dev\slider\views\FadeView.js

;(function($){

    "use strict";

    window.MSFadeView = function(options){
        MSBasicView.call(this , options);
        this.$element.removeClass('ms-basic-view').addClass('ms-fade-view');
        this.controller.renderCallback(this.__update , this);
    };

    MSFadeView.extend(MSBasicView);

    var p  = MSFadeView.prototype;
    var _super  = MSBasicView.prototype;

    /*-------------- METHODS --------------*/

    p.__update = function(controller , value){
        var cont_scroll = -value;
        var slide_pos , slide , distance;

        for(var i = 0; i < this.slidesCount; ++i){
            slide = this.slideList[i];
            distance = -cont_scroll - slide.position;
            this.__updateSlides(slide , distance);
        }
    };

    p.__updateSlides = function(slide , distance){
        var value =  Math.abs(distance / this[this.__dimension]);
        if(1 - value <= 0){
            slide.$element.fadeTo(0 , 0).css('visibility' , 'hidden');
        }else{
            slide.$element.fadeTo(0 , 1 - value).css('visibility' , '');
        }
    };

    p.__locateSlides = function(move , start){

        this.__updateViewList();

        // Old method
        // for(var i = 0; i < this.slidesCount ; ++i){
        // 	this.slides[i].position = i * this[this.__dimension];
        // }

        start = !this.loop ? this.slides.indexOf(this.viewSlidesList[0]) * (this[this.__dimension] + this.spacing ) : start || 0;

        var l = this.viewSlidesList.length , slide;

        for(var i = 0; i !== l ; i++){
            var pos =  start + i * this[this.__dimension];
            slide = this.viewSlidesList[i];
            slide.wakeup();
            slide.position = pos;
        }

        if(move !== false)this.controller.changeTo( this.slideList[this.index].position , false , null , null , false);

    };

    p.__pushEnd = function(){
        var first_slide = this.slides.shift();
        var last_slide = this.slides[this.slidesCount - 2];
        this.slides.push(first_slide);
        first_slide.position = last_slide.position + this[this.__dimension];
    };

    p.__pushStart = function(){
        var last_slide =  this.slides.pop();
        var first_slide = this.slides[0];
        this.slides.unshift(last_slide);
        last_slide.position = first_slide.position - this[this.__dimension];
    };

    p.create = function(index){
        _super.create.call(this , index);
        this.spacing = 0;
        this.controller.options.minValidDist = 10;
    };

    MSSlideController.registerView('fade' , MSFadeView);
})(jQuery);//dev\slider\views\ScaleView.js

;(function($){

    "use strict";

    window.MSScaleView = function(options){
        MSBasicView.call(this , options);
        this.$element.removeClass('ms-basic-view').addClass('ms-scale-view');
        this.controller.renderCallback(this.__update , this);
    };

    MSScaleView.extend(MSFadeView);

    var p  = MSScaleView.prototype;
    var _super  = MSFadeView.prototype;

    /*-------------- METHODS --------------*/

    p.__updateSlides = function(slide , distance){
        var value =  Math.abs(distance / this[this.__dimension]),
            element = slide.$element[0];

        if(1 - value <= 0){
            element.style.opacity = 0;
            element.style.visibility = 'hidden';
            element.style[window._jcsspfx + 'Transform'] = '';
        }else{
            element.style.opacity = 1 - value;
            element.style.visibility = '';
            element.style[window._jcsspfx + 'Transform'] = 'perspective(2000px) translateZ('+(value* (distance < 0 ? -0.5 : 0.5)) * 300+'px)';
        }

    };

    p.create = function(index){
        _super.create.call(this , index);
        this.controller.options.minValidDist = 0.03;
    };

    MSSlideController.registerView('scale' , MSScaleView);
})(jQuery);//dev\slider\views\FocusView.js

/**
 * Master Slider Focus View
 * @version 1.1
 * @author averta
 * @package MS
 * @extends {MSFadeBasicView}
 */

;(function(){

    'use strict';

    var perspective = 2000;

    window.MSFocusView = function(options){
        MSWaveView.call(this , options);
        this.$element.removeClass('ms-wave-view').addClass('ms-focus-view');
        this.options.centerSpace = this.options.centerSpace  || 1;
    };

    MSFocusView.extend(MSWaveView);
    MSFocusView._3dreq = true;
    MSFocusView._fallback = MSFadeBasicView;

    var p = MSFocusView.prototype;
    var _super = MSWaveView.prototype;

    /*-------------- METHODS --------------*/

    p.__calcview = function(z , w){
        var a =  w / 2 * z / (z + perspective);
        return a * (z + perspective) / perspective;
    };

    p.__updateSlidesHoriz = function(slide , distance){
        var value =  Math.abs(distance * 100 / this.__width);
        value = -Math.min(value , 100)* 15;
        slide.$element.css(window._csspfx + 'transform' , 'translateZ('+ value  +'px) rotateY(0.01deg) translateX('+ (distance < 0 ? 1 : -1) * (-this.__calcview(value, this.__width) * this.options.centerSpace )+'px)');
    };

    p.__updateSlidesVertic = function(slide , distance){
        var value =  Math.abs(distance * 100 / this.__width);
        value = -Math.min(value , 100)* 15;
        slide.$element.css(window._csspfx + 'transform' , 'translateZ('+ value  +'px) rotateY(0.01deg) translateY('+ (distance < 0 ? 1 : -1) * (-this.__calcview(value, this.__width) * this.options.centerSpace )+'px)');
    };

    MSSlideController.registerView('focus' , MSFocusView);

})();//dev\slider\views\PartialWaveView.js

/**
 * Master Slider Partial Wave View
 * @version 1.0
 * @author averta
 * @extends {MSWaveView}
 */

;(function(){

    window.MSPartialWaveView = function(options){
        MSWaveView.call(this , options);
        this.$element.removeClass('ms-wave-view').addClass('ms-partial-wave-view');
    };

    MSPartialWaveView.extend(MSWaveView);
    MSPartialWaveView._3dreq = true;
    MSPartialWaveView._fallback = MSFadeBasicView;

    var p = MSPartialWaveView.prototype;
    var _super = MSWaveView.prototype;

    /*-------------- METHODS --------------*/

    p.__updateSlidesHoriz = function(slide , distance){
        var value =  Math.abs(distance * 100 / this.__width);
        if( slide.hasBG ){
            slide.$bg_img.css('opacity' , (100 -  Math.abs(distance * 120 / this.__width / 3)) / 100);
        }
        slide.$element.css(window._csspfx + 'transform' , 'translateZ('+ -value * 3 +'px) rotateY(0.01deg) translateX('+distance*0.75+'px)');
    };

    p.__updateSlidesVertic = function(slide , distance){
        var value =  Math.abs(distance * 100 / this.__width);
        if( slide.hasBG ){
            slide.$bg_img.css('opacity' , (100 -  Math.abs(distance * 120 / this.__width / 3)) / 100);
        }
        slide.$element.css(window._csspfx + 'transform' , 'translateZ('+ -value * 3 +'px) rotateY(0.01deg) translateY('+distance*0.75+'px)');
    };

    MSSlideController.registerView('partialWave' , MSPartialWaveView);

})();//dev\slider\uicontrols\BaseControl.js

;(function($){

    "use strict";

    var BaseControl = function(){
        this.options = {
            prefix:'ms-',
            autohide:true,
            overVideo:true
        };
    };

    var p = BaseControl.prototype;

    /* -------------------------------- */

    p.slideAction = function(slide){

    };

    p.setup = function(){
        this.cont = this.options.insertTo ? $(this.options.insertTo) : this.slider.$controlsCont;
        if(!this.options.overVideo) this._hideOnvideoStarts();

        if(this.options.hideUnder){
            //this.slider.api.addEventListener(MSSliderEvent.RESIZE, this.onSliderResize, this);
            $(window).bind('resize', {that:this}, this.onResize);
            this.onResize();

            this.needsRealign = !this.options.insetTo && (this.options.align === 'left' || this.options.align === 'right') && this.options.inset === false;
        }
    };

    /**
     * hide control if width of slider changes to lower that specified value [hideUnder]
     * @since 1.5.7
     * @protected
     */
    p.onResize = function(event){
        var that = (event && event.data.that) || this;
        var w = window.innerWidth;
        if( w <= that.options.hideUnder && !that.detached ){
            that.hide(true);
            that.detached = true;
            that.onDetach();
        }else if( w >= that.options.hideUnder && that.detached ){
            that.detached = false;
            that.visible();
            that.onAppend();
        }
    };

    p.create = function(){
        var that = this;
        if(this.options.autohide && !window._touch){

            this.hide(true);

            this.slider.$controlsCont.mouseenter(function(){
                if(!that._disableAH && !that.mdown)that.visible();
                that.mleave = false;
            }).mouseleave(function(){
                that.mleave = true;
                if(!that.mdown)that.hide();
            }).mousedown(function(){
                that.mdown = true;
            });

            $(document).mouseup(function(){
                if(that.mdown && that.mleave)that.hide();
                that.mdown = false;
            });
        }

    };

    /**
     * calls by the parent class [MSBaseControl] when the control element visibles [hideUnder option]
     * @since 1.5.7
     */
    p.onAppend = function(){
        if( this.needsRealign ){
            this.slider._realignControls();
        }
    };

    /**
     * calls by the parent class [MSBaseControl] when the control element visibles [hideUnder option]
     * @since 1.5.7
     */
    p.onDetach = function(){
        if( this.needsRealign ){
            this.slider._realignControls();
        }
    };

    p._hideOnvideoStarts = function(){
        var that = this;
        slider.api.addEventListener(MSSliderEvent.VIDEO_PLAY , function(){
            that._disableAH = true;
            that.hide();
        });

        slider.api.addEventListener(MSSliderEvent.VIDEO_CLOSE , function(){
            that._disableAH = false;
            that.visible();
        });
    };

    p.hide = function(fast){
        if(fast){
            this.$element.css('opacity' , 0);
            this.$element.css('display' , 'none');
        } else {
            CTween.fadeOut(this.$element , 400 , false);
        }

        this.$element.addClass('ms-ctrl-hide');
    };

    p.visible = function(){
        if(this.detached) return;
        this.$element.css('display' , '');
        CTween.fadeIn(this.$element , 400 );
        this.$element.removeClass('ms-ctrl-hide');
    };

    p.destroy = function(){

        if(this.options && this.options.hideUnder){
            //this.slider.api.removeEventListener(MSSliderEvent.RESIZE, this.onResize, this);
            $(window).unbind('resize', this.onResize);
        }
    };

    window.BaseControl = BaseControl;

})(jQuery);
//dev\slider\uicontrols\Arrows.js

;(function($){

    "use strict";

    var MSArrows = function(options){
        BaseControl.call(this);
        $.extend(this.options , options);
    };

    MSArrows.extend(BaseControl);

    var p = MSArrows.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */

    p.setup = function(){
        var that = this;

        this.$next = $('<div></div>')
            .addClass(this.options.prefix + 'nav-next')
            .addClass('dont-unbind')
            //.appendTo(this.cont)
            .bind('click' , function(){
                if(!that.slider.options.loop && that.slider.api.index() === that.slider.api.count() - 1)
                    that.slider.view.controller.bounce(10);
                else
                    that.slider.api.next();
            });


        this.$prev = $('<div></div>')
            .addClass(this.options.prefix + 'nav-prev')
            .addClass('dont-unbind')
            //.appendTo(this.cont)
            .bind('click' , function(){
                if(!that.slider.options.loop && that.slider.api.index() === 0)
                    that.slider.view.controller.bounce(-10);
                else
                    that.slider.api.previous();
            });

        _super.setup.call(this);

        this.cont.append(this.$next);
        this.cont.append(this.$prev);
    };

    p.hide = function(fast){
        if(fast){
            this.$prev.css('opacity' , 0).css('display', 'none');
            this.$next.css('opacity' , 0).css('display', 'none');
            return;
        }

        CTween.fadeOut(this.$prev , 400 , false);
        CTween.fadeOut(this.$next , 400 , false);

        this.$prev.addClass('ms-ctrl-hide');
        this.$next.addClass('ms-ctrl-hide');
    };

    p.visible = function(){
        if(this.detached) return;
        CTween.fadeIn(this.$prev , 400 );
        CTween.fadeIn(this.$next , 400 );
        this.$prev.removeClass('ms-ctrl-hide').css('display', '');
        this.$next.removeClass('ms-ctrl-hide').css('display', '');
    };

    p.destroy = function(){
        _super.destroy();
        this.$next.remove();
        this.$prev.remove();
    };

    window.MSArrows = MSArrows;
    MSSlideController.registerControl('arrows' , MSArrows);
})(jQuery);
//dev\slider\uicontrols\Thumblist.js

;(function($){

    "use strict";

    var MSThumblist = function(options){
        BaseControl.call(this);

        // default options
        this.options.dir 	= 'h';
        this.options.wheel	= options.dir === 'v';
        this.options.arrows = true;
        this.options.speed  = 17;
        this.options.align  = null;
        this.options.inset = false;
        this.options.margin = 10;
        this.options.space = 10;
        this.options.width = 100;
        this.options.height = 100;
        this.options.type = 'thumbs'; // tabs


        $.extend(this.options , options);

        this.thumbs = [];
        this.index_count = 0;

        this.__dimen    		= this.options.dir === 'h' ? 'width' : 'height';
        this.__alignsize 		= this.options.dir === 'h' ? 'height' : 'width';
        this.__jdimen    		= this.options.dir === 'h' ? 'outerWidth' : 'outerHeight';
        this.__pos				= this.options.dir === 'h' ? 'left'	 : 'top';

        this.click_enable = true;

    };

    MSThumblist.extend(BaseControl);

    var p = MSThumblist.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */

    p.setup = function(){
        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'thumb-list');

        if(this.options.type === 'tabs'){
            this.$element.addClass(this.options.prefix + 'tabs');
        }

        this.$element.addClass('ms-dir-' + this.options.dir);

        _super.setup.call(this);


        if( this.slider.$controlsCont === this.cont ){
            this.$element.appendTo(this.slider.$element);
        }else{
            this.$element.appendTo(this.cont);
        }

        this.$thumbscont = $('<div></div>')
            .addClass('ms-thumbs-cont')
            .appendTo(this.$element);

        if(this.options.arrows){
            var that = this;
            this.$fwd = $('<div></div>').addClass('ms-thumblist-fwd').appendTo(this.$element).click(function(){that.controller.push(-15);});
            this.$bwd = $('<div></div>').addClass('ms-thumblist-bwd').appendTo(this.$element).click(function(){that.controller.push(15);});
        }

        // align control
        if( !this.options.insetTo && this.options.align ){
            var align = this.options.align;
            if( this.options.inset ){
                this.$element.css(align, this.options.margin );
            }else if( align === 'top' ){
                this.$element.detach().prependTo(this.slider.$element).css({
                    'margin-bottom': this.options.margin,
                    'position': 'relative'
                });
            }else if( align === 'bottom' ){
                this.$element.css({
                    'margin-top': this.options.margin,
                    'position': 'relative'
                });
            }else{
                this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
                this.align();
            }

            if( this.options.dir === 'v' ){
                this.$element.width(this.options.width);
            }else{
                this.$element.height(this.options.height);
            }
        }

    };

    /**
     * calls by "RESERVED_SPACE_CHGANE" realigns the control in slider
     * @since 1.5.7
     */
    p.align = function(event){
        if( this.detached ){
            return;
        }
        var align = this.options.align;
        var pos = this.slider.reserveSpace(align, this.options[this.__alignsize] + this.options.margin * 2);
        this.$element.css(align, -pos - this.options[this.__alignsize] - this.options.margin);
    };

    p.slideAction = function(slide){
        var thumb_ele = $(slide.$element.find('.ms-thumb'));
        var that = this;
        var thumb_frame = $('<div></div>')
            .addClass('ms-thumb-frame')
            .addClass('dont-unbind')
            .append(thumb_ele)
            .append($('<div class="ms-thumb-ol"></div>'))
            .bind('click' , function(){that.changeSlide(thumb_frame);});

        if( this.options.align ){
            thumb_frame.width(this.options.width)
                .height(this.options.height)
                .css('margin-'+(this.options.dir === 'v' ? 'bottom' : 'right'), this.options.space);
        }

        thumb_frame[0].index =  this.index_count ++;

        this.$thumbscont.append(thumb_frame);

        // Added Fillmode support to thumblist
        // @since 1.6.0
        if( this.options.fillMode && thumb_ele.is('img') ){
            var aligner = new window.MSAligner(this.options.fillMode, thumb_frame, thumb_ele);
            thumb_ele[0].aligner = aligner;
            thumb_ele.one('load', function(e){
                var $this = $(this);
                $this[0].aligner.init($this.width(), $this.height());
                $this[0].aligner.align();
            }).each($.jqLoadFix);
        }

        if($.browser.msie)
            thumb_ele.on('dragstart', function(event) { event.preventDefault(); }); // disable native dragging

        this.thumbs.push(thumb_frame);
    };

    p.create = function(){

        _super.create.call(this);

        this.__translate_end	= window._css3d ? ' translateZ(0px)' : '';
        this.controller 	 = new Controller(0 , 0 , {
            //snapping	     : true,
            snappingMinSpeed : 2,
            friction		 : (100 - this.options.speed * 0.5) / 100
        });

        this.controller.renderCallback(this.options.dir === 'h'? this._hMove : this._vMove , this);
        //this.controller.snappingCallback(this.__snapUpdate , this);
        //this.controller.snapCompleteCallback(this.__snapCompelet , this);

        var that = this;
        this.resize_listener = function(){that.__resize();};
        $(window).bind('resize', this.resize_listener);

        this.thumbSize = this.thumbs[0][this.__jdimen](true);

        this.setupSwipe();
        this.__resize();

        var that = this;
        if(this.options.wheel){

            this.wheellistener = function(event){
                var e = window.event || event.orginalEvent || event;
                var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
                that.controller.push(-delta*10);
                return false;
            };

            if($.browser.mozilla) this.$element[0].addEventListener('DOMMouseScroll' , this.wheellistener);
            else this.$element.bind('mousewheel', this.wheellistener);
        }

        this.slider.api.addEventListener(MSSliderEvent.CHANGE_START , this.update , this);
        this.cindex =  this.slider.api.index();
        this.select(this.thumbs[this.cindex]);


    };

    p._hMove = function(controller , value){
        this.__contPos = value;
        if(window._cssanim) {
            this.$thumbscont[0].style[window._jcsspfx + 'Transform'] = 'translateX('+-value+'px)'+ this.__translate_end;
            return;
        }
        this.$thumbscont[0].style.left = -value + 'px';
    };

    p._vMove = function(controller , value){
        this.__contPos = value;
        if(window._cssanim) {
            this.$thumbscont[0].style[window._jcsspfx + 'Transform'] = 'translateY('+-value+'px)'+ this.__translate_end;
            return;
        }
        this.$thumbscont[0].style.top = -value + 'px';
    };

    p.setupSwipe = function(){
        this.swipeControl = new averta.TouchSwipe(this.$element);
        this.swipeControl.swipeType = this.options.dir === 'h'? 'horizontal' : 'vertical';

        var that = this;
        if(this.options.dir === 'h')
            this.swipeControl.onSwipe = function(status){that.horizSwipeMove(status);};
        else
            this.swipeControl.onSwipe = function(status){that.vertSwipeMove(status);};
    };

    p.vertSwipeMove = function(status){
        if(this.dTouch) return;
        var phase = status.phase;
        if(phase === 'start')
            this.controller.stop();
        else if(phase === 'move')
            this.controller.drag(status.moveY);
        else if(phase === 'end' || phase === 'cancel'){
            var speed = Math.abs(status.distanceY / status.duration * 50/3);
            if(speed > 0.1){
                this.controller.push(-status.distanceY / status.duration * 50/3 );
            }else{
                this.click_enable = true;
                this.controller.cancel();
            }
        }
    };

    p.horizSwipeMove = function(status){
        if(this.dTouch) return;
        var phase = status.phase;
        if(phase === 'start'){
            this.controller.stop();
            this.click_enable = false;
        }else if(phase === 'move')
            this.controller.drag(status.moveX);
        else if(phase === 'end' || phase === 'cancel'){
            var speed = Math.abs(status.distanceX / status.duration * 50/3);
            if(speed > 0.1){
                this.controller.push(-status.distanceX / status.duration * 50/3 );
            }else {
                this.click_enable = true;
                this.controller.cancel();
            }
        }
    };

    p.update = function(){
        var nindex = this.slider.api.index();
        if(this.cindex === nindex) return;

        if(this.cindex != null)this.unselect(this.thumbs[this.cindex]);
        this.cindex = nindex;
        this.select(this.thumbs[this.cindex]);

        if(!this.dTouch)this.updateThumbscroll();
    };

    p.updateThumbscroll = function(){
        var thumb_size;

        var pos = this.thumbSize * this.cindex;

        if(this.controller.value == NaN) this.controller.value = 0;

        if(pos -  this.controller.value < 0){
            this.controller.gotoSnap(this.cindex , true);
            return;
        }

        if(pos + this.thumbSize - this.controller.value > this.$element[this.__dimen]()){
            var first_snap = this.cindex - Math.floor(this.$element[this.__dimen]() / this.thumbSize) + 1;
            this.controller.gotoSnap(first_snap , true);
            return;
        }
    };

    p.changeSlide = function(thumb){
        if(!this.click_enable || this.cindex === thumb[0].index) return;
        this.slider.api.gotoSlide(thumb[0].index);
    };

    p.unselect = function(ele){
        ele.removeClass('ms-thumb-frame-selected');
    };

    p.select = function(ele){
        ele.addClass('ms-thumb-frame-selected');
    };

    p.__resize = function(){
        var size = this.$element[this.__dimen]();

        if(this.ls === size) return;

        this.ls = size;

        this.thumbSize = this.thumbs[0][this.__jdimen](true);
        var len = this.slider.api.count() * this.thumbSize;
        this.$thumbscont[0].style[this.__dimen] = len + 'px';

        if(len <= size){
            this.dTouch = true;
            this.controller.stop();
            this.$thumbscont[0].style[this.__pos] = (size - len)*.5 + 'px';
            this.$thumbscont[0].style[window._jcsspfx + 'Transform'] = '';
        }else{
            this.dTouch = false;
            this.click_enable = true;
            this.$thumbscont[0].style[this.__pos] = '';
            this.controller._max_value = len - size;
            this.controller.options.snapsize = this.thumbSize;
            this.updateThumbscroll();
        }

    };

    p.destroy = function(){
        _super.destroy();

        if(this.options.wheel){
            if($.browser.mozilla) this.$element[0].removeEventListener('DOMMouseScroll' , this.wheellistener);
            else this.$element.unbind('mousewheel', this.wheellistener);
            this.wheellistener = null;
        }

        $(window).unbind('resize', this.resize_listener);

        this.$element.remove();

        this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
        this.slider.api.removeEventListener(MSSliderEvent.CHANGE_START , this.update , this);
    };



    window.MSThumblist = MSThumblist;
    MSSlideController.registerControl('thumblist' , MSThumblist);

})(jQuery);
//dev\slider\uicontrols\Bullets.js

;(function($){

    "use strict";

    var MSBulltes = function(options){
        BaseControl.call(this);

        this.options.dir 	= 'h';
        this.options.inset  = true;
        this.options.margin = 10;


        $.extend(this.options , options);

        this.bullets = [];

    };

    MSBulltes.extend(BaseControl);

    var p = MSBulltes.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */

    p.setup = function(){
        _super.setup.call(this);

        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'bullets')
            .addClass('ms-dir-' + this.options.dir)
            .appendTo(this.cont);

        this.$bullet_cont = $('<div></div>')
            .addClass('ms-bullets-count')
            .appendTo(this.$element);



        if( !this.options.insetTo && this.options.align ){
            // reset old styles
            this.$element.css({
                top:'auto',
                bottom:'auto'
            })

            var align = this.options.align;
            if( this.options.inset ){
                this.$element.css(align, this.options.margin );
            }
        }

    };

    p.create = function(){
        _super.create.call(this);
        var that = this;

        this.slider.api.addEventListener(MSSliderEvent.CHANGE_START , this.update , this);
        this.cindex =  this.slider.api.index();
        for(var i = 0; i < this.slider.api.count(); ++i){
            var bullet = $('<div></div>').addClass('ms-bullet');
            bullet[0].index = i;
            bullet.on('click', function(){that.changeSlide(this.index);});
            this.$bullet_cont.append(bullet);
            this.bullets.push(bullet);
        }

        if(this.options.dir === 'h')
            this.$element.width(bullet.outerWidth(true) * this.slider.api.count());

        this.select(this.bullets[this.cindex]);
    };

    p.update = function(){
        var nindex = this.slider.api.index();
        if(this.cindex === nindex) return;

        if(this.cindex != null)this.unselect(this.bullets[this.cindex]);
        this.cindex = nindex;
        this.select(this.bullets[this.cindex]);
    };

    p.changeSlide = function(index){
        if(this.cindex === index) return;
        this.slider.api.gotoSlide(index);
    };

    p.unselect = function(ele){
        ele.removeClass('ms-bullet-selected');
    };

    p.select = function(ele){
        ele.addClass('ms-bullet-selected');
    };

    p.destroy = function(){
        _super.destroy();
        this.slider.api.removeEventListener(MSSliderEvent.CHANGE_START , this.update , this);
        this.$element.remove();
    };

    window.MSBulltes = MSBulltes;

    MSSlideController.registerControl('bullets' , MSBulltes);

})(jQuery);
//dev\slider\uicontrols\Scrollbar.js

;(function($){

    "use strict";

    var MSScrollbar = function(options){
        BaseControl.call(this);

        this.options.dir 		= 'h';
        this.options.autohide	= true;
        this.options.width 		= 4;
        this.options.color 		= '#3D3D3D';
        this.options.margin		= 10;

        $.extend(this.options , options);
        this.__dimen    		= this.options.dir === 'h' ? 'width' : 'height';
        this.__jdimen    		= this.options.dir === 'h' ? 'outerWidth' : 'outerHeight';
        this.__pos				= this.options.dir === 'h' ? 'left'	 : 'top';
        this.__translate_end	= window._css3d ? ' translateZ(0px)' : '';
        this.__translate_start	= this.options.dir === 'h' ? ' translateX(' : 'translateY(';
    };

    MSScrollbar.extend(BaseControl);

    var p = MSScrollbar.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */

    p.setup = function(){

        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'sbar')
            .addClass('ms-dir-' + this.options.dir);

        _super.setup.call(this);

        if( this.slider.$controlsCont === this.cont ){
            this.$element.appendTo(this.slider.$element);
        }else{
            this.$element.appendTo(this.cont);
        }

        this.$bar = $('<div></div>')
            .addClass(this.options.prefix + 'bar')
            .appendTo(this.$element);

        if(this.slider.options.loop){
            console.log('WARNING, MSScrollbar cannot work with looped slider.');
            this.disable = true;
            this.$element.remove();
        }

        /**
         * align control
         * @since 1.5.7
         */
        // change width
        if( this.options.dir === 'v' ){
            this.$bar.width(this.options.width);
        } else {
            this.$bar.height(this.options.width);
        }

        // change color
        this.$bar.css('background-color', this.options.color);

        if( !this.options.insetTo && this.options.align ){

            // reset old versions styles
            if( this.options.dir === 'v' ){
                this.$element.css({
                    right:'auto',
                    left:'auto',
                });
            } else {
                this.$element.css({
                    top:'auto',
                    bottom:'auto',
                });
            }

            var align = this.options.align;
            if( this.options.inset ){
                this.$element.css(align, this.options.margin );
            }else if( align === 'top' ){
                this.$element.prependTo(this.slider.$element).css({
                    'margin-bottom': this.options.margin,
                    'position': 'relative'
                });
            }else if( align === 'bottom' ){
                this.$element.css({
                    'margin-top': this.options.margin,
                    'position': 'relative'
                });
            }else{
                this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
                this.align();
            }
        }
    };

    /**
     * calls by "RESERVED_SPACE_CHGANE" realigns the control in slider
     * @since 1.5.7
     */
    p.align = function(event){
        if( this.detached ){
            return;
        }

        var align = this.options.align;
        var pos = this.slider.reserveSpace(align, this.options.margin * 2 + this.options.width);
        this.$element.css(align, -pos - this.options.margin - this.options.width);
    };

    p.create = function(){

        if(this.disable) return;

        //_super.create.call(this);
        var that = this;

        this.scroller = this.slider.api.scroller;

        this.slider.api.view.addEventListener(MSViewEvents.SCROLL , this._update , this);
        this.slider.api.addEventListener(MSSliderEvent.RESIZE , this._resize , this);

        this._resize();

        if(this.options.autohide){
            this.$bar.css('opacity' , '0');
        }
    };

    p._resize = function(){
        this.vdimen = this.$element[this.__dimen]();
        this.bar_dimen = this.slider.api.view[ '__' + this.__dimen] * this.vdimen / this.scroller._max_value;
        this.$bar[this.__dimen](this.bar_dimen );
    };

    p._update = function(){
        var value = this.scroller.value * (this.vdimen - this.bar_dimen) / this.scroller._max_value;
        if(this.lvalue === value) return;
        this.lvalue = value;

        if(this.options.autohide){
            clearTimeout(this.hto);
            this.$bar.css('opacity' , '1');

            var that = this;
            this.hto = setTimeout(function(){
                //if(!that.slider.api.view.swipeControl.touchStarted)
                that.$bar.css('opacity' , '0');
            } , 150);
        }

        if(value < 0){
            this.$bar[0].style[this.__dimen] = this.bar_dimen + value + 'px';
            return;
        }

        if(value > this.vdimen - this.bar_dimen)
            this.$bar[0].style[this.__dimen] = this.vdimen - value + 'px';

        if(window._cssanim) {
            this.$bar[0].style[window._jcsspfx + 'Transform'] = this.__translate_start +value+'px)'+ this.__translate_end;
            return;
        }

        this.$bar[0].style[this.__pos] = value + 'px';

    };

    p.destroy = function(){
        _super.destroy();
        this.slider.api.view.removeEventListener(MSViewEvents.SCROLL , this._update , this);
        this.slider.api.removeEventListener(MSSliderEvent.RESIZE , this._resize , this);
        this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);

        this.$element.remove();
    };

    window.MSScrollbar = MSScrollbar;
    MSSlideController.registerControl('scrollbar' , MSScrollbar);
})(jQuery);
//dev\slider\uicontrols\Timebar.js

;(function($){

    "use strict";

    var MSTimerbar = function(options){
        BaseControl.call(this);

        this.options.autohide = false;
        this.options.width 		= 4;
        this.options.color 		= '#FFFFFF';
        this.options.inset 		= true;
        this.options.margin 	= 0;

        $.extend(this.options , options);
    };

    MSTimerbar.extend(BaseControl);

    var p = MSTimerbar.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */

    p.setup = function(){
        var that = this;
        _super.setup.call(this);

        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'timerbar');

        _super.setup.call(this);

        if( this.slider.$controlsCont === this.cont ){
            this.$element.appendTo(this.slider.$element);
        }else{
            this.$element.appendTo(this.cont);
        }

        this.$bar = $('<div></div>')
            .addClass('ms-time-bar')
            .appendTo(this.$element);

        // change width
        if( this.options.dir === 'v' ){
            this.$bar.width(this.options.width);
            this.$element.width(this.options.width);
        } else {
            this.$bar.height(this.options.width);
            this.$element.height(this.options.width);
        }

        // change color
        this.$bar.css('background-color', this.options.color);

        if( !this.options.insetTo && this.options.align ){

            this.$element.css({
                top:'auto',
                bottom:'auto',
            });

            var align = this.options.align;
            if( this.options.inset ){
                this.$element.css(align, this.options.margin );
            }else if( align === 'top' ){
                this.$element.prependTo(this.slider.$element).css({
                    'margin-bottom': this.options.margin,
                    'position': 'relative'
                });
            }else if( align === 'bottom' ){
                this.$element.css({
                    'margin-top': this.options.margin,
                    'position': 'relative'
                });
            }else{
                this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
                this.align();
            }
        }

    };

    /**
     * calls by "RESERVED_SPACE_CHGANE" realigns the control in slider
     * @since 1.5.7
     */
    p.align = function(event){
        if( this.detached ){
            return;
        }

        var align = this.options.align;
        var pos = this.slider.reserveSpace(align, this.options.margin * 2 + this.options.width);
        this.$element.css(align, -pos - this.options.margin - this.options.width);
    };

    p.create = function(){
        _super.create.call(this);
        this.slider.api.addEventListener(MSSliderEvent.WAITING , this._update , this);
        this._update();
    };

    p._update = function(){
        this.$bar[0].style.width = this.slider.api._delayProgress  + '%';
    };

    p.destroy = function(){
        _super.destroy();
        this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
        this.slider.api.removeEventListener(MSSliderEvent.WAITING , this._update , this);
        this.$element.remove();
    };

    window.MSTimerbar = MSTimerbar;
    MSSlideController.registerControl('timebar' , MSTimerbar);
})(jQuery);
//dev\slider\uicontrols\CircleTimer.js

;(function($){

    "use strict";

    var MSCircleTimer = function(options){
        BaseControl.call(this);

        this.options.color 	= '#A2A2A2';
        this.options.stroke = 10;
        this.options.radius	= 4;

        this.options.autohide = false;
        $.extend(this.options , options);
    };

    MSCircleTimer.extend(BaseControl);

    var p = MSCircleTimer.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */

    p.setup = function(){
        var that = this;
        _super.setup.call(this);

        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'ctimer')
            .appendTo(this.cont);

        this.$canvas = 	$('<canvas></canvas>')
            .addClass('ms-ctimer-canvas')
            .appendTo(this.$element);

        this.$bar = $('<div></div>')
            .addClass('ms-ctimer-bullet')
            .appendTo(this.$element);

        if(!this.$canvas[0].getContext){
            this.destroy();
            this.disable = true;
            return;
        }


        this.ctx		= this.$canvas[0].getContext('2d');
        this.prog		= 0;

        this.__w = (this.options.radius + this.options.stroke/2) * 2;
        this.$canvas[0].width  = this.__w;
        this.$canvas[0].height = this.__w;
    };

    p.create = function(){
        if(this.disable) return;
        _super.create.call(this);
        this.slider.api.addEventListener(MSSliderEvent.WAITING , this._update , this);

        var that = this;
        this.$element.click(function(){
            if(that.slider.api.paused)
                that.slider.api.resume();
            else
                that.slider.api.pause();
        });

        this._update();
    };

    p._update = function(){
        var that = this;
        $(this).stop(true).animate({prog:this.slider.api._delayProgress * 0.01} ,
            {duration:200 , step:function(){that._draw();}});
        //this.$bar[0].style.width = this.slider.api._delayProgress/100 * this.$element.width() + 'px';
    };

    p._draw = function(){
        this.ctx.clearRect(0 , 0,  this.__w ,  this.__w);
        this.ctx.beginPath();
        this.ctx.arc(this.__w * .5 , this.__w * .5 ,this.options.radius , Math.PI * 1.5 , Math.PI * 1.5 + 2 * Math.PI * this.prog, false);
        this.ctx.strokeStyle = this.options.color;
        this.ctx.lineWidth = this.options.stroke;
        this.ctx.stroke();
    };

    p.destroy = function(){
        _super.destroy();
        if(this.disable) return;
        $(this).stop(true);
        this.slider.api.removeEventListener(MSSliderEvent.WAITING , this._update , this);
        this.$element.remove();
    };

    window.MSCircleTimer = MSCircleTimer;
    MSSlideController.registerControl('circletimer' , MSCircleTimer);
})(jQuery);
//dev\slider\uicontrols\Lightbox.js

;(function($){

    "use strict";

    window.MSLightbox = function(options){
        BaseControl.call(this , options);

        this.options.autohide	= false;
        $.extend(this.options , options);

        this.data_list = [];
    };
    MSLightbox.fadeDuratation = 400;
    MSLightbox.extend(BaseControl);

    var p = MSLightbox.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */
    p.setup = function(){
        _super.setup.call(this);

        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'lightbox-btn')
            .appendTo(this.cont);

    };

    p.slideAction = function(slide)
    {
        $('<div></div>')
            .addClass(this.options.prefix + 'lightbox-btn')
            .appendTo(slide.$element)
            .append($(slide.$element.find('.ms-lightbox')));

    };

    p.create = function(){
        _super.create.call(this);

    };


    MSSlideController.registerControl('lightbox' , MSLightbox);
})(jQuery);
//dev\slider\uicontrols\SlideInfo.js

;(function($){

    "use strict";

    window.MSSlideInfo = function(options){
        BaseControl.call(this , options);

        this.options.autohide	= false;
        this.options.align  = null;
        this.options.inset = false;
        this.options.margin = 10;
        this.options.size = 100;
        this.options.dir = 'h';

        $.extend(this.options , options);

        this.data_list = [];
    };
    MSSlideInfo.fadeDuratation = 400;
    MSSlideInfo.extend(BaseControl);

    var p = MSSlideInfo.prototype;
    var _super = BaseControl.prototype;

    /* -------------------------------- */
    p.setup = function(){
        this.$element = $('<div></div>')
            .addClass(this.options.prefix + 'slide-info')
            .addClass('ms-dir-' + this.options.dir);

        _super.setup.call(this);

        if( this.slider.$controlsCont === this.cont ){
            this.$element.appendTo(this.slider.$element); // insert in outter container out of overflow hidden
        }else{
            this.$element.appendTo(this.cont);
        }

        // align control
        if( !this.options.insetTo && this.options.align ){
            var align = this.options.align;
            if( this.options.inset ){
                this.$element.css(align, this.options.margin );
            }else if( align === 'top' ){
                this.$element.prependTo(this.slider.$element).css({
                    'margin-bottom': this.options.margin,
                    'position': 'relative'
                });
            }else if( align === 'bottom' ){
                this.$element.css({
                    'margin-top': this.options.margin,
                    'position': 'relative'
                });
            }else{
                this.slider.api.addEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
                this.align();
            }

            if( this.options.dir === 'v' ){
                this.$element.width(this.options.size);
            }else{
                this.$element.css('min-height', this.options.size);
            }
        }

    };

    /**
     * calls by "RESERVED_SPACE_CHGANE" realigns the control in slider
     * @since 1.5.7
     */
    p.align = function(event){
        if( this.detached ){
            return;
        }
        var align = this.options.align;
        var pos = this.slider.reserveSpace(align, this.options.size + this.options.margin * 2);
        this.$element.css(align, -pos - this.options.size - this.options.margin);
    };

    p.slideAction = function(slide){
        var info_ele = $(slide.$element.find('.ms-info'));
        var that = this;
        info_ele.detach();

        this.data_list[slide.index] = info_ele;
    };

    p.create = function(){
        _super.create.call(this);
        this.slider.api.addEventListener(MSSliderEvent.CHANGE_START , this.update , this);
        this.cindex =  this.slider.api.index();
        this.switchEle(this.data_list[this.cindex]);
    };

    p.update = function(){
        var nindex = this.slider.api.index();
        this.switchEle(this.data_list[nindex]);
        this.cindex = nindex;
    };

    p.switchEle = function(ele){
        if(this.current_ele){
            var that = this;

            if(jQuery(this.current_ele[0]).tween)jQuery(this.current_ele[0]).tween.stop(true);
            jQuery(this.current_ele[0]).tween = CTween.animate(this.current_ele , MSSlideInfo.fadeDuratation  , {opacity:0} , {complete:function(){
                this.detach();
                this[0].tween = null;
                ele.css('position', 'relative');
            } , target:this.current_ele });

            //this.current_ele.css('position', 'absolute');
            ele.css('position', 'absolute');
        }

        this.__show(ele);
    };

    p.__show = function(ele){
        ele.appendTo(this.$element).css('opacity','0');///.css('position', 'relative');

        // calculate max height
        if ( this.current_ele ){
            ele.height( Math.max( ele.height(), this.current_ele.height() ) );
        }

        clearTimeout(this.tou);
        this.tou = setTimeout(function(){
            CTween.fadeIn(ele , MSSlideInfo.fadeDuratation );
            ele.css('height', '');
        }, MSSlideInfo.fadeDuratation);

        if(jQuery(ele[0]).tween)
        {
            jQuery(ele[0]).tween.stop(true);
        }
        this.current_ele = ele;
    };

    p.destroy = function(){
        _super.destroy();
        clearTimeout(this.tou);
        if(this.current_ele && this.current_ele[0].tween){
            this.current_ele[0].tween.stop('true');
        }
        this.$element.remove();
        this.slider.api.removeEventListener(MSSliderEvent.RESERVED_SPACE_CHANGE, this.align, this);
        this.slider.api.removeEventListener(MSSliderEvent.CHANGE_START , this.update , this);
    };

    MSSlideController.registerControl('slideinfo' , MSSlideInfo);
})(jQuery);
//dev\slider\plugins\MSGallery.js

/**
 *	Master Slider, Gallery Template v1.0
 * 	@author: Averta Ltd.
 */

;(function($){

    window.MSGallery = function(id , slider){
        this.id = id;
        this.slider = slider;

        this.telement = $('#'+id);

        this.botcont = $('<div></div>').addClass('ms-gallery-botcont').appendTo(this.telement);
        this.thumbcont = $('<div></div>').addClass('ms-gal-thumbcont hide-thumbs').appendTo(this.botcont);
        this.playbtn  = $('<div></div>').addClass('ms-gal-playbtn').appendTo(this.botcont);
        this.thumbtoggle  = $('<div></div>').addClass('ms-gal-thumbtoggle').appendTo(this.botcont);

        // adds required controls to slider
        slider.control('thumblist' , {insertTo:this.thumbcont , autohide:false , dir:'h'});
        slider.control('slidenum'  , {insertTo:this.botcont , autohide:false});
        slider.control('slideinfo' , {insertTo:this.botcont , autohide:false});
        slider.control('timebar'   , {insertTo:this.botcont , autohide:false});
        slider.control('bullets'   , {insertTo:this.botcont , autohide:false});
    };

    var p = MSGallery.prototype;

    p._init = function(){
        var that = this;

        if(!this.slider.api.paused)
            this.playbtn.addClass('btn-pause');

        this.playbtn.click(function(){
            if(that.slider.api.paused){
                that.slider.api.resume();
                that.playbtn.addClass('btn-pause');
            }else{
                that.slider.api.pause();
                that.playbtn.removeClass('btn-pause');
            }
        });


        this.thumbtoggle.click(function(){

            if(that.vthumbs){
                //that.hideThumbs();
                that.thumbtoggle.removeClass('btn-hide');
                that.vthumbs = false;
                that.thumbcont.addClass('hide-thumbs');
            }else{
                //that.showThumbs();
                that.thumbtoggle.addClass('btn-hide');
                that.thumbcont.removeClass('hide-thumbs');
                that.vthumbs = true;
            }
        });

    };

    p.setup = function(){
        var that = this;
        // $(document).ready(function(){that._init();});
        console.log("p.setup");
        that._init()
    };


})(jQuery);
//dev\slider\plugins\MSFlickrV2.js

/**
 * Master Slider Flickr Plugin Version 2
 * @version 2.0.0
 * @author Averta Ltd.
 */
;(function($){

    /**
     * Generate Flickr photoset url
     * @param  {String} key   api key
     * @param  {String} id    photoset id
     * @param  {Number} count number of images
     * @return {String}
     */
    var getPhotosetURL = function(key , id , count){
        return 'https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=' + key + '&photoset_id='+ id +'&per_page='+ count +'&extras=description,date_taken,owner_name,views&format=json&jsoncallback=?';
    };

    /**
     * Generate Flickr user public images url
     * @param  {String} key   api key
     * @param  {String} id    user id
     * @param  {Number} count number of images
     * @return {String}
     */
    var getUserPublicURL = function(key , id , count){
        return 'https://api.flickr.com/services/rest/?&method=flickr.people.getPublicPhotos&api_key=' + key + '&user_id='+ id +'&per_page='+ count +'&extras=description,date_taken,owner_name,views&format=json&jsoncallback=?';
    };

    /**
     * Generates image path
     * @param  {String} fid
     * @param  {String} server
     * @param  {String} id
     * @param  {String} secret
     * @param  {String} size
     * @return {String}
     */
    var getImageSource = function(fid , server , id , secret , size){
        return 'https://farm' + fid + '.staticflickr.com/'+ server + '/' + id + '_' + secret + size + '.jpg';
    };

    window.MSFlickrV2 = function(slider,options){
        var _options = {
            count			:10,
            type			:'photoset',
            /*
             * s small square 75x75
             * q large square 150x150
             * t thumbnail, 100 on longest side
             */
            thumbSize	:'q',

            /*
             * -	medium, 500 on longest side
             * z	medium 640, 640 on longest side
             * c	medium 800, 800 on longest side
             * b	large, 1024 on longest side
             * o	original image, either a jpg, gif or png, depending on source format
             */
            imgSize		: 'c'
        };

        this.slider = slider;
        this.slider.preventInit = true;

        if( !options.key ){
            this.errMsg('Flickr API Key required. Please add it in settings.');
            return;
        }

        $.extend(_options , options);
        this.options = _options;

        var that = this;

        if(this.options.type === 'photoset'){
            $.getJSON(getPhotosetURL(this.options.key , this.options.id , this.options.count) , function(data){
                that._photosData(data);
            });
        }else{
            $.getJSON(getUserPublicURL(this.options.key , this.options.id , this.options.count) , function(data){
                that.options.type = 'photos';
                that._photosData(data);
            });
        }

        if(this.options.imgSize !== '' && this.options.imgSize !== '-')
            this.options.imgSize = '_' + this.options.imgSize;

        this.options.thumbSize = '_' + this.options.thumbSize;

        // grab slide template from slider markup
        this.slideTemplate = this.slider.$element.find('.ms-slide')[0].outerHTML;
        this.slider.$element.find('.ms-slide').remove(); // remove all slides from slider markup
    };

    var p = MSFlickrV2.prototype;

    p._photosData = function(data){

        if(data.stat === 'fail'){
            this.errMsg('Flickr API ERROR#' + data.code + ': ' + data.message);
            return;
        }

        var that = this;
        var getInfo = this.options.author || this.options.desc;
        $.each(data[this.options.type].photo, function(i,item){

            var slide_cont = that.slideTemplate.replace(/{{[\w-]+}}/g, function(match){
                match = match.replace(/{{|}}/g, '');
                if( shortCodes[match] ) {
                    return shortCodes[match](item, that);
                } else {
                    return '['+match+']';
                }

            });

            $(slide_cont).appendTo(that.slider.$element);

        });

        that._initSlider();
    };

    p.errMsg = function(msg){
        this.slider.$element.css('display', 'block');
        if(!this.errEle)
            this.errEle = $('<div style="font-family:Arial; color:red; font-size:12px; position:absolute; top:10px; left:10px"></div>').appendTo(this.slider.$loading);

        this.errEle.html(msg);
    };

    p._initSlider = function(){
        this.slider.preventInit = false;
        this.slider._init();
    };

    // a list of functions that generates data from short codes
    var shortCodes = {
        'image': function(data, that){
            return getImageSource(data.farm , data.server , data.id , data.secret , that.options.imgSize);
        },

        'thumb': function(data, that){
            return getImageSource(data.farm , data.server , data.id , data.secret , that.options.thumbSize);
        },

        'title': function(data, that){
            return data.title;
        },

        'owner-name': function(data, that){
            return data.ownername;
        },

        'date-taken': function(data, that){
            return data.datetaken;
        },

        'views': function(data, that){
            return data.views;
        },

        'description': function(data, that){
            return data.description._content;
        }
    };

})(jQuery);//dev\slider\plugins\MSFacebookGallery.js

/**
 * Master Slider Facebook Gallery plugin
 * @author Averta Ltd.
 * @version 1.0.0
 */
;(function($){


    window.MSFacebookGallery = function(slider, options){
        var _options = {
            count			:10,
            type			:'photostream', // album
            /*
             orginal/960/720/600/480/320/130
             */
            thumbSize	:'320',

            /*
             orginal/960/720/600/480/320/130
             */
            imgSize		: 'orginal',

            https: false
        };

        this.slider = slider;
        this.slider.preventInit = true;

        $.extend(_options , options);
        this.options = _options;

        this.graph = this.options.https ? 'https://graph.facebook.com' : 'http://graph.facebook.com';

        var that = this;

        if(this.options.type === 'photostream'){
            $.getJSON(this.graph + '/' + this.options.username + '/photos/uploaded/?fields=source,name,link,images,from&limit=' + this.options.count , function(data){
                that._photosData(data);
            });
        }else{
            $.getJSON(this.graph + '/' + this.options.albumId + '/photos?fields=source,name,link,images,from&limit=' + this.options.count , function(data){
                that._photosData(data);
            });
        }

        // grab slide template from slider markup
        this.slideTemplate = this.slider.$element.find('.ms-slide')[0].outerHTML;
        this.slider.$element.find('.ms-slide').remove(); // remove all slides from slider markup
    };

    var p = MSFacebookGallery.prototype;

    p._photosData = function(content){

        if(content.error){
            this.errMsg('Facebook API ERROR#' + content.error.code + '(' + content.error.type + ')' + ': ' + content.error.message);
            return;
        }

        var that = this;
        var getInfo = this.options.author || this.options.desc;

        for(var i=0,l=content.data.length;i!==l;i++){

            var slide_cont = that.slideTemplate.replace(/{{[\w-]+}}/g, function(match){
                match = match.replace(/{{|}}/g, '');
                if( shortCodes[match] ) {
                    return shortCodes[match](content.data[i], that);
                } else {
                    return '{{'+match+'}}';
                }

            });

            $(slide_cont).appendTo(that.slider.$element);
        }

        that._initSlider();
    };

    p.errMsg = function(msg){
        this.slider.$element.css('display', 'block');
        if(!this.errEle)
            this.errEle = $('<div style="font-family:Arial; color:red; font-size:12px; position:absolute; top:10px; left:10px"></div>').appendTo(this.slider.$loading);

        this.errEle.html(msg);
    };

    p._initSlider = function(){
        this.slider.preventInit = false;
        this.slider._init();
    };

    var getImageSource = function(images, size){

        if( size === 'orginal' ) {
            return images[0].source;
        }

        for(var i = 0, l = images.length; i !== l; i++){
            if( images[i].source.indexOf(size + 'x' + size) !== -1 )
                return images[i].source;
        }

        return images[l-3].source;
    };

    // a list of functions that generates data from short codes
    var shortCodes = {
        'image': function(data, that){

            return getImageSource(data.images, that.options.imgSize);
        },

        'thumb': function(data, that){
            return getImageSource(data.images, that.options.thumbSize);
        },

        'name': function(data, that){
            return data.name;
        },

        'owner-name': function(data, that){
            return data.from.name;
        },

        'link': function(data, that){
            return data.link;
        }
    };

})(jQuery);