

/*========== Start Nav ==========*/
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration

jQuery.extend( jQuery.easing,
{

        easeInCubic: function (x, t, b, c, d) {
                return c*(t/=d)*t*t + b;
        },
        easeOutCubic: function (x, t, b, c, d) {
                return c*((t=t/d-1)*t*t + 1) + b;
        },

});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright � 2001 Robert Penner
 * All rights reserved.
  *
 */

(function(jQuery){
     jQuery.fn.extend({
         accordion: function() {       
            return this.each(function() {
                
                                function activate(el,effect){
                                        
                                        
                                        jQuery(el).siblings( panelSelector )[(effect || activationEffect)](((effect == "show")?activationEffectSpeed:false),function(){
jQuery(el).parents().show();
                                        
                                        });
                                        
                                }
                                
            });
        }
    }); 
})(jQuery);

jQuery(function($) {

//      $(".accordion li.parent").each(function(){
//              $(this).append('<span class="opener new">&nbsp;</span>');
//      });

        $('.accordion').accordion();
        
        $('.accordion').each(function(index){
                var activeItems = $(this).find('li.active');
                activeItems.each(function(i){
                        $(this).children('ul').css('display', 'block');
                        if (i == activeItems.length - 1)
                        {
                                $(this).addClass("current");
                        }
                });
        });
        
});


/*========== End Nav ==========*/

/*========== Start Products Slider ==========*/
jQuery(document).ready(function(){      
        //Back to top slider
    jQuery('a[href=#totop]').click(function(){
        jQuery('html, body').animate({scrollTop:0}, 600);
        return false;
    });
        // Product Slider
    jQuery('#featured-products').jcarousel();

        // FancyBox jQuery
        jQuery("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true }); 

        // Slider Homepage
        jQuery("#slider").easySlider({
                auto: true,
                continuous: true,
                numeric: true
        });
});


(function($) {
 
    $.fn.jcarousel = function(o) {
        return this.each(function() {
            new $jc(this, o);
        });
    };

    // Default configuration properties.
    var defaults = {
        vertical: false,
        start: 1,
        offset: 1,
        size: null,
        scroll: 3,
        visible: null,
        animation: 'normal',
        easing: 'swing',
        auto: 0,
        wrap: null,
        initCallback: null,
        reloadCallback: null,
        itemLoadCallback: null,
        itemFirstInCallback: null,
        itemFirstOutCallback: null,
        itemLastInCallback: null,
        itemLastOutCallback: null,
        itemVisibleInCallback: null,
        itemVisibleOutCallback: null,
        buttonNextHTML: '<div></div>',
        buttonPrevHTML: '<div></div>',
        buttonNextEvent: 'click',
        buttonPrevEvent: 'click',
        buttonNextCallback: null,
        buttonPrevCallback: null
    };

    /**
     * The jCarousel object.
     *
     * @constructor
     * @name $.jcarousel
     * @param Object e The element to create the carousel for.
     * @param Hash o A set of key/value pairs to set as configuration properties.
     * @cat Plugins/jCarousel
     */
    $.jcarousel = function(e, o) {
        this.options    = $.extend({}, defaults, o || {});

        this.locked     = false;

        this.container  = null;
        this.clip       = null;
        this.list       = null;
        this.buttonNext = null;
        this.buttonPrev = null;

        this.wh = !this.options.vertical ? 'width' : 'height';
        this.lt = !this.options.vertical ? 'left' : 'top';

        // Extract skin class
        var skin = '', split = e.className.split(' ');

        this.buttonPrev = $('.jcarousel-prev', this.container);

        if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
            this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();

        this.buttonPrev.addClass(this.className('jcarousel-prev'));

        this.buttonNext = $('.jcarousel-next', this.container);

        if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
            this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();

        this.buttonNext.addClass(this.className('jcarousel-next'));

        this.clip.addClass(this.className('jcarousel-clip'));
        this.list.addClass(this.className('jcarousel-list'));
        this.container.addClass(this.className('jcarousel-container'));

        if (li.size() > 0) {
            var wh = 0, i = this.options.offset;
            li.each(function() {
                self.format(this, i++);
                wh += self.dimension(this, di);
            });

            this.list.css(this.wh, wh + 'px');

            // Only set if not explicitly passed as option
            if (!o || o.size === undefined)
                this.options.size = li.size();
        }

        // For whatever reason, .show() does not work in Safari...
        this.container.css('display', 'block');
        this.buttonNext.css('display', 'block');
        this.buttonPrev.css('display', 'block');

        this.funcNext   = function() { self.next(); };
        this.funcPrev   = function() { self.prev(); };
        this.funcResize = function() { self.reload(); };

        if (this.options.initCallback != null)
            this.options.initCallback(this, 'init');

        if ($.browser.safari) {
            this.buttons(false, false);
            $(window).bind('load', function() { self.setup(); });
        } else
            this.setup();
    };

    // Create shortcut for internal use
    var $jc = $.jcarousel;

    $jc.fn = $jc.prototype = {
        jcarousel: '0.2.3'
    };

    $jc.fn.extend = $jc.extend = $.extend;

    $jc.fn.extend({
        


        /**
         * Animates the carousel to a certain position.
         *
         * @name animate
         * @type undefined
         * @param mixed p Position to scroll to.
         * @param Bool a Flag indicating whether to perform animation.
         * @cat Plugins/jCarousel
         */
        animate: function(p, a) {
            if (this.locked || this.animating)
                return;

            this.animating = true;

            var self = this;
            var scrolled = function() {
                self.animating = false;

                if (p == 0)
                    self.list.css(self.lt,  0);

                if (self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
                    self.startAuto();

                self.buttons();
                self.notify('onAfterAnimation');
            };

            this.notify('onBeforeAnimation');

            // Animate
            if (!this.options.animation || a == false) {
                this.list.css(this.lt, p + 'px');
                scrolled();
            } else {
                var o = !this.options.vertical ? {'left': p} : {'top': p};
                this.list.animate(o, this.options.animation, this.options.easing, scrolled);
            }
        },

        /**
         * Sets the states of the prev/next buttons.
         *
         * @name buttons
         * @type undefined
         * @cat Plugins/jCarousel
         */
        index: function(i, s) {
            if (s == undefined)
                s = this.options.size;

            return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
        }
    });

    $jc.extend({
        /**
         * Gets/Sets the global default configuration properties.
         *
         * @name defaults
         * @descr Gets/Sets the global default configuration properties.
         * @type Hash
         * @param Hash d A set of key/value pairs to set as configuration properties.
         * @cat Plugins/jCarousel
         */
  

        margin: function(e, p) {
            if (!e)
                return 0;

            var el = e.jquery != undefined ? e[0] : e;

            if (p == 'marginRight' && $.browser.safari) {
                var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;

                $.swap(el, old, function() { oWidth = el.offsetWidth; });

                old['marginRight'] = 0;
                $.swap(el, old, function() { oWidth2 = el.offsetWidth; });

                return oWidth2 - oWidth;
            }

            return $jc.intval($.css(el, p));
        },

        intval: function(v) {
            v = parseInt(v);
            return isNaN(v) ? 0 : v;
        }
    });

})(jQuery);
/*
 *      Easy Slider 1.7 - jQuery plugin
 *      written by Alen Grakalic        
 *      http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
 *
 *      Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *      Dual licensed under the MIT (MIT-LICENSE.txt)
 *      and GPL (GPL-LICENSE.txt) licenses.
 *
 *      Built for jQuery library
 *      http://jquery.com
 *
 */

(function($) {

        $.fn.easySlider = function(options){
          
                // default configuration properties
                var defaults = {                        
                        prevId:                 'prevBtn',
                        prevText:               'Previous',
                        nextId:                 'nextBtn',      
                        nextText:               'Next',
                        controlsShow:   true,
                        controlsBefore: '',
                        controlsAfter:  '',     
                        controlsFade:   true,
                        firstId:                'firstBtn',
                        firstText:              'First',
                        firstShow:              false,
                        lastId:                 'lastBtn',      
                        lastText:               'Last',
                        lastShow:               false,                          
                        vertical:               false,
                        speed:                  1000,
                        auto:                   false,
                        pause:                  3000,
                        continuous:             true, 
                        numeric:                false,
                        numericId:              'controls'
                }; 
                
                var options = $.extend(defaults, options);  
                                
                this.each(function() {  
                        var obj = $(this);                              
                        var s = $("li", obj).length;
                        var w = $("li", obj).width(); 
                        var h = $("li", obj).height(); 
                        var clickable = true;
                        obj.width(w); 
                        obj.height(h); 
                        obj.css("overflow","hidden");
                        var ts = s-1;
                        var t = 0;
                        $("ul", obj).css('width',s*w);                  
                        
                        if(options.continuous){
                                $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
                                $("ul", obj).append($("ul li:nth-child(2)", obj).clone());
                                $("ul", obj).css('width',(s+1)*w);
                        };                              
                        
                        if(!options.vertical) $("li", obj).css('float','left');
                                                                
                        
                        
                        function animate(dir,clicked){
                                if (clickable){
                                        clickable = false;
                                        var ot = t;                             
                                        switch(dir){
                                                case "next":
                                                        t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;                                           
                                                        break; 
                                                case "prev":
                                                        t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
                                                        break; 
                                                case "first":
                                                        t = 0;
                                                        break; 
                                                case "last":
                                                        t = ts;
                                                        break; 
                                                default:
                                                        t = dir;
                                                        break; 
                                        };      
                                                                        
                                        if(!options.vertical) {
                                                p = (t*w*-1);
                                                $("ul",obj).animate(
                                                        { marginLeft: p }, 
                                                        { queue:false, duration:speed, complete:adjust }
                                                );                              
                                        } else {
                                                p = (t*h*-1);
                                                $("ul",obj).animate(
                                                        { marginTop: p }, 
                                                        { queue:false, duration:speed, complete:adjust }
                                                );                                      
                                        };
                                        
                                                                
                                        
                                        if(clicked) clearTimeout(timeout);
                                        if(options.auto && dir=="next" && !clicked){;
                                                timeout = setTimeout(function(){
                                                        animate("next",false);
                                                },diff*options.speed+options.pause);
                                        };
                        
                                };
                                
                        };
                        // init
                                        
                        
                });
          
        };

})(jQuery);


;(function($) {
        $.fn.fixPNG = function() {
                return this.each(function () {
                        var image = $(this).css('backgroundImage');

                        if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
                                image = RegExp.$1;
                                $(this).css({
                                        'backgroundImage': 'none',
                                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=" + ($(this).css('backgroundRepeat') == 'no-repeat' ? 'crop' : 'scale') + ", src='" + image + "')"
                                }).each(function () {
                                        var position = $(this).css('position');
                                        if (position != 'absolute' && position != 'relative')
                                                $(this).css('position', 'relative');
                                });
                        }
                });
        };

        $.fn.fancybox = function(o) {
        
                function _initialize() {
                        elem = this;
                        opts = $.extend({}, settings);

                        _start();

                        return false;
                };

                function _start() {
                        if (busy) return;

                        if ($.isFunction(opts.callbackOnStart)) {
                                opts.callbackOnStart();
                        }

                        opts.itemArray          = [];
                        opts.itemCurrent        = 0;

                        if (settings.itemArray.length > 0) {
                                opts.itemArray = settings.itemArray;

                        } else {
                                var item = {};

                                if (!elem.rel || elem.rel == '') {
                                        var item = {href: elem.href, title: elem.title};

                                        if ($(elem).children("img:first").length) {
                                                item.orig = $(elem).children("img:first");
                                        } else {
                                                item.orig = $(elem);
                                        }

                                        if (item.title == '' || typeof item.title == 'undefined') {
                                                item.title = item.orig.attr('alt');
                                        }
                                        
                                        opts.itemArray.push( item );

                                } else {
                                        var subGroup = $(matchedGroup).filter("a[rel=" + elem.rel + "]");
                                        var item = {};

                                        for (var i = 0; i < subGroup.length; i++) {
                                                item = {href: subGroup[i].href, title: subGroup[i].title};

                                                if ($(subGroup[i]).children("img:first").length) {
                                                        item.orig = $(subGroup[i]).children("img:first");
                                                } else {
                                                        item.orig = $(subGroup[i]);
                                                }

                                                if (item.title == '' || typeof item.title == 'undefined') {
                                                        item.title = item.orig.attr('alt');
                                                }

                                                opts.itemArray.push( item );
                                        }
                                }
                        }
                
                        
                        $(window).bind("resize.fb scroll.fb", $.fn.fancybox.scrollBox);

                        _change_item();
                };



                function _finish() {
                        
                        
                        busy = false;
                };

                return this.unbind('click.fb').bind('click.fb', _initialize);
        };


        

})(jQuery);


