#1 JavaScript::Eval (size: 37383, repeated: 1) (function($) {
if ($.fn.carouFredSel) return;
$.fn.carouFredSel = function(o) {
if (this.length == 0) {
debug(true, 'No element found for "' + this.selector + '".');
return this
}
if (this.length > 1) {
return this.each(function() {
$(this).carouFredSel(o)
})
}
var r = this,
$tt0 = this[0];
r.init = function(o, b, c) {
var e = ['items', 'scroll', 'auto', 'prev', 'next', 'pagination'];
o = getObject($tt0, o);
for (var a = 0, l = e.length; a < l; a++) {
o[e[a]] = getObject($tt0, o[e[a]])
}
if (typeof o.scroll == 'number') {
if (o.scroll <= 50) o.scroll = {
'items': o.scroll
};
else o.scroll = {
'duration': o.scroll
}
} else {
if (typeof o.scroll == 'string') o.scroll = {
'easing': o.scroll
}
}
if (typeof o.items == 'number') o.items = {
'visible': o.items
};
else if (o.items == 'variable') o.items = {
'visible': o.items,
'width': o.items,
'height': o.items
};
if (b) opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
opts.d = {};
opts.variableVisible = false;
opts.visibleAdjust = false;
if (opts.items.start == 0 && typeof c == 'number') {
opts.items.start = c
}
conf.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';
var f = [
['width', 'innerWidth', 'outerWidth', 'height', 'innerHeight', 'outerHeight', 'left', 'top', 'marginRight', 0, 1, 2, 3],
['height', 'innerHeight', 'outerHeight', 'width', 'innerWidth', 'outerWidth', 'top', 'left', 'marginBottom', 3, 2, 1, 0]
];
var g = f[0].length,
dx = (opts.direction == 'right' || opts.direction == 'left') ? 0 : 1;
for (var d = 0; d < g; d++) {
opts.d[f[0][d]] = f[dx][d]
}
var h = r.children(),
lrgst_b = ms_getTrueLargestSize(h, opts, 'outerHeight', false);
if (opts.padding == 'auto') {
debug(true, 'The option "padding: auto" is deprecated, use "align: center".');
opts.padding = false;
opts.align = 'center'
}
if (opts[opts.d['height']] == 'auto') {
opts[opts.d['height']] = lrgst_b;
opts.items[opts.d['height']] = lrgst_b
}
if (!opts.items[opts.d['width']]) {
opts.items[opts.d['width']] = (ms_hasVariableSizes(h, opts, 'outerWidth')) ? 'variable' : h[opts.d['outerWidth']](true)
}
if (!opts.items[opts.d['height']]) {
opts.items[opts.d['height']] = (ms_hasVariableSizes(h, opts, 'outerHeight')) ? 'variable' : h[opts.d['outerHeight']](true)
}
if (!opts[opts.d['height']]) {
opts[opts.d['height']] = opts.items[opts.d['height']]
}
switch (opts.items.visible) {
case '+1':
case '-1':
case 'odd':
case 'odd+':
case 'even':
case 'even+':
opts.visibleAdjust = opts.items.visible;
opts.items.visible = false;
break
}
if (!opts.items.visible) {
if (opts.items[opts.d['width']] == 'variable') {
opts.items.visible = 'variable'
} else {
if (typeof opts[opts.d['width']] == 'number') {
opts.items.visible = Math.floor(opts[opts.d['width']] / opts.items[opts.d['width']])
} else {
var i = ms_getTrueInnerSize(w.parent(), opts, 'innerWidth');
opts.items.visible = Math.floor(i / opts.items[opts.d['width']]);
opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
if (!opts.visibleAdjust) opts.align = false
}
if (opts.items.visible == 'Infinity' || opts.items.visible < 0) {
debug(true, 'Not a valid number of visible items: Set to "1".');
opts.items.visible = 1
}
opts.items.visible = cf_getVisibleItemsAdjust(opts.items.visible, opts)
}
}
if (!opts[opts.d['width']]) {
if (opts.items.visible != 'variable' && opts.items[opts.d['width']] != 'variable') {
opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
opts.align = false
} else {
opts[opts.d['width']] = 'variable'
}
}
if (opts.items.visible == 'variable') {
opts.variableVisible = true;
opts.maxDimention = (opts[opts.d['width']] == 'variable') ? ms_getTrueInnerSize(w.parent(), opts, 'innerWidth') : opts[opts.d['width']];
if (opts.align === false) {
opts[opts.d['width']] = 'variable'
}
opts.items.visible = getVisibleItemsNext(h, opts, 0);
if (opts.items.visible > conf.items.total) {
opts.items.visible = conf.items.total
}
}
if (typeof opts.padding == 'undefined') {
opts.padding = 0
}
if (typeof opts.align == 'undefined') {
opts.align = (opts[opts.d['width']] == 'variable') ? false : 'center'
}
opts.items.oldVisible = opts.items.visible;
opts.usePadding = false;
opts.padding = cf_getPadding(opts.padding);
if (opts.align == 'top') opts.align = 'left';
if (opts.align == 'bottom') opts.align = 'right';
switch (opts.align) {
case 'center':
case 'left':
case 'right':
if (opts[opts.d['width']] != 'variable') {
var p = cf_getAlignPadding(getCurrentItems(h, opts), opts);
opts.usePadding = true;
opts.padding[opts.d[1]] = p[1];
opts.padding[opts.d[3]] = p[0]
}
break;
default:
opts.align = false;
opts.usePadding = (opts.padding[0] == 0 && opts.padding[1] == 0 && opts.padding[2] == 0 && opts.padding[3] == 0) ? false : true;
break
}
if (typeof opts.items.minimum != 'number') opts.items.minimum = opts.items.visible;
if (typeof opts.scroll.items != 'number') opts.scroll.items = (opts.variableVisible) ? 'variable' : opts.items.visible;
if (typeof opts.scroll.duration != 'number') opts.scroll.duration = 500;
opts.auto = getNaviObject($tt0, opts.auto, false, true);
opts.prev = getNaviObject($tt0, opts.prev);
opts.next = getNaviObject($tt0, opts.next);
opts.pagination = getNaviObject($tt0, opts.pagination, true);
opts.auto = $.extend(true, {}, opts.scroll, opts.auto);
opts.prev = $.extend(true, {}, opts.scroll, opts.prev);
opts.next = $.extend(true, {}, opts.scroll, opts.next);
opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination);
if (typeof opts.pagination.keys != 'boolean') opts.pagination.keys = false;
if (typeof opts.pagination.anchorBuilder != 'function') opts.pagination.anchorBuilder = $.fn.carouFredSel.pageAnchorBuilder;
if (typeof opts.auto.play != 'boolean') opts.auto.play = true;
if (typeof opts.auto.delay != 'number') opts.auto.delay = 0;
if (typeof opts.auto.pauseDuration != 'number') opts.auto.pauseDuration = (opts.auto.duration < 10) ? 2500 : opts.auto.duration * 5;
if (opts.auto.nap) {
debug(true, 'jQuery.nap-plugin is no longer supported.')
}
if (opts.synchronise) {
opts.synchronise = getSynchArr(opts.synchronise)
}
if (opts.debug) {
debug(true, 'Carousel width: ' + opts.width);
debug(true, 'Carousel height: ' + opts.height);
if (opts[opts.d['width']] == 'variable') debug(true, 'Available ' + opts.d['width'] + ': ' + opts.maxDimention);
debug(true, 'Item widths: ' + opts.items.width);
debug(true, 'Item heights: ' + opts.items.height);
debug(true, 'Number of items visible: ' + opts.items.visible);
if (opts.auto.play) debug(true, 'Number of items scrolled automatically: ' + opts.auto.items);
if (opts.prev.button) debug(true, 'Number of items scrolled backward: ' + opts.prev.items);
if (opts.next.button) debug(true, 'Number of items scrolled forward: ' + opts.next.items)
}
};
r.build = function() {
if (r.css('position') == 'absolute' || r.css('position') == 'fixed') {
debug(opts.debug, 'Carousels CSS-attribute "position" should be "static" or "relative".')
}
var a = {
'float': r.css('float'),
'position': r.css('position'),
'top': r.css('top'),
'right': r.css('right'),
'bottom': r.css('bottom'),
'left': r.css('left'),
'width': r.css('width'),
'height': r.css('height'),
'marginTop': r.css('marginTop'),
'marginRight': r.css('marginRight'),
'marginBottom': r.css('marginBottom'),
'marginLeft': r.css('marginLeft')
};
w.css(a).css({
'overflow': 'hidden',
'position': (a.position == 'absolute') ? 'absolute' : 'relative'
});
r.data('cfs_origCss', a).css({
'float': 'none',
'position': 'absolute',
'top': 0,
'left': 0,
'marginTop': 0,
'marginRight': 0,
'marginBottom': 0,
'marginLeft': 0
});
if (opts.usePadding) {
r.children().each(function() {
var m = parseInt($(this).css(opts.d['marginRight']));
if (isNaN(m)) m = 0;
$(this).data('cfs_origCssMargin', m)
})
}
};
r.bind_events = function() {
r.unbind_events();
r.bind('stop.cfs' + serial, function(e) {
e.stopPropagation();
r.trigger('pause');
opts.auto.play = false;
conf.isPaused = 'stopped'
});
r.bind('finish.cfs' + serial, function(e) {});
r.bind('pause.cfs' + serial, function(e, g) {
e.stopPropagation();
if (typeof g == 'boolean') {
debug(true, 'Pause a carousel globally is deprecated, use the "stop" custom event.');
r.trigger('stop');
return
}
conf.isPaused = true;
if (tmrs.timeouts.auto != null) clearTimeout(tmrs.timeouts.auto);
if (tmrs.intervals.auto != null) clearInterval(tmrs.intervals.auto);
if (tmrs.intervals.timer != null) clearInterval(tmrs.intervals.timer);
var a = opts.auto.pauseDuration - tmrs.pausePassed,
perc = 100 - Math.ceil(a * 100 / opts.auto.pauseDuration);
if (perc != 0) {
if (opts.auto.onPausePause) opts.auto.onPausePause.call($tt0, perc, a)
}
});
r.bind('play.cfs' + serial, function(e, b, c, d) {
e.stopPropagation();
r.trigger('pause');
var v = [b, c, d],
t = ['string', 'number', 'boolean'],
a = sortParams(v, t);
var b = a[0],
c = a[1],
d = a[2];
if (b != 'prev' && b != 'next') b = conf.direction;
if (typeof c != 'number') c = 0;
if (d) opts.auto.play = true;
if (!opts.auto.play) {
return e.stopImmediatePropagation()
}
conf.isPaused = false;
var f = opts.auto.pauseDuration - tmrs.pausePassed,
dur2 = f + c;
perc = 100 - Math.ceil(f * 100 / opts.auto.pauseDuration);
tmrs.timeouts.auto = setTimeout(function() {
if (conf.isAnimated) {
r.trigger('play', b)
} else {
tmrs.pausePassed = 0;
r.trigger(b, opts.auto)
}
}, dur2);
if (opts.auto.pauseOnHover === 'resume') {
tmrs.intervals.auto = setInterval(function() {
tmrs.pausePassed += 50
}, 50)
}
if (opts.auto.onPauseEnd && perc == 0) {
opts.auto.onPauseEnd.call($tt0, perc, f)
}
if (opts.auto.onPauseStart) {
tmrs.intervals.timer = setTimeout(function() {
opts.auto.onPauseStart.call($tt0, perc, f)
}, c)
}
});
r.bind('prev.cfs' + serial + ' next.cfs' + serial, function(e, b, f, g) {
e.stopPropagation();
if (conf.isPaused == 'stopped' || r.is(':hidden')) {
e.stopImmediatePropagation();
return debug(opts.debug, 'Carousel stopped or hidden: Not scrolling.')
}
var v = [b, f, g],
t = ['object', 'number/string', 'function'],
a = sortParams(v, t);
var b = a[0],
f = a[1],
g = a[2];
if (typeof b != 'object' || b == null) b = opts[e.type];
if (typeof g == 'function') b.onAfter = g;
if (typeof f != 'number') {
if (f == 'visible') {
if (!opts.variableVisible) f = opts.items.visible
} else {
if (typeof b.items == 'number') f = b.items;
else if (typeof opts[e.type].items == 'number') f = opts[e.type].items;
else if (opts.variableVisible) f = 'visible';
else f = opts.items.visible
}
}
if (b.duration > 0) {
if (conf.isAnimated) {
if (b.queue) r.trigger('queue', [e.type, [b, f, g]]);
e.stopImmediatePropagation();
return debug(opts.debug, 'Carousel currently scrolling.')
}
if (opts.items.minimum >= conf.items.total) {
e.stopImmediatePropagation();
return debug(opts.debug, 'Not enough items (' + conf.items.total + ', ' + opts.items.minimum + ' needed): Not scrolling.')
}
}
tmrs.pausePassed = 0;
if (b.conditions && !b.conditions.call($tt0)) {
e.stopImmediatePropagation();
return debug(opts.debug, 'Callback "conditions" returned false.')
}
r.trigger('slide_' + e.type, [b, f]);
if (opts.synchronise) {
var s = opts.synchronise,
c = [b, f];
for (var j = 0, l = s.length; j < l; j++) {
var d = e.type;
if (!s[j][1]) c[0] = s[j][0].triggerHandler('configuration', e.type);
if (!s[j][2]) d = (d == 'prev') ? 'next' : 'prev';
c[1] = f + s[j][3];
s[j][0].trigger('slide_' + d, c)
}
}
});
r.bind('slide_prev.cfs' + serial, function(e, d, f) {
e.stopPropagation();
var g = r.children();
if (!opts.circular) {
if (conf.items.first == 0) {
if (opts.infinite) {
r.trigger('next', conf.items.total - 1)
}
return e.stopImmediatePropagation()
}
}
if (opts.usePadding) resetMargin(g, opts);
if (opts.variableVisible) {
if (typeof f != 'number') {
f = getVisibleItemsPrev(g, opts, conf.items.total - 1)
}
}
if (!opts.circular) {
if (conf.items.total - f < conf.items.first) {
f = conf.items.total - conf.items.first
}
}
if (opts.variableVisible) {
var h = getVisibleItemsNext(g, opts, conf.items.total - f);
opts.items.oldVisible = opts.items.visible;
opts.items.visible = cf_getVisibleItemsAdjust(h, opts)
}
if (opts.usePadding) resetMargin(g, opts, true);
if (f == 0) {
e.stopImmediatePropagation();
return debug(opts.debug, '0 items to scroll: Not scrolling.')
}
debug(opts.debug, 'Scrolling ' + f + ' items backward.');
conf.items.first += f;
while (conf.items.first >= conf.items.total) conf.items.first -= conf.items.total;
if (!opts.circular) {
if (conf.items.first == 0 && d.onEnd) d.onEnd.call($tt0);
if (!opts.infinite) nv_enableNavi(opts, conf.items.first)
}
r.children().slice(conf.items.total - f).prependTo(r);
if (conf.items.total < opts.items.visible + f) {
r.children().slice(0, (opts.items.visible + f) - conf.items.total).clone(true).appendTo(r)
}
var g = r.children(),
c_old = getOldItemsPrev(g, opts, f),
c_new = getNewItemsPrev(g, opts),
l_cur = g.eq(f - 1),
l_old = c_old.last(),
l_new = c_new.last();
if (opts.usePadding) resetMargin(g, opts);
if (opts.align) var p = cf_getAlignPadding(c_new, opts);
if (d.fx == 'directscroll' && opts.items.oldVisible < f) {
var i = g.slice(opts.items.oldVisible, f).hide(),
orgW = opts.items[opts.d['width']];
opts.items[opts.d['width']] = 'variable'
} else {
var i = false
}
var j = ms_getTotalSize(g.slice(0, f), opts, 'width'),
w_siz = mapWrapperSizes(ms_getSizes(c_new, opts, true), opts, !opts.usePadding);
if (i) opts.items[opts.d['width']] = orgW;
if (opts.usePadding) {
resetMargin(g, opts, true);
resetMargin(l_old, opts, opts.padding[opts.d[1]]);
resetMargin(l_cur, opts, opts.padding[opts.d[3]])
}
if (opts.align) {
opts.padding[opts.d[1]] = p[1];
opts.padding[opts.d[3]] = p[0]
}
var k = {},
a_new = {},
a_cur = {},
a_old = {},
a_dur = d.duration;
if (d.fx == 'none') a_dur = 0;
else if (a_dur == 'auto') a_dur = opts.scroll.duration / opts.scroll.items * f;
else if (a_dur <= 0) a_dur = 0;
else if (a_dur < 10) a_dur = j / a_dur;
var l = {
duration: a_dur,
easing: d.easing
};
if (d.onBefore) d.onBefore.call($tt0, c_old, c_new, w_siz, a_dur);
if (opts.usePadding) {
var m = opts.padding[opts.d[3]];
a_cur[opts.d['marginRight']] = l_cur.data('cfs_origCssMargin');
a_new[opts.d['marginRight']] = l_new.data('cfs_origCssMargin') + opts.padding[opts.d[1]];
a_old[opts.d['marginRight']] = l_old.data('cfs_origCssMargin');
l_cur.stop().animate(a_cur, l);
l_old.stop().animate(a_old, l);
l_new.stop().animate(a_new, l)
} else {
var m = 0
}
k[opts.d['left']] = m;
if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') {
w.stop().animate(w_siz, l)
}
switch (d.fx) {
case 'crossfade':
case 'cover':
case 'uncover':
var n = r.clone().appendTo(w);
break
}
switch (d.fx) {
case 'uncover':
n.children().slice(0, f).remove();
case 'crossfade':
case 'cover':
n.children().slice(opts.items.visible).remove();
break
}
switch (d.fx) {
case 'fade':
fx_fade(d, r, 0, a_dur);
break;
case 'crossfade':
n.css({
'opacity': 0
});
fx_fade(d, n, 1, a_dur);
fx_fade(d, r, 1, a_dur, function() {
n.remove()
});
break;
case 'cover':
fx_cover(d, r, n, opts, a_dur, true);
break;
case 'uncover':
fx_uncover(d, r, n, opts, a_dur, true, f);
break
}
switch (d.fx) {
case 'fade':
case 'crossfade':
case 'cover':
case 'uncover':
f_dur = a_dur;
a_dur = 0;
break
}
conf.isAnimated = true;
var o = f;
r.css(opts.d['left'], -j);
r.animate(k, {
duration: a_dur,
easing: d.easing,
complete: function() {
conf.isAnimated = false;
var a = opts.items.visible + o - conf.items.total;
if (a > 0) {
r.children().slice(conf.items.total).remove();
c_old = r.children().slice(conf.items.total - (o - a)).get().concat(r.children().slice(0, a).get())
}
if (i) i.show();
if (opts.usePadding) {
var b = r.children().eq(opts.items.visible + o - 1);
b.css(opts.d['marginRight'], b.data('cfs_origCssMargin'))
}
var c = function() {
if (d.onAfter) {
d.onAfter.call($tt0, c_old, c_new, w_siz)
}
switch (d.fx) {
case 'fade':
case 'crossfade':
r.css('filter', '');
break
}
if (queue.length) {
setTimeout(function() {
r.trigger(queue[0][0], queue[0][1]);
queue.shift()
}, 1)
}
};
switch (d.fx) {
case 'fade':
case 'uncover':
fx_fade(d, r, 1, f_dur, c);
break;
default:
c();
break
}
}
});
r.trigger('updatePageStatus', [false, w_siz]).trigger('play', a_dur)
});
r.bind('slide_next.cfs' + serial, function(e, f, g) {
e.stopPropagation();
var h = r.children();
if (!opts.circular) {
if (conf.items.first == opts.items.visible) {
if (opts.infinite) {
r.trigger('prev', conf.items.total - 1)
}
return e.stopImmediatePropagation()
}
}
if (opts.usePadding) resetMargin(h, opts);
if (opts.variableVisible) {
if (typeof g != 'number') {
g = opts.items.visible
}
}
var i = (conf.items.first == 0) ? conf.items.total : conf.items.first;
if (!opts.circular) {
if (opts.variableVisible) {
var j = getVisibleItemsNext(h, opts, g),
xI = getVisibleItemsPrev(h, opts, i - 1)
} else {
var j = opts.items.visible,
xI = opts.items.visible
}
if (g + j > i) {
g = i - xI
}
}
if (opts.variableVisible) {
var j = getVisibleItemsNextTestCircular(h, opts, g, i);
while (opts.items.visible - g >= j && g < conf.items.total) {
g++;
j = getVisibleItemsNextTestCircular(h, opts, g, i)
}
opts.items.oldVisible = opts.items.visible;
opts.items.visible = cf_getVisibleItemsAdjust(j, opts)
}
if (opts.usePadding) resetMargin(h, opts, true);
if (g == 0) {
e.stopImmediatePropagation();
return debug(opts.debug, '0 items to scroll: Not scrolling.')
}
debug(opts.debug, 'Scrolling ' + g + ' items forward.');
conf.items.first -= g;
while (conf.items.first < 0) conf.items.first += conf.items.total;
if (!opts.circular) {
if (conf.items.first == opts.items.visible && f.onEnd) f.onEnd.call($tt0);
if (!opts.infinite) nv_enableNavi(opts, conf.items.first)
}
if (conf.items.total < opts.items.visible + g) {
r.children().slice(0, (opts.items.visible + g) - conf.items.total).clone(true).appendTo(r)
}
var h = r.children(),
c_old = getOldItemsNext(h, opts),
c_new = getNewItemsNext(h, opts, g),
l_cur = h.eq(g - 1),
l_old = c_old.last(),
l_new = c_new.last();
if (opts.usePadding) resetMargin(h, opts);
if (opts.align) var p = cf_getAlignPadding(c_new, opts);
if (f.fx == 'directscroll' && opts.items.oldVisible < g) {
var k = h.slice(opts.items.oldVisible, g).hide(),
orgW = opts.items[opts.d['width']];
opts.items[opts.d['width']] = 'variable'
} else {
var k = false
}
var l = ms_getTotalSize(h.slice(0, g), opts, 'width'),
w_siz = mapWrapperSizes(ms_getSizes(c_new, opts, true), opts, !opts.usePadding);
if (k) opts.items[opts.d['width']] = orgW;
if (opts.usePadding) {
resetMargin(h, opts, true);
resetMargin(l_old, opts, opts.padding[opts.d[1]]);
resetMargin(l_new, opts, opts.padding[opts.d[1]])
}
if (opts.align) {
opts.padding[opts.d[1]] = p[1];
opts.padding[opts.d[3]] = p[0]
}
var m = {},
a_old = {},
a_cur = {},
a_dur = f.duration;
if (f.fx == 'none') a_dur = 0;
else if (a_dur == 'auto') a_dur = opts.scroll.duration / opts.scroll.items * g;
else if (a_dur <= 0) a_dur = 0;
else if (a_dur < 10) a_dur = l / a_dur;
var n = {
duration: a_dur,
easing: f.easing
};
if (f.onBefore) f.onBefore.call($tt0, c_old, c_new, w_siz, a_dur);
if (opts.usePadding) {
a_old[opts.d['marginRight']] = l_old.data('cfs_origCssMargin');
a_cur[opts.d['marginRight']] = l_cur.data('cfs_origCssMargin') + opts.padding[opts.d[3]];
l_new.css(opts.d['marginRight'], l_new.data('cfs_origCssMargin') + opts.padding[opts.d[1]]);
l_old.stop().animate(a_old, n);
l_cur.stop().animate(a_cur, n)
}
m[opts.d['left']] = -l;
if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') {
w.stop().animate(w_siz, n)
}
switch (f.fx) {
case 'crossfade':
case 'cover':
case 'uncover':
var o = r.clone().appendTo(w);
break
}
switch (f.fx) {
case 'crossfade':
case 'cover':
o.children().slice(0, g).remove();
o.children().slice(opts.items.visible).remove();
break;
case 'uncover':
o.children().slice(opts.items.oldVisible).remove();
break
}
switch (f.fx) {
case 'fade':
fx_fade(f, r, 0, a_dur);
break;
case 'crossfade':
o.css({
'opacity': 0
});
fx_fade(f, o, 1, a_dur);
fx_fade(f, r, 1, a_dur, function() {
o.remove()
});
break;
case 'cover':
fx_cover(f, r, o, opts, a_dur, false);
break;
case 'uncover':
fx_uncover(f, r, o, opts, a_dur, false, g);
break
}
switch (f.fx) {
case 'fade':
case 'crossfade':
case 'cover':
case 'uncover':
f_dur = a_dur;
a_dur = 0;
break
}
conf.isAnimated = true;
var q = g;
r.animate(m, {
duration: a_dur,
easing: f.easing,
complete: function() {
conf.isAnimated = false;
var a = opts.items.visible + q - conf.items.total,
new_m = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
r.css(opts.d['left'], new_m);
if (a > 0) {
r.children().slice(conf.items.total).remove()
}
var b = r.children().slice(0, q).appendTo(r).last();
if (a > 0) {
c_new = getCurrentItems(h, opts)
}
if (k) k.show();
if (opts.usePadding) {
if (conf.items.total < opts.items.visible + q) {
var c = r.children().eq(opts.items.visible - 1);
c.css(opts.d['marginRight'], c.data('cfs_origCssMargin') + opts.padding[opts.d[3]])
}
b.css(opts.d['marginRight'], b.data('cfs_origCssMargin'))
}
var d = function() {
if (f.onAfter) {
f.onAfter.call($tt0, c_old, c_new, w_siz)
}
switch (f.fx) {
case 'fade':
case 'crossfade':
r.css('filter', '');
break
}
if (queue.length) {
setTimeout(function() {
r.trigger(queue[0][0], queue[0][1]);
queue.shift()
}, 1)
}
};
switch (f.fx) {
case 'fade':
case 'uncover':
fx_fade(f, r, 1, f_dur, d);
break;
default:
d();
break
}
}
});
r.trigger('updatePageStatus', [false, w_siz]).trigger('play', a_dur)
});
r.bind('slideTo.cfs' + serial, function(e, b, c, d, f, g) {
e.stopPropagation();
var v = [b, c, d, f, g],
t = ['string/number/object', 'number', 'boolean', 'object', 'string'],
a = sortParams(v, t);
var f = a[3],
g = a[4];
b = getItemIndex(a[0], a[1], a[2], conf.items, r);
if (b == 0) return;
if (typeof f != 'object') f = false;
if (conf.isAnimated) {
if (typeof f != 'object' || f.duration > 0) return
}
if (g != 'prev' && g != 'next') {
if (opts.circular) {
if (b <= conf.items.total / 2) g = 'next';
else g = 'prev'
} else {
if (conf.items.first == 0 || conf.items.first > b) g = 'next';
else g = 'prev'
}
}
if (g == 'prev') r.trigger('prev', [f, conf.items.total - b]);
else r.trigger('next', [f, b])
});
r.bind('jumpToStart.cfs' + serial, function(e) {
if (conf.items.first > 0) {
r.prepend(r.children().slice(conf.items.first))
}
});
r.bind('synchronise.cfs' + serial, function(e, s) {
if (s) s = getSynchArr(s);
else if (opts.synchronise) s = opts.synchronise;
else return debug(opts.debug, 'No carousel to synchronise.');
var n = r.triggerHandler('currentPosition');
for (var j = 0, l = s.length; j < l; j++) {
s[j][0].trigger('slideTo', [n, s[j][3], true])
}
});
r.bind('queue.cfs' + serial, function(e, a, b) {
if (typeof a == 'undefined') {
return queue
} else if (typeof a == 'function') {
a.call($tt0, queue)
} else if (is_array(a)) {
queue = a
} else {
queue.push([a, b])
}
});
r.bind('insertItem.cfs' + serial, function(e, b, c, d, f) {
e.stopPropagation();
var v = [b, c, d, f],
t = ['string/object', 'string/number/object', 'boolean', 'number'],
a = sortParams(v, t);
var b = a[0],
c = a[1],
d = a[2],
f = a[3];
if (typeof b == 'object' && typeof b.jquery == 'undefined') b = $(b);
if (typeof b == 'string') b = $(b);
if (typeof b != 'object' || typeof b.jquery == 'undefined' || b.length == 0) return debug(opts.debug, 'Not a valid object.');
if (typeof c == 'undefined') c = 'end';
if (opts.usePadding) {
b.each(function() {
var m = parseInt($(this).css(opts.d['marginRight']));
if (isNaN(m)) m = 0;
$(this).data('cfs_origCssMargin', m)
})
}
var g = c,
before = 'before';
if (c == 'end') {
if (d) {
if (conf.items.first == 0) {
c = conf.items.total - 1;
before = 'after'
} else {
c = conf.items.first;
conf.items.first += b.length
}
if (c < 0) c = 0
} else {
c = conf.items.total - 1;
before = 'after'
}
} else {
c = getItemIndex(c, f, d, conf.items, r)
}
if (g != 'end' && !d) {
if (c < conf.items.first) conf.items.first += b.length
}
if (conf.items.first >= conf.items.total) conf.items.first -= conf.items.total;
var h = r.children().eq(c);
if (h.length) {
h[before](b)
} else {
r.append(b)
}
conf.items.total = r.children().length;
r.trigger('linkAnchors');
var i = setSizes(r, opts);
nv_showNavi(opts, conf.items.total);
nv_enableNavi(opts, conf.items.first);
r.trigger('updatePageStatus', [true, i])
});
r.bind('removeItem.cfs' + serial, function(e, b, c, d) {
e.stopPropagation();
var v = [b, c, d],
t = ['string/number/object', 'boolean', 'number'],
a = sortParams(v, t);
var b = a[0],
c = a[1],
d = a[2];
if (typeof b == 'undefined' || b == 'end') {
r.children().last().remove()
} else {
b = getItemIndex(b, d, c, conf.items, r);
var f = r.children().eq(b);
if (f.length) {
if (b < conf.items.first) conf.items.first -= f.length;
f.remove()
}
}
conf.items.total = r.children().length;
var g = setSizes(r, opts);
nv_showNavi(opts, conf.items.total);
nv_enableNavi(opts, conf.items.first);
r.trigger('updatePageStatus', [true, g])
});
r.bind('currentPosition.cfs' + serial, function(e, a) {
e.stopPropagation();
if (conf.items.first == 0) var b = 0;
else var b = conf.items.total - conf.items.first;
if (typeof a == 'function') a.call($tt0, b);
return b
});
r.bind('currentPage.cfs' + serial, function(e, a) {
e.stopPropagation();
var b = Math.ceil(conf.items.total / opts.items.visible - 1);
if (conf.items.first == 0) var c = 0;
else if (conf.items.first < conf.items.total % opts.items.visible) var c = 0;
else if (conf.items.first == opts.items.visible && !opts.circular) var c = b;
else var c = Math.round((conf.items.total - conf.items.first) / opts.items.visible);
if (c < 0) c = 0;
if (c > b) c = b;
if (typeof a == 'function') a.call($tt0, c);
return c
});
r.bind('currentVisible.cfs' + serial, function(e, a) {
e.stopPropagation();
$i = getCurrentItems(r.children(), opts);
if (typeof a == 'function') a.call($tt0, $i);
return $i
});
r.bind('isPaused.cfs' + serial, function(e, a) {
e.stopPropagation();
if (typeof a == 'function') a.call($tt0, conf.isPaused);
return conf.isPaused
});
r.bind('configuration.cfs' + serial, function(e, a, b, c) {
e.stopPropagation();
var d = false;
if (typeof a == 'function') {
a.call($tt0, opts)
} else if (typeof a == 'object') {
opts_orig = $.extend(true, {}, opts_orig, a);
if (b !== false) d = true;
else opts = $.extend(true, {}, opts, a)
} else if (typeof a != 'undefined') {
if (typeof b == 'function') {
var f = eval('opts.' + a);
if (typeof f == 'undefined') f = '';
b.call($tt0, f)
} else if (typeof b != 'undefined') {
if (typeof c !== 'boolean') c = true;
eval('opts_orig.' + a + ' = b');
if (c !== false) d = true;
else eval('opts.' + a + ' = b')
} else {
return eval('opts.' + a)
}
}
if (d) {
resetMargin(r.children(), opts);
r.init(opts_orig);
var g = setSizes(r, opts);
nv_showNavi(opts, conf.items.total);
nv_enableNavi(opts, conf.items.first);
r.trigger('updatePageStatus', [true, g])
}
return opts
});
r.bind('linkAnchors.cfs' + serial, function(e, a, b) {
e.stopPropagation();
if (typeof a == 'undefined' || a.length == 0) a = $('body');
else if (typeof a == 'string') a = $(a);
if (typeof a != 'object') return debug(opts.debug, 'Not a valid object.');
if (typeof b != 'string' || b.length == 0) b = 'a.caroufredsel';
a.find(b).each(function() {
var h = this.hash || '';
if (h.length > 0 && r.children().index($(h)) != -1) {
$(this).unbind('click').click(function(e) {
e.preventDefault();
r.trigger('slideTo', h)
})
}
})
});
r.bind('updatePageStatus.cfs' + serial, function(e, b, c) {
e.stopPropagation();
if (!opts.pagination.container) return;
if (typeof b == 'boolean' && b) {
opts.pagination.container.children().remove();
for (var a = 0, l = Math.ceil(conf.items.total / opts.items.visible); a < l; a++) {
var i = r.children().eq(getItemIndex(a * opts.items.visible, 0, true, conf.items, r));
opts.pagination.container.append(opts.pagination.anchorBuilder(a + 1, i))
}
opts.pagination.container.children().unbind(opts.pagination.event).each(function(a) {
$(this).bind(opts.pagination.event, function(e) {
e.preventDefault();
r.trigger('slideTo', [a * opts.items.visible, 0, true, opts.pagination])
})
})
}
var d = r.triggerHandler('currentPage');
opts.pagination.container.children().removeClass('selected').eq(d).addClass('selected')
});
r.bind('destroy.cfs' + serial, function(e, a) {
e.stopPropagation();
if (a) {
r.trigger('jumpToStart')
}
if (opts.usePadding) {
resetMargin(r.children(), opts)
}
r.trigger('pause').css(r.data('cfs_origCss'));
r.unbind_events();
r.unbind_buttons();
w.replaceWith(r)
})
};
r.unbind_events = function() {
r.unbind('.cfs' + serial)
};
r.bind_buttons = function() {
r.unbind_buttons();
nv_showNavi(opts, conf.items.total);
nv_enableNavi(opts, conf.items.first);
if (opts.auto.pauseOnHover) {
w.bind('mouseenter.cfs' + serial, function() {
r.trigger('pause')
}).bind('mouseleave.cfs' + serial, function() {
r.trigger('play')
})
}
if (opts.prev.button) {
opts.prev.button.bind(opts.prev.event + '.cfs' + serial, function(e) {
e.preventDefault();
r.trigger('prev')
});
if (opts.prev.pauseOnHover) {
opts.prev.button.bind('mouseenter.cfs' + serial, function() {
r.trigger('pause')
}).bind('mouseleave.cfs' + serial, function() {
r.trigger('play')
})
}
}
if (opts.next.button) {
opts.next.button.bind(opts.next.event + '.cfs' + serial, function(e) {
e.preventDefault();
r.trigger('next')
});
if (opts.next.pauseOnHover) {
opts.next.button.bind('mouseenter.cfs' + serial, function() {
r.trigger('pause')
}).bind('mouseleave.cfs' + serial, function() {
r.trigger('play')
})
}
}
if ($.fn.mousewheel) {
if (opts.prev.mousewheel) {
w.mousewheel(function(e, a) {
if (a > 0) {
e.preventDefault();
num = (typeof opts.prev.mousewheel == 'number') ? opts.prev.mousewheel : null;
r.trigger('prev', num)
}
})
}
if (opts.next.mousewheel) {
w.mousewheel(function(e, a) {
if (a < 0) {
e.preventDefault();
num = (typeof opts.next.mousewheel == 'number') ? opts.next.mousewheel : null;
r.trigger('next', num)
}
})
}
}
if ($.fn.touchwipe) {
var b = (opts.prev.wipe) ?
function() {
r.trigger('prev')
} : null, wN = (opts.next.wipe) ?
function() {
r.trigger('next')
} : null;
if (wN || wN) {
var c = {
'min_move_x': 30,
'min_move_y': 30,
'preventDefaultEvents': true
};
switch (opts.direction) {
case 'up':
case 'down':
c.wipeUp = wN;
c.wipeDown = b;
break;
default:
c.wipeLeft = wN;
c.wipeRight = b
}
w.touchwipe(c)
}
}
if (opts.pagination.container) {
if (opts.pagination.pauseOnHover) {
opts.pagination.container.bind('mouseenter.cfs' + serial, function() {
r.trigger('pause')
}).bind('mouseleave.cfs' + serial, function() {
r.trigger('play')
})
}
}
if (opts.prev.key || opts.next.key) {
$(document).bind('keyup.cfs' + serial, function(e) {
var k = e.keyCode;
if (k == opts.next.key) {
e.preventDefault();
r.trigger('next')
}
if (k == opts.prev.key) {
e.preventDefault();
r.trigger('prev')
}
})
}
if (opts.pagination.keys) {
$(document).bind('keyup.cfs' + serial, function(e) {
var k = e.keyCode;
if (k >= 49 && k < 58) {
k = (k - 49) * opts.items.visible;
if (k <= conf.items.total) {
e.preventDefault();
r.trigger('slideTo', [k, 0, true, opts.pagination])
}
}
})
}
if (opts.auto.play) {
r.trigger('play', opts.auto.delay)
}
};
r.unbind_buttons = function() {
$(document).unbind('.cfs' + serial);
w.unbind('.cfs' + serial);
if (opts.prev.button) opts.prev.button.unbind('.cfs' + serial);
if (opts.next.button) opts.next.button.unbind('.cfs' + serial);
if (opts.pagination.container) opts.pagination.container.unbind('.cfs' + serial);
nv_showNavi(opts, 'hide');
nv_enableNavi(opts, 'removeClass');
if (opts.pagination.container) {
opts.pagination.container.children().remove()
}
};
r.configuration = function(a, b) {
debug(true, 'The "configuration" public method is deprecated, use the "configuration" custom event.');
var c = false;
var d = function(a) {
c = a
};
if (!a) a = d;
if (!b) b = d;
r.trigger('configuration', [a, b]);
return c
};
r.current_position = function() {
debug(true, 'The "current_position" public method is deprecated, use the "currentPosition" custom event.');
return r.triggerHandler('currentPosition')
};
r.destroy = function() {
debug(true, 'The "destroy" public method is deprecated, use the "destroy" custom event.');
r.trigger('destroy');
return r
};
r.link_anchors = function(a, b) {
debug(true, 'The "link_anchors" public method is deprecated, use the "linkAnchors" custom event.');
r.trigger('linkAnchors', [a, b]);
return r
};
if (r.parent().is('.caroufredsel_wrapper')) {
var u = r.triggerHandler('currentPosition');
r.trigger('destroy', true)
} else {
var u = false
}
var w = r.wrap('<div class="caroufredsel_wrapper" />').parent(),
conf = {
'direction': 'next',
'isPaused': true,
'isAnimated': false,
'items': {
'total': r.children().length,
'first': 0
}
},
tmrs = {
'pausePassed': 0,
'intervals': {
'auto': null,
'timer': null
},
'timeouts': {
'auto': null
}
},
opts = {},
opts_orig = o,
queue = [],
serial = $.fn.carouFredSel.serial++;
r.init(opts_orig, true, u);
r.build();
r.bind_events();
r.bind_buttons();
if (opts.items.start != 0) {
var s = opts.items.start;
if (s === true) {
s = window.location.hash;
if (!s.length) s = 0
} else if (s === 'random') {
s = Math.floor(Math.random() * conf.items.total)
}
r.trigger('slideTo', [s, 0, true,
{
duration: 0
}, 'next'])
}
var x = setSizes(r, opts, false),
itm = getCurrentItems(r.children(), opts);
if (opts.onCreate) {
opts.onCreate.call($tt0, itm, x)
}
r.trigger('updatePageStatus', [true, x]);
r.trigger('linkAnchors');
return this
};
$.fn.carouFredSel.serial = 0;
$.fn.carouFredSel.defaults = {
'debug': false,
'synchronise': false,
'infinite': true,
'circular': true,
'direction': 'left',
'items': {
'start': 0
},
'scroll': {
'easing': 'swing',
'pauseOnHover': false,
'mousewheel': false,
'wipe': false,
'event': 'click',
'queue': false
}
};
$.fn.carouFredSel.pageAnchorBuilder = function(a, b) {
return '<a href="#"><span>' + a + '</span></a>'
};
function fx_fade(a, c, x, d, f) {
var o = {
'duration': d,
'easing': a.easing
};
if (typeof f == 'function') o.complete = f;
c.animate({
opacity: x
}, o)
}
function fx_cover(a, b, c, o, d, e) {
var f = ms_getSizes(getOldItemsNext(b.children(), o), o, true)[0],
new_w = ms_getSizes(c.children(), o, true)[0],
cur_l = (e) ? -new_w : f,
css_o = {},
ani_o = {};
css_o[o.d['width']] = new_w;
css_o[o.d['left']] = cur_l;
ani_o[o.d['left']] = 0;
b.animate({
opacity: '+=0'
}, d);
c.css(css_o).animate(ani_o, {
duration: d,
easing: a.easing,
complete: function() {
$(this).remove()
}
})
}
function fx_uncover(a, b, c, o, d, e, n) {
var f = ms_getSizes(getNewItemsNext(b.children(), o, n), o, true)[0],
old_w = ms_getSizes(c.children(), o, true)[0],
cur_l = (e) ? -old_w : f,
css_o = {},
ani_o = {};
css_o[o.d['width']] = old_w;
css_o[o.d['left']] = 0;
ani_o[o.d['left']] = cur_l;
c.css(css_o).animate(ani_o, {
duration: d,
easing: a.easing,
complete: function() {
$(this).remove()
}
})
}
function nv_showNavi(o, t) {
if (t == 'show' || t == 'hide') {
var f = t
} else if (o.items.minimum >= t) {
debug(o.debug, 'Not enough items: hiding navigation (' + t + ' items, ' + o.items.minimum + ' needed).');
var f = 'hide'
} else {
var f = 'show'
}
if (o.prev.button) o.prev.button[f]();
if (o.next.button) o.next.button[f]();
if (o.pagination.container) o.pagination.container[f]()
}
function nv_enableNavi(o, f) {
if (o.circular || o.infinite) return;
var a = (f == 'removeClass' || f == 'addClass') ? f : false;
if (o.next.button) {
var b = a || (f == o.items.visible) ? 'addClass' : 'removeClass';
o.next.button[b]('disabled')
}
if (o.prev.button) {
var b = a || (f == 0) ? 'addClass' : 'removeClass';
o.prev.button[b]('disabled')
}
}
function sortParams(c, d) {
var e = [];
for (var a = 0, l1 = c.length; a < l1; a++) {
for (var b = 0, l2 = d.length; b < l2; b++) {
if (d[b].indexOf(typeof c[a]) > -1 && !e[b]) {
e[b] = c[a];
break
}
}
}
return e
}
function getSynchArr(s) {
if (!is_array(s)) s = [
[s]
];
if (!is_array(s[0])) s = [s];
for (var j = 0, l = s.length; j < l; j++) {
if (typeof s[j][0] == 'string') s[j][0] = $(s[j][0]);
if (typeof s[j][1] != 'boolean') s[j][1] = true;
if (typeof s[j][2] != 'boolean') s[j][2] = true;
if (typeof s[j][3] != 'number') s[j][3] = 0
}
return s
}
function getKeyCode(k) {
if (k == 'right') return 39;
if (k == 'left') return 37;
if (k == 'up') return 38;
if (k == 'down') return 40;
return -1
}
function getObject(a, b) {
if (typeof b == 'function') b = b.call(a);
if (typeof b == 'undefined') b = {};
return b
}
function getNaviObject(a, b, c, d) {
if (typeof c != 'boolean') c = false;
if (typeof d != 'boolean') d = false;
b = getObject(a, b);
if (typeof b == 'string') {
var e = getKeyCode(b);
if (e == -1) b = $(b);
else b = e
}
if (c) {
if (typeof b == 'boolean') b = {
'keys': b
};
if (typeof b.jquery != 'undefined') b = {
'container': b
};
if (typeof b.container == 'function') b.container = b.container.call(a);
if (typeof b.container == 'string') b.container = $(b.container)
} else if (d) {
if (typeof b == 'boolean') b = {
'play': b
};
if (typeof b == 'number') b = {
'pauseDuration': b
}
} else {
if (typeof b.jquery != 'undefined') b = {
'button': b
};
if (typeof b == 'number') b = {
'key': b
};
if (typeof b.button == 'function') b.button = b.button.call(a);
if (typeof b.button == 'string') b.button = $(b.button);
if (typeof b.key == 'string') b.key = getKeyCode(b.key)
}
return b
}
function getItemIndex(a, b, c, d, e) {
if (typeof a == 'string') {
if (isNaN(a)) a = $(a);
else a = parseInt(a)
}
if (typeof a == 'object') {
if (typeof a.jquery == 'undefined') a = $(a);
a = e.children().index(a);
if (a == -1) a = 0;
if (typeof c != 'boolean') c = false
} else {
if (typeof c != 'boolean') c = true
}
if (isNaN(a)) a = 0;
else a = parseInt(a);
if (isNaN(b)) b = 0;
else b = parseInt(b);
if (c) {
a += d.first
}
a += b;
if (d.total > 0) {
while (a >= d.total) {
a -= d.total
}
while (a < 0) {
a += d.total
}
}
return a
}
function getCurrentItems(i, o) {
return i.slice(0, o.items.visible)
}
function getOldItemsPrev(i, o, n) {
return i.slice(n, o.items.oldVisible + n)
}
function getNewItemsPrev(i, o) {
return i.slice(0, o.items.visible)
}
function getOldItemsNext(i, o) {
return i.slice(0, o.items.oldVisible)
}
function getNewItemsNext(i, o, n) {
return i.slice(n, o.items.visible + n)
}
function getVisibleItemsPrev(i, o, s) {
var t = 0,
x = 0;
for (var a = s; a >= 0; a--) {
t += i.eq(a)[o.d['outerWidth']](true);
if (t > o.maxDimention) return x;
if (a == 0) a = i.length;
x++
}
}
function getVisibleItemsNext(i, o, s) {
var t = 0,
x = 0;
for (var a = s, l = i.length - 1; a <= l; a++) {
t += i.eq(a)[o.d['outerWidth']](true);
if (t > o.maxDimention) return x;
if (a == l) a = -1;
x++
}
}
function getVisibleItemsNextTestCircular(i, o, s, l) {
var v = getVisibleItemsNext(i, o, s);
if (!o.circular) {
if (s + v > l) v = l - s
}
return v
}
function resetMargin(i, o, m) {
var x = (typeof m == 'boolean') ? m : false;
if (typeof m != 'number') m = 0;
i.each(function() {
var t = parseInt($(this).css(o.d['marginRight']));
if (isNaN(t)) t = 0;
$(this).data('cfs_tempCssMargin', t);
$(this).css(o.d['marginRight'], ((x) ? $(this).data('cfs_tempCssMargin') : m + $(this).data('cfs_origCssMargin')))
})
}
function ms_getSizes(i, o, a) {
s1 = ms_getTotalSize(i, o, 'width', a);
s2 = ms_getLargestSize(i, o, 'height', a);
return [s1, s2]
}
function ms_getLargestSize(i, o, a, b) {
if (typeof b != 'boolean') b = false;
if (typeof o[o.d[a]] == 'number' && b) return o[o.d[a]];
if (typeof o.items[o.d[a]] == 'number') return o.items[o.d[a]];
var c = (a.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight';
return ms_getTrueLargestSize(i, o, c)
}
function ms_getTrueLargestSize(i, o, a) {
var s = 0;
i.each(function() {
var m = $(this)[o.d[a]](true);
if (s < m) s = m
});
return s
}
function ms_getTrueInnerSize(b, o, c) {
var d = b[o.d[c]](),
arr = (o.d[c].toLowerCase().indexOf('width') > -1) ? ['paddingLeft', 'paddingRight'] : ['paddingTop', 'paddingBottom'];
for (a = 0, l = arr.length; a < l; a++) {
var m = parseInt(b.css(arr[a]));
if (isNaN(m)) m = 0;
d -= m
}
return d
}
function ms_getTotalSize(i, o, a, b) {
if (typeof b != 'boolean') b = false;
if (typeof o[o.d[a]] == 'number' && b) return o[o.d[a]];
if (typeof o.items[o.d[a]] == 'number') return o.items[o.d[a]] * i.length;
var d = (a.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight',
s = 0;
i.each(function() {
var j = $(this);
if (j.is(':visible')) {
s += j[o.d[d]](true)
}
});
return s
}
function ms_hasVariableSizes(i, o, a) {
var s = false,
v = false;
i.each(function() {
c = $(this)[o.d[a]](true);
if (s === false) s = c;
else if (s != c) v = true;
if (s == 0) v = true
});
return v
}
function mapWrapperSizes(a, o, p) {
if (typeof p != 'boolean') p = true;
var b = (o.usePadding && p) ? o.padding : [0, 0, 0, 0];
var c = {};
c[o.d['width']] = a[0] + b[1] + b[3];
c[o.d['height']] = a[1] + b[0] + b[2];
return c
}
function setSizes(a, o, p) {
var b = a.parent(),
$i = a.children(),
$v = getCurrentItems($i, o),
sz = mapWrapperSizes(ms_getSizes($v, o, true), o, p);
b.css(sz);
if (o.usePadding) {
var c = $v.last();
c.css(o.d['marginRight'], c.data('cfs_origCssMargin') + o.padding[o.d[1]]);
a.css(o.d['top'], o.padding[o.d[0]]);
a.css(o.d['left'], o.padding[o.d[3]])
}
a.css(o.d['width'], sz[o.d['width']] + (ms_getTotalSize($i, o, 'width') * 2));
a.css(o.d['height'], ms_getLargestSize($i, o, 'height'));
return sz
}
function cf_getPadding(p) {
if (typeof p == 'undefined') return [0, 0, 0, 0];
if (typeof p == 'number') return [p, p, p, p];
else if (typeof p == 'string') p = p.split('px').join('').split(' ');
if (!is_array(p)) {
return [0, 0, 0, 0]
}
for (var i = 0; i < 4; i++) {
p[i] = parseInt(p[i])
}
switch (p.length) {
case 0:
return [0, 0, 0, 0];
case 1:
return [p[0], p[0], p[0], p[0]];
case 2:
return [p[0], p[1], p[0], p[1]];
case 3:
return [p[0], p[1], p[2], p[1]];
default:
return [p[0], p[1], p[2], p[3]]
}
}
function cf_getAlignPadding(a, o) {
var x = (typeof o[o.d['width']] == 'number') ? Math.ceil(o[o.d['width']] - ms_getTotalSize(a, o, 'width')) : 0;
switch (o.align) {
case 'left':
return [0, x];
break;
case 'right':
return [x, 0];
break;
case 'center':
default:
var b = Math.ceil(x / 2),
x2 = Math.floor(x / 2);
return [b, x2];
break
}
}
function cf_getVisibleItemsAdjust(x, o) {
switch (o.visibleAdjust) {
case '+1':
return x + 1;
break;
case '-1':
return x - 1;
break;
case 'odd':
if (x % 2 == 0) return x - 1;
break;
case 'odd+':
if (x % 2 == 0) return x + 1;
break;
case 'even':
if (x % 2 == 1) return x - 1;
break;
case 'even+':
if (x % 2 == 1) return x + 1;
break;
default:
return x;
break
}
}
function is_array(a) {
return typeof(a) == 'object' && (a instanceof Array)
}
function debug(d, m) {
if (!d) return false;
if (typeof m == 'string') m = 'carouFredSel: ' + m;
else m = ['carouFredSel:', m];
if (window.console && window.console.log) window.console.log(m);
return false
}
$.fn.caroufredsel = function(o) {
return this.carouFredSel(o)
}
})(jQuery); |