/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(i){var q={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null, itemFallbackDimension:null},r=false;i(window).bind("load.jcarousel",function(){r=true});i.jcarousel=function(a,c){this.options=i.extend({},q,c||{});this.autoStopped=this.locked=false;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===undefined)this.options.rtl=(i(a).attr("dir")||i("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?this.options.rtl? "right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){i(a).removeClass(d[f]);b=d[f];break}if(a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"){this.list=i(a);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");this.container=this.container.parent()}else if(!this.container.hasClass("jcarousel-container"))this.container= this.list.wrap("<div></div>").parent()}else{this.container=i(a);this.list=this.container.find("ul,ol").eq(0)}b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();this.buttonNext=i(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext= this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className("jcarousel-next"));this.buttonPrev=i(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden", position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;b=this.list.children("li");var e=this;if(b.size()>0){var g=0,k=this.options.offset;b.each(function(){e.format(this,k++);g+=e.dimension(this, j)});this.list.css(this.wh,g+100+"px");if(!c||c.size===undefined)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.reload()};this.options.initCallback!==null&&this.options.initCallback(this,"init");if(!r&&i.browser.safari){this.buttons(false,false);i(window).bind("load.jcarousel",function(){e.setup()})}else this.setup()}; var h=i.jcarousel;h.fn=h.prototype={jcarousel:"0.2.7"};h.fn.extend=h.extend=i.extend;h.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=false;this.tail=this.timer=null;this.inTail=false;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(a,false);i(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}}, reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0; this.list.children("li").each(function(f){b+=a.dimension(this,c);if(f+1<a.first)d=b});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(a){if(a!==undefined){this.options.size=a;this.locked||this.buttons()}return this.options.size},has:function(a,c){if(c===undefined||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b= a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return false}return true},get:function(a){return i(".jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,f=i(c);if(b.length===0){var j,e=h.intval(a);for(b=this.create(a);;){j=this.get(--e);if(e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}}else d=this.dimension(b);if(f.get(0).nodeName.toUpperCase()=="LI"){b.replaceWith(f);b=f}else b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")), a);f=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;d=this.dimension(b,f)-d;a>0&&a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,h.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(!(!c.length||a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,h.intval(this.list.css(this.wh))- b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!(this.locked|| this.animating||!this.tail)){this.pauseAuto();var c=h.intval(this.list.css(this.lt));c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){if(!(this.locked||this.animating)){this.pauseAuto();this.animate(this.pos(a),c)}},pos:function(a,c){var b=h.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;if(this.options.wrap!="circular")a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a;for(var d= this.first>a,f=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(f):this.get(this.last),e=d?f:f-1,g=null,k=0,l=false,m=0;d?--e>=a:++e<a;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g=this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(l)k+= m;if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<=this.options.size)))b=d?b+m:b-m}f=this.clipping();var p=[],o=0,n=0;j=this.get(a-1);for(e=a;++o;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j.length===0?this.list.prepend(g):j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g= this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(m===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");if(this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size)p.push(g);else if(l)k+=m;n+=m;if(n>=f)break;e++}for(g=0;g<p.length;g++)p[g].remove();if(k>0){this.list.css(this.wh,this.dimension(this.list)+k+"px");if(d){b-=k;this.list.css(this.lt,h.intval(this.list.css(this.lt))-k+"px")}}k=a+o-1;if(this.options.wrap!="circular"&& this.options.size&&k>this.options.size)k=this.options.size;if(e>k){o=0;e=k;for(n=0;++o;){g=this.get(e--);if(!g.length)break;n+=this.dimension(g);if(n>=f)break}}e=k-o+1;if(this.options.wrap!="circular"&&e<1)e=1;if(this.inTail&&d){b+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&k==this.options.size&&k-o+1>=1){d=h.margin(this.get(k),!this.options.vertical?"marginRight":"marginBottom");if(n-d>f)this.tail=n-f-d}if(c&&a===this.options.size&&this.tail){b-=this.tail;this.inTail= true}for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=k;return b},animate:function(a,c){if(!(this.locked||this.animating)){this.animating=true;var b=this,d=function(){b.animating=false;a===0&&b.list.css(b.lt,0);if(!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail))b.startAuto();b.buttons();b.notify("onAfterAnimation"); if(b.options.wrap=="circular"&&b.options.size!==null)for(var f=b.prevFirst;f<=b.prevLast;f++)if(f!==null&&!(f>=b.first&&f<=b.last)&&(f<1||f>b.options.size))b.remove(f)};this.notify("onBeforeAnimation");if(!this.options.animation||c===false){this.list.css(this.lt,a+"px");d()}else this.list.animate(!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},this.options.animation,this.options.easing,d)}},startAuto:function(a){if(a!==undefined)this.options.auto=a;if(this.options.auto===0)return this.stopAuto(); if(this.timer===null){this.autoStopped=false;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null}},buttons:function(a,c){if(a==null){a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap== "first")&&this.options.size!==null&&this.last>=this.options.size)a=this.tail!==null&&!this.inTail}if(c==null){c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1)c=this.tail!==null&&this.inTail}var b=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);a&&this.buttonNext.bind(this.options.buttonNextEvent+ ".jcarousel",this.funcNext);this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?false:true);this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)}else this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+ ".jcarousel",this.funcPrev);c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?false:true);this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)}else this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b, null,c);this.buttonNextState=a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",a,c,this.first);this.callback("itemFirstOutCallback",a,c,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",a,c,this.last);this.callback("itemLastOutCallback",a,c,this.prevLast)}this.callback("itemVisibleInCallback", a,c,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var g=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(i.isFunction(g)){var k=this;if(d===undefined)g(k,b,c);else if(f===undefined)this.get(d).each(function(){g(k,this,d,b,c)});else{a=function(m){k.get(m).each(function(){g(k, this,m,b,c)})};for(var l=d;l<=f;l++)l!==null&&!(l>=j&&l<=e)&&a(l)}}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){a=i(a);for(var b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical? "-horizontal":"-vertical")},dimension:function(a,c){var b=a.jquery!==undefined?a[0]:a,d=!this.options.vertical?(b.offsetWidth||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginLeft")+h.margin(b,"marginRight"):(b.offsetHeight||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginTop")+h.margin(b,"marginBottom");if(c==null||d==c)return d;d=!this.options.vertical?c-h.margin(b,"marginLeft")-h.margin(b,"marginRight"):c-h.margin(b,"marginTop")-h.margin(b,"marginBottom");i(b).css(this.wh, d+"px");return this.dimension(b)},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-h.intval(this.clip.css("borderLeftWidth"))-h.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-h.intval(this.clip.css("borderTopWidth"))-h.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});h.extend({defaults:function(a){return i.extend(q,a||{})},margin:function(a,c){if(!a)return 0; var b=a.jquery!==undefined?a[0]:a;if(c=="marginRight"&&i.browser.safari){var d={display:"block","float":"none",width:"auto"},f,j;i.swap(b,d,function(){f=b.offsetWidth});d.marginRight=0;i.swap(b,d,function(){j=b.offsetWidth});return j-f}return h.intval(i.css(b,c))},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a}});i.fn.jcarousel=function(a){if(typeof a=="string"){var c=i(this).data("jcarousel"),b=Array.prototype.slice.call(arguments,1);return c[a].apply(c,b)}else return this.each(function(){i(this).data("jcarousel", new h(this,a))})}})(jQuery);

function mycarousel_initCallback(carousel) {
                        {
                        // Pause autoscrolling if the user moves with the cursor over the clip.
                        carousel.clip.hover(function() {
                                carousel.stopAuto();
                        }, function() {
                                carousel.startAuto();
                        });
                };

                jQuery('.jcarousel-control a').bind('click', function() {
                        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
            $(".jcarousel-control a").removeClass("active");
            $(".jcarousel-control a:eq("+parseInt(jQuery(this).text()-1)+")").addClass("active");
                        return false;
                });
                
        };
                function koren(carousel,state) {
        //console.log(carousel.first)
        $(".jcarousel-control a").removeClass("active");
            $(".jcarousel-control a:eq("+parseInt(carousel.first-1)%5+")").addClass("active");
        }
        // Ride the carousel...
        jQuery(document).ready(function() {
                jQuery("#mycarousel").jcarousel({
                        scroll: 1,
                        auto: 3,
                        animation: 'slow',
                        wrap: 'circular',
                        initCallback: mycarousel_initCallback,
            itemLoadCallback: koren
                });
        
                jQuery("#mycarousel2").jcarousel({
                        scroll: 1,
                        wrap: 'circular',
            animation: 'slow',
                        initCallback: mycarousel_initCallback
                });

                jQuery("#mycarousel3").jcarousel({
                        vertical: true,
            scroll: 1,
            auto: 3,
            wrap: 'circular',
                        initCallback: mycarousel_initCallback
                });
        });



/*========== End Products Slider ==========*/

/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/

/* Cart JS
 * Project: Twitter Bootstrap Hover Dropdown
 * Author: Cameron Spear
 * Contributors: Mattia Larentis
 *
 * Dependencies?: Twitter Bootstrap's Dropdown plugin
 *
 * A simple plugin to enable twitter bootstrap dropdowns to active on hover and provide a nice user experience.
 *
 * No license, do what you want. I'd love credit or a shoutout, though.
 *
 * http://cameronspear.com/blog/twitter-bootstrap-dropdown-on-hover-plugin/
 */
;if(!!("ontouchstart" in window)){}else{(function(f,e,g){var h=f();f.fn.dropdownHover=function(i){h=h.add(this.parent());return this.each(function(){var o=f(this),n=o.parent(),m={delay:500,instantlyCloseOthers:true},l={delay:f(this).data("delay"),instantlyCloseOthers:f(this).data("close-others")},j=f.extend(true,{},m,i,l),k;n.hover(function(p){if(!n.hasClass("open")&&!o.is(p.target)){return true}if(c){if(j.instantlyCloseOthers===true){h.removeClass("open")}e.clearTimeout(k);n.addClass("open")}},function(){if(c){k=e.setTimeout(function(){n.removeClass("open")},200)}});o.hover(function(){if(c){if(j.instantlyCloseOthers===true){h.removeClass("open")}e.clearTimeout(k);n.addClass("open")}});n.find(".dropdown-submenu").each(function(){var q=f(this);var p;q.hover(function(){if(c){e.clearTimeout(p);q.children(".dropdown-menu").show();q.siblings().children(".dropdown-menu").hide()}},function(){var r=q.children(".dropdown-menu");if(c){p=e.setTimeout(function(){r.hide()},j.delay)}else{r.hide()}})})})};var c=false,a={hits:0,x:null,y:null};f(document).ready(function(){f('[data-hover="dropdown"]').dropdownHover();f(document).mousemove(function(i){a.hits++;if(a.hits>20||(Math.abs(i.pageX-a.x)+Math.abs(i.pageY-a.y))<4){f(this).unbind(i);c=true}else{a.x=i.pageX;a.y=i.pageY}})});var b=".dropdown-submenu:hover>.dropdown-menu{display:none}";var d=document.createElement("style");d.type="text/css";if(d.styleSheet){d.styleSheet.cssText=b}else{d.appendChild(document.createTextNode(b))}f("head")[0].appendChild(d)})(jQuery,this)};



(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);




jQuery(function($){
        //cart dropdown
        var config = {
             over: function(){
                                $('.cart-top .details').animate({opacity:1, height:'toggle'}, 400);
                        },
             timeout: 500, // number = milliseconds delay before onMouseOut
             out: function(){
                                $('.cart-top .details').animate({opacity:0, height:'toggle'}, 400);
                        }
        };
        $("div.cart-top").hoverIntent( config );

        //fix menu behavior
        $('#nav li').hover(
                function(){
                        $(this).children('div').addClass('shown-sub');
                },
                function(){
                        $(this).children('div').removeClass('shown-sub');
                }
        );

        //fix description height
        $('#nav li.menu-category-description').each(function(){
                var height = 0;
                $(this).parent().children('li').each(function(){
                        if ( $(this).height() > height )
                                height = $(this).height();
                });
                $(this).height( height );
        });

        $('#newsletter').focus( function() {
            if( $(this).val() == $(this).attr('title') ) { $(this).val(''); }
          })
          .blur( function() {
                if( $(this).val() == '' ) { $(this).val( $(this).attr('title') ); }
        });

        //banner hover
        $('.banners a, .banner a').each(function(i, obj){
                $(obj).append('<em/>');
        });

    //site-blocks
    $(".site-block-title").hover(
        function(e){
            if ( $(this).parent().hasClass('left-side') ) {
                $(this).parent().animate({ left: "0"} , 500);
            } else {
                $(this).parent().animate({ right: "0"} , 500);
            }
        },
        function(e){
            if ( $(this).parent().hasClass('left-side') ) {
                $(this).parent().animate({ left: -$(this).parent().width()} , 500);
            } else {
                $(this).parent().animate({ right: -$(this).parent().width()} , 500);
            }
        }
    );

});


/*
|--------------------------------------------------------------------------
| UItoTop jQuery Plugin 1.1
| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
|--------------------------------------------------------------------------
*/

(function($){
        $.fn.UItoTop = function(options) {

                var defaults = {
                        text: 'To Top',
                        min: 200,
                        inDelay:600,
                        outDelay:400,
                        containerID: 'toTop',
                        containerHoverID: 'toTopHover',
                        scrollSpeed: 1200,
                        easingType: 'linear'
                };

                var settings = $.extend(defaults, options);
                var containerIDhash = '#' + settings.containerID;
                var containerHoverIDHash = '#'+settings.containerHoverID;
                
                $('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>');
                $(containerIDhash).hide().click(function(){
                        $('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
                        $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
                        return false;
                })
                .prepend('<span id="'+settings.containerHoverID+'"></span>')
                .hover(function() {
                                $(containerHoverIDHash, this).stop().animate({
                                        'opacity': 1
                                }, 600, 'linear');
                        }, function() { 
                                $(containerHoverIDHash, this).stop().animate({
                                        'opacity': 0
                                }, 700, 'linear');
                        });
                                        
                $(window).scroll(function() {
                        var sd = $(window).scrollTop();
                        if(typeof document.body.style.maxHeight === "undefined") {
                                $(containerIDhash).css({
                                        'position': 'absolute',
                                        'top': $(window).scrollTop() + $(window).height() - 50
                                });
                        }
                        if ( sd > settings.min ) 
                                $(containerIDhash).fadeIn(settings.inDelay);
                        else 
                                $(containerIDhash).fadeOut(settings.Outdelay);
                });

};
})(jQuery);
jQuery(window).load(function() {
  jQuery().UItoTop();
        });



/*
 * DC jQuery Vertical Accordion Menu - jQuery vertical accordion menu plugin
 * Copyright (c) 2011 Design Chemical
 *
 * Dual licensed under the MIT and GPL licenses:
 *      http://www.opensource.org/licenses/mit-license.php
 *      http://www.gnu.org/licenses/gpl.html
 *
 */

(function($){

        $.fn.dcAccordion = function(options) {

                //set default options 
                var defaults = {
                        classParent      : 'dcjq-parent',
                        classActive      : 'active',
                        classArrow       : 'dcjq-icon',
                        classCount       : 'dcjq-count',
                        classExpand      : 'dcjq-current-parent',
                        classDisable : '',
                        eventType        : 'click',
                        hoverDelay       : 300,
                        menuClose     : true,
                        autoClose    : true,
                        autoExpand       : false,
                        speed        : 'slow',
                        saveState        : true,
                        disableLink      : true,
                        showCount : false,
                        cookie  : 'dcjq-accordion'
                };

                //call in the default otions
                var options = $.extend(defaults, options);

                this.each(function(options){

                        var obj = this;
                        $objLinks = $('li > span',obj);
                        $objSub = $('li > ul',obj);
                        if(defaults.classDisable){
                                $objLinks = $('li:not(.'+defaults.classDisable+') > a',obj);
                                $objSub = $('li:not(.'+defaults.classDisable+') > ul',obj);
                        }
                        
                        classActive = defaults.classActive;
                        
                        setUpAccordion();
                        if(defaults.saveState == true){
                                checkCookie(defaults.cookie, obj, classActive);
                        }
                        if(defaults.autoExpand == true){
                                $('li.'+defaults.classExpand+' > a').addClass(classActive);
                        }
                        resetAccordion();

                        if(defaults.eventType == 'hover'){

                                var config = {
                                        sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
                                        interval: defaults.hoverDelay, // number = milliseconds for onMouseOver polling interval
                                        over: linkOver, // function = onMouseOver callback (REQUIRED)
                                        timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
                                        out: linkOut // function = onMouseOut callback (REQUIRED)
                                };

                                $objLinks.hoverIntent(config);
                                var configMenu = {
                                        sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
                                        interval: 1000, // number = milliseconds for onMouseOver polling interval
                                        over: menuOver, // function = onMouseOver callback (REQUIRED)
                                        timeout: 1000, // number = milliseconds delay before onMouseOut
                                        out: menuOut // function = onMouseOut callback (REQUIRED)
                                };

                                $(obj).hoverIntent(configMenu);

                                // Disable parent links
                                if(defaults.disableLink == true){

                                        $objLinks.click(function(e){
                                                if($(this).siblings('ul').length >0){
                                                        e.preventDefault();
                                                }
                                        });
                                }

                        } else {
                        
                                $objLinks.click(function(e){

                                        $activeLi = $(this).parent('li');
                                        $parentsLi = $activeLi.parents('li');
                                        $parentsUl = $activeLi.parents('ul');

                                        // Prevent browsing to link if has child links
                                        if(defaults.disableLink == true){
                                                if($(this).siblings('ul').length >0){
                                                        e.preventDefault();
                                                }
                                        }

                                        // Auto close sibling menus
                                        if(defaults.autoClose == true){
                                                autoCloseAccordion($parentsLi, $parentsUl);
                                        }

                                        if ($('> ul',$activeLi).is(':visible')){
                                                $('ul',$activeLi).slideUp(defaults.speed);
                                                $('a',$activeLi).removeClass(classActive);
                                        } else {
                                                $(this).siblings('ul').slideToggle(defaults.speed);
                                                $('> a',$activeLi).addClass(classActive);
                                        }
                                        
                                        // Write cookie if save state is on
                                        if(defaults.saveState == true){
                                                createCookie(defaults.cookie, obj, classActive);
                                        }
                                });
                        }

                        // Set up accordion
                        function setUpAccordion(){

                                $arrow = '<span class="'+defaults.classArrow+'"></span>';
                                var classParentLi = defaults.classParent+'-li';
                                $objSub.show();
                                $('li',obj).each(function(){
                                        if($('> ul',this).length > 0){
                                                $(this).addClass(classParentLi);
                                                $('> li',this).addClass(defaults.classParent).append($arrow);
                                        }
                                });
                                $objSub.hide();
                                if(defaults.classDisable){
                                        $('li.'+defaults.classDisable+' > ul').show();
                                }
                                if(defaults.showCount == true){
                                        $('li.'+classParentLi,obj).each(function(){
                                                if(defaults.disableLink == true){
                                                        var getCount = parseInt($('ul a:not(.'+defaults.classParent+')',this).length);
                                                } else {
                                                        var getCount = parseInt($('ul a',this).length);
                                                }
                                                $('> a',this).append(' <span class="'+defaults.classCount+'">('+getCount+')</span>');
                                        });
                                }
                        }
                        
                        function linkOver(){

                        $activeLi = $(this).parent('li');
                        $parentsLi = $activeLi.parents('li');
                        $parentsUl = $activeLi.parents('ul');

                        // Auto close sibling menus
                        if(defaults.autoClose == true){
                                autoCloseAccordion($parentsLi, $parentsUl);

                        }

                        if ($('> ul',$activeLi).is(':visible')){
                                $('ul',$activeLi).slideUp(defaults.speed);
                                $('a',$activeLi).removeClass(classActive);
                        } else {
                                $(this).siblings('ul').slideToggle(defaults.speed);
                                $('> a',$activeLi).addClass(classActive);
                        }

                        // Write cookie if save state is on
                        if(defaults.saveState == true){
                                createCookie(defaults.cookie, obj, classActive);
                        }
                }

                function linkOut(){
                }

                function menuOver(){
                }

                function menuOut(){

                        if(defaults.menuClose == true){
                                $objSub.slideUp(defaults.speed);
                                // Reset active links
                                $('a',obj).removeClass(classActive);
                                createCookie(defaults.cookie, obj, classActive);
                        }
                }

                // Auto-Close Open Menu Items
                function autoCloseAccordion($parentsLi, $parentsUl){
                        $('ul',obj).not($parentsUl).slideUp(defaults.speed);
                        // Reset active links
                        $('a',obj).removeClass(classActive);
                        $('> a',$parentsLi).addClass(classActive);
                }
                // Reset accordion using active links
                function resetAccordion(){
                        $objSub.hide();
                        var $parentsLi = $('a.'+classActive,obj).parents('li');
                        $('> a',$parentsLi).addClass(classActive);
                        $allActiveLi = $('a.'+classActive,obj);
                        $($allActiveLi).siblings('ul').show();
                }
                });

                // Retrieve cookie value and set active items
                function checkCookie(cookieId, obj, classActive){
                        var cookieVal = $.cookie(cookieId);
                        if(cookieVal != null){
                                // create array from cookie string
                                var activeArray = cookieVal.split(',');
                                $.each(activeArray, function(index,value){
                                        var $cookieLi = $('li:eq('+value+')',obj);
                                        $('> a',$cookieLi).addClass(classActive);
                                        var $parentsLi = $cookieLi.parents('li');
                                        $('> a',$parentsLi).addClass(classActive);
                                });
                        }
                }

                // Write cookie
                function createCookie(cookieId, obj, classActive){
                        var activeIndex = [];
                        // Create array of active items index value
                        $('li a.'+classActive,obj).each(function(i){
                                var $arrayItem = $(this).parent('li');
                                var itemIndex = $('li',obj).index($arrayItem);
                                        activeIndex.push(itemIndex);
                                });
                        // Store in cookie
                        $.cookie(cookieId, activeIndex, { path: '/' });
                }
        };
})(jQuery);


/*========== Start Mobile Nav ==========*/
/*
 * jQuery UI Multilevel Accordion v.1
 * 
 * Copyright (c) 2011 Pieter Pareit
 *
 * http://www.scriptbreaker.com
 *
 */

//plugin definition
(function($){
    $.fn.extend({

    //pass the options variable to the function
    accordion: function(options) {
        
                var defaults = {
                        accordion: 'true',
                        speed: 300,
                        closedSign: '[+]',
                        openedSign: '[-]'
                };

                // Extend our default options with those provided.
                var opts = $.extend(defaults, options);
                //Assign current element to variable, in this case is UL element
                var $this = $(this);
                
                //add a mark [+] to a multilevel menu
                $this.find("li").each(function() {
                        if($(this).find("ul").size() != 0){
                                //add the multilevel sign next to the link
                                $(this).find("a:first").after("<em>"+ opts.closedSign +"</em>");
                                
                                //avoid jumping to the top of the page when the href is an #
                                if($(this).find("a:first").attr('href') == "#"){
                                        $(this).find("a:first").click(function(){return false;});
                                }
                        }
                });

                //open active level
                //$this.find("li.active").each(function() {
                        //$(this).parents("ul").slideDown(opts.speed);
                        //$(this).parents("ul").parent("li").find("em:first").html(opts.openedSign);
                //});

                $this.find("li em").click(function() {
                        if($(this).parent().find("ul").size() != 0){
                                if(opts.accordion){
                                        //Do nothing when the list is open
                                        if(!$(this).parent().find("ul").is(':visible')){
                                                parents = $(this).parent().parents("ul");
                                                visible = $this.find("ul:visible");
                                                visible.each(function(visibleIndex){
                                                        var close = true;
                                                        parents.each(function(parentIndex){
                                                                if(parents[parentIndex] == visible[visibleIndex]){
                                                                        close = false;
                                                                        return false;
                                                                }
                                                        });
                                                        if(close){
                                                                if($(this).parent().find("ul") != visible[visibleIndex]){
                                                                        $(visible[visibleIndex]).slideUp(opts.speed, function(){
                                                                                $(this).parent("li").find("em:first").html(opts.closedSign);
                                                                        });
                                                                        
                                                                }
                                                        }
                                                });
                                        }
                                }
                                if($(this).parent().find("ul:first").is(":visible")){
                                        $(this).parent().find("ul:first").slideUp(opts.speed, function(){
                                                $(this).parent("li").find("em:first").delay(opts.speed).html(opts.closedSign);
                                        });
                                        
                                        
                                }else{
                                        $(this).parent().find("ul:first").slideDown(opts.speed, function(){
                                                $(this).parent("li").find("em:first").delay(opts.speed).html(opts.openedSign);
                                        });
                                }
                        }
                });
    }
});
})(jQuery);


/*========== End Mobile Nav ==========*/

/*========== Left Nav ===========*/
 

function product_search_filter()
{
jQuery('.top_search_input').bind('keydown', function(e)
        {
                if (e.keyCode == 13)
                {
                        name = jQuery(this).attr('name');
                        var search = jQuery(this).attr('value');
                        url = jQuery('base').attr('href') + 'index.php?route=product/search';

                        if (search)
                        {
                                url += '&search=' + encodeURIComponent(search);
                        }                       
                        location = url;
                }
        });
}


function remove_info_box()
{
        jQuery('.success img, .warning img, .attention img, .information img').live('click', function() {
                jQuery(this).parent().fadeOut('slow', function() {
                        jQuery(this).remove();
                });
        });
}


//function to style checkbox and radio buttons
function inputs_skin(){
  jQuery('.select_skin select').live('change', function(){
    var the_select = jQuery(this);
    the_span = jQuery(this).parent().find('.selected_value');
    the_span.text(the_select.find('option:selected').text());        
    });
}
        

//function  increase/ decrease product qunatity buttons +/-
function change_qty(container){ 
        var container = container;      
        var input = jQuery(container).find('input:text');
        default_val = jQuery(input).val();
        j = default_val;
        remove = jQuery(container).find('span.minus_qty');
        add = jQuery(container).find('span.plus_qty');

        add.on('click', function(){
                j++;
                jQuery(input).val(j);
        });

        remove.on('click', function(){
                if(j > 1)
                {
                        j--;
                jQuery(input).val(j);
                } else{
                        j = 1;
                }
        });
        
        input.blur(function(){          
                if(jQuery(this).val() <= 0){
                        j = 1;
                        jQuery(this).val(1);
                }else{
                        j = jQuery(this).val();
                }
        });
}



jQuery(document).ready(function(){      
        inputs_skin();
        product_search_filter();
        remove_info_box();      

 

        //increase/ decrease product qunatity buttons +/- in cart.html table
        if(jQuery('.subDropdown')[0]){
                jQuery('.subDropdown').click(function(){
                        jQuery(this).toggleClass('plus');
                        jQuery(this).toggleClass('minus');
                        jQuery(this).parent().find('ul').slideToggle();
                });
        }
        

        


});
/*=============End Left Nav=============*/

/*============banner slider=============*/
/*
Sequence.js (http://www.sequencejs.com)
Version: 1.0.1.1
Author: Ian Lunn @IanLunn
Author URL: http://www.ianlunn.co.uk/
Github: https://github.com/IanLunn/Sequence

This is a FREE script and is available under a MIT License:
http://www.opensource.org/licenses/mit-license.php

Sequence.js and its dependencies are (c) Ian Lunn Design 2012 - 2013 unless otherwise stated.

Sequence also relies on the following open source scripts:

- jQuery imagesLoaded 2.1.0 (http://github.com/desandro/imagesloaded)
        Paul Irish et al
        Available under a MIT License: http://www.opensource.org/licenses/mit-license.php

- jQuery TouchWipe 1.1.1 (http://www.netcu.de/jquery-touchwipe-iphone-ipad-library)
        Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
        Available under a MIT License: http://www.opensource.org/licenses/mit-license.php

- Modernizr 2.6.1 Custom Build (http://modernizr.com/) (Named Modernizr for Sequence to prevent conflicts)
        Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
        Available under the BSD and MIT licenses: www.modernizr.com/license/
        */(function(e){
    function n(n,r,i,s){
        function f(){
            o.afterLoaded();
            o.settings.hideFramesUntilPreloaded&&o.settings.preloader!==undefined&&o.settings.preloader!==!1&&o.frames.show();
            if(o.settings.preloader!==undefined&&o.settings.preloader!==!1)if(o.settings.hidePreloaderUsingCSS&&o.transitionsSupported){
                o.prependPreloadingCompleteTo=o.settings.prependPreloadingComplete===!0?o.settings.preloader:e(o.settings.prependPreloadingComplete);
                o.prependPreloadingCompleteTo.addClass("preloading-complete");
                setTimeout(g,o.settings.hidePreloaderDelay)
                }else o.settings.preloader.fadeOut(o.settings.hidePreloaderDelay,function(){
                clearInterval(o.defaultPreloader);
                g()
                });else g()
                }
                function h(t,n){
            var r=[];
            if(!n)for(var i=t;i>0;i--)o.frames.eq(o.settings.preloadTheseFrames[i-1]-1).find("img").each(function(){
                r.push(e(this)[0])
                });else for(var s=t;s>0;s--)r.push(e("body").find('img[src="'+o.settings.preloadTheseImages[s-1]+'"]'));
            return r
            }
            function p(t,n){
            function c(){
                var t=e(f),r=e(l);
                s&&(l.length?s.reject(u,t,r):s.resolve(u));
                e.isFunction(n)&&n.call(i,u,t,r)
                }
                function h(t,n){
                if(t.src===r||e.inArray(t,a)!==-1)return;
                a.push(t);
                n?l.push(t):f.push(t);
                e.data(t,"imagesLoaded",{
                    isBroken:n,
                    src:t.src
                    });
                o&&s.notifyWith(e(t),[n,u,e(f),e(l)]);
                if(u.length===a.length){
                    setTimeout(c);
                    u.unbind(".imagesLoaded")
                    }
                }
            var r="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",i=t,s=e.isFunction(e.Deferred)?e.Deferred():0,o=e.isFunction(s.notify),u=i.find("img").add(i.filter("img")),a=[],f=[],l=[];
        e.isPlainObject(n)&&e.each(n,function(e,t){
            e==="callback"?n=t:s&&s[e](t)
            });
        u.length?u.bind("load.imagesLoaded error.imagesLoaded",function(e){
            h(e.target,e.type==="error")
            }).each(function(t,n){
            var i=n.src,s=e.data(n,"imagesLoaded");
            if(s&&s.src===i){
                h(n,s.isBroken);
                return
            }
            if(n.complete&&n.naturalWidth!==undefined){
                h(n,n.naturalWidth===0||n.naturalHeight===0);
                return
            }
            if(n.readyState||n.complete){
                n.src=r;
                n.src=i
                }
            }):c()
    }
    function g(){
    function t(e,t){
        var r,i;
        for(i in t){
            i==="left"||i==="right"?r=n[i]:r=i;
            e===parseFloat(r)&&o._initCustomKeyEvent(t[i])
            }
        }
        function r(){
    o.canvas.on("touchmove.sequence",i);
    u=null;
    f=!1
    }
    function i(e){
    o.settings.swipePreventsDefault&&e.preventDefault();
    if(f){
        var t=e.originalEvent.touches[0].pageX,n=e.originalEvent.touches[0].pageY,i=u-t,s=a-n;
        if(Math.abs(i)>=o.settings.swipeThreshold){
            r();
            i>0?o._initCustomKeyEvent(o.settings.swipeEvents.left):o._initCustomKeyEvent(o.settings.swipeEvents.right)
            }else if(Math.abs(s)>=o.settings.swipeThreshold){
            r();
            s>0?o._initCustomKeyEvent(o.settings.swipeEvents.down):o._initCustomKeyEvent(o.settings.swipeEvents.up)
            }
        }
}
function s(e){
    if(e.originalEvent.touches.length===1){
        u=e.originalEvent.touches[0].pageX;
        a=e.originalEvent.touches[0].pageY;
        f=!0;
        o.canvas.on("touchmove.sequence",i)
        }
    }
e(o.settings.preloader).remove();
o.nextButton=o._renderUiElements(o.settings.nextButton,".sequence-next");
o.prevButton=o._renderUiElements(o.settings.prevButton,".sequence-prev");
o.pauseButton=o._renderUiElements(o.settings.pauseButton,".sequence-pause");
o.pagination=o._renderUiElements(o.settings.pagination,".sequence-pagination");
o.nextButton!==undefined&&o.nextButton!==!1&&o.settings.showNextButtonOnInit===!0&&o.nextButton.show();
o.prevButton!==undefined&&o.prevButton!==!1&&o.settings.showPrevButtonOnInit===!0&&o.prevButton.show();
o.pauseButton!==undefined&&o.pauseButton!==!1&&o.settings.showPauseButtonOnInit===!0&&o.pauseButton.show();
if(o.settings.pauseIcon!==!1){
    o.pauseIcon=o._renderUiElements(o.settings.pauseIcon,".sequence-pause-icon");
    o.pauseIcon!==undefined&&o.pauseIcon.hide()
    }else o.pauseIcon=undefined;
if(o.pagination!==undefined&&o.pagination!==!1){
    o.paginationLinks=o.pagination.children();
    o.paginationLinks.on("click.sequence",function(){
        var t=e(this).index()+1;
        o.goTo(t)
        });
    o.settings.showPaginationOnInit===!0&&o.pagination.show()
    }
    o.nextFrameID=o.settings.startingFrameID;
if(o.settings.hashTags===!0){
    o.frames.each(function(){
        o.frameHashID.push(e(this).prop(o.getHashTagFrom))
        });
    o.currentHashTag=location.hash.replace("#","");
    if(o.currentHashTag===undefined||o.currentHashTag==="")o.nextFrameID=o.settings.startingFrameID;
    else{
        o.frameHashIndex=e.inArray(o.currentHashTag,o.frameHashID);
        o.frameHashIndex!==-1?o.nextFrameID=o.frameHashIndex+1:o.nextFrameID=o.settings.startingFrameID
        }
    }
o.nextFrame=o.frames.eq(o.nextFrameID-1);
o.nextFrameChildren=o.nextFrame.children();
o.pagination!==undefined&&e(o.paginationLinks[o.settings.startingFrameID-1]).addClass("current");
if(o.transitionsSupported)if(!o.settings.animateStartingFrameIn){
    o.currentFrameID=o.nextFrameID;
    o.settings.moveActiveFrameToTop&&o.nextFrame.css("z-index",o.numberOfFrames);
    o._resetElements(o.transitionPrefix,o.nextFrameChildren,"0s");
    o.nextFrame.addClass("animate-in");
    if(o.settings.hashTags&&o.settings.hashChangesOnFirstFrame){
        o.currentHashTag=o.nextFrame.prop(o.getHashTagFrom);
        document.location.hash="#"+o.currentHashTag
        }
        setTimeout(function(){
        o._resetElements(o.transitionPrefix,o.nextFrameChildren,"")
        },100);
    o._resetAutoPlay(!0,o.settings.autoPlayDelay)
    }else if(o.settings.reverseAnimationsWhenNavigatingBackwards&&o.settings.autoPlayDirection-1&&o.settings.animateStartingFrameIn){
    o._resetElements(o.transitionPrefix,o.nextFrameChildren,"0s");
    o.nextFrame.addClass("animate-out");
    o.goTo(o.nextFrameID,-1,!0)
    }else o.goTo(o.nextFrameID,1,!0);
else{
    o.container.addClass("sequence-fallback");
    o.currentFrameID=o.nextFrameID;
    if(o.settings.hashTags&&o.settings.hashChangesOnFirstFrame){
        o.currentHashTag=o.nextFrame.prop(o.getHashTagFrom);
        document.location.hash="#"+o.currentHashTag
        }
        o.frames.addClass("animate-in");
    o.frames.not(":eq("+(o.nextFrameID-1)+")").css({
        display:"none",
        opacity:0
    });
    o._resetAutoPlay(!0,o.settings.autoPlayDelay)
    }
    o.nextButton!==undefined&&o.nextButton.bind("click.sequence",function(){
    o.next()
    });
o.prevButton!==undefined&&o.prevButton.bind("click.sequence",function(){
    o.prev()
    });
o.pauseButton!==undefined&&o.pauseButton.bind("click.sequence",function(){
    o.pause(!0)
    });
if(o.settings.keyNavigation){
    var n={
        left:37,
        right:39
    };
    
    e(document).bind("keydown.sequence",function(e){
        var n=String.fromCharCode(e.keyCode);
        if(n>0&&n<=o.numberOfFrames&&o.settings.numericKeysGoToFrames){
            o.nextFrameID=n;
            o.goTo(o.nextFrameID)
            }
            t(e.keyCode,o.settings.keyEvents);
        t(e.keyCode,o.settings.customKeyEvents)
        })
    }
    o.canvas.on({
    "mouseenter.sequence":function(){
        if(o.settings.pauseOnHover&&o.settings.autoPlay&&!o.hasTouch){
            o.isBeingHoveredOver=!0;
            o.isHardPaused||o.pause()
            }
        },
"mouseleave.sequence":function(){
    if(o.settings.pauseOnHover&&o.settings.autoPlay&&!o.hasTouch){
        o.isBeingHoveredOver=!1;
        o.isHardPaused||o.unpause()
        }
    }
});
o.settings.hashTags&&e(window).bind("hashchange.sequence",function(){
    var t=location.hash.replace("#","");
    if(o.currentHashTag!==t){
        o.currentHashTag=t;
        o.frameHashIndex=e.inArray(o.currentHashTag,o.frameHashID);
        if(o.frameHashIndex!==-1){
            o.nextFrameID=o.frameHashIndex+1;
            o.goTo(o.nextFrameID)
            }
        }
});
if(o.settings.swipeNavigation&&o.hasTouch){
    var u,a,f=!1;
    o.canvas.on("touchstart.sequence",s)
    }
}
var o=this;
o.container=e(n);
o.canvas=o.container.children(".sequence-canvas");
o.frames=o.canvas.children("li");
o._modernizrForSequence();
var u={
    WebkitTransition:"-webkit-",
    WebkitAnimation:"-webkit-",
    MozTransition:"-moz-",
    "MozAnimation ":"-moz-",
    OTransition:"-o-",
    OAnimation:"-o-",
    msTransition:"-ms-",
    msAnimation:"-ms-",
    transition:"",
    animation:""
},a={
    WebkitTransition:"webkitTransitionEnd.sequence",
    WebkitAnimation:"webkitAnimationEnd.sequence",
    MozTransition:"transitionend.sequence",
    MozAnimation:"animationend.sequence",
    OTransition:"otransitionend.sequence",
    OAnimation:"oanimationend.sequence",
    msTransition:"MSTransitionEnd.sequence",
    msAnimation:"MSAnimationEnd.sequence",
    transition:"transitionend.sequence",
    animation:"animationend.sequence"
};

o.transitionPrefix=u[ModernizrForSequence.prefixed("transition")],o.animationPrefix=u[ModernizrForSequence.prefixed("animation")],o.transitionProperties={},o.transitionEnd=a[ModernizrForSequence.prefixed("transition")]+" "+a[ModernizrForSequence.prefixed("animation")],o.numberOfFrames=o.frames.length,o.transitionsSupported=o.transitionPrefix!==undefined?!0:!1,o.hasTouch="ontouchstart"in window?!0:!1,o.isPaused=!1,o.isBeingHoveredOver=!1,o.container.removeClass("sequence-destroyed");
o.paused=function(){},o.unpaused=function(){},o.beforeNextFrameAnimatesIn=function(){},o.afterNextFrameAnimatesIn=function(){},o.beforeCurrentFrameAnimatesOut=function(){},o.afterCurrentFrameAnimatesOut=function(){},o.afterLoaded=function(){};

o.destroyed=function(){};

o.settings=e.extend({},i,r);
o.settings.preloader=o._renderUiElements(o.settings.preloader,".sequence-preloader");
o.isStartingFrame=o.settings.animateStartingFrameIn?!0:!1;
o.settings.unpauseDelay=o.settings.unpauseDelay===null?o.settings.autoPlayDelay:o.settings.unpauseDelay;
o.getHashTagFrom=o.settings.hashDataAttribute?"data-sequence-hashtag":"id";
o.frameHashID=[];
o.direction=o.settings.autoPlayDirection;
o.settings.hideFramesUntilPreloaded&&o.settings.preloader!==undefined&&o.settings.preloader!==!1&&o.frames.hide();
o.transitionPrefix==="-o-"&&(o.transitionsSupported=o._operaTest());
o.frames.removeClass("animate-in");
var l=o.settings.preloadTheseFrames.length,c=o.settings.preloadTheseImages.length;
if(o.settings.preloader===undefined||o.settings.preloader===!1||l===0&&c===0)if(t===!0){
    f();
    e(this).unbind("load.sequence")
    }else e(window).bind("load.sequence",function(){
    f();
    e(this).unbind("load.sequence")
    });
else{
    var d=h(l),v=h(c,!0),m=e(d.concat(v));
    p(m,f)
    }
}
var t=!1;
e(window).bind("load",function(){
    t=!0
    });
n.prototype={
    startAutoPlay:function(e){
        var t=this;
        e=e===undefined?t.settings.autoPlayDelay:e;
        t.unpause();
        t._resetAutoPlay();
        t.autoPlayTimer=setTimeout(function(){
            t.settings.autoPlayDirection===1?t.next():t.prev()
            },e)
        },
    stopAutoPlay:function(){
        var e=this;
        e.pause(!0);
        clearTimeout(e.autoPlayTimer)
        },
    pause:function(e){
        var t=this;
        if(!t.isSoftPaused){
            if(t.pauseButton!==undefined){
                t.pauseButton.addClass("paused");
                t.pauseIcon!==undefined&&t.pauseIcon.show()
                }
                t.paused();
            t.isSoftPaused=!0;
            t.isHardPaused=e?!0:!1;
            t.isPaused=!0;
            t._resetAutoPlay()
            }else t.unpause()
            },
    unpause:function(e){
        var t=this;
        if(t.pauseButton!==undefined){
            t.pauseButton.removeClass("paused");
            t.pauseIcon!==undefined&&t.pauseIcon.hide()
            }
            t.isSoftPaused=!1;
        t.isHardPaused=!1;
        t.isPaused=!1;
        if(!t.active){
            e!==!1&&t.unpaused();
            t._resetAutoPlay(!0,t.settings.unpauseDelay)
            }else t.delayUnpause=!0
            },
    next:function(){
        var e=this;
        id=e.currentFrameID!==e.numberOfFrames?e.currentFrameID+1:1;
        e.active===!1||e.active===undefined?e.goTo(id,1):e.goTo(id,1,!0)
        },
    prev:function(){
        var e=this;
        id=e.currentFrameID===1?e.numberOfFrames:e.currentFrameID-1;
        e.active===!1||e.active===undefined?e.goTo(id,-1):e.goTo(id,-1,!0)
        },
    goTo:function(t,n,r){
        var i=this;
        i.nextFrameID=parseFloat(t);
        var s=r===!0?0:i.settings.transitionThreshold;
        if(i.nextFrameID===i.currentFrameID||i.settings.navigationSkip&&i.navigationSkipThresholdActive||!i.settings.navigationSkip&&i.active||!i.transitionsSupported&&i.active||!i.settings.cycle&&n===1&&i.currentFrameID===i.numberOfFrames||!i.settings.cycle&&n===-1&&i.currentFrameID===1||i.settings.preventReverseSkipping&&i.direction!==n&&i.active)return!1;
        if(i.settings.navigationSkip&&i.active){
            i.navigationSkipThresholdActive=!0;
            i.settings.fadeFrameWhenSkipped&&i.nextFrame.stop().animate({
                opacity:0
            },i.settings.fadeFrameTime);
            clearTimeout(i.transitionThresholdTimer);
            setTimeout(function(){
                i.navigationSkipThresholdActive=!1
                },i.settings.navigationSkipThreshold)
            }
            if(!i.active||i.settings.navigationSkip){
            i.active=!0;
            i._resetAutoPlay();
            n===undefined?i.direction=i.nextFrameID>i.currentFrameID?1:-1:i.direction=n;
            i.currentFrame=i.canvas.children(".animate-in");
            i.nextFrame=i.frames.eq(i.nextFrameID-1);
            i.currentFrameChildren=i.currentFrame.children();
            i.nextFrameChildren=i.nextFrame.children();
            if(i.pagination!==undefined){
                i.paginationLinks.removeClass("current");
                e(i.paginationLinks[i.nextFrameID-1]).addClass("current")
                }
                if(i.transitionsSupported){
                if(i.currentFrame.length!==undefined){
                    i.beforeCurrentFrameAnimatesOut();
                    i.settings.moveActiveFrameToTop&&i.currentFrame.css("z-index",1);
                    i._resetElements(i.transitionPrefix,i.nextFrameChildren,"0s");
                    if(!i.settings.reverseAnimationsWhenNavigatingBackwards||i.direction===1){
                        i.nextFrame.removeClass("animate-out");
                        i._resetElements(i.transitionPrefix,i.currentFrameChildren,"")
                        }else if(i.settings.reverseAnimationsWhenNavigatingBackwards&&i.direction===-1){
                        i.nextFrame.addClass("animate-out");
                        i._reverseTransitionProperties()
                        }
                    }else i.isStartingFrame=!1;
            i.active=!0;
            i.currentFrame.unbind(i.transitionEnd);
            i.nextFrame.unbind(i.transitionEnd);
            i.settings.fadeFrameWhenSkipped&&i.settings.navigationSkip&&i.nextFrame.css("opacity",1);
            i.beforeNextFrameAnimatesIn();
            i.settings.moveActiveFrameToTop&&i.nextFrame.css("z-index",i.numberOfFrames);
            if(!i.settings.reverseAnimationsWhenNavigatingBackwards||i.direction===1){
                setTimeout(function(){
                    i._resetElements(i.transitionPrefix,i.nextFrameChildren,"");
                    i._waitForAnimationsToComplete(i.nextFrame,i.nextFrameChildren,"in");
                    (i.afterCurrentFrameAnimatesOut!=="function () {}"||i.settings.transitionThreshold===!0&&r!==!0)&&i._waitForAnimationsToComplete(i.currentFrame,i.currentFrameChildren,"out",!0,1)
                    },50);
                setTimeout(function(){
                    if(i.settings.transitionThreshold===!1||i.settings.transitionThreshold===0||r===!0){
                        i.currentFrame.toggleClass("animate-out animate-in");
                        i.nextFrame.addClass("animate-in")
                        }else{
                        i.currentFrame.toggleClass("animate-out animate-in");
                        i.settings.transitionThreshold!==!0&&(i.transitionThresholdTimer=setTimeout(function(){
                            i.nextFrame.addClass("animate-in")
                            },s))
                        }
                    },50)
            }else if(i.settings.reverseAnimationsWhenNavigatingBackwards&&i.direction===-1){
            setTimeout(function(){
                i._resetElements(i.transitionPrefix,i.currentFrameChildren,"");
                i._resetElements(i.transitionPrefix,i.nextFrameChildren,"");
                i._reverseTransitionProperties();
                i._waitForAnimationsToComplete(i.nextFrame,i.nextFrameChildren,"in");
                (i.afterCurrentFrameAnimatesOut!=="function () {}"||i.settings.transitionThreshold===!0&&r!==!0)&&i._waitForAnimationsToComplete(i.currentFrame,i.currentFrameChildren,"out",!0,-1)
                },50);
            setTimeout(function(){
                if(i.settings.transitionThreshold===!1||i.settings.transitionThreshold===0||r===!0){
                    i.currentFrame.removeClass("animate-in");
                    i.nextFrame.toggleClass("animate-out animate-in")
                    }else{
                    i.currentFrame.removeClass("animate-in");
                    i.settings.transitionThreshold!==!0&&(i.transitionThresholdTimer=setTimeout(function(){
                        i.nextFrame.toggleClass("animate-out animate-in")
                        },s))
                    }
                },50)
        }
    }else{
    function o(){
        i._setHashTag();
        i.active=!1;
        i._resetAutoPlay(!0,i.settings.autoPlayDelay)
        }
        switch(i.settings.fallback.theme){
        case"fade":
            i.frames.css({
            position:"relative"
        });
        i.beforeCurrentFrameAnimatesOut();
            i.currentFrame=i.frames.eq(i.currentFrameID-1);
            i.currentFrame.animate({
            opacity:0
        },i.settings.fallback.speed,function(){
            i.currentFrame.css({
                display:"none",
                "z-index":"1"
            });
            i.afterCurrentFrameAnimatesOut();
            i.beforeNextFrameAnimatesIn();
            i.nextFrame.css({
                display:"block",
                "z-index":i.numberOfFrames
                }).animate({
                opacity:1
            },500,function(){
                i.afterNextFrameAnimatesIn()
                });
            o()
            });
        i.frames.css({
            position:"relative"
        });
        break;
        case"slide":default:
            var u={},a={},f={};
            
            if(i.direction===1){
            u.left="-100%";
            a.left="100%"
            }else{
            u.left="100%";
            a.left="-100%"
            }
            f.left="0";
        f.opacity=1;
        i.currentFrame=i.frames.eq(i.currentFrameID-1);
            i.beforeCurrentFrameAnimatesOut();
            i.currentFrame.animate(u,i.settings.fallback.speed,function(){
            i.currentFrame.css({
                display:"none",
                "z-index":"1"
            });
            i.afterCurrentFrameAnimatesOut()
            });
        i.beforeNextFrameAnimatesIn();
            i.nextFrame.show().css(a);
            i.nextFrame.css({
            display:"block",
            "z-index":i.numberOfFrames
            }).animate(f,i.settings.fallback.speed,function(){
            o();
            i.afterNextFrameAnimatesIn()
            })
        }
        }
i.currentFrameID=i.nextFrameID
}
},
destroy:function(t){
    var n=this;
    n.container.addClass("sequence-destroyed");
    n.nextButton!==undefined&&n.nextButton.unbind("click.sequence");
    n.prevButton!==undefined&&n.prevButton.unbind("click.sequence");
    n.pauseButton!==undefined&&n.pauseButton.unbind("click.sequence");
    n.pagination!==undefined&&n.paginationLinks.unbind("click.sequence");
    e(document).unbind("keydown.sequence");
    n.canvas.unbind("mouseenter.sequence, mouseleave.sequence, touchstart.sequence, touchmove.sequence");
    e(window).unbind("hashchange.sequence");
    n.stopAutoPlay();
    clearTimeout(n.transitionThresholdTimer);
    n.canvas.children("li").remove();
    n.canvas.prepend(n.frames);
    n.frames.removeClass("animate-in animate-out").removeAttr("style");
    n.frames.eq(n.currentFrameID-1).addClass("animate-in");
    n.nextButton!==undefined&&n.nextButton!==!1&&n.nextButton.hide();
    n.prevButton!==undefined&&n.prevButton!==!1&&n.prevButton.hide();
    n.pauseButton!==undefined&&n.pauseButton!==!1&&n.pauseButton.hide();
    n.pauseIcon!==undefined&&n.pauseIcon!==!1&&n.pauseIcon.hide();
    n.pagination!==undefined&&n.pagination!==!1&&n.pagination.hide();
    t!==undefined&&t();
    n.destroyed();
    n.container.removeData()
    },
_initCustomKeyEvent:function(e){
    var t=this;
    switch(e){
        case"next":
            t.next();
            break;
        case"prev":
            t.prev();
            break;
        case"pause":
            t.pause(!0)
            }
        },
_resetElements:function(e,t,n){
    var r=this;
    t.css(r._prefixCSS(e,{
        "transition-duration":n,
        "transition-delay":n,
        "transition-timing-function":""
    }))
    },
_reverseTransitionProperties:function(){
    var t=this,n=[],r=[];
    t.currentFrameChildren.each(function(){
        n.push(parseFloat(e(this).css(t.transitionPrefix+"transition-duration").replace("s",""))+parseFloat(e(this).css(t.transitionPrefix+"transition-delay").replace("s","")))
        });
    t.nextFrameChildren.each(function(){
        r.push(parseFloat(e(this).css(t.transitionPrefix+"transition-duration").replace("s",""))+parseFloat(e(this).css(t.transitionPrefix+"transition-delay").replace("s","")))
        });
    var i=Math.max.apply(Math,n),s=Math.max.apply(Math,r),o=i-s,u=0,a=0;
    o<0&&!t.settings.preventDelayWhenReversingAnimations?u=Math.abs(o):o>0&&(a=Math.abs(o));
    var f=function(n,r,i,s){
        function o(e){
            e=e.split(",")[0];
            var t={
                linear:"cubic-bezier(0.0,0.0,1.0,1.0)",
                ease:"cubic-bezier(0.25, 0.1, 0.25, 1.0)",
                "ease-in":"cubic-bezier(0.42, 0.0, 1.0, 1.0)",
                "ease-in-out":"cubic-bezier(0.42, 0.0, 0.58, 1.0)",
                "ease-out":"cubic-bezier(0.0, 0.0, 0.58, 1.0)"
            };
            
            e.indexOf("cubic-bezier")<0&&(e=t[e]);
            return e
            }
            r.each(function(){
            var r=parseFloat(e(this).css(t.transitionPrefix+"transition-duration").replace("s","")),u=parseFloat(e(this).css(t.transitionPrefix+"transition-delay").replace("s","")),a=e(this).css(t.transitionPrefix+"transition-timing-function");
            if(a.indexOf("cubic")===-1)var a=o(a);
            var f=a.replace("cubic-bezier(","").replace(")","").split(",");
            e.each(f,function(e,t){
                f[e]=parseFloat(t)
                });
            var l=[1-f[2],1-f[3],1-f[0],1-f[1]];
            a="cubic-bezier("+l+")";
            var c=r+u;
            n["transition-duration"]=r+"s";
            n["transition-delay"]=i-c+s+"s";
            n["transition-timing-function"]=a;
            e(this).css(t._prefixCSS(t.transitionPrefix,n))
            })
        };
        
    f(t.transitionProperties,t.currentFrameChildren,i,u);
    f(t.transitionProperties,t.nextFrameChildren,s,a)
    },
_prefixCSS:function(e,t){
    var n=this,r={};
    
    for(var i in t)r[e+i]=t[i];return r
    },
_resetAutoPlay:function(e,t){
    var n=this;
    if(e===!0){
        if(n.settings.autoPlay&&!n.isSoftPaused){
            clearTimeout(n.autoPlayTimer);
            n.autoPlayTimer=setTimeout(function(){
                n.settings.autoPlayDirection===1?n.next():n.prev()
                },t)
            }
        }else clearTimeout(n.autoPlayTimer)
    },
_renderUiElements:function(t,n){
    var r=this;
    switch(t){
        case!1:
            return undefined;
        case!0:
            n===".sequence-preloader"&&r._defaultPreloader(r.container,r.transitionsSupported,r.animationPrefix);
            return e(n);
        default:
            return e(t)
            }
        },
_waitForAnimationsToComplete:function(t,n,r,i,s){
    var o=this;
    if(r==="out")var u=function(){
        o.afterCurrentFrameAnimatesOut();
        o.settings.transitionThreshold===!0&&(s===1?o.nextFrame.addClass("animate-in"):s===-1&&o.nextFrame.toggleClass("animate-out animate-in"))
        };
    else if(r==="in")var u=function(){
        o.afterNextFrameAnimatesIn();
        o._setHashTag();
        o.active=!1;
        if(!o.isHardPaused&&!o.isBeingHoveredOver)if(!o.delayUnpause)o.unpause(!1);
            else{
            o.delayUnpause=!1;
            o.unpause()
            }
        };
        
n.data("animationEnded",!1);
t.bind(o.transitionEnd,function(r){
    e(r.target).data("animationEnded",!0);
    var i=!0;
    n.each(function(){
        if(e(this).data("animationEnded")===!1){
            i=!1;
            return!1
            }
        });
if(i){
    t.unbind(o.transitionEnd);
    u()
    }
})
},
_setHashTag:function(){
    var t=this;
    if(t.settings.hashTags){
        t.currentHashTag=t.nextFrame.prop(t.getHashTagFrom);
        t.frameHashIndex=e.inArray(t.currentHashTag,t.frameHashID);
        if(t.frameHashIndex!==-1&&(t.settings.hashChangesOnFirstFrame||!t.isStartingFrame||!t.transitionsSupported)){
            t.nextFrameID=t.frameHashIndex+1;
            document.location.hash="#"+t.currentHashTag
            }else{
            t.nextFrameID=t.settings.startingFrameID;
            t.isStartingFrame=!1
            }
        }
},
_modernizrForSequence:function(){
    window.ModernizrForSequence=function(e,t,n){
        function r(e){
            v.cssText=e
            }
            function i(e,t){
            return r(prefixes.join(e+";")+(t||""))
            }
            function s(e,t){
            return typeof e===t
            }
            function o(e,t){
            return!!~(""+e).indexOf(t)
            }
            function u(e,t){
            for(var r in e){
                var i=e[r];
                if(!o(i,"-")&&v[i]!==n)return t=="pfx"?i:!0
                    }
                    return!1
            }
            function a(e,t,r){
            for(var i in e){
                var o=t[e[i]];
                if(o!==n)return r===!1?e[i]:s(o,"function")?o.bind(r||t):o
                    }
                    return!1
            }
            function f(e,t,n){
            var r=e.charAt(0).toUpperCase()+e.slice(1),i=(e+" "+b.join(r+" ")+r).split(" ");
            return s(t,"string")||s(t,"undefined")?u(i,t):(i=(e+" "+w.join(r+" ")+r).split(" "),a(i,t,n))
            }
            var l="2.6.1",c={},h=t.documentElement,p="modernizrForSequence",d=t.createElement(p),v=d.style,m,g={}.toString,y="Webkit Moz O ms",b=y.split(" "),w=y.toLowerCase().split(" "),E={
            svg:"http://www.w3.org/2000/svg"
        },S={},x={},T={},N=[],C=N.slice,k,L={}.hasOwnProperty,A;
        !s(L,"undefined")&&!s(L.call,"undefined")?A=function(e,t){
            return L.call(e,t)
            }:A=function(e,t){
            return t in e&&s(e.constructor.prototype[t],"undefined")
            },Function.prototype.bind||(Function.prototype.bind=function(e){
            var t=self;
            if(typeof t!="function")throw new TypeError;
            var n=C.call(arguments,1),r=function(){
                if(self instanceof r){
                    var i=function(){};
                    
                    i.prototype=t.prototype;
                    var s=new i,o=t.apply(s,n.concat(C.call(arguments)));
                    return Object(o)===o?o:s
                    }
                    return t.apply(e,n.concat(C.call(arguments)))
                };
                
            return r
            }),S.svg=function(){
            return!!t.createElementNS&&!!t.createElementNS(E.svg,"svg").createSVGRect
            };
            
        for(var O in S)A(S,O)&&(k=O.toLowerCase(),c[k]=S[O](),N.push((c[k]?"":"no-")+k));return c.addTest=function(e,t){
            if(typeof e=="object")for(var r in e)A(e,r)&&c.addTest(r,e[r]);else{
                e=e.toLowerCase();
                if(c[e]!==n)return c;
                t=typeof t=="function"?t():t,enableClasses&&(h.className+=" "+(t?"":"no-")+e),c[e]=t
                }
                return c
            },r(""),d=m=null,c._version=l,c._domPrefixes=w,c._cssomPrefixes=b,c.testProp=function(e){
            return u([e])
            },c.testAllProps=f,c.prefixed=function(e,t,n){
            return t?f(e,t,n):f(e,"pfx")
            },c
        }(self,self.document)
    },
_defaultPreloader:function(t,n,r){
    var i='<div class="sequence-preloader"><svg class="preloading" xmlns="http://www.w3.org/2000/svg"><circle class="circle" cx="6" cy="6" r="6" /><circle class="circle" cx="22" cy="6" r="6" /><circle class="circle" cx="38" cy="6" r="6" /></svg></div>';
    e("head").append("<style>.sequence-preloader{height: 100%;position: absolute;width: 100%;z-index: 999999;}@"+r+"keyframes preload{0%{opacity: 1;}50%{opacity: 0;}100%{opacity: 1;}}.sequence-preloader .preloading .circle{fill: #ff9442;display: inline-block;height: 12px;position: relative;top: -50%;width: 12px;"+r+"animation: preload 1s infinite; animation: preload 1s infinite;}.preloading{display:block;height: 12px;margin: 0 auto;top: 50%;margin-top:-6px;position: relative;width: 48px;}.sequence-preloader .preloading .circle:nth-child(2){"+r+"animation-delay: .15s; animation-delay: .15s;}.sequence-preloader .preloading .circle:nth-child(3){"+r+"animation-delay: .3s; animation-delay: .3s;}.preloading-complete{opacity: 0;visibility: hidden;"+r+"transition-duration: 1s; transition-duration: 1s;}div.inline{background-color: #ff9442; margin-right: 4px; float: left;}</style>");
    t.prepend(i);
    if(!ModernizrForSequence.svg&&!n){
        e(".sequence-preloader").prepend('<div class="preloading"><div class="circle inline"></div><div class="circle inline"></div><div class="circle inline"></div></div>');
        setInterval(function(){
            e(".sequence-preloader .circle").fadeToggle(500)
            },500)
        }else n||setInterval(function(){
        e(".sequence-preloader").fadeToggle(500)
        },500)
    },
_operaTest:function(){
    e("body").append('<span id="sequence-opera-test"></span>');
    var t=e("#sequence-opera-test");
    t.css("-o-transition","1s");
    if(t.css("-o-transition")!=="1s"){
        t.remove();
        return!1
        }
        t.remove();
    return!0
    }
};

var r={
    startingFrameID:1,
    cycle:!0,
    animateStartingFrameIn:!1,
    transitionThreshold:!1,
    reverseAnimationsWhenNavigatingBackwards:!0,
    preventDelayWhenReversingAnimations:!1,
    moveActiveFrameToTop:!0,
    autoPlay:!1,
    autoPlayDirection:1,
    autoPlayDelay:5e3,
    navigationSkip:!0,
    navigationSkipThreshold:250,
    fadeFrameWhenSkipped:!0,
    fadeFrameTime:150,
    preventReverseSkipping:!1,
    nextButton:!1,
    showNextButtonOnInit:!0,
    prevButton:!1,
    showPrevButtonOnInit:!0,
    pauseButton:!1,
    unpauseDelay:null,
    pauseOnHover:!0,
    pauseIcon:!1,
    showPauseButtonOnInit:!0,
    pagination:!1,
    showPaginationOnInit:!0,
    preloader:!1,
    preloadTheseFrames:[1],
    preloadTheseImages:[],
    hideFramesUntilPreloaded:!0,
    prependPreloadingComplete:!0,
    hidePreloaderUsingCSS:!0,
    hidePreloaderDelay:0,
    keyNavigation:!0,
    numericKeysGoToFrames:!0,
    keyEvents:{
        left:"prev",
        right:"next"
    },
    customKeyEvents:{},
    swipeNavigation:!0,
    swipeThreshold:20,
    swipePreventsDefault:!1,
    swipeEvents:{
        left:"prev",
        right:"next",
        up:!1,
        down:!1
        },
    hashTags:!1,
    hashDataAttribute:!1,
    hashChangesOnFirstFrame:!1,
    fallback:{
        theme:"slide",
        speed:500
    }
};

e.fn.sequence=function(t){
    return this.each(function(){
        e.data(this,"sequence")||e.data(this,"sequence",new n(e(this),t,r))
        })
    }
})(jQuery);
        
var $jq=jQuery.noConflict();    

 /*
 * jQuery FlexSlider v2.1
 * http://www.woothemes.com/flexslider/
 *
 * Copyright 2012 WooThemes
 * Free to use under the GPLv2 license.
 * http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Contributing author: Tyler Smith (@mbmufffin)
 */

;(function ($) {

  //FlexSlider: Object Instance
  $.flexslider = function(el, options) {
    var slider = $(el),
        vars = $.extend({}, $.flexslider.defaults, options),
        namespace = vars.namespace,
        touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
        eventType = (touch) ? "touchend" : "click",
        vertical = vars.direction === "vertical",
        reverse = vars.reverse,
        carousel = (vars.itemWidth > 0),
        fade = vars.animation === "fade",
        asNav = vars.asNavFor !== "",
        methods = {};
    
    // Store a reference to the slider object
    $.data(el, "flexslider", slider);
    
    // Privat slider methods
    methods = {
      init: function() {
        slider.animating = false;
        slider.currentSlide = vars.startAt;
        slider.animatingTo = slider.currentSlide;
        slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
        slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
        slider.slides = $(vars.selector, slider);
        slider.container = $(slider.containerSelector, slider);
        slider.count = slider.slides.length;
       
        // SLIDE:
        if (vars.animation === "slide") vars.animation = "swing";
        slider.prop = (vertical) ? "top" : "marginLeft";
        slider.args = {};
        // SLIDESHOW:
        slider.manualPause = false;
       
        // CONTROLSCONTAINER:
        if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer);
        // MANUAL:
        if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls);
        
        // RANDOMIZE:
        if (vars.randomize) {
          slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
          slider.container.empty().append(slider.slides);
        }
        
        slider.doMath();
        
       
        // CONTROLNAV:
        if (vars.controlNav) methods.controlNav.setup();
        
        // DIRECTIONNAV:
        if (vars.directionNav) methods.directionNav.setup();
         
        // SLIDSESHOW
        if (vars.slideshow) {
          if (vars.pauseOnHover) {
            slider.hover(function() {
              if (!slider.manualPlay && !slider.manualPause) slider.pause();
            }, function() {
              if (!slider.manualPause && !slider.manualPlay) slider.play();
            });
          }
          // initialize animation
          (vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play();
        }
        
        // TOUCH
        if (touch && vars.touch) methods.touch();
        
        // FADE&&SMOOTHHEIGHT || SLIDE:
        if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
        
        
        // API: start() Callback
        setTimeout(function(){
          vars.start(slider);
        }, 200);
      },
      
      controlNav: {
       
        setupPaging: function() {
          var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
              j = 1,
              item;
          
                  
          if (slider.pagingCount > 1) {
            for (var i = 0; i < slider.pagingCount; i++) {
              item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
              slider.controlNavScaffold.append('<li>' + item + '</li>');
              j++;
            }
          }
          
          // CONTROLSCONTAINER:
          (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
          methods.controlNav.set();
          
          methods.controlNav.active();
        
          slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
            event.preventDefault();
            var $this = $(this),
                target = slider.controlNav.index($this);

            if (!$this.hasClass(namespace + 'active')) {
              slider.direction = (target > slider.currentSlide) ? "next" : "prev";
              slider.flexAnimate(target, vars.pauseOnAction);
            }
          });
          
          // Prevent iOS click event bug
          if (touch) {
            slider.controlNav.live("click touchstart", function(event) {
              event.preventDefault();
            });
          }
        },
        set: function() {
          var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a';
          slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
        },
        active: function() {
          slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
        },
        update: function(action, pos) {
          if (slider.pagingCount > 1 && action === "add") {
            slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
          } else if (slider.pagingCount === 1) {
            slider.controlNavScaffold.find('li').remove();
          } else {
            slider.controlNav.eq(pos).closest('li').remove();
          }
          methods.controlNav.set();
          (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
        }
      },
      directionNav: {
        setup: function() {
          var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + vars.nextText + '</a></li></ul>');
        
          // CONTROLSCONTAINER:
          if (slider.controlsContainer) {
            $(slider.controlsContainer).append(directionNavScaffold);
            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
          } else {
            slider.append(directionNavScaffold);
            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
          }
        
          methods.directionNav.update();
        
          slider.directionNav.bind(eventType, function(event) {
            event.preventDefault();
            var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
            slider.flexAnimate(target, vars.pauseOnAction);
          });
          // Prevent iOS click event bug
          if (touch) {
            slider.directionNav.bind("click touchstart", function(event) {
              event.preventDefault();
            });
          }
        },
        update: function() {
          var disabledClass = namespace + 'disabled';
          if (slider.pagingCount === 1) {
            slider.directionNav.addClass(disabledClass);
          } else if (!vars.animationLoop) {
            if (slider.animatingTo === 0) {
              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass);
            } else if (slider.animatingTo === slider.last) {
              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass);
            } else {
              slider.directionNav.removeClass(disabledClass);
            }
          } else {
            slider.directionNav.removeClass(disabledClass);
          }
        }
      },
      pausePlay: {
        setup: function() {
          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
        
         
          // Prevent iOS click event bug
          if (touch) {
            slider.pausePlay.bind("click touchstart", function(event) {
              event.preventDefault();
            });
          }
        },
        update: function(state) {
          (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText);
        }
      },
      touch: function() {
        var startX,
          startY,
          offset,
          cwidth,
          dx,
          startT,
          scrolling = false;
              
        el.addEventListener('touchstart', onTouchStart, false);
       
        function onTouchEnd(e) {
          // finish the touch by undoing the touch session
          el.removeEventListener('touchmove', onTouchMove, false);
          
          if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
            var updateDx = (reverse) ? -dx : dx,
                target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
            
            if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
              slider.flexAnimate(target, vars.pauseOnAction);
            } else {
              if (!fade) slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true);
            }
          }
          el.removeEventListener('touchend', onTouchEnd, false);
          startX = null;
          startY = null;
          dx = null;
          offset = null;
        }
      },
      resize: function() {
        if (!slider.animating && slider.is(':visible')) {
          if (!carousel) slider.doMath();
          
          if (fade) {
            // SMOOTH HEIGHT:
            methods.smoothHeight();
          } else if (carousel) { //CAROUSEL:
            slider.slides.width(slider.computedW);
            slider.update(slider.pagingCount);
            slider.setProps();
          }
          else if (vertical) { //VERTICAL:
            slider.viewport.height(slider.h);
            slider.setProps(slider.h, "setTotal");
          } else {
            // SMOOTH HEIGHT:
            if (vars.smoothHeight) methods.smoothHeight();
            slider.newSlides.width(slider.computedW);
            slider.setProps(slider.computedW, "setTotal");
          }
        }
      },
      smoothHeight: function(dur) {
        if (!vertical || fade) {
          var $obj = (fade) ? slider : slider.viewport;
          (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
        }
      },
      sync: function(action) {
        var $obj = $(vars.sync).data("flexslider"),
            target = slider.animatingTo;
        
        switch (action) {
          case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break;
          case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
          case "pause": $obj.pause(); break;
        }
      }
    }
    
    // public methods
    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
      if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
      
      if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
        if (asNav && withSync) {
          var master = $(vars.asNavFor).data('flexslider');
          slider.atEnd = target === 0 || target === slider.count - 1;
          master.flexAnimate(target, true, false, true, fromNav);
          slider.direction = (slider.currentItem < target) ? "next" : "prev";
          master.direction = slider.direction;
          
          if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
            slider.currentItem = target;
            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
            target = Math.floor(target/slider.visible);
          } else {
            slider.currentItem = target;
            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
            return false;
          }
        }
        
        slider.animating = true;
        slider.animatingTo = target;
        // API: before() animation Callback
        vars.before(slider);
        
        // SLIDESHOW:
        if (pause) slider.pause();
        
        // SYNC:
        if (slider.syncExists && !fromNav) methods.sync("animate");
        
        // CONTROLNAV
        if (vars.controlNav) methods.controlNav.active();
  
        
        // SLIDE:
        if (!fade) {
          var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
              margin, slideString, calcNext;
          
          // INFINITE LOOP / REVERSE:
         
          slider.setProps(slideString, "", vars.animationSpeed);
          if (slider.transitions) {
            if (!vars.animationLoop || !slider.atEnd) {
              slider.animating = false;
              slider.currentSlide = slider.animatingTo;
            }
            slider.container.unbind("webkitTransitionEnd transitionend");
            slider.container.bind("webkitTransitionEnd transitionend", function() {
              slider.wrapup(dimension);
            });
          } else {
            slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){
              slider.wrapup(dimension);
            });
          }
        } else { // FADE:
         
        }
        // SMOOTH HEIGHT:
        if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed);
      }
    } 
    slider.wrapup = function(dimension) {
      // SLIDE:
      if (!fade && !carousel) {
        if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) {
          slider.setProps(dimension, "jumpEnd");
        } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) {
          slider.setProps(dimension, "jumpStart");
        }
      }
      slider.animating = false;
      slider.currentSlide = slider.animatingTo;
      // API: after() animation Callback
      vars.after(slider);
    }
    
    // SLIDESHOW:
    slider.animateSlides = function() {
      if (!slider.animating) slider.flexAnimate(slider.getTarget("next"));
    }
    // SLIDESHOW:
    slider.pause = function() {
      clearInterval(slider.animatedSlides);
      slider.playing = false;
      // PAUSEPLAY:
      if (vars.pausePlay) methods.pausePlay.update("play");
      // SYNC:
      if (slider.syncExists) methods.sync("pause");
    }
    // SLIDESHOW:
    slider.play = function() {
      slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed);
      slider.playing = true;
      // PAUSEPLAY:
      if (vars.pausePlay) methods.pausePlay.update("pause");
      // SYNC:
      if (slider.syncExists) methods.sync("play");
    }
    slider.canAdvance = function(target, fromNav) {
      // ASNAV:
      var last = (asNav) ? slider.pagingCount - 1 : slider.last;
      return (fromNav) ? true :
             (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
             (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
             (target === slider.currentSlide && !asNav) ? false :
             (vars.animationLoop) ? true :
             (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
             (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
             true;
    }
    slider.getTarget = function(dir) {
      slider.direction = dir; 
      if (dir === "next") {
        return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
      } else {
        return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
      }
    }
    
    // SLIDE:
    slider.setProps = function(pos, special, dur) {
      var target = (function() {
        var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo,
            posCalc = (function() {
              if (carousel) {
                return (special === "setTouch") ? pos :
                       (reverse && slider.animatingTo === slider.last) ? 0 :
                       (reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
                       (slider.animatingTo === slider.last) ? slider.limit : posCheck;
              } else {
                switch (special) {
                  case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
                  case "setTouch": return (reverse) ? pos : pos;
                  case "jumpEnd": return (reverse) ? pos : slider.count * pos;
                  case "jumpStart": return (reverse) ? slider.count * pos : pos;
                  default: return pos;
                }
              }
            }());
            return (posCalc * -1) + "px";
          }());

     
      
      slider.args[slider.prop] = target;
      if (slider.transitions || dur === undefined) slider.container.css(slider.args);
    }
    
    slider.setup = function(type) {
      // SLIDE:
      if (!fade) {
        var sliderOffset, arr;
            
  

        slider.newSlides = $(vars.selector, slider);
        
        sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
        // VERTICAL:
        if (vertical && !carousel) {
          slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
          setTimeout(function(){
            slider.newSlides.css({"display": "block"});
            slider.doMath();
            slider.viewport.height(slider.h);
            slider.setProps(sliderOffset * slider.h, "init");
          }, (type === "init") ? 100 : 0);
        } else {
          slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
          slider.setProps(sliderOffset * slider.computedW, "init");
          setTimeout(function(){
            slider.doMath();
            slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
            // SMOOTH HEIGHT:
            if (vars.smoothHeight) methods.smoothHeight();
          }, (type === "init") ? 100 : 0);
        }
      } else { // FADE: 
        slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
        if (type === "init") {
          if (!touch) {
            slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing);
          } else {
            slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
          }
        }
        // SMOOTH HEIGHT:
        if (vars.smoothHeight) methods.smoothHeight();
      }
      // !CAROUSEL:
      // CANDIDATE: active slide
      if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
    }
    
    slider.doMath = function() {
      var slide = slider.slides.first(),
          slideMargin = vars.itemMargin,
          minItems = vars.minItems,
          maxItems = vars.maxItems;
      
      slider.w = slider.width();
      slider.h = slide.height();
      slider.boxPadding = slide.outerWidth() - slide.width();

      // CAROUSEL:
      if (carousel) {
        slider.itemT = vars.itemWidth + slideMargin;
        slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
        slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w;
        slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems :
                       (slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems :
                       (vars.itemWidth > slider.w) ? slider.w : vars.itemWidth;
        slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin));
        slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible;
        slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
        slider.last =  slider.pagingCount - 1;
        slider.limit = (slider.pagingCount === 1) ? 0 :
                       (vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
      } else {
        slider.itemW = slider.w;
        slider.pagingCount = slider.count;
        slider.last = slider.count - 1;
      }
      slider.computedW = slider.itemW - slider.boxPadding;
    }
    
    slider.update = function(pos, action) {
      slider.doMath();
     
 
      
 
      
      // FlexSlider: removed() Callback
      vars.removed(slider);
    }
    
    //FlexSlider: Initialize
    methods.init();
  }
  
  //FlexSlider: Default Settings
  $.flexslider.defaults = {
    namespace: "flex-",             //{NEW} String: Prefix string attached to the class of every element generated by the plugin
    selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
    animation: "fade",              //String: Select your animation type, "fade" or "slide"
    easing: "swing",               //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
    direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
    reverse: false,                 //{NEW} Boolean: Reverse the animation direction
    animationLoop: true,             //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
    smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode  
    startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
    slideshow: true,                //Boolean: Animate slider automatically
    slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
    animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
    initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
    randomize: false,               //Boolean: Randomize slide order

    
    // Primary Controls
    controlNav: true,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
    directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
    prevText: "",           //String: Set the text for the "previous" directionNav item
    nextText: "",               //String: Set the text for the "next" directionNav item
    
  
    
             
    // Callback API
    start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
    before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
    after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
    end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
    added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
    removed: function(){}           //{NEW} Callback: function(slider) - Fires after a slide is removed
  }


  //FlexSlider: Plugin Function
  $.fn.flexslider = function(options) {
    if (options === undefined) options = {};
    
    if (typeof options === "object") {
      return this.each(function() {
        var $this = $(this),
            selector = (options.selector) ? options.selector : ".slides > li",
            $slides = $this.find(selector);

        if ($slides.length === 1) {
          $slides.fadeIn(400);
          if (options.start) options.start($this);
        } else if ($this.data('flexslider') == undefined) {
          new $.flexslider(this, options);
        }
      });
    } else {
      // Helper strings to quickly perform functions on the slider
      var $slider = $(this).data('flexslider');
      switch (options) {
        case "play": $slider.play(); break;
        case "pause": $slider.pause(); break;
        case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
        case "prev":
        case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
        default: if (typeof options === "number") $slider.flexAnimate(options, true);
      }
    }
  }  

})(jQuery);
var j$ = jQuery.noConflict();
